Compare commits
No commits in common. "27342936f0eb31367c1d82cbecc780b6e55b5172" and "99bbd3eeabccd9fb7481f200fd13dcc600e4e790" have entirely different histories.
27342936f0
...
99bbd3eeab
7 changed files with 73 additions and 151 deletions
|
@ -26,8 +26,6 @@ const TimelineHome = lazy(() => import("./timelines/Home.js"));
|
||||||
const Settings = lazy(() => import("./settings/Settings.js"));
|
const Settings = lazy(() => import("./settings/Settings.js"));
|
||||||
const TootBottomSheet = lazy(() => import("./timelines/TootBottomSheet.js"));
|
const TootBottomSheet = lazy(() => import("./timelines/TootBottomSheet.js"));
|
||||||
const MotionSettings = lazy(() => import("./settings/Motions.js"));
|
const MotionSettings = lazy(() => import("./settings/Motions.js"));
|
||||||
const LanguageSettings = lazy(() => import("./settings/Language.js"));
|
|
||||||
const RegionSettings = lazy(() => import("./settings/Region.jsx"));
|
|
||||||
|
|
||||||
const Routing: Component = () => {
|
const Routing: Component = () => {
|
||||||
return (
|
return (
|
||||||
|
@ -36,8 +34,6 @@ const Routing: Component = () => {
|
||||||
<Route path=""></Route>
|
<Route path=""></Route>
|
||||||
<Route path="/settings" component={Settings}>
|
<Route path="/settings" component={Settings}>
|
||||||
<Route path=""></Route>
|
<Route path=""></Route>
|
||||||
<Route path="/language" component={LanguageSettings}></Route>
|
|
||||||
<Route path="/region" component={RegionSettings}></Route>
|
|
||||||
<Route path="/motions" component={MotionSettings}></Route>
|
<Route path="/motions" component={MotionSettings}></Route>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/:acct/:id" component={TootBottomSheet}></Route>
|
<Route path="/:acct/:id" component={TootBottomSheet}></Route>
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
&.animated {
|
&.animated {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
transform: translateY(-50%);
|
transform: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
will-change: width, height, top, left;
|
will-change: width, height, top, left;
|
||||||
|
|
||||||
|
@ -54,12 +54,6 @@
|
||||||
& * {
|
& * {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 560px) {
|
|
||||||
& {
|
|
||||||
transform: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.bottom {
|
&.bottom {
|
||||||
|
|
|
@ -36,7 +36,7 @@ function composeAnimationFrame(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const MOVE_SPEED = 1200;
|
const MOVE_SPEED = 1400; // 1400px/s, bottom sheet is big and a bit heavier than small papers
|
||||||
|
|
||||||
const BottomSheet: ParentComponent<BottomSheetProps> = (props) => {
|
const BottomSheet: ParentComponent<BottomSheetProps> = (props) => {
|
||||||
let element: HTMLDialogElement;
|
let element: HTMLDialogElement;
|
||||||
|
@ -62,17 +62,13 @@ const BottomSheet: ParentComponent<BottomSheetProps> = (props) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
const srcElement = hero();
|
hero()!.style.visibility = 'unset'
|
||||||
if (srcElement) {
|
|
||||||
srcElement.style.visibility = "unset";
|
|
||||||
}
|
|
||||||
|
|
||||||
element.close();
|
element.close();
|
||||||
setHero();
|
setHero();
|
||||||
};
|
};
|
||||||
|
|
||||||
const animatedClose = () => {
|
const animatedClose = () => {
|
||||||
const srcElement = hero();
|
const srcElement = hero()
|
||||||
const endRect = srcElement?.getBoundingClientRect();
|
const endRect = srcElement?.getBoundingClientRect();
|
||||||
if (endRect) {
|
if (endRect) {
|
||||||
const startRect = element.getBoundingClientRect();
|
const startRect = element.getBoundingClientRect();
|
||||||
|
@ -80,94 +76,19 @@ const BottomSheet: ParentComponent<BottomSheetProps> = (props) => {
|
||||||
animation.addEventListener("finish", onClose);
|
animation.addEventListener("finish", onClose);
|
||||||
animation.addEventListener("cancel", onClose);
|
animation.addEventListener("cancel", onClose);
|
||||||
} else {
|
} else {
|
||||||
if (window.innerWidth > 560 && !props.bottomUp) {
|
element.close();
|
||||||
onClose();
|
setHero();
|
||||||
return;
|
|
||||||
}
|
|
||||||
const animation = props.bottomUp
|
|
||||||
? animateSlideInFromBottom(element, true)
|
|
||||||
: animateSlideInFromRight(element, true);
|
|
||||||
animation.addEventListener("finish", onClose);
|
|
||||||
animation.addEventListener("cancel", onClose);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const animatedOpen = () => {
|
const animatedOpen = () => {
|
||||||
element.showModal();
|
element.showModal();
|
||||||
const srcElement = hero();
|
const srcElement = hero()
|
||||||
const startRect = srcElement?.getBoundingClientRect();
|
const startRect = srcElement?.getBoundingClientRect();
|
||||||
if (startRect) {
|
if (!startRect) return;
|
||||||
srcElement!.style.visibility = "hidden";
|
srcElement!.style.visibility = 'hidden'
|
||||||
const endRect = element.getBoundingClientRect();
|
const endRect = element.getBoundingClientRect();
|
||||||
animateHero(startRect, endRect, element);
|
animateHero(startRect, endRect, element);
|
||||||
} else if (props.bottomUp) {
|
|
||||||
animateSlideInFromBottom(element);
|
|
||||||
} else if (window.innerWidth <= 560) {
|
|
||||||
animateSlideInFromRight(element);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const animateSlideInFromRight = (element: HTMLElement, reserve?: boolean) => {
|
|
||||||
const rect = element.getBoundingClientRect();
|
|
||||||
const easing = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
||||||
element.classList.add(styles.animated);
|
|
||||||
const oldOverflow = document.body.style.overflow;
|
|
||||||
document.body.style.overflow = "hidden";
|
|
||||||
const distance = Math.abs(rect.left - window.innerWidth);
|
|
||||||
const duration = (distance / MOVE_SPEED) * 1000;
|
|
||||||
|
|
||||||
animation = element.animate(
|
|
||||||
{
|
|
||||||
top: [rect.top, rect.top],
|
|
||||||
left: reserve
|
|
||||||
? [`${rect.left}px`, `${window.innerWidth}px`]
|
|
||||||
: [`${window.innerWidth}px`, `${rect.left}px`],
|
|
||||||
width: [rect.width, rect.width],
|
|
||||||
height: [rect.height, rect.height],
|
|
||||||
},
|
|
||||||
{ easing, duration },
|
|
||||||
);
|
|
||||||
const onAnimationEnd = () => {
|
|
||||||
element.classList.remove(styles.animated);
|
|
||||||
document.body.style.overflow = oldOverflow;
|
|
||||||
animation = undefined;
|
|
||||||
};
|
|
||||||
animation.addEventListener("cancel", onAnimationEnd);
|
|
||||||
animation.addEventListener("finish", onAnimationEnd);
|
|
||||||
return animation;
|
|
||||||
};
|
|
||||||
|
|
||||||
const animateSlideInFromBottom = (
|
|
||||||
element: HTMLElement,
|
|
||||||
reserve?: boolean,
|
|
||||||
) => {
|
|
||||||
const rect = element.getBoundingClientRect();
|
|
||||||
const easing = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
||||||
element.classList.add(styles.animated);
|
|
||||||
const oldOverflow = document.body.style.overflow;
|
|
||||||
document.body.style.overflow = "hidden";
|
|
||||||
const distance = Math.abs(rect.top - window.innerHeight);
|
|
||||||
const duration = (distance / MOVE_SPEED) * 1000;
|
|
||||||
|
|
||||||
animation = element.animate(
|
|
||||||
{
|
|
||||||
left: [rect.left, rect.left],
|
|
||||||
top: reserve
|
|
||||||
? [`${rect.top}px`, `${window.innerHeight}px`]
|
|
||||||
: [`${window.innerHeight}px`, `${rect.top}px`],
|
|
||||||
width: [rect.width, rect.width],
|
|
||||||
height: [rect.height, rect.height],
|
|
||||||
},
|
|
||||||
{ easing, duration },
|
|
||||||
);
|
|
||||||
const onAnimationEnd = () => {
|
|
||||||
element.classList.remove(styles.animated);
|
|
||||||
document.body.style.overflow = oldOverflow;
|
|
||||||
animation = undefined;
|
|
||||||
};
|
|
||||||
animation.addEventListener("cancel", onAnimationEnd);
|
|
||||||
animation.addEventListener("finish", onAnimationEnd);
|
|
||||||
return animation;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const animateHero = (
|
const animateHero = (
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
Switch,
|
Switch,
|
||||||
Toolbar,
|
Toolbar,
|
||||||
} from "@suid/material";
|
} from "@suid/material";
|
||||||
import { ArrowBack } from "@suid/icons-material";
|
import { Close as CloseIcon } from "@suid/icons-material";
|
||||||
import iso639_1 from "iso-639-1";
|
import iso639_1 from "iso-639-1";
|
||||||
import {
|
import {
|
||||||
autoMatchLangTag,
|
autoMatchLangTag,
|
||||||
|
@ -22,12 +22,14 @@ import {
|
||||||
} from "../platform/i18n";
|
} from "../platform/i18n";
|
||||||
import { Title } from "../material/typography";
|
import { Title } from "../material/typography";
|
||||||
import type { Template } from "@solid-primitives/i18n";
|
import type { Template } from "@solid-primitives/i18n";
|
||||||
import { useStore } from "@nanostores/solid";
|
|
||||||
import { $settings } from "./stores";
|
|
||||||
import { useNavigate } from "@solidjs/router";
|
|
||||||
|
|
||||||
const ChooseLang: Component = () => {
|
type ChooseLangProps = {
|
||||||
const navigate = useNavigate()
|
code?: string;
|
||||||
|
onCodeChange: (ncode?: string) => void;
|
||||||
|
onClose?: JSX.EventHandlerUnion<HTMLButtonElement, MouseEvent>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const ChooseLang: Component<ChooseLangProps> = (props) => {
|
||||||
const [t] = createTranslator(
|
const [t] = createTranslator(
|
||||||
() => import("./i18n/lang-names.json"),
|
() => import("./i18n/lang-names.json"),
|
||||||
(code) =>
|
(code) =>
|
||||||
|
@ -37,9 +39,6 @@ const ChooseLang: Component = () => {
|
||||||
};
|
};
|
||||||
}>,
|
}>,
|
||||||
);
|
);
|
||||||
const settings = useStore($settings)
|
|
||||||
|
|
||||||
const code = () => settings().language
|
|
||||||
|
|
||||||
const unsupportedLangCodes = createMemo(() => {
|
const unsupportedLangCodes = createMemo(() => {
|
||||||
return iso639_1.getAllCodes().filter((x) => !["zh", "en"].includes(x));
|
return iso639_1.getAllCodes().filter((x) => !["zh", "en"].includes(x));
|
||||||
|
@ -47,10 +46,6 @@ const ChooseLang: Component = () => {
|
||||||
|
|
||||||
const matchedLangCode = createMemo(() => autoMatchLangTag());
|
const matchedLangCode = createMemo(() => autoMatchLangTag());
|
||||||
|
|
||||||
const onCodeChange = (code?: string) => {
|
|
||||||
$settings.setKey("language", code)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Scaffold
|
<Scaffold
|
||||||
topbar={
|
topbar={
|
||||||
|
@ -59,8 +54,8 @@ const ChooseLang: Component = () => {
|
||||||
variant="dense"
|
variant="dense"
|
||||||
sx={{ paddingTop: "var(--safe-area-inset-top, 0px)" }}
|
sx={{ paddingTop: "var(--safe-area-inset-top, 0px)" }}
|
||||||
>
|
>
|
||||||
<IconButton color="inherit" onClick={[navigate, -1]} disableRipple>
|
<IconButton color="inherit" onClick={props.onClose} disableRipple>
|
||||||
<ArrowBack />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Title>{t("Choose Language")}</Title>
|
<Title>{t("Choose Language")}</Title>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
@ -74,7 +69,7 @@ const ChooseLang: Component = () => {
|
||||||
>
|
>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onCodeChange(code() ? undefined : matchedLangCode());
|
props.onCodeChange(props.code ? undefined : matchedLangCode());
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ListItemText>
|
<ListItemText>
|
||||||
|
@ -83,20 +78,20 @@ const ChooseLang: Component = () => {
|
||||||
})}
|
})}
|
||||||
</ListItemText>
|
</ListItemText>
|
||||||
<ListItemSecondaryAction>
|
<ListItemSecondaryAction>
|
||||||
<Switch checked={typeof code() === "undefined"} />
|
<Switch checked={typeof props.code === "undefined"} />
|
||||||
</ListItemSecondaryAction>
|
</ListItemSecondaryAction>
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
<List subheader={<ListSubheader>{t("Supported")}</ListSubheader>}>
|
<List subheader={<ListSubheader>{t("Supported")}</ListSubheader>}>
|
||||||
<For each={SUPPORTED_LANGS}>
|
<For each={SUPPORTED_LANGS}>
|
||||||
{(c) => (
|
{(code) => (
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
disabled={typeof code() === "undefined"}
|
disabled={typeof props.code === "undefined"}
|
||||||
onClick={[onCodeChange, c]}
|
onClick={[props.onCodeChange, code]}
|
||||||
>
|
>
|
||||||
<ListItemText>{t(`lang.${c}`)}</ListItemText>
|
<ListItemText>{t(`lang.${code}`)}</ListItemText>
|
||||||
<ListItemSecondaryAction>
|
<ListItemSecondaryAction>
|
||||||
<Radio
|
<Radio
|
||||||
checked={code() === c || (code() === undefined && matchedLangCode() == c)}
|
checked={props.code === code || (props.code === undefined && matchedLangCode() == code)}
|
||||||
/>
|
/>
|
||||||
</ListItemSecondaryAction>
|
</ListItemSecondaryAction>
|
||||||
</ListItemButton>
|
</ListItemButton>
|
|
@ -12,7 +12,8 @@ import {
|
||||||
Switch,
|
Switch,
|
||||||
Toolbar,
|
Toolbar,
|
||||||
} from "@suid/material";
|
} from "@suid/material";
|
||||||
import { ArrowBack } from "@suid/icons-material";
|
import { Close as CloseIcon } from "@suid/icons-material";
|
||||||
|
import iso639_1 from "iso-639-1";
|
||||||
import {
|
import {
|
||||||
autoMatchRegion,
|
autoMatchRegion,
|
||||||
createTranslator,
|
createTranslator,
|
||||||
|
@ -20,12 +21,14 @@ import {
|
||||||
} from "../platform/i18n";
|
} from "../platform/i18n";
|
||||||
import { Title } from "../material/typography";
|
import { Title } from "../material/typography";
|
||||||
import type { Template } from "@solid-primitives/i18n";
|
import type { Template } from "@solid-primitives/i18n";
|
||||||
import { useNavigate } from "@solidjs/router";
|
|
||||||
import { $settings } from "./stores";
|
|
||||||
import { useStore } from "@nanostores/solid";
|
|
||||||
|
|
||||||
const ChooseRegion: Component = () => {
|
type ChooseRegionProps = {
|
||||||
const navigate = useNavigate();
|
code?: string;
|
||||||
|
onCodeChange: (ncode?: string) => void;
|
||||||
|
onClose?: JSX.EventHandlerUnion<HTMLButtonElement, MouseEvent>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const ChooseRegion: Component<ChooseRegionProps> = (props) => {
|
||||||
const [t] = createTranslator(
|
const [t] = createTranslator(
|
||||||
() => import("./i18n/lang-names.json"),
|
() => import("./i18n/lang-names.json"),
|
||||||
(code) =>
|
(code) =>
|
||||||
|
@ -36,16 +39,12 @@ const ChooseRegion: Component = () => {
|
||||||
}>,
|
}>,
|
||||||
);
|
);
|
||||||
|
|
||||||
const settings = useStore($settings);
|
const unsupportedLangCodes = createMemo(() => {
|
||||||
|
return iso639_1.getAllCodes().filter((x) => !["zh", "en"].includes(x));
|
||||||
const region = () => settings().region;
|
});
|
||||||
|
|
||||||
const matchedRegionCode = createMemo(() => autoMatchRegion());
|
const matchedRegionCode = createMemo(() => autoMatchRegion());
|
||||||
|
|
||||||
const onCodeChange = (code?: string) => {
|
|
||||||
$settings.setKey("region", code);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Scaffold
|
<Scaffold
|
||||||
topbar={
|
topbar={
|
||||||
|
@ -54,8 +53,8 @@ const ChooseRegion: Component = () => {
|
||||||
variant="dense"
|
variant="dense"
|
||||||
sx={{ paddingTop: "var(--safe-area-inset-top, 0px)" }}
|
sx={{ paddingTop: "var(--safe-area-inset-top, 0px)" }}
|
||||||
>
|
>
|
||||||
<IconButton color="inherit" onClick={[navigate, -1]} disableRipple>
|
<IconButton color="inherit" onClick={props.onClose} disableRipple>
|
||||||
<ArrowBack />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Title>{t("Choose Language")}</Title>
|
<Title>{t("Choose Language")}</Title>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
@ -69,17 +68,16 @@ const ChooseRegion: Component = () => {
|
||||||
>
|
>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onCodeChange(region() ? undefined : matchedRegionCode());
|
props.onCodeChange(props.code ? undefined : matchedRegionCode());
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ListItemText>
|
<ListItemText>
|
||||||
{t("region.auto", {
|
{t("region.auto", {
|
||||||
detected:
|
detected: t(`region.${matchedRegionCode()}`) ?? matchedRegionCode(),
|
||||||
t(`region.${matchedRegionCode()}`) ?? matchedRegionCode(),
|
|
||||||
})}
|
})}
|
||||||
</ListItemText>
|
</ListItemText>
|
||||||
<ListItemSecondaryAction>
|
<ListItemSecondaryAction>
|
||||||
<Switch checked={typeof region() === "undefined"} />
|
<Switch checked={typeof props.code === "undefined"} />
|
||||||
</ListItemSecondaryAction>
|
</ListItemSecondaryAction>
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
|
|
||||||
|
@ -87,16 +85,13 @@ const ChooseRegion: Component = () => {
|
||||||
<For each={SUPPORTED_REGIONS}>
|
<For each={SUPPORTED_REGIONS}>
|
||||||
{(code) => (
|
{(code) => (
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
disabled={typeof region() === "undefined"}
|
disabled={typeof props.code === "undefined"}
|
||||||
onClick={[onCodeChange, code]}
|
onClick={[props.onCodeChange, code]}
|
||||||
>
|
>
|
||||||
<ListItemText>{t(`region.${code}`)}</ListItemText>
|
<ListItemText>{t(`region.${code}`)}</ListItemText>
|
||||||
<ListItemSecondaryAction>
|
<ListItemSecondaryAction>
|
||||||
<Radio
|
<Radio
|
||||||
checked={
|
checked={props.code === code || (props.code === undefined && matchedRegionCode() == code)}
|
||||||
region() === code ||
|
|
||||||
(region() === undefined && matchedRegionCode() == code)
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</ListItemSecondaryAction>
|
</ListItemSecondaryAction>
|
||||||
</ListItemButton>
|
</ListItemButton>
|
|
@ -14,7 +14,7 @@ import {
|
||||||
} from "@suid/material";
|
} from "@suid/material";
|
||||||
import { Title } from "../material/typography";
|
import { Title } from "../material/typography";
|
||||||
import { useNavigate } from "@solidjs/router";
|
import { useNavigate } from "@solidjs/router";
|
||||||
import { ArrowBack } from "@suid/icons-material";
|
import { Close as CloseIcon } from "@suid/icons-material";
|
||||||
import { createTranslator } from "../platform/i18n";
|
import { createTranslator } from "../platform/i18n";
|
||||||
import { useStore } from "@nanostores/solid";
|
import { useStore } from "@nanostores/solid";
|
||||||
import { $settings } from "./stores";
|
import { $settings } from "./stores";
|
||||||
|
@ -37,7 +37,7 @@ const Motions: Component = () => {
|
||||||
sx={{ paddingTop: "var(--safe-area-inset-top, 0px)" }}
|
sx={{ paddingTop: "var(--safe-area-inset-top, 0px)" }}
|
||||||
>
|
>
|
||||||
<IconButton color="inherit" onClick={[navigate, -1]} disableRipple>
|
<IconButton color="inherit" onClick={[navigate, -1]} disableRipple>
|
||||||
<ArrowBack />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Title>{t("motions")}</Title>
|
<Title>{t("motions")}</Title>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
|
|
@ -41,10 +41,15 @@ import {
|
||||||
autoMatchLangTag,
|
autoMatchLangTag,
|
||||||
autoMatchRegion,
|
autoMatchRegion,
|
||||||
createTranslator,
|
createTranslator,
|
||||||
|
SUPPORTED_LANGS,
|
||||||
|
SUPPORTED_REGIONS,
|
||||||
useDateFnLocale,
|
useDateFnLocale,
|
||||||
} from "../platform/i18n.jsx";
|
} from "../platform/i18n.jsx";
|
||||||
import { type Template } from "@solid-primitives/i18n";
|
import { type Template } from "@solid-primitives/i18n";
|
||||||
import BottomSheet from "../material/BottomSheet.jsx";
|
import BottomSheet from "../material/BottomSheet.jsx";
|
||||||
|
import ChooseLang from "./ChooseLang.jsx";
|
||||||
|
import ChooseRegion from "./ChooseRegion.jsx";
|
||||||
|
import { Portal } from "solid-js/web";
|
||||||
|
|
||||||
type Strings = {
|
type Strings = {
|
||||||
["lang.auto"]: Template<{ detected: string }>;
|
["lang.auto"]: Template<{ detected: string }>;
|
||||||
|
@ -64,6 +69,8 @@ const Settings: ParentComponent = (props) => {
|
||||||
needRefresh: [needRefresh],
|
needRefresh: [needRefresh],
|
||||||
} = useRegisterSW();
|
} = useRegisterSW();
|
||||||
const dateFnLocale = useDateFnLocale();
|
const dateFnLocale = useDateFnLocale();
|
||||||
|
const [langPickerOpen, setLangPickerOpen] = createSignal(false);
|
||||||
|
const [regionPickerOpen, setRegionPickerOpen] = createSignal(false);
|
||||||
|
|
||||||
const [profiles] = useSignedInProfiles();
|
const [profiles] = useSignedInProfiles();
|
||||||
|
|
||||||
|
@ -168,7 +175,7 @@ const Settings: ParentComponent = (props) => {
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<ListSubheader>{t("This Application")}</ListSubheader>
|
<ListSubheader>{t("This Application")}</ListSubheader>
|
||||||
<ListItemButton component={A} href="./language">
|
<ListItemButton onClick={[setLangPickerOpen, true]}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<TranslateIcon />
|
<TranslateIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
|
@ -185,8 +192,15 @@ const Settings: ParentComponent = (props) => {
|
||||||
{t("Language")}
|
{t("Language")}
|
||||||
</ListItemText>
|
</ListItemText>
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
|
<BottomSheet open={langPickerOpen()}>
|
||||||
|
<ChooseLang
|
||||||
|
code={settings$().language}
|
||||||
|
onCodeChange={(nval) => $settings.setKey("language", nval)}
|
||||||
|
onClose={[setLangPickerOpen, false]}
|
||||||
|
/>
|
||||||
|
</BottomSheet>
|
||||||
<Divider />
|
<Divider />
|
||||||
<ListItemButton component={A} href="./region">
|
<ListItemButton onClick={[setRegionPickerOpen, true]}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<PublicIcon />
|
<PublicIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
|
@ -203,6 +217,13 @@ const Settings: ParentComponent = (props) => {
|
||||||
{t("Region")}
|
{t("Region")}
|
||||||
</ListItemText>
|
</ListItemText>
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
|
<BottomSheet open={regionPickerOpen()}>
|
||||||
|
<ChooseRegion
|
||||||
|
code={settings$().region}
|
||||||
|
onCodeChange={(nval) => $settings.setKey("region", nval)}
|
||||||
|
onClose={[setRegionPickerOpen, false]}
|
||||||
|
/>
|
||||||
|
</BottomSheet>
|
||||||
<Divider />
|
<Divider />
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemText secondary={t("About Tutu.2nd")}>
|
<ListItemText secondary={t("About Tutu.2nd")}>
|
||||||
|
|
Loading…
Reference in a new issue