Skip to content

Commit 14a49af

Browse files
committed
refactor: update button handlers in ArticleEditor and improve user profile photo handling in LatestUsers
1 parent e2440cd commit 14a49af

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/components/Editor/ArticleEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ const ArticleEditor: React.FC<ArticleEditorProps> = ({ article, uuid }) => {
273273
>
274274
{article?.is_published ? _t("Unpublish") : _t("Publish")}
275275
</button>
276-
<button onClick={toggleSettingDrawer}>
276+
<button onClick={toggleSettingDrawer.open}>
277277
<GearIcon className="w-5 h-5" />
278278
</button>
279279
</div>
@@ -326,7 +326,7 @@ const ArticleEditor: React.FC<ArticleEditorProps> = ({ article, uuid }) => {
326326
<ArticleEditorDrawer
327327
article={article}
328328
open={isOpenSettingDrawer}
329-
onClose={toggleSettingDrawer}
329+
onClose={toggleSettingDrawer.close}
330330
onSave={() => {
331331
// silence is good
332332
}}

src/components/widgets/LatestUsers.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Link from "next/link";
33
import * as userActions from "@/backend/services/user.action";
44
import { User } from "@/backend/models/domain-models";
55
import Image from "next/image";
6+
import getFileUrl from "@/utils/getFileUrl";
67

78
const LatestUsers = async () => {
89
const usersResponse = await userActions.getUsers();
@@ -29,18 +30,20 @@ export default LatestUsers;
2930

3031
const UserItem = ({ user }: { user: User }) => (
3132
<div className="flex items-center">
32-
<Link href={`/@${user.username}`}>
33-
<div className="size-10 overflow-hidden rounded-full">
34-
<Image
35-
src={user?.profile_photo_url!}
36-
alt={user?.name!}
37-
loading="lazy"
38-
className="h-auto w-full"
39-
width={40}
40-
height={40}
41-
/>
42-
</div>
43-
</Link>
33+
{user?.profile_photo && (
34+
<Link href={`/@${user.username}`}>
35+
<div className="size-10 overflow-hidden rounded-full">
36+
<Image
37+
src={getFileUrl(user?.profile_photo)!}
38+
alt={user?.name!}
39+
loading="lazy"
40+
className="h-auto w-full"
41+
width={40}
42+
height={40}
43+
/>
44+
</div>
45+
</Link>
46+
)}
4447

4548
<div className="ml-2">
4649
<h3 className="text-dark text-base">

0 commit comments

Comments
 (0)