From f42bdf2fb81271ed418bc4df4bf854728abb4996 Mon Sep 17 00:00:00 2001 From: alexsparkes Date: Sun, 1 Feb 2026 15:49:09 +0000 Subject: [PATCH] feat(QuoteOptions): refactor custom quote UI and styles for improved layout and usability --- src/features/quote/Quote.jsx | 21 +- src/features/quote/options/QuoteOptions.jsx | 104 +++++----- src/features/quote/options/QuoteOptions.scss | 198 +++++++++++++++++++ 3 files changed, 270 insertions(+), 53 deletions(-) create mode 100644 src/features/quote/options/QuoteOptions.scss diff --git a/src/features/quote/Quote.jsx b/src/features/quote/Quote.jsx index 07731ee9..a0255ce6 100644 --- a/src/features/quote/Quote.jsx +++ b/src/features/quote/Quote.jsx @@ -25,8 +25,12 @@ export default function Quote() { const zoomQuote = localStorage.getItem('zoomQuote'); return `${1.2 * Number((zoomQuote || 100) / 100)}em`; }); - const [authorDetails, setAuthorDetails] = useState(localStorage.getItem('authorDetails') === 'true'); - const [isLegacyStyle, setIsLegacyStyle] = useState(localStorage.getItem('widgetStyle') === 'legacy'); + const [authorDetails, setAuthorDetails] = useState( + localStorage.getItem('authorDetails') === 'true', + ); + const [isLegacyStyle, setIsLegacyStyle] = useState( + localStorage.getItem('widgetStyle') === 'legacy', + ); // Compute if current quote is favorited const isFavourited = useMemo(() => { @@ -62,8 +66,9 @@ export default function Quote() { } }; - const shouldRefresh = localStorage.getItem('quotechange') === 'refresh' || - localStorage.getItem('quotechange') === null; + const shouldRefresh = + localStorage.getItem('quotechange') === 'refresh' || + localStorage.getItem('quotechange') === null; if (shouldRefresh) { getQuote(); @@ -100,8 +105,9 @@ export default function Quote() { {quoteData.quote} - {authorDetails && ( - isLegacyStyle ? ( + {authorDetails && + quoteData.author && + (isLegacyStyle ? ( toggleShareModal(true)} isFavourited={isFavourited} /> - ) - )} + ))} ); } diff --git a/src/features/quote/options/QuoteOptions.jsx b/src/features/quote/options/QuoteOptions.jsx index 0d0a10b7..63264c52 100644 --- a/src/features/quote/options/QuoteOptions.jsx +++ b/src/features/quote/options/QuoteOptions.jsx @@ -13,6 +13,7 @@ import { import { Checkbox, Dropdown, Textarea } from 'components/Form/Settings'; import { Button } from 'components/Elements'; import { FREQUENCY_OPTIONS } from 'utils/frequencyManager'; +import './QuoteOptions.scss'; const QuoteOptions = ({ currentSubSection, onSubSectionChange, sectionName }) => { const getCustom = () => { @@ -143,9 +144,11 @@ const QuoteOptions = ({ currentSubSection, onSubSectionChange, sectionName }) => localStorage.removeItem('quoteQueue'); } // Notify the frequency interval hook that the frequency changed - window.dispatchEvent(new CustomEvent('frequencyChanged', { - detail: { type: 'quote' } - })); + window.dispatchEvent( + new CustomEvent('frequencyChanged', { + detail: { type: 'quote' }, + }), + ); }} items={FREQUENCY_OPTIONS.map((opt) => ({ value: opt.value, @@ -209,35 +212,48 @@ const QuoteOptions = ({ currentSubSection, onSubSectionChange, sectionName }) => {customQuote.length !== 0 ? ( -
- {customQuote.map((_url, index) => ( -
-
- -
-
-