Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ft/panel fontsize #342

Merged
merged 6 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="bg-white col-span-3 m-3 rounded-md shadow overflow-hidden">
Expand All @@ -21,7 +23,14 @@ export default function ReferenceSelector({ data, versepath, verse }) {
{story.verseNumber}
</div>
</div>
<p className="text-sm text-gray-600 leading-relaxed">
<p
className="text-sm text-gray-600 leading-relaxed"
style={{
fontFamily: font || 'sans-serif',
fontSize: `${fontSize}rem`,
lineHeight: (fontSize > 1.3) ? 1.5 : '',
}}
>
{story.verseText}
</p>
</div>
Expand Down
4 changes: 2 additions & 2 deletions renderer/src/components/EditorPage/AudioEditor/AudioEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -219,7 +219,7 @@ const AudioEditor = ({ editor }) => {
verse={verse}
location={audioPath}
updateWave={updateWave}
fontSize={fontSize}
fontSize={editorFontSize}
selectedFont={selectedFont}
/>
)}
Expand Down
13 changes: 7 additions & 6 deletions renderer/src/components/EditorPage/ObsEditor/EditorPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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`,
}}
/>
</div>
Expand Down Expand Up @@ -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 : '',
}}
/>
</div>
Expand All @@ -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 : '',
}}
/>
</div>
Expand Down
7 changes: 6 additions & 1 deletion renderer/src/components/EditorPage/ObsEditor/ObsEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ import { getDetails } from './utils/getDetails';
const ObsEditor = () => {
const [mdData, setMdData] = useState();
const [directoryName, setDirectoryName] = useState();
const { state: { obsNavigation, loadData }, actions: { setLoadData } } = useContext(ReferenceContext);
const {
state: {
obsNavigation, loadData,
}, actions: { setLoadData },
} = useContext(ReferenceContext);

const updateStory = (story) => {
logger.debug('ObsEditor.js', 'In updateStory for upadting the story to the backend md file');
Expand Down Expand Up @@ -89,6 +93,7 @@ const ObsEditor = () => {
);
localforage.setItem('projectmeta', value);
// This func will update the scribe-setting.json file
// saveReferenceResource(selectedFont, editorFontSize);
saveReferenceResource();
});
});
Expand Down
5 changes: 3 additions & 2 deletions renderer/src/components/EditorPage/ObsEditor/ReferenceObs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ReferenceObs = ({ stories }) => {
state: {
selectedStory,
selectedFont,
fontSize,
fontSize1: fontSize,
},
actions: {
setSelectedStory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const ReferenceAudio = ({
chapter,
verse,
bookId,
font,
fontSize,
}) => {
const {
actions: {
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function ObsResourceCard({
isLoading,
setIndex,
font,
fontSize,
}) {
const {
state: { filters, markdownView },
Expand All @@ -36,7 +37,12 @@ function ObsResourceCard({
itemIndex={index}
setItemIndex={setIndex}
/>
<div style={{ fontFamily: font || 'sans-serif' }}>
<div style={{
fontFamily: font || 'sans-serif',
fontSize: `${fontSize}rem`,
lineHeight: (fontSize > 1.3) ? 1.5 : '',
}}
>
<CardContent
item={[]}
items={items}
Expand Down
2 changes: 2 additions & 0 deletions renderer/src/components/EditorPage/Reference/OBS/ObsTn.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function ObsTnCard({
resourceId,
offlineResource,
font,
fontSize,
...props
}) {
const [index, setIndex] = useState(0);
Expand Down Expand Up @@ -143,6 +144,7 @@ function ObsTnCard({
index={index}
setIndex={(v) => setIndex(v)}
font={font}
fontSize={fontSize}
/>
) : <LoadingScreen />
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function ObsTwlCard({
resourceId,
offlineResource,
font,
fontSize,
...props
}) {
const [index, setIndex] = useState(1);
Expand Down Expand Up @@ -104,6 +105,7 @@ function ObsTwlCard({
index={index}
setIndex={(v) => setIndex(v)}
font={font}
fontSize={fontSize}
/>
) : (
<LoadingScreen />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const ReferenceBibleX = ({
refName,
bookId,
font,
fontSize,
}) => {
const {
states: {
Expand Down Expand Up @@ -47,6 +48,7 @@ const ReferenceBibleX = ({
refName,
scrollLock,
font,
fontSize,
};
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const ReferenceCard = ({
font,
setResetTrigger,
resetTrigger,
fontSize,
}) => {
const {
state: {
Expand Down Expand Up @@ -43,7 +44,12 @@ const ReferenceCard = ({
setItemIndex={setItemIndex}
/>
)}
<div style={{ fontFamily: font || 'sans-serif' }}>
<div style={{
fontFamily: font || 'sans-serif',
fontSize: `${fontSize}rem`,
lineHeight: (fontSize > 1.3) ? 1.5 : '',
}}
>
<CardContent
item={item}
items={items}
Expand Down
13 changes: 12 additions & 1 deletion renderer/src/components/EditorPage/Reference/TranslationHelps.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ObsTnCard from './OBS/ObsTn';
import ObsTwlCard from './OBS/ObsTwlCard';

const TranslationHelps = ({
selectedResource, languageId, refName, bookId, chapter, verse, owner, story, offlineResource, font,
selectedResource, languageId, refName, bookId, chapter, verse, owner, story, offlineResource, font, fontSize,
}) => {
const {
state: {
Expand Down Expand Up @@ -40,6 +40,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'twl':
Expand All @@ -56,6 +57,7 @@ const TranslationHelps = ({
owner="test_org"
server="https://git.door43.org"
font={font}
fontSize={fontSize}
/>
);
case 'twlm':
Expand All @@ -72,6 +74,7 @@ const TranslationHelps = ({
owner={owner}
server="https://git.door43.org"
font={font}
fontSize={fontSize}
/>
);
case 'tq':
Expand All @@ -90,6 +93,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'tw':
Expand All @@ -106,6 +110,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'ta':
Expand All @@ -123,6 +128,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'bible':
Expand All @@ -135,6 +141,7 @@ const TranslationHelps = ({
chapter={chapter}
verse={verse}
font={font}
fontSize={fontSize}
/>
);
case 'obs':
Expand All @@ -147,6 +154,7 @@ const TranslationHelps = ({
chapter={chapter}
verse={verse}
font={font}
fontSize={fontSize}
/>
);
case 'obs-tn':
Expand All @@ -163,6 +171,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'obs-tq':
Expand All @@ -179,6 +188,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'obs-twlm':
Expand All @@ -195,6 +205,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default function TranslationHelpsCard({
viewMode,
offlineResource,
font,
fontSize,
}) {
const [offlineItems, setOfflineItems] = useState([]);
const [offlineItemsDisable, setOfflineItemsDisable] = useState(false);
Expand Down Expand Up @@ -271,6 +272,7 @@ export default function TranslationHelpsCard({
selectedQuote={selectedQuote}
setQuote={setQuote}
font={font}
fontSize={fontSize}
setResetTrigger={setResetTrigger}
resetTrigger={resetTrigger}
/>
Expand Down
6 changes: 3 additions & 3 deletions renderer/src/components/EditorPage/TextEditor/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function Editor(props) {

const {
state: {
chapter, selectedFont, fontSize, projectScriptureDir,
chapter, selectedFont, editorFontSize, projectScriptureDir,
},
} = useContext(ReferenceContext);

Expand Down Expand Up @@ -166,8 +166,8 @@ export default function Editor(props) {
id="fulleditor"
style={{
fontFamily: selectedFont || 'sans-serif',
fontSize: `${fontSize}rem`,
lineHeight: (fontSize > 1.3) ? 1.5 : '',
fontSize: `${editorFontSize}rem`,
lineHeight: (editorFontSize > 1.3) ? 1.5 : '',
direction: `${projectScriptureDir === 'RTL' ? 'rtl' : 'auto'}`,
}}
className="border-l-2 border-r-2 border-secondary pb-16 overflow-auto h-full scrollbars-width leading-8"
Expand Down
Loading
Loading