diff --git a/data_structure/add_id.py b/data_structure/add_id.py index 682ff04..8ee40e4 100644 --- a/data_structure/add_id.py +++ b/data_structure/add_id.py @@ -116,7 +116,7 @@ for filename in md_filenames: "id": code, "index": index, "isFirst": index == 0, - "isLast": index == len(md_filenames) - 1, + "isLast": position == len(subjects[subject_index]), "title": subjects[subject_index][index], "subject": subject_index, "files": [{"filename": filename, "version": version}], diff --git a/data_structure/topics.json b/data_structure/topics.json index a63d8a9..de2ae9b 100644 --- a/data_structure/topics.json +++ b/data_structure/topics.json @@ -47,7 +47,7 @@ "id": "F0_55", "index": 54, "isFirst": false, - "isLast": false, + "isLast": true, "title": "Алергия. Алергични заболявания. Анафилактичен шок. Поведение на медицинската сестра при спешни алергични състояния.", "subject": 0, "files": [ @@ -1102,7 +1102,7 @@ "id": "F1_21", "index": 20, "isFirst": false, - "isLast": false, + "isLast": true, "title": "Лекарствени средства, действащи върху храносмилателната система – апетитостимулиращи, апетитопотискащи (анорексигенни), противоповръщащи (антиеметични), противоязвени (антиулкусни).", "subject": 1, "files": [ diff --git a/reader/src/icons/Icons.jsx b/reader/src/icons/Icons.jsx index 6746171..3230aa5 100644 --- a/reader/src/icons/Icons.jsx +++ b/reader/src/icons/Icons.jsx @@ -30,6 +30,92 @@ export function TitleIcon({ className }) { ); } +export function JustifyTextIcon({ className }) { + return ( + + + + + ); +} + +export function TextIncreaseIcon({ className }) { + return ( + + + + + ); +} + +export function TextDecreaseIcon({ className }) { + return ( + + + + + ); +} + +export function HRuleIcon({ className }) { + return ( + + + + + + + + + ); +} + +export function VRuleIcon({ className = "" }) { + return ( + + + + ); +} + export function EllipsisIcon({ className = "" }) { return ( - + {topics.map((topic, i) => ( ))} - + Продължи четенето: @@ -208,24 +214,59 @@ export function Reader({ topic }) { return ( <> - + - + + + {config.contentZoomLevel}% + + + changeConfig({ contentZoomLevel: Math.max(50, config.contentZoomLevel - 10) }) + } + > + + + + { + changeConfig({ contentZoomLevel: Math.min(150, config.contentZoomLevel + 10) }); + }} + > + + + + + + changeConfig({ displayTitle: !config.displayTitle })} > + changeConfig({ justifyText: !config.justifyText })} + > + + + {window.innerWidth > 576 && ( changeConfig({ narrowMode: !config.narrowMode })} > @@ -308,7 +349,8 @@ export function Reader({ topic }) { ); } -export function PDFViewer({ file, compact }) { +export function PDFViewer({ file, compact, justifyText }) { + const iframeRef = useRef(null); const [content, setContent] = useState(null); const htmlContent = useMemo(() => { const fileContent = ` @@ -330,12 +372,18 @@ export function PDFViewer({ file, compact }) { padding: 0 12px 40px; ${compact ? "max-width: 36rem; margin: 0 auto;" : ""} } - p { - text-align: justify; - text-justify: inter-word; - } - pre, code { - font-family: 'SF Mono', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; + ${ + justifyText + ? ` + p { + text-align: justify; + text-justify: inter-word; + } + pre, code { + font-family: 'SF Mono', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; + } + ` + : "" } @@ -345,10 +393,18 @@ export function PDFViewer({ file, compact }) {