From 29e93815f51036247908ed2acbfb3cc2106a4f30 Mon Sep 17 00:00:00 2001 From: ikkz Date: Fri, 22 Nov 2024 19:59:26 +0800 Subject: [PATCH] feat: Support hiding options to avoid potential answer hints --- .changeset/thirty-glasses-applaud.md | 5 +++++ src/components/settings.tsx | 11 +++++++++++ src/entries/mcq.tsx | 15 ++++++++++++++- src/locales/en.json | 4 +++- src/locales/zh.json | 4 +++- 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 .changeset/thirty-glasses-applaud.md diff --git a/.changeset/thirty-glasses-applaud.md b/.changeset/thirty-glasses-applaud.md new file mode 100644 index 0000000..c856ede --- /dev/null +++ b/.changeset/thirty-glasses-applaud.md @@ -0,0 +1,5 @@ +--- +'anki-templates': minor +--- + +Support hiding options to avoid potential answer hints (支持隐藏选项以避免可能的答案提示) diff --git a/src/components/settings.tsx b/src/components/settings.tsx index b0a3ae3..ba93015 100644 --- a/src/components/settings.tsx +++ b/src/components/settings.tsx @@ -27,6 +27,10 @@ export const hideQuestionTypeAtom = atomWithLocalStorage( false, ); export const noScorllAtom = atomWithLocalStorage('noScorll', true); +export const blurOptionsAtom = atomWithLocalStorage( + 'blurOptions', + false, +); let OptionList: FC; @@ -41,6 +45,7 @@ if (id === 'mcq') { const [hideQuestionType, setHideQuestionType] = useAtom(hideQuestionTypeAtom); const [noScorll, setNoScorll] = useAtom(noScorllAtom); + const [blurOptions, setBlurOptions] = useAtom(blurOptionsAtom); return ( <> @@ -72,6 +77,12 @@ if (id === 'mcq') { checked={selectionMenu} onChange={setSelectionMenu} /> + { const note = useField('note'); const isMultipleChoice = answers.length > 1; + const [blurred, setBlurred] = useStorage( + 'blurred', + useAtomValue(blurOptionsAtom), + ); + return ( {
setBlurred(false)} > {options.map((name) => { const selectResult = getSelectResult(name); @@ -150,6 +160,9 @@ export default () => { 'before:text-indigo-500 after:hidden': selectResult === 'none', }, + { + [`pointer-events-none blur`]: blurred, + }, )} >