diff --git a/public/verse-backgrounds/README.txt b/public/verse-backgrounds/README.txt new file mode 100644 index 0000000..9038a33 --- /dev/null +++ b/public/verse-backgrounds/README.txt @@ -0,0 +1,15 @@ +Photos for behind the verse of the day and the "Share as image" pictures. + +1. Drop landscape photos (about 1200px wide or larger, .jpg/.png/.webp) into this folder. +2. List them in index.json, for example: + + [ + { "file": "mountain-lake.jpg", "name": "Mountain lake" }, + { "file": "wheat.jpg", "name": "Wheat" } + ] + + (A plain list of file names also works: ["mountain-lake.jpg", "wheat.jpg"].) + +They then appear under "Your photos" in the background menus, and "Picture of the day" rotates through them +along with the built-in scenes. With no index.json the built-in scenes are used. Free sources: pixabay.com, +unsplash.com. Check each photo's licence before sharing pictures made from it. diff --git a/public/verse-backgrounds/index.json b/public/verse-backgrounds/index.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/public/verse-backgrounds/index.json @@ -0,0 +1 @@ +[] diff --git a/src/components/BookCover.jsx b/src/components/BookCover.jsx new file mode 100644 index 0000000..9188dd4 --- /dev/null +++ b/src/components/BookCover.jsx @@ -0,0 +1,27 @@ +// The picture on a study's card: a coloured cover for the kind of book, with the book's name. +import { coverFor } from '../utils/bookCovers.js'; + +export default function BookCover({ summary, className = '' }) { + const { group, name, extra } = coverFor(summary); + const [from, to] = group.colors; + const id = `cover-${group.id}`; + return ( +
{image.error}
+ : image.url ?Making the image…
} +Verse of the day
+ + +{text.key === key && text.value ? text.value : text.key === key && text.error ? verse.text : '…'}
- {text.key === key && text.error && translation !== 'KJV' &&Couldn’t load {translation} just now, so this is the KJV.
} - + {backgroundUrl ? ( +{shown}+
{shown}+ )} + {loaded && text.error && translation !== 'KJV' &&
Couldn’t load {translation} just now, so this is the KJV.
} +{READER_TRANSLATIONS.find((t) => t.id === translation).notice}
)} diff --git a/src/components/reader/VerseSheet.jsx b/src/components/reader/VerseSheet.jsx index f9cc333..6b7f7ab 100644 --- a/src/components/reader/VerseSheet.jsx +++ b/src/components/reader/VerseSheet.jsx @@ -10,6 +10,7 @@ import { diffVerses, differenceLabel } from '../../utils/textDiff.js'; import { DiffText } from './DiffText.jsx'; import { HIGHLIGHT_COLORS, colorTitle } from '../../utils/highlightColors.js'; import { useIqAvailable } from '../../hooks/useIq.js'; +import VerseShareImage from '../VerseShareImage.jsx'; import IqLexicon from '../iq/IqLexicon.jsx'; import IqStudyAids from '../iq/IqStudyAids.jsx'; @@ -160,6 +161,7 @@ export default function VerseSheet({ const TABS = iqOn ? [...BASE_TABS, ['aids', 'Study aids']] : BASE_TABS; const [tab, setTab] = useState('commentary'); const [copied, setCopied] = useState(false); + const [imageOpen, setImageOpen] = useState(false); const [preview, setPreview] = useState(null); // the cross-reference being read in the panel const appliedRequest = useRef(0); // Leaving this verse closes the preview; a cross-reference tapped in the text opens it here. (Tracks the @@ -177,7 +179,7 @@ export default function VerseSheet({ } }, [verse?.number, request?.n]); // eslint-disable-line react-hooks/exhaustive-deps useEffect(() => { if (verse && tab === 'refs') onLoadCrossRefs(); }, [verse?.number, tab]); // eslint-disable-line react-hooks/exhaustive-deps - useEffect(() => { setCopied(false); }, [verse?.number]); + useEffect(() => { setCopied(false); setImageOpen(false); }, [verse?.number]); if (!verse) return null; const copy = () => { @@ -201,12 +203,21 @@ export default function VerseSheet({ )} + > )} > + {imageOpen && ( +