A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
import { useLingui } from "@lingui/react/macro";
import { useState } from "react";
import { Pressable, View } from "react-native";
import { edit } from "./hooks";
import { Picker } from "@/features/design/picker";
import { getLocaleOptions } from "@/features/settings/locale-names";
import { selectableLocales } from "@/i18n";
import { Icon, Sheet, Text, useTheme } from "@/ui";
type ResumeLanguageProps = { locale: string; locked: boolean };
/**
* The resume's own language, at the top of Write: a new resume takes the app's language, which is easy to miss when
* writing in another one. The same setting as Design → Page → Language.
*/
export function ResumeLanguage({ locale, locked }: ResumeLanguageProps) {
const { t, i18n } = useLingui();
const { colors, space } = useTheme();
const [open, setOpen] = useState(false);
const options = getLocaleOptions(i18n, selectableLocales);
const languageName = (code: string) => options.find((option) => option.value === code)?.label ?? code;
const label = t({
comment: "Label beside the picker for the language a resume's headings and dates print in",
message: "Resume language",
});
return (
<>
<Pressable
accessibilityRole="button"
accessibilityLabel={label}
accessibilityValue={{ text: languageName(locale) }}
accessibilityHint={t`Sets section titles, date words and text direction. Your content isn't translated.`}
disabled={locked}
onPress={() => setOpen(true)}
style={{ flexDirection: "row", alignItems: "center", gap: space.s1 }}
>
<Text variant="micro" color="ink3">
{label}
</Text>
<Text variant="micro" color={locked ? "ink3" : "accentText"}>
{languageName(locale)}
</Text>
{locked ? null : <Icon name="caret-down" size={12} color={colors.accentText} />}
</Pressable>
<Sheet open={open} onClose={() => setOpen(false)} title={label} detents={[0.7, 1]}>
<View style={{ flex: 1 }}>
<Picker
title={label}
value={locale}
options={options}
onPick={(next) =>
edit((draft) => {
draft.metadata.page.locale = next;
})
}
onDone={() => setOpen(false)}
/>
</View>
</Sheet>
</>
);
}