Skip to content

Commit

Permalink
Use Hanyu Pinyin as default pronunciation
Browse files Browse the repository at this point in the history
  • Loading branch information
justinsilvestre committed Sep 12, 2024
1 parent bfddd74 commit 9b22d08
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app/texts/[textId]/PassageDisplayOptionsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export function PassageDisplayOptionsForm({
name="qieyun"
id="qieyun-decorated-onyomi"
value="decorated-onyomi"
checked={displayOptions.qieyun === "decorated-onyomi"}
checked={!displayOptions.qieyun || displayOptions.qieyun === "decorated-onyomi"}
onChange={() =>
setDisplayOptions((opts) => ({
...opts,
Expand Down Expand Up @@ -250,17 +250,18 @@ export function PassageDisplayOptionsForm({
}

export function useDisplayOptions() {
const [displayOptions, setDisplayOptions] = useState<DisplayOptions>(() => {
const [displayOptions, setDisplayOptions] = useState<DisplayOptions>((): DisplayOptions => {
const storedString =
globalThis.window && localStorage.getItem("displayOptions");
const parsed = storedString ? JSON.parse(storedString) : null;
if (parsed?.version === LATEST_DISPLAY_OPTIONS_VERSION) {
return parsed;
}
return {
ruby: "vi",
ruby: "pinyin",
translation: "gloss",
version: LATEST_DISPLAY_OPTIONS_VERSION,
qieyun: "decorated-onyomi"
};
});
const initialized = useRef(false);
Expand Down

0 comments on commit 9b22d08

Please sign in to comment.