chore(format): normalize repository files
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { Icon } from "@icones/react";
|
import { Icon } from "@icones/react"
|
||||||
import { Button } from "@workspace/ui/components/button";
|
import { Button } from "@workspace/ui/components/button"
|
||||||
import { cn } from "@workspace/ui/lib/utils";
|
import { cn } from "@workspace/ui/lib/utils"
|
||||||
import React from "react";
|
import React from "react"
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
@@ -29,30 +29,26 @@ export function Layout({ children, className }: Props) {
|
|||||||
"[--app-header-height:--spacing(18)]",
|
"[--app-header-height:--spacing(18)]",
|
||||||
"[--app-aside-width:--spacing(56)]",
|
"[--app-aside-width:--spacing(56)]",
|
||||||
"[--app-split-gap:--spacing(4)]",
|
"[--app-split-gap:--spacing(4)]",
|
||||||
className,
|
className
|
||||||
)}
|
)}
|
||||||
data-slot="root"
|
data-slot="root"
|
||||||
>
|
>
|
||||||
<header className="z-10 sticky top-0 h-0" data-slot="header">
|
<header className="sticky top-0 z-10 h-0" data-slot="header">
|
||||||
<div className="h-(--app-header-height)">
|
<div className="h-(--app-header-height)">header</div>
|
||||||
header
|
<div className="absolute inset-x-0 top-(--app-header-height) h-0 border-t" />
|
||||||
</div>
|
|
||||||
<div className="border-t h-0 absolute inset-x-0 top-(--app-header-height)" />
|
|
||||||
</header>
|
</header>
|
||||||
<div className="flex gap-(--app-split-gap)">
|
<div className="flex gap-(--app-split-gap)">
|
||||||
<aside
|
<aside
|
||||||
className="w-(--app-aside-width) h-svh pt-(--app-header-height) shrink-0"
|
className="h-svh w-(--app-aside-width) shrink-0 pt-(--app-header-height)"
|
||||||
data-slot="aside"
|
data-slot="aside"
|
||||||
>
|
>
|
||||||
<div className="flex flex-col items-stretch h-full py-4">
|
<div className="flex h-full flex-col items-stretch py-4">
|
||||||
<Navigation items={groups} />
|
<Navigation items={groups} />
|
||||||
<Navigation className="mt-auto" items={[links[1]]} />
|
<Navigation className="mt-auto" items={[links[1]]} />
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
<main className="pt-(--app-header-height)" data-slot="main">
|
<main className="pt-(--app-header-height)" data-slot="main">
|
||||||
<div className="p-4">
|
<div className="p-4">{children}</div>
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -61,7 +57,11 @@ export function Layout({ children, className }: Props) {
|
|||||||
|
|
||||||
const links = [
|
const links = [
|
||||||
{ key: "inbox", label: "收件箱", icon: <Icon name="tabler:inbox" /> },
|
{ key: "inbox", label: "收件箱", icon: <Icon name="tabler:inbox" /> },
|
||||||
{ key: "starred", label: "已加星标", icon: <Icon name="tabler:star-filled" /> },
|
{
|
||||||
|
key: "starred",
|
||||||
|
label: "已加星标",
|
||||||
|
icon: <Icon name="tabler:star-filled" />,
|
||||||
|
},
|
||||||
{ key: "sent", label: "已发送", icon: <Icon name="tabler:send" /> },
|
{ key: "sent", label: "已发送", icon: <Icon name="tabler:send" /> },
|
||||||
{ key: "drafts", label: "草稿", icon: <Icon name="tabler:edit" /> },
|
{ key: "drafts", label: "草稿", icon: <Icon name="tabler:edit" /> },
|
||||||
{ key: "deleted", label: "已删除", icon: <Icon name="tabler:trash" /> },
|
{ key: "deleted", label: "已删除", icon: <Icon name="tabler:trash" /> },
|
||||||
@@ -90,7 +90,13 @@ function isGroup(item: NavGroup | NavItem): item is NavGroup {
|
|||||||
return (item as NavGroup).items !== undefined
|
return (item as NavGroup).items !== undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
function Navigation({ items, className }: { items: NavItems; className?: string }) {
|
function Navigation({
|
||||||
|
items,
|
||||||
|
className,
|
||||||
|
}: {
|
||||||
|
items: NavItems
|
||||||
|
className?: string
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<ul className={className}>
|
<ul className={className}>
|
||||||
{items.map((item, index) => {
|
{items.map((item, index) => {
|
||||||
@@ -104,12 +110,14 @@ function Navigation({ items, className }: { items: NavItems; className?: string
|
|||||||
"not-last:mb-4",
|
"not-last:mb-4",
|
||||||
previousItem && isGroup(previousItem)
|
previousItem && isGroup(previousItem)
|
||||||
? "mt-0"
|
? "mt-0"
|
||||||
: "not-first:mt-4",
|
: "not-first:mt-4"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<span className="text-xs px-2.5 text-muted-foreground">{item.label}</span>
|
<span className="px-2.5 text-xs text-muted-foreground">
|
||||||
|
{item.label}
|
||||||
|
</span>
|
||||||
<ul>
|
<ul>
|
||||||
{item.items.map(subItem => (
|
{item.items.map((subItem) => (
|
||||||
<li key={subItem.key}>
|
<li key={subItem.key}>
|
||||||
<NavigationItem
|
<NavigationItem
|
||||||
label={subItem.label}
|
label={subItem.label}
|
||||||
@@ -120,7 +128,7 @@ function Navigation({ items, className }: { items: NavItems; className?: string
|
|||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -131,13 +139,17 @@ function Navigation({ items, className }: { items: NavItems; className?: string
|
|||||||
current={item.key === "drafts"}
|
current={item.key === "drafts"}
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
);
|
)
|
||||||
})}
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function NavigationItem({ label, icon, current }: {
|
function NavigationItem({
|
||||||
|
label,
|
||||||
|
icon,
|
||||||
|
current,
|
||||||
|
}: {
|
||||||
label: string
|
label: string
|
||||||
icon: React.ReactNode
|
icon: React.ReactNode
|
||||||
current: boolean
|
current: boolean
|
||||||
@@ -146,7 +158,7 @@ function NavigationItem({ label, icon, current }: {
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
aria-current={current ? "page" : undefined}
|
aria-current={current ? "page" : undefined}
|
||||||
className="flex w-full justify-start rounded-l-none rounded-r-full aria-[current=page]:text-red-600 aria-[current=page]:bg-current/10 [&_svg:not([class*='size-'])]:size-5"
|
className="flex w-full justify-start rounded-l-none rounded-r-full aria-[current=page]:bg-current/10 aria-[current=page]:text-red-600 [&_svg:not([class*='size-'])]:size-5"
|
||||||
size="lg"
|
size="lg"
|
||||||
>
|
>
|
||||||
{icon}
|
{icon}
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ export const messages = {
|
|||||||
"blocks.media.copy.failed": "复制失败,请检查浏览器剪贴板权限。",
|
"blocks.media.copy.failed": "复制失败,请检查浏览器剪贴板权限。",
|
||||||
"blocks.media.deleteAsset.description": "该媒体将不再显示在媒体库中。",
|
"blocks.media.deleteAsset.description": "该媒体将不再显示在媒体库中。",
|
||||||
"blocks.media.deleteAsset.title": "删除媒体",
|
"blocks.media.deleteAsset.title": "删除媒体",
|
||||||
"blocks.media.deleteFolder.description": "该目录及其子目录将被删除,其中的媒体会变为未分类。",
|
"blocks.media.deleteFolder.description":
|
||||||
|
"该目录及其子目录将被删除,其中的媒体会变为未分类。",
|
||||||
"blocks.media.deleteFolder.title": "删除目录",
|
"blocks.media.deleteFolder.title": "删除目录",
|
||||||
"blocks.media.details.dimensions": "尺寸",
|
"blocks.media.details.dimensions": "尺寸",
|
||||||
"blocks.media.details.fileName": "文件名称",
|
"blocks.media.details.fileName": "文件名称",
|
||||||
@@ -40,7 +41,8 @@ export const messages = {
|
|||||||
"blocks.media.filters.image": "图片",
|
"blocks.media.filters.image": "图片",
|
||||||
"blocks.media.filters.unclassified": "未分类",
|
"blocks.media.filters.unclassified": "未分类",
|
||||||
"blocks.media.filters.video": "视频",
|
"blocks.media.filters.video": "视频",
|
||||||
"blocks.media.folders.classification": "目录仅用于媒体库内分类,不会改变文件链接。",
|
"blocks.media.folders.classification":
|
||||||
|
"目录仅用于媒体库内分类,不会改变文件链接。",
|
||||||
"blocks.media.folders.create": "新建目录",
|
"blocks.media.folders.create": "新建目录",
|
||||||
"blocks.media.folders.empty": "暂无目录,点击新建。",
|
"blocks.media.folders.empty": "暂无目录,点击新建。",
|
||||||
"blocks.media.folders.name": "目录名称",
|
"blocks.media.folders.name": "目录名称",
|
||||||
@@ -54,7 +56,8 @@ export const messages = {
|
|||||||
"blocks.media.picker.selectedCount": "已选择 {count} 项",
|
"blocks.media.picker.selectedCount": "已选择 {count} 项",
|
||||||
"blocks.media.picker.title": "选择媒体",
|
"blocks.media.picker.title": "选择媒体",
|
||||||
"blocks.media.picker.useSelected": "使用所选媒体",
|
"blocks.media.picker.useSelected": "使用所选媒体",
|
||||||
"blocks.media.renameMedia.description": "仅修改展示名称,不会改变文件或已有链接。",
|
"blocks.media.renameMedia.description":
|
||||||
|
"仅修改展示名称,不会改变文件或已有链接。",
|
||||||
"blocks.media.renameMedia.title": "修改媒体名称",
|
"blocks.media.renameMedia.title": "修改媒体名称",
|
||||||
"blocks.media.search": "搜索媒体文件",
|
"blocks.media.search": "搜索媒体文件",
|
||||||
"blocks.media.title": "媒体库",
|
"blocks.media.title": "媒体库",
|
||||||
|
|||||||
Reference in New Issue
Block a user