diff --git a/modules/frontend/src/components/cards/TitleCardHorizontal.tsx b/modules/frontend/src/components/cards/TitleCardHorizontal.tsx index b848702..4a020b7 100644 --- a/modules/frontend/src/components/cards/TitleCardHorizontal.tsx +++ b/modules/frontend/src/components/cards/TitleCardHorizontal.tsx @@ -10,7 +10,7 @@ export function TitleCardHorizontal({ title }: { title: Title }) { borderRadius: 8 }}> {title.poster?.image_path && ( - + )}

{title.title_names["en"]}

diff --git a/modules/frontend/src/components/cards/TitleCardSquare.tsx b/modules/frontend/src/components/cards/TitleCardSquare.tsx index 0bcb49d..6a7a071 100644 --- a/modules/frontend/src/components/cards/TitleCardSquare.tsx +++ b/modules/frontend/src/components/cards/TitleCardSquare.tsx @@ -10,7 +10,7 @@ export function TitleCardSquare({ title }: { title: Title }) { textAlign: "center" }}> {title.poster?.image_path && ( - + )}

{title.title_names["en"]}

diff --git a/modules/frontend/src/components/cards/UserTitleCardHorizontal.tsx b/modules/frontend/src/components/cards/UserTitleCardHorizontal.tsx index ad7d5df..aec30d2 100644 --- a/modules/frontend/src/components/cards/UserTitleCardHorizontal.tsx +++ b/modules/frontend/src/components/cards/UserTitleCardHorizontal.tsx @@ -10,7 +10,7 @@ export function UserTitleCardHorizontal({ title }: { title: UserTitle }) { borderRadius: 8 }}> {title.title?.poster?.image_path && ( - + )}

{title.title?.title_names["en"]}

diff --git a/modules/frontend/src/components/cards/UserTitleCardSquare.tsx b/modules/frontend/src/components/cards/UserTitleCardSquare.tsx index edcf1d5..a9424f6 100644 --- a/modules/frontend/src/components/cards/UserTitleCardSquare.tsx +++ b/modules/frontend/src/components/cards/UserTitleCardSquare.tsx @@ -10,7 +10,7 @@ export function UserTitleCardSquare({ title }: { title: UserTitle }) { textAlign: "center" }}> {title.title?.poster?.image_path && ( - + )}

{title.title?.title_names["en"]}

diff --git a/modules/frontend/src/pages/SettingsPage/SettingsPage.tsx b/modules/frontend/src/pages/SettingsPage/SettingsPage.tsx new file mode 100644 index 0000000..16c7e9e --- /dev/null +++ b/modules/frontend/src/pages/SettingsPage/SettingsPage.tsx @@ -0,0 +1,154 @@ +// import React, { useEffect, useState } from "react"; +// import { updateUser, getUsersId } from "../../api"; +// import { useNavigate } from "react-router-dom"; + +// export const SettingsPage: React.FC = () => { +// const navigate = useNavigate(); + +// const userId = Number(localStorage.getItem("user_id")); +// const initialNickname = localStorage.getItem("user_name") || ""; +// const [mail, setMail] = useState(""); +// const [nickname, setNickname] = useState(initialNickname); +// const [dispName, setDispName] = useState(""); +// const [userDesc, setUserDesc] = useState(""); +// const [avatarId, setAvatarId] = useState(null); + +// const [loading, setLoading] = useState(false); +// const [success, setSuccess] = useState(null); +// const [error, setError] = useState(null); + +// useEffect(() => { +// const fetch = async () => { +// const res = await getUsersId({ +// path: { user_id: String(userId) }, +// }); + +// setProfile(res.data); +// }; + +// fetch(); +// }, [userId]); + +// const saveSettings = async (e: React.FormEvent) => { +// e.preventDefault(); +// setLoading(true); +// setSuccess(null); +// setError(null); + +// try { +// const res = await updateUser({ +// path: { user_id: userId }, +// body: { +// ...(mail ? { mail } : {}), +// ...(nickname ? { nickname } : {}), +// ...(dispName ? { disp_name: dispName } : {}), +// ...(userDesc ? { user_desc: userDesc } : {}), +// ...(avatarId !== undefined ? { avatar_id: avatarId } : {}), +// } +// }); + +// // Обновляем локальное отображение username +// if (nickname) { +// localStorage.setItem("user_name", nickname); +// window.dispatchEvent(new Event("storage")); // чтобы Header обновился +// } + +// setSuccess("Settings updated!"); +// setTimeout(() => navigate("/profile"), 800); + +// } catch (err: any) { +// console.error(err); +// setError(err?.message || "Failed to update settings"); +// } finally { +// setLoading(false); +// } +// }; + +// return ( +//
+//

User Settings

+ +// {success &&
{success}
} +// {error &&
{error}
} + +//
+// {/* Email */} +//
+// +// setMail(e.target.value)} +// placeholder="example@mail.com" +// className="w-full px-4 py-2 border rounded-lg" +// /> +//
+ +// {/* Nickname */} +//
+// +// setNickname(e.target.value)} +// className="w-full px-4 py-2 border rounded-lg" +// /> +//
+ +// {/* Display name */} +//
+// +// setDispName(e.target.value)} +// placeholder="Shown name" +// className="w-full px-4 py-2 border rounded-lg" +// /> +//
+ +// {/* Bio */} +//
+// +//