Skip to content

Commit 9b46c70

Browse files
fix: fix some ui problems (#14)
* fix: fix undefined values in overview page * fix: change editing icon * fix: fix font weight
1 parent 8de6c74 commit 9b46c70

File tree

5 files changed

+17
-23
lines changed

5 files changed

+17
-23
lines changed

src/app/(main)/(dashboard)/(overview)/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ export default async function OverviewPage() {
2525
<div className="lg:flex h-full gap-6">
2626
<div className="md:w-1/2">
2727
<Greeting user={user} siteName={SITE_NAME} />
28-
<AccountConfig verified={user!.verified} />
28+
<AccountConfig verified={user?.verified} />
2929
<h3 className="text-lg">我的资源</h3>
3030
<Resources
31-
profiles={user!.profiles}
32-
closet={user!.closet}
33-
isAdmin={user!.role === "ADMIN"}
31+
profiles={user?.profiles}
32+
closet={user?.closet}
33+
isAdmin={user?.role === "ADMIN"}
3434
/>
3535
</div>
3636
<div className="flex flex-col md:w-1/2 h-full">

src/components/account-info.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

3-
import { FormEvent, useState } from "react";
4-
import { ChevronLeft, LoaderCircle, Pencil } from "lucide-react";
3+
import { useState } from "react";
4+
import { ChevronLeft, LoaderCircle, SquarePen } from "lucide-react";
55
import { Input } from "@/components/ui/input";
66
import { Button } from "@/components/ui/button";
77
import { updatePasswordParams, updateUserInfoParams } from "@/lib/schema";
@@ -22,7 +22,7 @@ export default function AccountInfo({ user }) {
2222

2323
const router = useRouter();
2424

25-
async function handleUpdateUserInfo(e: FormEvent) {
25+
async function handleUpdateUserInfo(e) {
2626
setInfoPending(true);
2727
e.preventDefault();
2828

@@ -57,7 +57,7 @@ export default function AccountInfo({ user }) {
5757
const [passwordMessage, setPasswordMessage] = useState<string>("");
5858
const [passwordPending, setPasswordPending] = useState<boolean>(false);
5959

60-
async function handleUpdatePassword(e: FormEvent) {
60+
async function handleUpdatePassword(e) {
6161
setPasswordPending(true);
6262
e.preventDefault();
6363
const validated = updatePasswordParams.safeParse({
@@ -91,10 +91,10 @@ export default function AccountInfo({ user }) {
9191
) : (
9292
<span className="mx-2">{user.name}</span>
9393
)}
94-
<Pencil
94+
<SquarePen
9595
onClick={() => setEditingName(!editingName)}
96-
size={15}
97-
className="hover:scale-110"
96+
size={20}
97+
className={clsx("hover:scale-110", !editingName && "text-muted-foreground")}
9898
/>
9999
</p>
100100
<p className="my-3 flex">
@@ -113,10 +113,10 @@ export default function AccountInfo({ user }) {
113113
<code className="bg-accent p-1 rounded-sm text-muted-foreground">{user.email}</code>
114114
</span>
115115
)}
116-
<Pencil
116+
<SquarePen
117117
onClick={() => setEditingEmail(!editingEmail)}
118-
size={15}
119-
className="hover:scale-110"
118+
size={20}
119+
className={clsx("hover:scale-110", !editingEmail && "text-muted-foreground")}
120120
/>
121121
</p>
122122
{(editingName || editingEmail) && (

src/components/profile-list.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ export default async function ProfileList({ userId, isAdmin, verified, detail })
4040
<TableBody>
4141
{profiles.map((profile) => (
4242
<TableRow key={profile.id} className={clsx(detail === profile.id && "bg-muted")}>
43-
<TableCell>
44-
<strong>{profile.name}</strong>
45-
</TableCell>
43+
<TableCell className="font-medium">{profile.name}</TableCell>
4644
<TableCell>
4745
<code>{profile.uuid}</code>
4846
</TableCell>

src/components/profile-tab.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ export default async function ProfileTab({ where }) {
5050
<TableBody>
5151
{profiles.map((profile) => (
5252
<TableRow key={profile.id}>
53-
<TableCell>
54-
<strong>{profile.id}</strong>
55-
</TableCell>
53+
<TableCell className="font-medium">{profile.id}</TableCell>
5654
<TableCell>{profile.name}</TableCell>
5755
<TableCell>{profile.uuid}</TableCell>
5856
<TableCell>

src/components/texture-tab.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ export default async function TextureTab({ where }) {
4646
<TableBody>
4747
{textures.map((texture) => (
4848
<TableRow key={texture.id}>
49-
<TableCell>
50-
<strong>{texture.id}</strong>
51-
</TableCell>
49+
<TableCell className="font-medium">{texture.id}</TableCell>
5250
<TableCell className="max-w-30">
5351
<p className="truncate" title={texture.name}>
5452
{texture.name}

0 commit comments

Comments
 (0)