ALF content language dialog (#9471)

Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
Samuel Newman
2026-02-18 16:57:32 +00:00
committed by GitHub
parent bdf143ce79
commit 512ce3d5d0
14 changed files with 170 additions and 659 deletions
@@ -11,11 +11,11 @@ import {
import {atoms as a, useTheme} from '#/alf'
import {Button, type ButtonProps} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
import {LanguageSelectDialog} from '#/components/dialogs/LanguageSelectDialog'
import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRightIcon} from '#/components/icons/Chevron'
import {Globe_Stroke2_Corner0_Rounded as GlobeIcon} from '#/components/icons/Globe'
import * as Menu from '#/components/Menu'
import {Text} from '#/components/Typography'
import {PostLanguageSelectDialog} from './PostLanguageSelectDialog'
export function PostLanguageSelect({
currentLanguages: currentLanguagesProp,
@@ -36,6 +36,15 @@ export function PostLanguageSelect({
const currentLanguages =
currentLanguagesProp ?? toPostLanguages(langPrefs.postLanguage)
const onSelectLanguages = (languages: string[]) => {
let langsString = languages.join(',')
if (!langsString) {
langsString = langPrefs.primaryLanguage
}
setLangPrefs.setPostLanguage(langsString)
onSelectLanguage?.(langsString)
}
if (
dedupedHistory.length === 1 &&
dedupedHistory[0] === langPrefs.postLanguage
@@ -43,9 +52,15 @@ export function PostLanguageSelect({
return (
<>
<LanguageBtn onPress={languageDialogControl.open} />
<PostLanguageSelectDialog
<LanguageSelectDialog
titleText={<Trans>Choose post languages</Trans>}
subtitleText={
<Trans>Select up to 3 languages used in this post</Trans>
}
control={languageDialogControl}
currentLanguages={currentLanguages}
onSelectLanguages={onSelectLanguages}
maxLanguages={3}
/>
</>
)
@@ -94,10 +109,13 @@ export function PostLanguageSelect({
</Menu.Outer>
</Menu.Root>
<PostLanguageSelectDialog
<LanguageSelectDialog
titleText={<Trans>Choose post languages</Trans>}
subtitleText={<Trans>Select up to 3 languages used in this post</Trans>}
control={languageDialogControl}
currentLanguages={currentLanguages}
onSelectLanguage={onSelectLanguage}
onSelectLanguages={onSelectLanguages}
maxLanguages={3}
/>
</>
)