diff --git a/website/src/components/Entry.tsx b/website/src/components/Entry.tsx index d58a8fe..77ddaee 100644 --- a/website/src/components/Entry.tsx +++ b/website/src/components/Entry.tsx @@ -9,6 +9,7 @@ import ExtraEntryInfo from "../components/ExtraEntryInfo"; import classNames from "classnames"; import { Types as T, InlinePs } from "@lingdocs/ps-react"; import playStorageAudio from "./PlayStorageAudio"; +import { getRecordedGenders } from "../lib/recorded-genders"; function Entry({ entry, @@ -22,11 +23,12 @@ function Entry({ isolateEntry?: (ts: number) => void; admin: boolean; }) { - function handlePlayStorageAudio( - e: React.MouseEvent - ) { - e.stopPropagation(); - playStorageAudio(entry.ts, entry.p, () => null); + const gendersRecorded = getRecordedGenders(entry); + function handlePlayStorageAudio(gender: T.Gender) { + return (e: React.MouseEvent) => { + e.stopPropagation(); + playStorageAudio(entry.ts, gender, entry.p, () => null); + }; } return (
here can't be empty */} {entry.c || "\u00A0"} - {entry.a && !nonClickable && ( - - )} + {!nonClickable && + gendersRecorded.map((gender) => ( + + ))}
diff --git a/website/src/components/EntryAudioDisplay.tsx b/website/src/components/EntryAudioDisplay.tsx index eb26242..6151de6 100644 --- a/website/src/components/EntryAudioDisplay.tsx +++ b/website/src/components/EntryAudioDisplay.tsx @@ -1,6 +1,7 @@ import { Types as T, InlinePs } from "@lingdocs/ps-react"; import { getAudioPath } from "./PlayStorageAudio"; import ReactGA from "react-ga4"; +import { getRecordedGenders } from "../lib/recorded-genders"; export function EntryAudioDisplay({ entry, @@ -9,23 +10,46 @@ export function EntryAudioDisplay({ entry: T.DictionaryEntry; opts: T.TextOptions; }) { - const audioPath = getAudioPath(entry.ts); + if (!entry.a) { + return null; + } + return ( +
+ {getRecordedGenders(entry).map((gender) => ( + + ))} +
+ ); +} + +function EntryRecording({ + entry, + opts, + gender, +}: { + entry: T.DictionaryEntry; + opts: T.TextOptions; + gender: T.Gender; +}) { + const audioPath = getAudioPath(entry.ts, gender); if (!entry.a) { return null; } function handlePlay() { ReactGA.event({ category: "sounds", - action: `play ${entry.p} - ${entry.ts}`, + action: `play ${entry.p} - ${entry.ts} ${gender}`, }); } function handleDownload() { ReactGA.event({ category: "sounds", - action: `download ${entry.p} - ${entry.ts}`, + action: `download ${entry.p} - ${entry.ts} ${gender}`, }); - const documentName = `${entry.p}-${entry.ts}.mp3`; + const documentName = `${entry.p}-${entry.ts}-${ + gender === "masc" ? "m" : "f" + }.mp3`; fetch(audioPath) .then((res) => { @@ -45,10 +69,15 @@ export function EntryAudioDisplay({
- Listen to + Listen to : + {` `} + {gender === "masc" ? "Male" : "Female"} recording
+
+ {gender === "masc" ? "M" : "F"} +