diff --git a/front/apps/mobile/app/(public)/_layout.tsx b/front/apps/mobile/app/(public)/_layout.tsx index b4a57b1c..cb81a20c 100644 --- a/front/apps/mobile/app/(public)/_layout.tsx +++ b/front/apps/mobile/app/(public)/_layout.tsx @@ -28,7 +28,7 @@ export default function PublicLayout() { const theme = useTheme(); const account = useAccount(); const { error } = useContext(ConnectionErrorContext); - const oldAccount = useRef(null); + const oldAccount = useRef(account); if (account && !error && account != oldAccount.current) return ; oldAccount.current = account; diff --git a/front/apps/mobile/app/(public)/settings/index.tsx b/front/apps/mobile/app/(public)/settings/index.tsx new file mode 100644 index 00000000..1fa5a7a1 --- /dev/null +++ b/front/apps/mobile/app/(public)/settings/index.tsx @@ -0,0 +1,24 @@ +/* + * Kyoo - A portable and vast media library solution. + * Copyright (c) Kyoo. + * + * See AUTHORS.md and LICENSE file in the project root for full license information. + * + * Kyoo is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * Kyoo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kyoo. If not, see . + */ + +import { SettingsPage } from "@kyoo/ui"; + +export default SettingsPage; + diff --git a/front/apps/web/src/pages/settings/index.tsx b/front/apps/web/src/pages/settings/index.tsx new file mode 100644 index 00000000..22fe9369 --- /dev/null +++ b/front/apps/web/src/pages/settings/index.tsx @@ -0,0 +1,24 @@ +/* + * Kyoo - A portable and vast media library solution. + * Copyright (c) Kyoo. + * + * See AUTHORS.md and LICENSE file in the project root for full license information. + * + * Kyoo is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * Kyoo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kyoo. If not, see . + */ + +import { SettingsPage } from "@kyoo/ui"; +import { withRoute } from "~/router"; + +export default withRoute(SettingsPage); diff --git a/front/packages/ui/src/index.ts b/front/packages/ui/src/index.ts index f4053f5f..de07c18a 100644 --- a/front/packages/ui/src/index.ts +++ b/front/packages/ui/src/index.ts @@ -27,3 +27,4 @@ export { Player } from "./player"; export { SearchPage } from "./search"; export { LoginPage, RegisterPage } from "./login"; export { DownloadPage, DownloadProvider } from "./downloads"; +export { SettingsPage } from "./settings"; diff --git a/front/packages/ui/src/navbar/index.tsx b/front/packages/ui/src/navbar/index.tsx index 999bd3ed..168a9e42 100644 --- a/front/packages/ui/src/navbar/index.tsx +++ b/front/packages/ui/src/navbar/index.tsx @@ -41,6 +41,7 @@ import Login from "@material-symbols/svg-400/rounded/login.svg"; import Register from "@material-symbols/svg-400/rounded/app_registration.svg"; import Logout from "@material-symbols/svg-400/rounded/logout.svg"; import Delete from "@material-symbols/svg-400/rounded/delete.svg"; +import Settings from "@material-symbols/svg-400/rounded/settings.svg"; import { KyooLongLogo } from "./icon"; import { forwardRef, useEffect, useRef, useState } from "react"; @@ -118,6 +119,7 @@ export const NavbarProfile = () => { /> ))} {accounts.length > 0 &&
} + {!account ? ( <> @@ -178,7 +180,7 @@ export const NavbarRight = () => { }; export const Navbar = (props: Stylable) => { - const { css, theme } = useYoshiki(); + const { css } = useYoshiki(); const { t } = useTranslation(); return ( diff --git a/front/packages/ui/src/settings/index.tsx b/front/packages/ui/src/settings/index.tsx new file mode 100644 index 00000000..2e68b0f2 --- /dev/null +++ b/front/packages/ui/src/settings/index.tsx @@ -0,0 +1,78 @@ +/* + * Kyoo - A portable and vast media library solution. + * Copyright (c) Kyoo. + * + * See AUTHORS.md and LICENSE file in the project root for full license information. + * + * Kyoo is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * Kyoo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kyoo. If not, see . + */ + +import { QueryIdentifier, QueryPage, User, UserP } from "@kyoo/models"; +import { Container, P, Select, ts } from "@kyoo/primitives"; +import { DefaultLayout } from "../layout"; +import { ReactNode } from "react"; +import { useTranslation } from "react-i18next"; +import { ScrollView, View } from "react-native"; +import { useYoshiki } from "yoshiki/native"; + +const Preference = ({ label, children, ...props }: { label: string; children: ReactNode }) => { + const { css } = useYoshiki(); + + return ( + +

{label}

+ {children} +
+ ); +}; + +const query: QueryIdentifier = { + parser: UserP, + path: ["auth", "me"], +}; + +export const SettingsPage: QueryPage = () => { + const { t } = useTranslation(); + + return ( + + + +