diff --git a/front/packages/primitives/src/button.tsx b/front/packages/primitives/src/button.tsx index 971d7d6d..5e095475 100644 --- a/front/packages/primitives/src/button.tsx +++ b/front/packages/primitives/src/button.tsx @@ -27,8 +27,10 @@ import { View } from "react-native"; export const Button = forwardRef< View, - { text: string; icon?: ReactElement } & ComponentProps ->(function Button({ text, icon, ...props }, ref) { + { text: string; licon?: ReactElement; icon?: ReactElement } & ComponentProps< + typeof PressableFeedback + > +>(function Button({ text, icon, licon, ...props }, ref) { const { css } = useYoshiki("button"); return ( @@ -60,6 +62,7 @@ export const Button = forwardRef< alignItems: "center", })} > + {licon}

{text}

{icon} diff --git a/front/packages/ui/src/navbar/index.tsx b/front/packages/ui/src/navbar/index.tsx index 168a9e42..50439e3a 100644 --- a/front/packages/ui/src/navbar/index.tsx +++ b/front/packages/ui/src/navbar/index.tsx @@ -18,9 +18,8 @@ * along with Kyoo. If not, see . */ -import { deleteAccount, logout, useAccount, useAccounts } from "@kyoo/models"; +import { logout, useAccount, useAccounts } from "@kyoo/models"; import { - Alert, Input, IconButton, Header, @@ -40,7 +39,6 @@ import Search from "@material-symbols/svg-400/rounded/search-fill.svg"; 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"; @@ -129,29 +127,6 @@ export const NavbarProfile = () => { <> - { - Alert.alert( - t("login.delete"), - t("login.delete-confirmation"), - [ - { text: t("misc.cancel"), style: "cancel" }, - { - text: t("misc.delete"), - onPress: deleteAccount, - style: "destructive", - }, - ], - { - cancelable: true, - userInterfaceStyle: theme.mode === "auto" ? "light" : theme.mode, - icon: "warning", - }, - ); - }} - /> )} diff --git a/front/packages/ui/src/settings/index.tsx b/front/packages/ui/src/settings/index.tsx index b82a4072..070cdb74 100644 --- a/front/packages/ui/src/settings/index.tsx +++ b/front/packages/ui/src/settings/index.tsx @@ -25,12 +25,15 @@ import { QueryPage, User, UserP, + deleteAccount, + logout, queryFn, setUserTheme, useAccount, useUserTheme, } from "@kyoo/models"; import { + Alert, Button, Container, H1, @@ -50,13 +53,15 @@ import { Children, ComponentProps, ReactElement, ReactNode, useState } from "rea import { useTranslation } from "react-i18next"; import { ScrollView, View } from "react-native"; import { px, rem, useYoshiki } from "yoshiki/native"; +import { useMutation, useQueryClient } from "@tanstack/react-query"; +import { PasswordInput } from "../login/password-input"; import Theme from "@material-symbols/svg-400/outlined/dark_mode.svg"; import Username from "@material-symbols/svg-400/outlined/badge.svg"; import Mail from "@material-symbols/svg-400/outlined/mail.svg"; import Password from "@material-symbols/svg-400/outlined/password.svg"; -import { useMutation, useQueryClient } from "@tanstack/react-query"; -import { PasswordInput } from "../login/password-input"; +import Logout from "@material-symbols/svg-400/rounded/logout.svg"; +import Delete from "@material-symbols/svg-400/rounded/delete.svg"; const Preference = ({ icon, @@ -100,13 +105,17 @@ const Preference = ({ const SettingsContainer = ({ children, title, + extra, + ...props }: { children: ReactElement | ReactElement[]; title: string; + extra?: ReactElement; }) => { const { css } = useYoshiki(); + return ( - +

{title}

{({ css }) => ( @@ -125,6 +134,7 @@ const SettingsContainer = ({ )} + {extra}
); }; @@ -248,6 +258,7 @@ const ChangePasswordPopup = ({ const AccountSettings = ({ setPopup }: { setPopup: (e?: ReactElement) => void }) => { const account = useAccount(); + const { css, theme } = useYoshiki(); const { t } = useTranslation(); const queryClient = useQueryClient(); @@ -271,7 +282,43 @@ const AccountSettings = ({ setPopup }: { setPopup: (e?: ReactElement) => void }) return ( account && ( - + +