Skip to content

Commit 0daa6ca

Browse files
committed
feat(func): media library
1 parent 4e1b7e7 commit 0daa6ca

3 files changed

Lines changed: 236 additions & 234 deletions

File tree

src/app/RootLayout.tsx

Lines changed: 57 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { useColorMode, Icon } from "@hope-ui/solid"
1515
import { TbChevronLeft, TbChevronRight } from "solid-icons/tb"
1616
import { Nav } from "~/pages/home/Nav"
1717
import { Layout } from "~/pages/home/header/layout"
18+
import { TopBarActions } from "~/pages/home/toolbar/Right"
1819
import { useRouter } from "~/hooks"
1920
import { getSetting, objStore, State } from "~/store"
2021
import { BsSearch } from "solid-icons/bs"
@@ -61,49 +62,6 @@ const TopBar = () => {
6162
gap: "8px",
6263
}}
6364
>
64-
{/* 侧边栏收起/展开按钮 */}
65-
<button
66-
onClick={() => setSidebarCollapsed(!sidebarCollapsed())}
67-
title={sidebarCollapsed() ? "展开侧边栏" : "收起侧边栏"}
68-
style={{
69-
background: isDark() ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.05)",
70-
border: `1px solid ${isDark() ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)"}`,
71-
"border-radius": "7px",
72-
width: "28px",
73-
height: "28px",
74-
cursor: "pointer",
75-
display: "flex",
76-
"align-items": "center",
77-
"justify-content": "center",
78-
color: mutedColor(),
79-
transition: "all 0.18s ease",
80-
"flex-shrink": "0",
81-
}}
82-
onMouseEnter={(e) => {
83-
const el = e.currentTarget as HTMLButtonElement
84-
el.style.background = isDark()
85-
? "rgba(59,130,246,0.15)"
86-
: "rgba(59,130,246,0.08)"
87-
el.style.color = "#3b82f6"
88-
el.style.borderColor = "rgba(59,130,246,0.3)"
89-
}}
90-
onMouseLeave={(e) => {
91-
const el = e.currentTarget as HTMLButtonElement
92-
el.style.background = isDark()
93-
? "rgba(255,255,255,0.06)"
94-
: "rgba(0,0,0,0.05)"
95-
el.style.color = mutedColor()
96-
el.style.borderColor = isDark()
97-
? "rgba(255,255,255,0.08)"
98-
: "rgba(0,0,0,0.08)"
99-
}}
100-
>
101-
<Icon
102-
as={sidebarCollapsed() ? TbChevronRight : TbChevronLeft}
103-
boxSize="14px"
104-
/>
105-
</button>
106-
10765
{/* 面包屑导航 / 页面标题 */}
10866
<div style={{ flex: "1", "min-width": "0", overflow: "hidden" }}>
10967
<Show
@@ -116,24 +74,70 @@ const TopBar = () => {
11674
"font-weight": "600",
11775
}}
11876
>
119-
媒体库
77+
📺 媒体库
12078
</span>
12179
}
12280
>
12381
<Nav />
12482
</Show>
12583
</div>
12684

127-
{/* 右侧工具区(仅文件浏览时显示) */}
128-
<Show when={isFileBrowser()}>
129-
<div
85+
{/* 右侧工具区 */}
86+
<div
87+
style={{
88+
display: "flex",
89+
"align-items": "center",
90+
gap: "6px",
91+
"flex-shrink": "0",
92+
}}
93+
>
94+
{/* 侧边栏收起/展开按钮 */}
95+
<button
96+
onClick={() => setSidebarCollapsed(!sidebarCollapsed())}
97+
title={sidebarCollapsed() ? "展开侧边栏" : "收起侧边栏"}
13098
style={{
99+
background: isDark()
100+
? "rgba(255,255,255,0.06)"
101+
: "rgba(0,0,0,0.05)",
102+
border: `1px solid ${isDark() ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)"}`,
103+
"border-radius": "7px",
104+
width: "28px",
105+
height: "28px",
106+
cursor: "pointer",
131107
display: "flex",
132108
"align-items": "center",
133-
gap: "6px",
109+
"justify-content": "center",
110+
color: mutedColor(),
111+
transition: "all 0.18s ease",
134112
"flex-shrink": "0",
135113
}}
114+
onMouseEnter={(e) => {
115+
const el = e.currentTarget as HTMLButtonElement
116+
el.style.background = isDark()
117+
? "rgba(59,130,246,0.15)"
118+
: "rgba(59,130,246,0.08)"
119+
el.style.color = "#3b82f6"
120+
el.style.borderColor = "rgba(59,130,246,0.3)"
121+
}}
122+
onMouseLeave={(e) => {
123+
const el = e.currentTarget as HTMLButtonElement
124+
el.style.background = isDark()
125+
? "rgba(255,255,255,0.06)"
126+
: "rgba(0,0,0,0.05)"
127+
el.style.color = mutedColor()
128+
el.style.borderColor = isDark()
129+
? "rgba(255,255,255,0.08)"
130+
: "rgba(0,0,0,0.08)"
131+
}}
136132
>
133+
<Icon
134+
as={sidebarCollapsed() ? TbChevronRight : TbChevronLeft}
135+
boxSize="14px"
136+
/>
137+
</button>
138+
139+
{/* 搜索按钮和布局切换(仅文件浏览时显示) */}
140+
<Show when={isFileBrowser()}>
137141
{/* 搜索按钮 */}
138142
<Show when={isFolder() && getSetting("search_index") !== "none"}>
139143
<button
@@ -179,12 +183,15 @@ const TopBar = () => {
179183
</button>
180184
</Show>
181185

186+
{/* 工具操作按钮 */}
187+
<TopBarActions />
188+
182189
{/* 布局切换 */}
183190
<Show when={isFolder()}>
184191
<Layout />
185192
</Show>
186-
</div>
187-
</Show>
193+
</Show>
194+
</div>
188195
</div>
189196
)
190197
}

src/components/GlobalSidebar.tsx

Lines changed: 86 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
TbMenu2,
1818
TbLayersIntersect,
1919
TbSettings,
20+
TbAdjustments,
2021
} from "solid-icons/tb"
2122
import { BsPlayCircleFill, BsCardImage } from "solid-icons/bs"
2223
import { BiSolidBookContent } from "solid-icons/bi"
@@ -85,7 +86,7 @@ export const GlobalSidebar = () => {
8586
})
8687

8788
const isVisible = createMemo(() => !isMobile() || sidebarVisible())
88-
const sidebarWidth = createMemo(() => (sidebarCollapsed() ? "48px" : "128px"))
89+
const sidebarWidth = createMemo(() => (sidebarCollapsed() ? "48px" : "130px"))
8990

9091
// Logo:从设置读取,支持亮/暗两套(与 Header.tsx 保持完全一致)
9192
const logos = getSetting("logo").split("\n")
@@ -152,6 +153,12 @@ export const GlobalSidebar = () => {
152153
if (isMobile()) setSidebarVisible(false)
153154
}
154155

156+
// ─── 系统设置跳转 ─────────────────────────────────────────
157+
const handleSettings = () => {
158+
window.location.href = joinBase("/@manage/settings/site")
159+
if (isMobile()) setSidebarVisible(false)
160+
}
161+
155162
// ─── 透明模式切换 ─────────────────────────────────────────
156163
const toggleTransparent = () => {
157164
const next = !sidebarTransparent()
@@ -409,6 +416,7 @@ export const GlobalSidebar = () => {
409416
padding: sidebarCollapsed() ? "8px 0" : "8px 8px",
410417
"border-top": `1px solid ${borderColor()}`,
411418
display: "flex",
419+
"flex-direction": sidebarCollapsed() ? "column" : "row",
412420
"align-items": "center",
413421
"justify-content": sidebarCollapsed() ? "center" : "space-between",
414422
gap: "6px",
@@ -446,54 +454,83 @@ export const GlobalSidebar = () => {
446454
<Icon as={isDark() ? FiSun : FiMoon} boxSize="15px" />
447455
</button>
448456

449-
{/* 透明模式切换(折叠时隐藏) */}
450-
<Show when={!sidebarCollapsed()}>
451-
<button
452-
onClick={toggleTransparent}
453-
title={sidebarTransparent() ? "关闭透明模式" : "开启透明模式"}
454-
style={{
455-
background: sidebarTransparent()
456-
? isDark()
457-
? "rgba(6,182,212,0.18)"
458-
: "rgba(6,182,212,0.10)"
459-
: btnBg(),
460-
border: `1px solid ${sidebarTransparent() ? "rgba(6,182,212,0.35)" : btnBorder()}`,
461-
"border-radius": "7px",
462-
height: "28px",
463-
padding: "0 8px",
464-
cursor: "pointer",
465-
display: "flex",
466-
"align-items": "center",
467-
gap: "4px",
468-
"font-size": "11px",
469-
color: sidebarTransparent()
470-
? isDark()
471-
? "#67e8f9"
472-
: "#0891b2"
473-
: textSecondary(),
474-
"font-weight": sidebarTransparent() ? "600" : "400",
475-
transition: "all 0.18s ease",
476-
"white-space": "nowrap",
477-
}}
478-
onMouseEnter={(e) => {
479-
if (!sidebarTransparent()) {
480-
const el = e.currentTarget as HTMLButtonElement
481-
el.style.background = isDark()
482-
? "rgba(6,182,212,0.10)"
483-
: "rgba(6,182,212,0.06)"
484-
}
485-
}}
486-
onMouseLeave={(e) => {
487-
if (!sidebarTransparent()) {
488-
;(e.currentTarget as HTMLButtonElement).style.background =
489-
btnBg()
490-
}
491-
}}
492-
>
493-
<Icon as={TbLayersIntersect} boxSize="14px" />
494-
透明
495-
</button>
496-
</Show>
457+
{/* 系统设置 */}
458+
<button
459+
onClick={handleSettings}
460+
title="系统设置"
461+
style={{
462+
background: btnBg(),
463+
border: `1px solid ${btnBorder()}`,
464+
"border-radius": "7px",
465+
width: "28px",
466+
height: "28px",
467+
cursor: "pointer",
468+
display: "flex",
469+
"align-items": "center",
470+
"justify-content": "center",
471+
color: textSecondary(),
472+
transition: "all 0.18s ease",
473+
"flex-shrink": "0",
474+
}}
475+
onMouseEnter={(e) => {
476+
const el = e.currentTarget as HTMLButtonElement
477+
el.style.background = isDark()
478+
? "rgba(59,130,246,0.15)"
479+
: "rgba(59,130,246,0.08)"
480+
el.style.color = "#3b82f6"
481+
}}
482+
onMouseLeave={(e) => {
483+
const el = e.currentTarget as HTMLButtonElement
484+
el.style.background = btnBg()
485+
el.style.color = textSecondary()
486+
}}
487+
>
488+
<Icon as={TbAdjustments} boxSize="15px" />
489+
</button>
490+
491+
{/* 透明模式切换 */}
492+
<button
493+
onClick={toggleTransparent}
494+
title={sidebarTransparent() ? "关闭透明模式" : "开启透明模式"}
495+
style={{
496+
background: sidebarTransparent()
497+
? isDark()
498+
? "rgba(6,182,212,0.18)"
499+
: "rgba(6,182,212,0.10)"
500+
: btnBg(),
501+
border: `1px solid ${sidebarTransparent() ? "rgba(6,182,212,0.35)" : btnBorder()}`,
502+
"border-radius": "7px",
503+
width: "28px",
504+
height: "28px",
505+
cursor: "pointer",
506+
display: "flex",
507+
"align-items": "center",
508+
"justify-content": "center",
509+
color: sidebarTransparent()
510+
? isDark()
511+
? "#67e8f9"
512+
: "#0891b2"
513+
: textSecondary(),
514+
transition: "all 0.18s ease",
515+
"flex-shrink": "0",
516+
}}
517+
onMouseEnter={(e) => {
518+
if (!sidebarTransparent()) {
519+
const el = e.currentTarget as HTMLButtonElement
520+
el.style.background = isDark()
521+
? "rgba(6,182,212,0.10)"
522+
: "rgba(6,182,212,0.06)"
523+
}
524+
}}
525+
onMouseLeave={(e) => {
526+
if (!sidebarTransparent()) {
527+
;(e.currentTarget as HTMLButtonElement).style.background =
528+
btnBg()
529+
}
530+
}}
531+
>
532+
<Icon as={TbLayersIntersect} boxSize="15px" />
533+
</button>
497534
</div>
498535
</div>
499536

0 commit comments

Comments
 (0)