From 4ecf62faffdaf1db39a35d181852c0b2093d152a Mon Sep 17 00:00:00 2001 From: tylen Date: Mon, 24 Nov 2025 17:24:41 +0200 Subject: [PATCH] implement wihslist and secret santa --- frontend/src/components/SecretSanta.tsx | 41 +++++++++++++------------ 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/SecretSanta.tsx b/frontend/src/components/SecretSanta.tsx index 734eede..a5286eb 100644 --- a/frontend/src/components/SecretSanta.tsx +++ b/frontend/src/components/SecretSanta.tsx @@ -1,14 +1,14 @@ import CenteredContainer from "./ChildrenContainer"; import useFetchUser from "../utils/fetchUser.tsx" import type { SantaInfo } from "../types/index"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import { useNotification } from "../NotificationContext.tsx"; function SecretSanta() { const { updateWishlist, getSantaInfo } = useFetchUser() - const [ santaInfo, setSantaInfo ] = useState(null) - const [ wishListUrl, setWishListUrl ] = useState('') + const [santaInfo, setSantaInfo] = useState(null) + const [wishListUrl, setWishListUrl] = useState('') const notify = useNotification(); @@ -27,18 +27,25 @@ function SecretSanta() { } } - useEffect(() => { - fetchSecretSanta() - }, []) - return ( <>

Secret Santa

- Тут вы сможете узнать кому вы дарите свой подарок, а так же увидеть его вишлист, если он его добавит. Вы тоже сможете добавить свой вишлист, если захотите, чтобы ваш санта его видел! -

-

Добавить свой вишлист

+ {santaInfo ? ( + <> +

Вы санта для Пятки: {santaInfo.santa_to}

+ {santaInfo.wishlist ? ( +

Пятка оставила вам вишлист

+ ) : ( +

Пятка не оставила вам вишлист, используйте свое воображение. Либо ждите, пока добавит...

+ )} + + ) : ( + + )} +
+ Добавить свой вишлист
+
- +
-

Вы санта для Пятки: {santaInfo?.santa_to}

- {santaInfo?.wishlist ? ( -

Пятка оставила вам вишлсит

- ): ( -

Пятка не оставила вам вишлист, используйте свое воображение. Либо ждите пока добавит....

- )} +