From f8853e666f4fb7ef56e904910f8f3a3b7e20a9a7 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 29 May 2024 09:19:52 +0530 Subject: [PATCH 1/6] font state change for reference - test --- .../components/ReferenceSelector.js | 13 +++++++++++-- .../EditorPage/ObsEditor/ReferenceObs.js | 5 +++-- .../EditorPage/ObsEditor/WebReferenceObs.js | 2 +- .../EditorPage/Reference/ReferenceCard.js | 8 +++++++- .../EditorPage/Reference/TranslationHelps.js | 13 ++++++++++++- .../Reference/TranslationHelpsCard.js | 2 ++ .../src/components/context/ReferenceContext.js | 18 +++++++++++++++--- 7 files changed, 51 insertions(+), 10 deletions(-) diff --git a/renderer/src/components/AudioRecorder/components/ReferenceSelector.js b/renderer/src/components/AudioRecorder/components/ReferenceSelector.js index be9e05d6b..2268d8382 100644 --- a/renderer/src/components/AudioRecorder/components/ReferenceSelector.js +++ b/renderer/src/components/AudioRecorder/components/ReferenceSelector.js @@ -3,7 +3,9 @@ import PropTypes from 'prop-types'; const AudioWaveform = dynamic(() => import('./WaveForm'), { ssr: false }); -export default function ReferenceSelector({ data, versepath, verse }) { +export default function ReferenceSelector({ + data, versepath, verse, font, fontSize, +}) { const path = require('path'); return (
@@ -21,7 +23,14 @@ export default function ReferenceSelector({ data, versepath, verse }) { {story.verseNumber}
-

+

1.3) ? 1.5 : '', + }} + > {story.verseText}

diff --git a/renderer/src/components/EditorPage/ObsEditor/ReferenceObs.js b/renderer/src/components/EditorPage/ObsEditor/ReferenceObs.js index ab236fddc..376ddb769 100644 --- a/renderer/src/components/EditorPage/ObsEditor/ReferenceObs.js +++ b/renderer/src/components/EditorPage/ObsEditor/ReferenceObs.js @@ -18,14 +18,15 @@ const style = { fontStyle: 'italic', }, }; -const ReferenceObs = ({ stories, font, title }) => { +const ReferenceObs = ({ + stories, font, title, fontSize, +}) => { const [isLoading, setIsLoading] = useState(true); const [direction, setDirection] = useState('ltr'); const [networkState, setNetworkState] = useState({ online: true }); const { state: { selectedStory, - fontSize, }, actions: { setSelectedStory, diff --git a/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js b/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js index 9135e95c4..88700360a 100644 --- a/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js +++ b/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js @@ -26,7 +26,7 @@ const ReferenceObs = ({ stories }) => { state: { selectedStory, selectedFont, - fontSize, + fontSize1: fontSize, }, actions: { setSelectedStory, diff --git a/renderer/src/components/EditorPage/Reference/ReferenceCard.js b/renderer/src/components/EditorPage/Reference/ReferenceCard.js index c3de35bb1..e3b93af7e 100644 --- a/renderer/src/components/EditorPage/Reference/ReferenceCard.js +++ b/renderer/src/components/EditorPage/Reference/ReferenceCard.js @@ -15,6 +15,7 @@ const ReferenceCard = ({ font, setResetTrigger, resetTrigger, + fontSize, }) => { const { state: { @@ -43,7 +44,12 @@ const ReferenceCard = ({ setItemIndex={setItemIndex} /> )} -
+
1.3) ? 1.5 : '', + }} + > { const { state: { @@ -40,6 +40,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'twl': @@ -56,6 +57,7 @@ const TranslationHelps = ({ owner="test_org" server="https://git.door43.org" font={font} + fontSize={fontSize} /> ); case 'twlm': @@ -72,6 +74,7 @@ const TranslationHelps = ({ owner={owner} server="https://git.door43.org" font={font} + fontSize={fontSize} /> ); case 'tq': @@ -90,6 +93,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'tw': @@ -106,6 +110,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'ta': @@ -123,6 +128,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'bible': @@ -135,6 +141,7 @@ const TranslationHelps = ({ chapter={chapter} verse={verse} font={font} + fontSize={fontSize} /> ); case 'obs': @@ -147,6 +154,7 @@ const TranslationHelps = ({ chapter={chapter} verse={verse} font={font} + fontSize={fontSize} /> ); case 'obs-tn': @@ -163,6 +171,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'obs-tq': @@ -179,6 +188,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'obs-twlm': @@ -195,6 +205,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); default: diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js index 1b15f9323..425db8547 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js @@ -32,6 +32,7 @@ export default function TranslationHelpsCard({ viewMode, offlineResource, font, + fontSize, }) { const [offlineItems, setOfflineItems] = useState([]); const [offlineItemsDisable, setOfflineItemsDisable] = useState(false); @@ -271,6 +272,7 @@ export default function TranslationHelpsCard({ selectedQuote={selectedQuote} setQuote={setQuote} font={font} + fontSize={fontSize} setResetTrigger={setResetTrigger} resetTrigger={resetTrigger} /> diff --git a/renderer/src/components/context/ReferenceContext.js b/renderer/src/components/context/ReferenceContext.js index 22a1183aa..a55cc39f5 100644 --- a/renderer/src/components/context/ReferenceContext.js +++ b/renderer/src/components/context/ReferenceContext.js @@ -37,7 +37,11 @@ export default function ReferenceContextProvider({ children }) { const [font2, setFont2] = useState('sans-serif'); const [font3, setFont3] = useState('sans-serif'); const [font4, setFont4] = useState('sans-serif'); - const [fontSize, setFontsize] = React.useState(1); + const [editorFontSize, setEditorFontSize] = React.useState(1); + const [fontSize1, setFontsize1] = React.useState(1); + const [fontSize2, setFontsize2] = React.useState(1); + const [fontSize3, setFontsize3] = React.useState(1); + const [fontSize4, setFontsize4] = React.useState(1); const [layout, setLayout] = useState(0); const [row, setRow] = useState(0); const [refernceLoading, setRefernceLoading] = useState({ @@ -196,7 +200,11 @@ export default function ReferenceContextProvider({ children }) { font2, font3, font4, - fontSize, + fontSize1, + fontSize2, + fontSize3, + fontSize4, + editorFontSize, layout, row, refernceLoading, @@ -244,7 +252,11 @@ export default function ReferenceContextProvider({ children }) { setFont2, setFont3, setFont4, - setFontsize, + setEditorFontSize, + setFontsize1, + setFontsize2, + setFontsize3, + setFontsize4, setLayout, setRow, setRefernceLoading, From c51fe26cccf452d18a464ca4e4568cbcb564fab8 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 29 May 2024 09:20:31 +0530 Subject: [PATCH 2/6] all panes changed with icons --- .../EditorPage/AudioEditor/AudioEditor.js | 5 +- .../EditorPage/ObsEditor/EditorPanel.js | 13 ++-- .../Reference/Audio/ReferenceAudio.js | 4 ++ .../Reference/OBS/ObsResourceCard.js | 8 ++- .../EditorPage/Reference/OBS/ObsTn.js | 2 + .../EditorPage/Reference/OBS/ObsTwlCard.js | 2 + .../ReferenceBible/ReferenceBibleX.js | 2 + .../components/MenuDropdown/MenuDropdown.js | 16 +++-- renderer/src/layouts/editor/EditorSection.js | 59 +++++++++++++++++-- .../src/layouts/editor/SectionPlaceholder1.js | 26 +++++++- .../src/layouts/editor/SectionPlaceholder2.js | 28 ++++++++- renderer/src/layouts/editor/WebMenuBar.js | 2 +- 12 files changed, 140 insertions(+), 27 deletions(-) diff --git a/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js b/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js index 274f4f5be..427c30bb9 100644 --- a/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js +++ b/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js @@ -31,7 +31,7 @@ const AudioEditor = ({ editor }) => { audioContent, audioPath, selectedFont, - fontSize, + editorFontSize, // eslint-disable-next-line no-unused-vars updateWave, // updateWave is used to update the waveform in the Editor after recording audio }, actions: { @@ -40,6 +40,7 @@ const AudioEditor = ({ editor }) => { setAudioContent, setAudioCurrentChapter, setAudioPath, + setEditorFontSize, }, } = useContext(ReferenceContext); @@ -219,7 +220,7 @@ const AudioEditor = ({ editor }) => { verse={verse} location={audioPath} updateWave={updateWave} - fontSize={fontSize} + fontSize={editorFontSize} selectedFont={selectedFont} /> )} diff --git a/renderer/src/components/EditorPage/ObsEditor/EditorPanel.js b/renderer/src/components/EditorPage/ObsEditor/EditorPanel.js index 3dee90440..61bda0a19 100644 --- a/renderer/src/components/EditorPage/ObsEditor/EditorPanel.js +++ b/renderer/src/components/EditorPage/ObsEditor/EditorPanel.js @@ -8,12 +8,13 @@ const EditorPanel = ({ obsStory, storyUpdate }) => { const { state: { selectedFont, - fontSize, + editorFontSize, }, actions: { setSelectedStory, }, } = useContext(ReferenceContext); + const { states: { scrollLock } } = useContext(ProjectContext); const { t } = useTranslation(); const handleChange = (e) => { @@ -90,7 +91,7 @@ const EditorPanel = ({ obsStory, storyUpdate }) => { className="flex-grow text-justify ml-2 p-2 text-xl" style={{ fontFamily: selectedFont || 'sans-serif', - fontSize: `${fontSize}rem`, + fontSize: `${editorFontSize}rem`, }} />
@@ -118,8 +119,8 @@ const EditorPanel = ({ obsStory, storyUpdate }) => { onInput={(e) => handleAutoHeight(e)} style={{ fontFamily: selectedFont || 'sans-serif', - fontSize: `${fontSize}rem`, - lineHeight: (fontSize > 1.3) ? 1.5 : '', + fontSize: `${editorFontSize}rem`, + lineHeight: (editorFontSize > 1.3) ? 1.5 : '', }} />
@@ -140,8 +141,8 @@ const EditorPanel = ({ obsStory, storyUpdate }) => { className="flex-grow text-justify ml-2 p-2 text-sm" style={{ fontFamily: selectedFont || 'sans-serif', - fontSize: `${fontSize}rem`, - lineHeight: (fontSize > 1.3) ? 1.5 : '', + fontSize: `${editorFontSize}rem`, + lineHeight: (editorFontSize > 1.3) ? 1.5 : '', }} /> diff --git a/renderer/src/components/EditorPage/Reference/Audio/ReferenceAudio.js b/renderer/src/components/EditorPage/Reference/Audio/ReferenceAudio.js index cda21beb9..e9be9002b 100644 --- a/renderer/src/components/EditorPage/Reference/Audio/ReferenceAudio.js +++ b/renderer/src/components/EditorPage/Reference/Audio/ReferenceAudio.js @@ -25,6 +25,8 @@ const ReferenceAudio = ({ chapter, verse, bookId, + font, + fontSize, }) => { const { actions: { @@ -227,6 +229,8 @@ const ReferenceAudio = ({ data={bookData} versepath={mp3Path} verse={verse} + font={font} + fontSize={fontSize} // goToVerse={{ // chapter: parseInt(chapter, 10), // verse: parseInt(verse, 10), diff --git a/renderer/src/components/EditorPage/Reference/OBS/ObsResourceCard.js b/renderer/src/components/EditorPage/Reference/OBS/ObsResourceCard.js index 5890d1168..6d97e2069 100644 --- a/renderer/src/components/EditorPage/Reference/OBS/ObsResourceCard.js +++ b/renderer/src/components/EditorPage/Reference/OBS/ObsResourceCard.js @@ -17,6 +17,7 @@ function ObsResourceCard({ isLoading, setIndex, font, + fontSize, }) { const { state: { filters, markdownView }, @@ -36,7 +37,12 @@ function ObsResourceCard({ itemIndex={index} setItemIndex={setIndex} /> -
+
1.3) ? 1.5 : '', + }} + > setIndex(v)} font={font} + fontSize={fontSize} /> ) : ); diff --git a/renderer/src/components/EditorPage/Reference/OBS/ObsTwlCard.js b/renderer/src/components/EditorPage/Reference/OBS/ObsTwlCard.js index 8c226d1f5..63654c297 100644 --- a/renderer/src/components/EditorPage/Reference/OBS/ObsTwlCard.js +++ b/renderer/src/components/EditorPage/Reference/OBS/ObsTwlCard.js @@ -23,6 +23,7 @@ function ObsTwlCard({ resourceId, offlineResource, font, + fontSize, ...props }) { const [index, setIndex] = useState(1); @@ -104,6 +105,7 @@ function ObsTwlCard({ index={index} setIndex={(v) => setIndex(v)} font={font} + fontSize={fontSize} /> ) : ( diff --git a/renderer/src/components/EditorPage/Reference/ReferenceBible/ReferenceBibleX.js b/renderer/src/components/EditorPage/Reference/ReferenceBible/ReferenceBibleX.js index 472e791c1..5ff7a6c7c 100644 --- a/renderer/src/components/EditorPage/Reference/ReferenceBible/ReferenceBibleX.js +++ b/renderer/src/components/EditorPage/Reference/ReferenceBible/ReferenceBibleX.js @@ -13,6 +13,7 @@ const ReferenceBibleX = ({ refName, bookId, font, + fontSize, }) => { const { states: { @@ -47,6 +48,7 @@ const ReferenceBibleX = ({ refName, scrollLock, font, + fontSize, }; return ( <> diff --git a/renderer/src/components/MenuDropdown/MenuDropdown.js b/renderer/src/components/MenuDropdown/MenuDropdown.js index b46e21be0..bbcf91959 100644 --- a/renderer/src/components/MenuDropdown/MenuDropdown.js +++ b/renderer/src/components/MenuDropdown/MenuDropdown.js @@ -14,7 +14,7 @@ import { } from 'font-detect-rhl'; export default function MenuDropdown({ - selectedFont, setSelectedFont, buttonStyle, + selectedFont, setSelectedFont, buttonStyle, showIcon = true, }) { const detectedFonts = useDetectFonts({ fonts: fontsArray }); const [query, setQuery] = useState(''); @@ -37,12 +37,16 @@ export default function MenuDropdown({ { + if (status === 'dec' && fontSize > 0.70) { + setFontsize(fontSize - 0.2); + } + if (status === 'inc' && fontSize < 2) { + setFontsize(fontSize + 0.2); + } + }; + const addRow = () => { if (sectionNum >= 0 && sectionNum < 2) { setSectionNum(sectionNum + 1); @@ -224,7 +234,10 @@ export default function EditorSection({ /> )} -
+
{title}
@@ -233,14 +246,20 @@ export default function EditorSection({ {scrollLock && title ? ( <> {CustomNavigation} -
+
{title}
) : (
-
+
{title}
@@ -248,10 +267,40 @@ export default function EditorSection({ )} )} -
+
+ + + +
{ setSelectedBook(bookId.toUpperCase()); diff --git a/renderer/src/components/EditorPage/TextEditor/index.jsx b/renderer/src/components/EditorPage/TextEditor/index.jsx index c2e35b7b0..e11bdc78e 100644 --- a/renderer/src/components/EditorPage/TextEditor/index.jsx +++ b/renderer/src/components/EditorPage/TextEditor/index.jsx @@ -28,8 +28,10 @@ export default function TextEditor() { const { usfmData, bookAvailable } = useReadUsfmFile(); const { - state: { bookId, selectedFont }, - actions: { handleSelectedFont, onChangeChapter, onChangeVerse }, + state: { bookId, selectedFont, editorFontSize }, + actions: { + handleSelectedFont, onChangeChapter, onChangeVerse, setEditorFontSize, + }, } = useContext(ReferenceContext); const { @@ -59,7 +61,7 @@ export default function TextEditor() { useEffect(() => { onChangeChapter(chapterNumber, 1); onChangeVerse(verseNumber, 1); - // eslint-disable-next-line react-hooks/exhaustive-deps + // eslint-disable-next-line react-hooks/exhaustive-deps }, [chapterNumber, verseNumber]); const { catalog } = useCatalog({ proskomma, stateId, verbose }); @@ -94,6 +96,7 @@ export default function TextEditor() { ...perfState, ...actions, ...perfActions, + editorFontSize, selectedFont, chapterNumber, verseNumber, @@ -101,6 +104,7 @@ export default function TextEditor() { bookName, bookChange, bookAvailable, + setEditorFontSize, setBookChange, setChapterNumber, setVerseNumber, diff --git a/renderer/src/layouts/editor/SubMenuBar.js b/renderer/src/layouts/editor/SubMenuBar.js index 205ff41d2..44b7b2709 100644 --- a/renderer/src/layouts/editor/SubMenuBar.js +++ b/renderer/src/layouts/editor/SubMenuBar.js @@ -36,6 +36,10 @@ export default function SubMenuBar() { row, // openResource1, // openResource3, + fontSize1, + fontSize2, + fontSize3, + fontSize4, }, actions: { @@ -43,8 +47,13 @@ export default function SubMenuBar() { setOpenResource3, setLayout, setRow, + setFontsize1, + setFontsize2, + setFontsize3, + setFontsize4, }, } = useContext(ReferenceContext); + const { states: { editorSave, @@ -128,20 +137,20 @@ export default function SubMenuBar() { supabaseResourceType(); } }); - const { - state: { - fontSize, - }, - actions: { - setFontsize, - }, - } = useContext(ReferenceContext); + + // All Panel together const handleFontSize = (status) => { - if (status === 'dec' && fontSize > 0.70) { - setFontsize(fontSize - 0.2); + if (status === 'dec') { + fontSize1 > 0.70 && setFontsize1(fontSize1 - 0.2); + fontSize2 > 0.70 && setFontsize2(fontSize2 - 0.2); + fontSize3 > 0.70 && setFontsize3(fontSize3 - 0.2); + fontSize4 > 0.70 && setFontsize4(fontSize4 - 0.2); } - if (status === 'inc' && fontSize < 2) { - setFontsize(fontSize + 0.2); + if (status === 'inc') { + fontSize1 < 2 && setFontsize1(fontSize1 + 0.2); + fontSize2 < 2 && setFontsize2(fontSize2 + 0.2); + fontSize3 < 2 && setFontsize3(fontSize3 + 0.2); + fontSize4 < 2 && setFontsize4(fontSize4 + 0.2); } }; return ( diff --git a/renderer/src/modules/editor/Editor.js b/renderer/src/modules/editor/Editor.js index f02159a84..a169b05bd 100644 --- a/renderer/src/modules/editor/Editor.js +++ b/renderer/src/modules/editor/Editor.js @@ -32,7 +32,7 @@ export default function Editor({ const { state: { selectedFont, - fontSize, + editorFontSize, bookmarksVerses, bookName, chapter, @@ -43,6 +43,7 @@ export default function Editor({ setBookmarksVerses, setObsNavigation, handleSelectedFont, + setEditorFontSize, }, } = useContext(ReferenceContext); const [bookMarked, setBookMarks] = useState(false); @@ -52,6 +53,15 @@ export default function Editor({ setScrollLock(!scrollLock); }; + const handleFontSize = (status) => { + if (status === 'dec' && editorFontSize > 0.70) { + setEditorFontSize(editorFontSize - 0.2); + } + if (status === 'inc' && editorFontSize < 2) { + setEditorFontSize(editorFontSize + 0.2); + } + }; + useEffect(() => { if (((bookmarksVerses?.find((x) => x.bookname === bookName && x.chapter === chapter) !== undefined))) { @@ -148,7 +158,34 @@ export default function Editor({
{t('label-editor-pane')}
-
+
+ {/* */}
@@ -183,8 +220,8 @@ export default function Editor({
1.3) ? 1.5 : '', + fontSize: `${editorFontSize}rem`, + lineHeight: (editorFontSize > 1.3) ? 1.5 : '', direction: `${projectScriptureDir === 'RTL' ? 'rtl' : 'auto'}`, }} aria-label="editor" From 03f611b3732731c900e569c1222a99a71ae64216 Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 29 May 2024 09:25:53 +0530 Subject: [PATCH 4/6] fixed lint issue --- renderer/src/components/EditorPage/AudioEditor/AudioEditor.js | 1 - 1 file changed, 1 deletion(-) diff --git a/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js b/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js index 427c30bb9..793151c69 100644 --- a/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js +++ b/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js @@ -40,7 +40,6 @@ const AudioEditor = ({ editor }) => { setAudioContent, setAudioCurrentChapter, setAudioPath, - setEditorFontSize, }, } = useContext(ReferenceContext); From 5fb4cb64ee310c9b4977c924a4355428b4b86a1e Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 29 May 2024 11:15:20 +0530 Subject: [PATCH 5/6] fixed alignment of font size icon in tw and ta --- renderer/src/layouts/editor/EditorSection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renderer/src/layouts/editor/EditorSection.js b/renderer/src/layouts/editor/EditorSection.js index d75ecf4fb..5e8c30690 100644 --- a/renderer/src/layouts/editor/EditorSection.js +++ b/renderer/src/layouts/editor/EditorSection.js @@ -267,7 +267,7 @@ export default function EditorSection({ )} )} -
+