Skip to content

Commit 231f483

Browse files
authored
feat: menu add back to home item (#89)
* feat: menu add back to home item * chore: auto-fix linting and formatting issues --------- Co-authored-by: hamster1963 <hamster1963@users.noreply.github.com>
1 parent f93d266 commit 231f483

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

src/components/header.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { useMainStore } from "@/hooks/useMainStore"
2020
import { useMediaQuery } from "@/hooks/useMediaQuery"
2121
import { cn } from "@/lib/utils"
2222
import i18next from "i18next"
23-
import { LogOut, Settings, User2 } from "lucide-react"
23+
import { HomeIcon, LogOut, Settings, User2 } from "lucide-react"
2424
import { DateTime } from "luxon"
2525
import { useEffect, useRef, useState } from "react"
2626
import { useTranslation } from "react-i18next"
@@ -147,6 +147,18 @@ export default function Header() {
147147
</DropdownMenuItem>
148148
</DropdownMenuGroup>
149149
<DropdownMenuSeparator />
150+
<DropdownMenuItem
151+
onClick={() => {
152+
setDropdownOpen(false)
153+
navigate("/")
154+
}}
155+
className="cursor-pointer"
156+
>
157+
<div className="flex items-center gap-2 w-full">
158+
<HomeIcon />
159+
{t("BackToHome")}
160+
</div>
161+
</DropdownMenuItem>
150162
<DropdownMenuItem
151163
onClick={logout}
152164
className="cursor-pointer"

src/locales/en/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"Group": "Group",
3434
"Profile": "Profile",
3535
"Settings": "System settings",
36+
"BackToHome": "Back to Home",
3637
"Logout": "Log out",
3738
"NavigateTo": "Navigate to",
3839
"SelectAPageToNavigateTo": "Choose a page to jump to",

src/locales/zh-CN/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"Group": "分组",
3434
"Profile": "个人信息",
3535
"Settings": "系统设置",
36+
"BackToHome": "返回前台",
3637
"Logout": "登出",
3738
"NavigateTo": "导航至",
3839
"SelectAPageToNavigateTo": "选择一个页面跳转",

src/locales/zh-TW/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"Group": "分組",
3434
"Profile": "個人資訊",
3535
"Settings": "系統設定",
36+
"BackToHome": "返回前台",
3637
"Logout": "登出",
3738
"NavigateTo": "導航至",
3839
"SelectAPageToNavigateTo": "選擇一個頁面跳轉",

0 commit comments

Comments
 (0)