From 6bb905b3880b3c1be6ed907645fdffe70103394b Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sun, 9 Nov 2025 16:34:26 +0100 Subject: [PATCH] Rework settings page --- front/packages/ui/src/settings/oidc.tsx | 128 ---------- front/src/app/(app)/settings.tsx | 3 + front/src/app/(public)/_layout.tsx | 3 +- front/src/models/user.ts | 72 +++--- front/src/primitives/alert.web.tsx | 20 -- front/src/primitives/index.ts | 6 +- front/src/primitives/popup.tsx | 25 +- front/src/providers/native-providers.web.tsx | 3 +- front/src/query/query.tsx | 2 +- .../ui/src => src/ui}/settings/account.tsx | 227 +++++++++--------- front/src/ui/settings/base.tsx | 27 ++- front/src/ui/settings/general.tsx | 2 +- front/src/ui/settings/index.tsx | 8 +- front/src/ui/settings/oidc.tsx | 108 +++++++++ .../ui/src => src/ui}/settings/playback.tsx | 52 ++-- 15 files changed, 328 insertions(+), 358 deletions(-) delete mode 100644 front/packages/ui/src/settings/oidc.tsx create mode 100644 front/src/app/(app)/settings.tsx rename front/{packages/ui/src => src/ui}/settings/account.tsx (59%) create mode 100644 front/src/ui/settings/oidc.tsx rename front/{packages/ui/src => src/ui}/settings/playback.tsx (66%) diff --git a/front/packages/ui/src/settings/oidc.tsx b/front/packages/ui/src/settings/oidc.tsx deleted file mode 100644 index e4c383e5..00000000 --- a/front/packages/ui/src/settings/oidc.tsx +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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 { - type QueryIdentifier, - type ServerInfo, - ServerInfoP, - queryFn, - useAccount, - useFetch, -} from "@kyoo/models"; -import { Button, IconButton, Link, Skeleton, tooltip, ts } from "@kyoo/primitives"; -import { useTranslation } from "react-i18next"; -import { ImageBackground } from "react-native"; -import { rem, useYoshiki } from "yoshiki/native"; -import { ErrorView } from "../../../../src/ui/errors"; -import { Preference, SettingsContainer } from "./base"; - -import Badge from "@material-symbols/svg-400/outlined/badge.svg"; -import Remove from "@material-symbols/svg-400/outlined/close.svg"; -import OpenProfile from "@material-symbols/svg-400/outlined/open_in_new.svg"; -import { useMutation, useQueryClient } from "@tanstack/react-query"; - -export const OidcSettings = () => { - const account = useAccount()!; - const { css } = useYoshiki(); - const { t } = useTranslation(); - const { data, error } = useFetch(OidcSettings.query()); - const queryClient = useQueryClient(); - const { mutateAsync: unlinkAccount } = useMutation({ - mutationFn: async (provider: string) => - await queryFn({ - path: ["auth", "login", provider], - method: "DELETE", - }), - onSettled: async () => await queryClient.invalidateQueries({ queryKey: ["auth", "me"] }), - }); - - return ( - - {error ? ( - - ) : data ? ( - Object.entries(data.oidc).map(([id, x]) => { - const acc = account.externalId[id]; - return ( - - ) - } - > - {acc ? ( - <> - {acc.profileUrl && ( - - )} - unlinkAccount(id)} - {...tooltip(t("settings.oidc.delete", { provider: x.displayName }))} - /> - - ) : ( -