- Something went wrong. Please try again. + 出现了错误。请重试。
- + ) diff --git a/frontend/src/components/UserSettings/UserInformation.tsx b/frontend/src/components/UserSettings/UserInformation.tsx index 4bfaf60..5e99cd5 100644 --- a/frontend/src/components/UserSettings/UserInformation.tsx +++ b/frontend/src/components/UserSettings/UserInformation.tsx @@ -64,7 +64,7 @@ const UserInformation = () => { const onSubmit = (data: FormData) => { const updateData: UserUpdateMe = {} - // only include fields that have changed + // 仅包含已更改的字段 if (data.full_name !== currentUser?.full_name) { updateData.full_name = data.full_name } diff --git a/frontend/src/components/ui/sidebar.tsx b/frontend/src/components/ui/sidebar.tsx index 60c0115..623535a 100644 --- a/frontend/src/components/ui/sidebar.tsx +++ b/frontend/src/components/ui/sidebar.tsx @@ -79,8 +79,8 @@ function SidebarProvider({ return cookie.split("=")[1] === "true" } - // This is the internal state of the sidebar. - // We use openProp and setOpenProp for control from outside the component. + // 这是侧边栏的内部状态。 + // 我们使用 openProp 和 setOpenProp 从组件外部进行控制。 const [_open, _setOpen] = React.useState(getInitialOpen) const open = openProp ?? _open const setOpen = React.useCallback( @@ -92,18 +92,18 @@ function SidebarProvider({ _setOpen(openState) } - // This sets the cookie to keep the sidebar state. + // 设置 cookie 以保持侧边栏状态。 document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}` }, [setOpenProp, open], ) - // Helper to toggle the sidebar. + // 切换侧边栏的辅助函数。 const toggleSidebar = React.useCallback(() => { return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open) }, [isMobile, setOpen]) - // Adds a keyboard shortcut to toggle the sidebar. + // 添加键盘快捷键来切换侧边栏。 React.useEffect(() => { const handleKeyDown = (event: KeyboardEvent) => { if ( @@ -119,8 +119,8 @@ function SidebarProvider({ return () => window.removeEventListener("keydown", handleKeyDown) }, [toggleSidebar]) - // We add a state so that we can do data-state="expanded" or "collapsed". - // This makes it easier to style the sidebar with Tailwind classes. + // 添加状态以便使用 data-state="expanded" 或 "collapsed"。 + // 这样可以更容易地使用 Tailwind 类来设置侧边栏样式。 const state = open ? "expanded" : "collapsed" const contextValue = React.useMemo