From 0eb24eee2fd0651abd23f36a319ea4f16e86b33b Mon Sep 17 00:00:00 2001 From: nyne Date: Wed, 9 Jul 2025 18:11:33 +0800 Subject: [PATCH] format code --- frontend/src/components/comment_tile.tsx | 4 +- frontend/src/pages/comment_page.tsx | 15 ++-- frontend/src/pages/resource_details_page.tsx | 3 +- frontend/src/pages/user_page.tsx | 76 ++++++++++++-------- 4 files changed, 56 insertions(+), 42 deletions(-) diff --git a/frontend/src/components/comment_tile.tsx b/frontend/src/components/comment_tile.tsx index a3066f5..70b8646 100644 --- a/frontend/src/components/comment_tile.tsx +++ b/frontend/src/components/comment_tile.tsx @@ -1,8 +1,6 @@ import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router"; -import { - MdOutlineComment, -} from "react-icons/md"; +import { MdOutlineComment } from "react-icons/md"; import { Comment } from "../network/models"; import { network } from "../network/network"; import Badge from "./badge"; diff --git a/frontend/src/pages/comment_page.tsx b/frontend/src/pages/comment_page.tsx index 49daad1..6dca143 100644 --- a/frontend/src/pages/comment_page.tsx +++ b/frontend/src/pages/comment_page.tsx @@ -46,7 +46,7 @@ export default function CommentPage() { const onUpdated = useCallback(() => { setComment(null); - const id = parseInt(commentId || "0"); + const id = parseInt(commentId || "0"); if (isNaN(id) || id <= 0) { showToast({ message: t("Invalid comment ID"), @@ -116,11 +116,11 @@ export default function CommentPage() { {app.user?.id === comment.user.id && ( -
- - -
- )} +
+ + +
+ )}
@@ -282,7 +282,6 @@ function CommentsList({ ); } - function EditCommentDialog({ comment, onUpdated, @@ -460,4 +459,4 @@ function DeleteCommentDialog({ ); -} \ No newline at end of file +} diff --git a/frontend/src/pages/resource_details_page.tsx b/frontend/src/pages/resource_details_page.tsx index 9adc926..86d1b1e 100644 --- a/frontend/src/pages/resource_details_page.tsx +++ b/frontend/src/pages/resource_details_page.tsx @@ -23,7 +23,8 @@ import Markdown from "react-markdown"; import "../markdown.css"; import Loading from "../components/loading.tsx"; import { - MdAdd, MdOutlineArchive, + MdAdd, + MdOutlineArchive, MdOutlineArticle, MdOutlineComment, MdOutlineDataset, diff --git a/frontend/src/pages/user_page.tsx b/frontend/src/pages/user_page.tsx index aaf5e71..e892895 100644 --- a/frontend/src/pages/user_page.tsx +++ b/frontend/src/pages/user_page.tsx @@ -8,7 +8,11 @@ import Loading from "../components/loading"; import Pagination from "../components/pagination"; import { CommentTile } from "../components/comment_tile.tsx"; import Badge from "../components/badge.tsx"; -import { MdOutlineArchive, MdOutlineComment, MdOutlinePhotoAlbum, MdPhotoAlbum } from "react-icons/md"; +import { + MdOutlineArchive, + MdOutlineComment, + MdOutlinePhotoAlbum, +} from "react-icons/md"; import { useTranslation } from "react-i18next"; export default function UserPage() { @@ -69,7 +73,10 @@ export default function UserPage() { return (
-
+
- - - {t("Resources")} {user.resources_count} - - - - {t('Files')} {user.files_count} - - - - {t("Comments")} {user.comments_count} - -

+ const statistics = ( +

+ + + + {t("Resources")} {user.resources_count} + + + + + + {t("Files")} {user.files_count} + + + + + + {t("Comments")} {user.comments_count} + + +

+ ); const haveBio = user.bio.trim() !== ""; return ( <>
-
-
- {"avatar"} +
+
+ {"avatar"} +
+
+
+
+

{user.username}

+
+ {haveBio ? ( +

{user.bio.trim()}

+ ) : ( + statistics + )}
-
-
-

{user.username}

-
- {haveBio ? ( -

{user.bio.trim()}

- ): statistics} -
- -
- { haveBio &&
{statistics}
} + {haveBio &&
{statistics}
} ); }