From 745f6f07db74b313cd584efc63c6fbc786257a43 Mon Sep 17 00:00:00 2001 From: shihao <3127647737@qq.com> Date: Wed, 22 Apr 2026 11:34:25 +0800 Subject: [PATCH] feat: redesign user workspace console --- .../src/app/(dashboard)/profile/page.tsx | 56 +- .../app/(dashboard)/workspace/assets/page.tsx | 325 ++++-- .../app/(dashboard)/workspace/create/page.tsx | 978 +++++++++++++++--- frontend-web/src/app/globals.css | 855 +++++++++++++-- frontend-web/src/app/layout.tsx | 14 +- frontend-web/src/components/site-shell.tsx | 103 +- frontend-web/src/components/status-badge.tsx | 17 +- 7 files changed, 2017 insertions(+), 331 deletions(-) diff --git a/frontend-web/src/app/(dashboard)/profile/page.tsx b/frontend-web/src/app/(dashboard)/profile/page.tsx index 2081444..9262ede 100644 --- a/frontend-web/src/app/(dashboard)/profile/page.tsx +++ b/frontend-web/src/app/(dashboard)/profile/page.tsx @@ -1,7 +1,7 @@ "use client"; import { useMutation, useQuery } from "@tanstack/react-query"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import { api } from "@/lib/api"; import type { UserProfile } from "@/lib/types"; @@ -12,29 +12,25 @@ export default function ProfilePage() { queryFn: () => api.get("/api/v1/profile"), }); const [form, setForm] = useState({ - username: "", - nickname: "", - avatarUrl: "", + username: undefined as string | undefined, + nickname: undefined as string | undefined, }); - - useEffect(() => { - if (profileQuery.data) { - setForm({ - username: profileQuery.data.username, - nickname: profileQuery.data.nickname, - avatarUrl: profileQuery.data.avatarUrl, - }); - } - }, [profileQuery.data]); + const username = form.username ?? profileQuery.data?.username ?? ""; + const nickname = form.nickname ?? profileQuery.data?.nickname ?? ""; const mutation = useMutation({ mutationFn: () => api.put("/api/v1/profile", { - username: form.username, - nickname: form.nickname, - avatar_url: form.avatarUrl, + username, + nickname, }), - onSuccess: () => profileQuery.refetch(), + onSuccess: () => { + setForm({ + username: undefined, + nickname: undefined, + }); + void profileQuery.refetch(); + }, }); return ( @@ -45,7 +41,7 @@ export default function ProfilePage() {