YuSaZh commited on
Commit
a0b03f3
·
1 Parent(s): 759ebab

Improve mobile layout

Browse files
web/src/app/accounts/page.tsx CHANGED
@@ -372,10 +372,10 @@ function AccountsPageContent() {
372
  <h1 className="text-2xl font-semibold tracking-tight">号池管理</h1>
373
  </div>
374
 
375
- <div className="flex flex-wrap items-center gap-2">
376
  <Button
377
  variant="outline"
378
- className="h-10 rounded-xl border-stone-200 bg-white/80 px-4 text-stone-700 hover:bg-white"
379
  onClick={() => void loadAccounts()}
380
  disabled={isLoading || isRefreshing || isDeleting}
381
  >
@@ -384,12 +384,12 @@ function AccountsPageContent() {
384
  </Button>
385
  <Button
386
  variant="outline"
387
- className="h-10 rounded-xl border-stone-200 bg-white/80 px-4 text-stone-700 hover:bg-white"
388
  onClick={() => void handleRefreshAccounts(accounts.map((item) => item.access_token))}
389
  disabled={isLoading || isRefreshing || isDeleting || accounts.length === 0}
390
  >
391
  <RefreshCw className={cn("size-4", isRefreshing ? "animate-spin" : "")} />
392
- 一键刷新所有账号信息和额度
393
  </Button>
394
  <AccountImportDialog
395
  disabled={isLoading || isRefreshing || isDeleting}
@@ -401,12 +401,12 @@ function AccountsPageContent() {
401
  />
402
  <Button
403
  variant="outline"
404
- className="h-10 rounded-xl border-stone-200 bg-white/80 px-4 text-stone-700 hover:bg-white"
405
  onClick={() => downloadTokens(accounts)}
406
  disabled={accounts.length === 0}
407
  >
408
  <Download className="size-4" />
409
- 导出全部 Token
410
  </Button>
411
  </div>
412
  </section>
@@ -518,7 +518,7 @@ function AccountsPageContent() {
518
  </div>
519
 
520
  <div className="flex flex-col gap-2 lg:flex-row lg:items-center">
521
- <div className="relative min-w-[260px]">
522
  <Search className="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-stone-400" />
523
  <Input
524
  value={query}
 
372
  <h1 className="text-2xl font-semibold tracking-tight">号池管理</h1>
373
  </div>
374
 
375
+ <div className="grid grid-cols-2 gap-2 sm:flex sm:flex-wrap sm:items-center">
376
  <Button
377
  variant="outline"
378
+ className="h-10 rounded-xl border-stone-200 bg-white/80 px-3 text-sm text-stone-700 hover:bg-white sm:px-4"
379
  onClick={() => void loadAccounts()}
380
  disabled={isLoading || isRefreshing || isDeleting}
381
  >
 
384
  </Button>
385
  <Button
386
  variant="outline"
387
+ className="h-10 rounded-xl border-stone-200 bg-white/80 px-3 text-sm text-stone-700 hover:bg-white sm:px-4"
388
  onClick={() => void handleRefreshAccounts(accounts.map((item) => item.access_token))}
389
  disabled={isLoading || isRefreshing || isDeleting || accounts.length === 0}
390
  >
391
  <RefreshCw className={cn("size-4", isRefreshing ? "animate-spin" : "")} />
392
+ 一键刷新
393
  </Button>
394
  <AccountImportDialog
395
  disabled={isLoading || isRefreshing || isDeleting}
 
401
  />
402
  <Button
403
  variant="outline"
404
+ className="h-10 rounded-xl border-stone-200 bg-white/80 px-3 text-sm text-stone-700 hover:bg-white sm:px-4"
405
  onClick={() => downloadTokens(accounts)}
406
  disabled={accounts.length === 0}
407
  >
408
  <Download className="size-4" />
409
+ 导出 Token
410
  </Button>
411
  </div>
412
  </section>
 
518
  </div>
519
 
520
  <div className="flex flex-col gap-2 lg:flex-row lg:items-center">
521
+ <div className="relative w-full lg:w-[260px]">
522
  <Search className="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-stone-400" />
523
  <Input
524
  value={query}
web/src/app/image-manager/page.tsx CHANGED
@@ -102,16 +102,18 @@ function ImageManagerContent() {
102
  <div className="text-xs font-semibold tracking-[0.18em] text-stone-500 uppercase">Images</div>
103
  <h1 className="text-2xl font-semibold tracking-tight">图片管理</h1>
104
  </div>
105
- <div className="flex flex-wrap gap-2">
106
- <DateRangeFilter startDate={startDate} endDate={endDate} onChange={(start, end) => { setStartDate(start); setEndDate(end); }} />
107
- <Button variant="outline" onClick={clearFilters} className="h-10 rounded-xl border-stone-200 bg-white px-4 text-stone-700">
108
- 清除筛选条件
 
 
109
  </Button>
110
- <Button onClick={() => void loadImages()} disabled={isLoading} className="h-10 rounded-xl bg-stone-950 px-4 text-white hover:bg-stone-800">
111
  {isLoading ? <LoaderCircle className="size-4 animate-spin" /> : <Search className="size-4" />}
112
  查询
113
  </Button>
114
- <Button variant="outline" onClick={() => setDeleteMode("filtered")} disabled={isDeleting || items.length === 0 || (!startDate && !endDate)} className="h-10 rounded-xl border-rose-200 bg-white px-4 text-rose-600 hover:bg-rose-50">
115
  <Trash2 className="size-4" />
116
  删除匹配日期
117
  </Button>
@@ -120,7 +122,7 @@ function ImageManagerContent() {
120
 
121
  <Card className="rounded-2xl border-white/80 bg-white/90 shadow-sm">
122
  <CardContent className="p-0">
123
- <div className="flex flex-wrap items-center justify-between gap-3 border-b border-stone-100 px-5 py-4">
124
  <div className="flex flex-wrap items-center gap-3 text-sm text-stone-600">
125
  <ImageIcon className="size-4" />
126
  共 {items.length} 张
 
102
  <div className="text-xs font-semibold tracking-[0.18em] text-stone-500 uppercase">Images</div>
103
  <h1 className="text-2xl font-semibold tracking-tight">图片管理</h1>
104
  </div>
105
+ <div className="grid grid-cols-2 gap-2 sm:flex sm:flex-wrap">
106
+ <div className="col-span-2 sm:col-span-1">
107
+ <DateRangeFilter startDate={startDate} endDate={endDate} onChange={(start, end) => { setStartDate(start); setEndDate(end); }} />
108
+ </div>
109
+ <Button variant="outline" onClick={clearFilters} className="h-10 rounded-xl border-stone-200 bg-white px-3 text-sm text-stone-700 sm:px-4">
110
+ 清除筛选
111
  </Button>
112
+ <Button onClick={() => void loadImages()} disabled={isLoading} className="h-10 rounded-xl bg-stone-950 px-3 text-sm text-white hover:bg-stone-800 sm:px-4">
113
  {isLoading ? <LoaderCircle className="size-4 animate-spin" /> : <Search className="size-4" />}
114
  查询
115
  </Button>
116
+ <Button variant="outline" onClick={() => setDeleteMode("filtered")} disabled={isDeleting || items.length === 0 || (!startDate && !endDate)} className="col-span-2 h-10 rounded-xl border-rose-200 bg-white px-3 text-sm text-rose-600 hover:bg-rose-50 sm:col-span-1 sm:px-4">
117
  <Trash2 className="size-4" />
118
  删除匹配日期
119
  </Button>
 
122
 
123
  <Card className="rounded-2xl border-white/80 bg-white/90 shadow-sm">
124
  <CardContent className="p-0">
125
+ <div className="flex flex-col gap-3 border-b border-stone-100 px-4 py-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:px-5">
126
  <div className="flex flex-wrap items-center gap-3 text-sm text-stone-600">
127
  <ImageIcon className="size-4" />
128
  共 {items.length} 张
web/src/app/image/page.tsx CHANGED
@@ -935,7 +935,7 @@ function ImagePageContent({ isAdmin }: { isAdmin: boolean }) {
935
 
936
  return (
937
  <>
938
- <section className="mx-auto grid h-[calc(100dvh-6.25rem)] min-h-0 w-full max-w-[1380px] grid-cols-1 gap-2 px-0 pb-[calc(env(safe-area-inset-bottom)+0.5rem)] sm:h-[calc(100dvh-5rem)] sm:gap-3 sm:px-3 sm:pb-6 lg:grid-cols-[240px_minmax(0,1fr)]">
939
  <div className="hidden h-full min-h-0 border-r border-stone-200/70 pr-3 lg:block">
940
  <ImageSidebar
941
  conversations={conversations}
 
935
 
936
  return (
937
  <>
938
+ <section className="mx-auto grid h-[calc(100dvh-8.25rem)] min-h-0 w-full max-w-[1380px] grid-cols-1 gap-2 px-0 pb-[calc(env(safe-area-inset-bottom)+0.5rem)] sm:h-[calc(100dvh-5rem)] sm:gap-3 sm:px-3 sm:pb-6 lg:grid-cols-[240px_minmax(0,1fr)]">
939
  <div className="hidden h-full min-h-0 border-r border-stone-200/70 pr-3 lg:block">
940
  <ImageSidebar
941
  conversations={conversations}
web/src/app/layout.tsx CHANGED
@@ -23,8 +23,8 @@ export default function RootLayout({
23
  }}
24
  >
25
  <Toaster position="top-center" richColors offset={48} />
26
- <main className="min-h-screen bg-[radial-gradient(circle_at_top_left,_rgba(255,255,255,0.92),_rgba(245,239,231,0.96)_42%,_rgba(240,235,227,0.99)_100%)] px-4 py-2 text-stone-900 sm:px-6 lg:px-8">
27
- <div className="mx-auto flex max-w-[1440px] flex-col gap-5">
28
  <TopNav />
29
  {children}
30
  </div>
 
23
  }}
24
  >
25
  <Toaster position="top-center" richColors offset={48} />
26
+ <main className="min-h-screen overflow-x-hidden bg-[radial-gradient(circle_at_top_left,_rgba(255,255,255,0.92),_rgba(245,239,231,0.96)_42%,_rgba(240,235,227,0.99)_100%)] px-3 py-2 text-stone-900 sm:px-6 lg:px-8">
27
+ <div className="mx-auto flex max-w-[1440px] flex-col gap-3 sm:gap-5">
28
  <TopNav />
29
  {children}
30
  </div>
web/src/app/logs/page.tsx CHANGED
@@ -107,19 +107,21 @@ function LogsContent() {
107
  <div className="text-xs font-semibold tracking-[0.18em] text-stone-500 uppercase">Logs</div>
108
  <h1 className="text-2xl font-semibold tracking-tight">日志管理</h1>
109
  </div>
110
- <div className="flex flex-wrap gap-2">
111
  <Select value={type} onValueChange={setType}>
112
- <SelectTrigger className="h-10 w-[150px] rounded-xl border-stone-200 bg-white"><SelectValue /></SelectTrigger>
113
  <SelectContent>
114
  <SelectItem value={LogType.Call}>调用日志</SelectItem>
115
  <SelectItem value={LogType.Account}>账号管理日志</SelectItem>
116
  </SelectContent>
117
  </Select>
118
- <DateRangeFilter startDate={startDate} endDate={endDate} onChange={(start, end) => { setStartDate(start); setEndDate(end); }} />
119
- <Button variant="outline" onClick={clearFilters} className="h-10 rounded-xl border-stone-200 bg-white px-4 text-stone-700">
120
- 清除筛选条件
 
 
121
  </Button>
122
- <Button onClick={() => void loadLogs()} disabled={isLoading} className="h-10 rounded-xl bg-stone-950 px-4 text-white hover:bg-stone-800">
123
  {isLoading ? <LoaderCircle className="size-4 animate-spin" /> : <Search className="size-4" />}
124
  查询
125
  </Button>
@@ -128,7 +130,7 @@ function LogsContent() {
128
 
129
  <Card className="overflow-hidden rounded-2xl border-white/80 bg-white/90 shadow-sm">
130
  <CardContent className="p-0">
131
- <div className="flex items-center justify-between border-b border-stone-100 px-5 py-4 text-sm text-stone-600">
132
  <span>共 {items.length} 条</span>
133
  <Button variant="ghost" className="h-8 rounded-lg px-3 text-stone-500" onClick={() => void loadLogs()} disabled={isLoading}>
134
  <RefreshCw className={`size-4 ${isLoading ? "animate-spin" : ""}`} />
 
107
  <div className="text-xs font-semibold tracking-[0.18em] text-stone-500 uppercase">Logs</div>
108
  <h1 className="text-2xl font-semibold tracking-tight">日志管理</h1>
109
  </div>
110
+ <div className="grid grid-cols-2 gap-2 sm:flex sm:flex-wrap">
111
  <Select value={type} onValueChange={setType}>
112
+ <SelectTrigger className="h-10 w-full rounded-xl border-stone-200 bg-white sm:w-[150px]"><SelectValue /></SelectTrigger>
113
  <SelectContent>
114
  <SelectItem value={LogType.Call}>调用日志</SelectItem>
115
  <SelectItem value={LogType.Account}>账号管理日志</SelectItem>
116
  </SelectContent>
117
  </Select>
118
+ <div className="col-span-2 sm:col-span-1">
119
+ <DateRangeFilter startDate={startDate} endDate={endDate} onChange={(start, end) => { setStartDate(start); setEndDate(end); }} />
120
+ </div>
121
+ <Button variant="outline" onClick={clearFilters} className="h-10 rounded-xl border-stone-200 bg-white px-3 text-sm text-stone-700 sm:px-4">
122
+ 清除筛选
123
  </Button>
124
+ <Button onClick={() => void loadLogs()} disabled={isLoading} className="h-10 rounded-xl bg-stone-950 px-3 text-sm text-white hover:bg-stone-800 sm:px-4">
125
  {isLoading ? <LoaderCircle className="size-4 animate-spin" /> : <Search className="size-4" />}
126
  查询
127
  </Button>
 
130
 
131
  <Card className="overflow-hidden rounded-2xl border-white/80 bg-white/90 shadow-sm">
132
  <CardContent className="p-0">
133
+ <div className="flex flex-col gap-3 border-b border-stone-100 px-4 py-4 text-sm text-stone-600 sm:flex-row sm:items-center sm:justify-between sm:px-5">
134
  <span>共 {items.length} 条</span>
135
  <Button variant="ghost" className="h-8 rounded-lg px-3 text-stone-500" onClick={() => void loadLogs()} disabled={isLoading}>
136
  <RefreshCw className={`size-4 ${isLoading ? "animate-spin" : ""}`} />
web/src/components/date-range-filter.tsx CHANGED
@@ -26,15 +26,15 @@ export function DateRangeFilter({ startDate, endDate, onChange }: DateRangeFilte
26
  const label = startDate ? `${startDate} 至 ${endDate || startDate}` : "选择日期范围";
27
 
28
  return (
29
- <Field className="w-[240px]">
30
  <Popover>
31
  <PopoverTrigger asChild>
32
- <Button variant="outline" className="h-10 justify-start rounded-xl border-stone-200 bg-white px-3 font-normal text-stone-700">
33
- <CalendarIcon className="size-4 text-stone-400" />
34
- {label}
35
  </Button>
36
  </PopoverTrigger>
37
- <PopoverContent className="w-auto p-3" align="start">
38
  <Calendar
39
  mode="range"
40
  defaultMonth={selected?.from}
 
26
  const label = startDate ? `${startDate} 至 ${endDate || startDate}` : "选择日期范围";
27
 
28
  return (
29
+ <Field className="w-full sm:w-[240px]">
30
  <Popover>
31
  <PopoverTrigger asChild>
32
+ <Button variant="outline" className="h-10 w-full justify-start rounded-xl border-stone-200 bg-white px-3 font-normal text-stone-700">
33
+ <CalendarIcon className="size-4 shrink-0 text-stone-400" />
34
+ <span className="truncate">{label}</span>
35
  </Button>
36
  </PopoverTrigger>
37
+ <PopoverContent className="w-[calc(100vw-2rem)] overflow-x-auto p-3 sm:w-auto" align="start">
38
  <Calendar
39
  mode="range"
40
  defaultMonth={selected?.from}
web/src/components/top-nav.tsx CHANGED
@@ -65,8 +65,8 @@ export function TopNav() {
65
  const displayName = session.name.trim() || roleLabel;
66
 
67
  return (
68
- <header className="border-b border-stone-100/50">
69
- <div className="flex min-h-12 flex-col gap-1 px-3 py-2 sm:h-12 sm:flex-row sm:items-center sm:justify-between sm:gap-3 sm:px-6 sm:py-0">
70
  <div className="flex items-center justify-between gap-2 sm:justify-start sm:gap-3">
71
  <Link
72
  href="/image"
@@ -92,7 +92,7 @@ export function TopNav() {
92
  退出
93
  </button>
94
  </div>
95
- <nav className="hide-scrollbar -mx-1 flex min-w-0 flex-1 gap-1 overflow-x-auto px-1 sm:mx-0 sm:justify-center sm:gap-8 sm:overflow-visible sm:px-0">
96
  {navItems.map((item) => {
97
  const active = pathname === item.href;
98
  return (
@@ -100,10 +100,10 @@ export function TopNav() {
100
  key={item.href}
101
  href={item.href}
102
  className={cn(
103
- "relative shrink-0 whitespace-nowrap rounded-full px-2.5 py-1 text-[13px] font-medium transition sm:rounded-none sm:px-0 sm:text-[15px]",
104
  active
105
- ? "bg-stone-950 text-white sm:bg-transparent sm:font-semibold sm:text-stone-950"
106
- : "text-stone-500 hover:text-stone-900",
107
  )}
108
  >
109
  {item.label}
 
65
  const displayName = session.name.trim() || roleLabel;
66
 
67
  return (
68
+ <header className="sticky top-2 z-40 rounded-3xl border border-white/70 bg-white/80 shadow-[0_16px_50px_-36px_rgba(15,23,42,0.45)] backdrop-blur sm:static sm:rounded-none sm:border-x-0 sm:border-t-0 sm:border-b-stone-100/50 sm:bg-transparent sm:shadow-none sm:backdrop-blur-none">
69
+ <div className="flex min-h-12 flex-col gap-2 px-3 py-2.5 sm:h-12 sm:flex-row sm:items-center sm:justify-between sm:gap-3 sm:px-6 sm:py-0">
70
  <div className="flex items-center justify-between gap-2 sm:justify-start sm:gap-3">
71
  <Link
72
  href="/image"
 
92
  退出
93
  </button>
94
  </div>
95
+ <nav className="hide-scrollbar -mx-1 flex min-w-0 flex-1 gap-1 overflow-x-auto px-1 pb-0.5 sm:mx-0 sm:justify-center sm:gap-8 sm:overflow-visible sm:px-0 sm:pb-0">
96
  {navItems.map((item) => {
97
  const active = pathname === item.href;
98
  return (
 
100
  key={item.href}
101
  href={item.href}
102
  className={cn(
103
+ "relative shrink-0 whitespace-nowrap rounded-full px-3 py-1.5 text-[13px] font-medium transition sm:rounded-none sm:px-0 sm:py-1 sm:text-[15px]",
104
  active
105
+ ? "bg-stone-950 text-white shadow-sm sm:bg-transparent sm:font-semibold sm:text-stone-950 sm:shadow-none"
106
+ : "bg-stone-100/70 text-stone-600 hover:bg-stone-200/80 hover:text-stone-900 sm:bg-transparent sm:text-stone-500 sm:hover:bg-transparent",
107
  )}
108
  >
109
  {item.label}