Add delete button for the avatar

This commit is contained in:
Zoe Roux 2024-02-04 23:32:49 +01:00
parent 666477e448
commit eb4f88bc60
2 changed files with 33 additions and 22 deletions

View File

@ -18,7 +18,7 @@
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>. * along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { View, ViewStyle, Image } from "react-native"; import { View, ViewStyle, Image, ImageProps } from "react-native";
import { useYoshiki, px, Stylable } from "yoshiki/native"; import { useYoshiki, px, Stylable } from "yoshiki/native";
import { Icon } from "./icons"; import { Icon } from "./icons";
import { P } from "./text"; import { P } from "./text";
@ -102,7 +102,7 @@ export const Avatar = forwardRef<
alt={alt} alt={alt}
width={size} width={size}
height={size} height={size}
{...css({ position: "absolute" })} {...css({ position: "absolute" }) as ImageProps}
/> />
</Container> </Container>
); );

View File

@ -136,6 +136,7 @@ export const AccountSettings = () => {
label={t("settings.account.avatar.label")} label={t("settings.account.avatar.label")}
description={t("settings.account.avatar.description")} description={t("settings.account.avatar.description")}
> >
<View {...css({ flexDirection: "row", gap: ts(1) })}>
<Button <Button
text={t("misc.edit")} text={t("misc.edit")}
onPress={async () => { onPress={async () => {
@ -156,6 +157,16 @@ export const AccountSettings = () => {
}); });
}} }}
/> />
<Button
text={t("misc.delete")}
onPress={async () => {
await queryFn({
method: "DELETE",
path: ["auth", "me", "logo"],
});
}}
/>
</View>
</Preference> </Preference>
<Preference icon={Mail} label={t("settings.account.email.label")} description={account.email}> <Preference icon={Mail} label={t("settings.account.email.label")} description={account.email}>
<Button <Button