Skip to content

Commit 1c7fcf0

Browse files
authored
Merge pull request #20 from besscroft/dev
v0.6.4
2 parents cf9425d + d2b02ee commit 1c7fcf0

38 files changed

+124
-358
lines changed

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ PicImpact
88
<img src="https://img.shields.io/github/repo-size/besscroft/PicImpact?style=flat-square&color=328657" alt="存储库大小">
99
</p>
1010

11-
### 无障碍支持
12-
13-
已经在尽力支持了,主要基于 [WAI-ARIA 规范](https://developer.mozilla.org/zh-CN/docs/Learn/Accessibility/WAI-ARIA_basics),有爱,无障碍!
11+
<p align="center">
12+
<img src=picimpact.png width=384 />
13+
</p>
1414

1515
### 如何部署
1616

@@ -126,6 +126,10 @@ PicImpact 欢迎各种贡献,包括但不限于改进,新功能,文档和
126126

127127
> 事实上不是过于老旧的浏览器,一般都是能用的。
128128

129+
### 无障碍支持
130+
131+
已经在尽力支持了,主要基于 [WAI-ARIA 规范](https://developer.mozilla.org/zh-CN/docs/Learn/Accessibility/WAI-ARIA_basics),有爱,无障碍!
132+
129133
### 技术栈
130134

131135
- Web框架:

app/admin/page.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default async function Admin() {
1212
result: any[]
1313
}> => {
1414
'use server'
15+
// @ts-ignore
1516
return await fetchImagesAnalysis()
1617
}
1718

app/admin/settings/about/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import favicon from '~/public/favicon.svg'
44
import Image from 'next/image'
55
import { Divider, Avatar } from '@nextui-org/react'
6-
import { BookOpenCheck, ExternalLink, Github } from 'lucide-react'
6+
import { ExternalLink, Github } from 'lucide-react'
77
import Link from 'next/link'
88

99
export default function About() {

app/admin/settings/backup/page.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,14 @@ export default function Backup() {
109109
icon={<CloudDownloadOutlined />}
110110
loading={backupLoading}
111111
onClick={() => backup()}
112+
aria-label="备份"
112113
>备份</Button>
113114
<Upload {...picimpactProps}>
114115
<Button
115116
className="!w-full sm:!w-64 !block"
116117
icon={<CloudUploadOutlined />}
117118
loading={restorePicImpactLoading}
119+
aria-label="选择备份文件(本机迁移)"
118120
>选择备份文件(本机迁移)</Button>
119121
</Upload>
120122
<p>如果您在线上环境,请确保您的数据库单次会话时长以及事务的支持,否则会还原数据失败!</p>

app/admin/settings/layout.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default function AdminLayout({
2020
color="primary"
2121
variant={pathname === '/admin/settings/preferences' ? 'bordered': 'light'}
2222
onClick={() => router.push('/admin/settings/preferences')}
23+
aria-label="首选项"
2324
>
2425
首选项
2526
</Button>
@@ -28,6 +29,7 @@ export default function AdminLayout({
2829
color="primary"
2930
variant={pathname === '/admin/settings/password' ? 'bordered': 'light'}
3031
onClick={() => router.push('/admin/settings/password')}
32+
aria-label="密码修改"
3133
>
3234
密码修改
3335
</Button>
@@ -36,6 +38,7 @@ export default function AdminLayout({
3638
color="primary"
3739
variant={pathname === '/admin/settings/storages' ? 'bordered': 'light'}
3840
onClick={() => router.push('/admin/settings/storages')}
41+
aria-label="存储"
3942
>
4043
存储
4144
</Button>
@@ -44,6 +47,7 @@ export default function AdminLayout({
4447
color="primary"
4548
variant={pathname === '/admin/settings/backup' ? 'bordered': 'light'}
4649
onClick={() => router.push('/admin/settings/backup')}
50+
aria-label="备份"
4751
>
4852
备份
4953
</Button>
@@ -52,6 +56,7 @@ export default function AdminLayout({
5256
color="primary"
5357
variant={pathname === '/admin/settings/about' ? 'bordered': 'light'}
5458
onClick={() => router.push('/admin/settings/about')}
59+
aria-label="关于"
5560
>
5661
关于
5762
</Button>

app/admin/settings/password/page.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export default function PassWord() {
121121
setTwoPassword('')
122122
setThreePassword('')
123123
}}
124+
aria-label="重置"
124125
>
125126
重置
126127
</Button>
@@ -129,6 +130,7 @@ export default function PassWord() {
129130
variant="bordered"
130131
isLoading={loading}
131132
onClick={() => updatePassword()}
133+
aria-label="提交"
132134
>
133135
提交
134136
</Button>

app/admin/settings/preferences/page.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function Preferences() {
1010
const [title, setTitle] = useState('')
1111
const [loading, setLoading] = useState(false)
1212

13-
const { data } = useSWR('/api/get-custom-title', fetcher)
13+
const { data } = useSWR('/api/v1/get-custom-title', fetcher)
1414

1515
async function updateTitle() {
1616
try {
@@ -54,6 +54,7 @@ export default function Preferences() {
5454
variant="bordered"
5555
isLoading={loading}
5656
onClick={() => updateTitle()}
57+
aria-label="提交"
5758
>
5859
提交
5960
</Button>

app/api/get-link/route.ts

-9
This file was deleted.

components/Masonry.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export default function Masonry(props : Readonly<ImageHandleProps>) {
7474
onClick={() => {
7575
setSize(size + 1)
7676
}}
77+
aria-label="加载更多"
7778
>
7879
加载更多
7980
</Button>

components/MasonryItem.tsx

+56-10
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ import {
66
} from '~/components/ui/Dialog'
77
import { useButtonStore } from '~/app/providers/button-store-Providers'
88
import { ImageType } from '~/types'
9-
import { Image, Tabs, Tab, Card, CardHeader, Table, TableHeader, TableColumn, TableBody, TableRow, TableCell } from '@nextui-org/react'
10-
import { Aperture, Camera } from 'lucide-react'
9+
import { Image, Tabs, Tab, Card, CardHeader, Table, TableHeader, TableColumn, TableBody, TableRow, TableCell, Button } from '@nextui-org/react'
10+
import { Aperture, Camera, Image as ImageIcon, Languages, CalendarDays, X, SunMedium, MoonStar } from 'lucide-react'
11+
import * as React from 'react'
12+
import { useTheme } from 'next-themes'
1113

1214
export default function MasonryItem() {
1315
const { MasonryView, MasonryViewData, setMasonryView, setMasonryViewData } = useButtonStore(
1416
(state) => state,
1517
)
18+
const { theme, setTheme } = useTheme()
1619

1720
return (
1821
<Dialog
@@ -26,8 +29,36 @@ export default function MasonryItem() {
2629
}}
2730
>
2831
<DialogContent className="flex flex-col">
29-
<div>
30-
<p>{MasonryViewData.detail}</p>
32+
<div className="flex items-center">
33+
<div className="flex-1">
34+
<p>{MasonryViewData.detail}</p>
35+
</div>
36+
<div className="flex items-center space-x-4">
37+
<Button
38+
isIconOnly
39+
variant="shadow"
40+
size="sm"
41+
aria-label="切换主题"
42+
className="bg-white dark:bg-gray-800"
43+
onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}
44+
>
45+
{theme === 'light' ? <SunMedium size={20} /> : <MoonStar size={20} />}
46+
</Button>
47+
<Button
48+
isIconOnly
49+
variant="shadow"
50+
size="sm"
51+
aria-label="关闭"
52+
className="bg-white dark:bg-gray-800"
53+
onClick={() => {
54+
setMasonryView(false)
55+
setMasonryViewData({} as ImageType)
56+
}}
57+
>
58+
<X size={20}/>
59+
<span className="sr-only">Close</span>
60+
</Button>
61+
</div>
3162
</div>
3263
<div className="h-full flex flex-col space-y-2 md:grid md:gap-2 md:grid-cols-3 xl:gap-4">
3364
<div className="md:col-span-2 md:flex md:justify-center md:max-h-[90vh]">
@@ -44,32 +75,47 @@ export default function MasonryItem() {
4475
<Tab
4576
key="detail"
4677
title={
47-
<div className="flex items-center space-x-2">
48-
<Aperture/>
78+
<div className="flex items-center space-x-2 select-none">
79+
<ImageIcon />
4980
<span>详情</span>
5081
</div>
5182
}
5283
>
5384
<div className="flex flex-col space-y-2">
5485
<Card className="py-4" shadow="sm">
5586
<CardHeader className="pb-0 pt-2 px-4 flex-col items-start">
56-
<p className="text-tiny uppercase font-bold">相机</p>
87+
<div className="flex items-center space-x-1">
88+
<Camera size={20}/>
89+
<p className="text-tiny uppercase font-bold select-none">相机</p>
90+
</div>
5791
<h4 className="font-bold text-large">{MasonryViewData?.exif?.model || 'N&A'}</h4>
5892
</CardHeader>
5993
</Card>
6094
<Card className="py-4" shadow="sm">
6195
<CardHeader className="pb-0 pt-2 px-4 flex-col items-start">
62-
<p className="text-tiny uppercase font-bold">相片描述</p>
96+
<div className="flex items-center space-x-1">
97+
<Languages size={20}/>
98+
<p className="text-tiny uppercase font-bold select-none">相片描述</p>
99+
</div>
63100
<h4 className="font-bold text-large">{MasonryViewData.detail || 'N&A'}</h4>
64101
</CardHeader>
65102
</Card>
103+
<Card className="py-4" shadow="sm">
104+
<CardHeader className="pb-0 pt-2 px-4 flex-col items-start">
105+
<div className="flex items-center space-x-1">
106+
<CalendarDays size={20}/>
107+
<p className="text-tiny uppercase font-bold select-none">拍摄时间</p>
108+
</div>
109+
<h4 className="font-bold text-large">{MasonryViewData?.exif?.data_time || 'N&A'}</h4>
110+
</CardHeader>
111+
</Card>
66112
</div>
67113
</Tab>
68114
<Tab
69115
key="exif"
70116
title={
71-
<div className="flex items-center space-x-2">
72-
<Camera />
117+
<div className="flex items-center space-x-2 select-none">
118+
<Aperture />
73119
<span>Exif</span>
74120
</div>
75121
}

components/RefreshButton.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default function RefreshButton(props: Readonly<HandleProps>) {
1515
size="sm"
1616
variant="shadow"
1717
isLoading={isLoading}
18+
aria-label="刷新"
1819
onClick={async () => {
1920
await mutate()
2021
}}

components/admin/list/ImageEditSheet.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export default function ImageEditSheet(props : Readonly<ImageServerHandleProps &
161161
color="primary"
162162
variant="shadow"
163163
onClick={() => submit()}
164+
aria-label="更新"
164165
>
165166
更新
166167
</Button>

components/admin/list/ListProps.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export default function ListProps(props : Readonly<ImageServerHandleProps>) {
142142
await totalMutate()
143143
await mutate()
144144
}}
145+
aria-label="刷新"
145146
>
146147
刷新
147148
</Button>
@@ -167,7 +168,7 @@ export default function ListProps(props : Readonly<ImageServerHandleProps>) {
167168
<Badge content={image.tag_values.split(",").length} color="primary">
168169
<Popover placement="top" shadow="sm">
169170
<PopoverTrigger className="cursor-pointer">
170-
<Chip variant="shadow" className="flex-1">{image.tag_names.length > 8 ? image.tag_names.substring(0, 8) + '...' : image.tag_names}</Chip>
171+
<Chip variant="shadow" className="flex-1" aria-label="标签">{image.tag_names.length > 8 ? image.tag_names.substring(0, 8) + '...' : image.tag_names}</Chip>
171172
</PopoverTrigger>
172173
<PopoverContent>
173174
<div className="px-1 py-2 select-none">
@@ -180,7 +181,7 @@ export default function ListProps(props : Readonly<ImageServerHandleProps>) {
180181
:
181182
<Popover placement="top" shadow="sm">
182183
<PopoverTrigger className="cursor-pointer">
183-
<Chip variant="shadow" className="flex-1">{image.tag_names}</Chip>
184+
<Chip variant="shadow" className="flex-1" aria-label="标签">{image.tag_names}</Chip>
184185
</PopoverTrigger>
185186
<PopoverContent>
186187
<div className="px-1 py-2 select-none">
@@ -198,6 +199,7 @@ export default function ListProps(props : Readonly<ImageServerHandleProps>) {
198199
setImageViewData(image)
199200
setImageView(true)
200201
}}
202+
aria-label="查看图片"
201203
>
202204
<ScanSearch size={20} />
203205
</Button>
@@ -237,6 +239,7 @@ export default function ListProps(props : Readonly<ImageServerHandleProps>) {
237239
color="primary"
238240
variant="shadow"
239241
startContent={<ArrowDown10 size={20} />}
242+
aria-label="排序"
240243
>{image.sort}</Chip>
241244
</PopoverTrigger>
242245
<PopoverContent>
@@ -255,6 +258,7 @@ export default function ListProps(props : Readonly<ImageServerHandleProps>) {
255258
setImageEditData(image)
256259
setImageEdit(true)
257260
}}
261+
aria-label="编辑图片"
258262
>
259263
<Pencil size={20} />
260264
</Button>
@@ -265,6 +269,7 @@ export default function ListProps(props : Readonly<ImageServerHandleProps>) {
265269
setImage(image)
266270
setIsOpen(true)
267271
}}
272+
aria-label="删除图片"
268273
>
269274
<Trash size={20} />
270275
</Button>
@@ -304,13 +309,15 @@ export default function ListProps(props : Readonly<ImageServerHandleProps>) {
304309
setImage({} as ImageType)
305310
setIsOpen(false)
306311
}}
312+
aria-label="不删除"
307313
>
308314
算了
309315
</Button>
310316
<Button
311317
color="primary"
312318
isLoading={deleteLoading}
313319
onClick={() => deleteImage()}
320+
aria-label="确认删除"
314321
>
315322
是的
316323
</Button>

components/admin/settings/storages/AListEditSheet.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export default function AListEditSheet() {
7979
color="primary"
8080
variant="shadow"
8181
onClick={() => submit()}
82+
aria-label="更新"
8283
>
8384
更新
8485
</Button>

components/admin/settings/storages/AListTabs.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default function AListTabs() {
3434
radius="full"
3535
isLoading={isValidating}
3636
onClick={() => mutate()}
37+
aria-label="刷新"
3738
>
3839
刷新
3940
</Button>
@@ -46,6 +47,7 @@ export default function AListTabs() {
4647
setAListEdit(true)
4748
setAListEditData(JSON.parse(JSON.stringify(data)))
4849
}}
50+
aria-label="编辑"
4951
>
5052
编辑
5153
</Button>

components/admin/settings/storages/R2EditSheet.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export default function S3EditSheet() {
7979
color="primary"
8080
variant="shadow"
8181
onClick={() => submit()}
82+
aria-label="更新"
8283
>
8384
更新
8485
</Button>

components/admin/settings/storages/R2Tabs.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default function R2Tabs() {
3434
radius="full"
3535
isLoading={isValidating}
3636
onClick={() => mutate()}
37+
aria-label="刷新"
3738
>
3839
刷新
3940
</Button>
@@ -46,6 +47,7 @@ export default function R2Tabs() {
4647
setR2Edit(true)
4748
setR2EditData(JSON.parse(JSON.stringify(data)))
4849
}}
50+
aria-label="编辑"
4951
>
5052
编辑
5153
</Button>

0 commit comments

Comments
 (0)