diff --git a/app/lib/constants.ts b/app/lib/constants.ts index f91f6b5..764d47b 100644 --- a/app/lib/constants.ts +++ b/app/lib/constants.ts @@ -4,7 +4,7 @@ export const RequiredVersions = { controller: VERSION, tts: '2.0.0', piper: '1.3.0', - sounder: '2.0.0' + sounder: '2.1.0' } export const DOCS_URL = `https://openschoolbell.co.uk` diff --git a/app/lib/i18n.server.ts b/app/lib/i18n.server.ts index ac66330..2795391 100644 --- a/app/lib/i18n.server.ts +++ b/app/lib/i18n.server.ts @@ -46,7 +46,10 @@ const getMessages = (locale: SupportedLocale): Messages => { const messages: Messages = {} ;(Object.keys(locales[FALLBACK_LOCALE]) as MessageKey[]).forEach(key => { - messages[key] = locales[locale][key] ?? locales[FALLBACK_LOCALE][key] + messages[key] = + (locales[locale] as Partial<(typeof locales)[typeof FALLBACK_LOCALE]>)[ + key + ] ?? locales[FALLBACK_LOCALE][key] }) return messages diff --git a/app/lib/sequence-builder.tsx b/app/lib/sequence-builder.tsx new file mode 100644 index 0000000..bdd8f92 --- /dev/null +++ b/app/lib/sequence-builder.tsx @@ -0,0 +1,132 @@ +import {useState, useEffect} from 'react' +import {type Audio} from '@prisma/client' + +import CopyIcon from '@heroicons/react/24/outline/DocumentDuplicateIcon' +import PasteIcon from '@heroicons/react/24/outline/ClipboardDocumentIcon' + +import {getSecondsAsTime, INPUT_CLASSES} from './utils' +import {HelperText} from './ui' +import {useTranslation} from './i18n' + +export const SequenceBuilder = ({ + sounds, + initialQueue, + name, + label, + helperText +}: { + sounds: Audio[] + initialQueue: string[] + name: string + label: string + helperText: string +}) => { + const [queue, setQueue] = useState(initialQueue) + const [selected, setSelected] = useState(sounds[0].id) + const {t} = useTranslation() + + let duration = 0 + + return ( +
{sound.name}
+ ++ {getSecondsAsTime(sound.duration)} +
+