From 2bf18bd98836a70c6e57996c44db3bfde87dbf74 Mon Sep 17 00:00:00 2001 From: touyoutaaa <1849625991@qq.com> Date: Sun, 13 Apr 2025 16:02:55 +0800 Subject: [PATCH 1/5] fix:solve the Nested problem --- src/app/(repo)/[user]/[repo]/pr/page.tsx | 39 ++++++++++++------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/app/(repo)/[user]/[repo]/pr/page.tsx b/src/app/(repo)/[user]/[repo]/pr/page.tsx index 697b4bb..800fd16 100644 --- a/src/app/(repo)/[user]/[repo]/pr/page.tsx +++ b/src/app/(repo)/[user]/[repo]/pr/page.tsx @@ -3,8 +3,8 @@ import { Button, Input, Tabs, Menu } from '@mantine/core'; import { BsSearch } from 'react-icons/bs'; import { IconChevronDown } from '@tabler/icons-react'; -export default function Page(){ - return( +export default function Page() { + return (
@@ -23,13 +23,13 @@ export default function Page(){ rightSection={ + }} /> } /> @@ -53,7 +53,7 @@ export default function Page(){ @@ -61,23 +61,22 @@ export default function Page(){ PReviews2 PReviews3 - - - - - - Oldest - Newest - Best match - - - + + + + + + + Oldest + Newest + Best match +
- ) -} \ No newline at end of file + ); +} From 631f47e1d74cf6486e088278bc3b80410e67b025 Mon Sep 17 00:00:00 2001 From: touyoutaaa <1849625991@qq.com> Date: Sun, 13 Apr 2025 16:15:33 +0800 Subject: [PATCH 2/5] fix:solve the data time type problem --- src/app/settings/access/page.tsx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/app/settings/access/page.tsx b/src/app/settings/access/page.tsx index d329c99..33e8e14 100644 --- a/src/app/settings/access/page.tsx +++ b/src/app/settings/access/page.tsx @@ -1,9 +1,9 @@ 'use client'; import { useState, useEffect } from 'react'; -import {Button, Divider, Input, InputLabel, Modal, Textarea} from '@mantine/core'; +import { Button, Divider, Input, InputLabel, Modal, Textarea } from '@mantine/core'; import { notifications } from '@mantine/notifications'; import { DateTime } from 'luxon'; -import {useDisclosure} from "@mantine/hooks"; +import { useDisclosure } from "@mantine/hooks"; export interface TokenModel { uid: string; @@ -22,7 +22,7 @@ export default function NewAccess() { name: "", description: "", }); - const [GeneratedToken, setGeneratedToken] = useState(null); // 用于存储生成的令牌 + const [GeneratedToken, setGeneratedToken] = useState(null); const Fetch = async () => { try { @@ -36,7 +36,12 @@ export default function NewAccess() { if (res.status === 200) { const data = await res.json(); if (data.tokens) { - setList(data.tokens); + const tokens: TokenModel[] = data.tokens.map((token: { created_at: string; updated_at: string; uid: string; user_uid: string; name: string; description: string }) => ({ + ...token, + created_at: DateTime.fromISO(token.created_at), + updated_at: DateTime.fromISO(token.updated_at), + })); + setList(tokens); } else { notifications.show({ title: 'Failed', @@ -166,10 +171,10 @@ export default function NewAccess() {
{GeneratedToken && ( -
-

Generated Token:

-

{GeneratedToken}

-
+
+

Generated Token:

+

{GeneratedToken}

+
)}

Personal Access Tokens

From 9813b80f164fbee66f011d9c2ecf907097c65abf Mon Sep 17 00:00:00 2001 From: touyoutaaa <1849625991@qq.com> Date: Sun, 13 Apr 2025 16:51:14 +0800 Subject: [PATCH 3/5] fix:solve the copy button and warning problem --- src/app/settings/access/page.tsx | 22 ++++++++++++++++++++++ src/style/setting.css | 10 ++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/app/settings/access/page.tsx b/src/app/settings/access/page.tsx index 33e8e14..bd7ae74 100644 --- a/src/app/settings/access/page.tsx +++ b/src/app/settings/access/page.tsx @@ -173,7 +173,29 @@ export default function NewAccess() { {GeneratedToken && (

Generated Token:

+

This token will only be displayed once. Please copy it now.

{GeneratedToken}

+
)} diff --git a/src/style/setting.css b/src/style/setting.css index 408a454..aca131a 100644 --- a/src/style/setting.css +++ b/src/style/setting.css @@ -90,9 +90,19 @@ align-items: center; } .access-list-delete { + background-color: red; + color: white; + align-items: center; span { color: white; margin: 0; } } } + +.warning { + color: red; + font-weight: bold; + margin: 10px 0; +} + From bb1a0815d90a416dff6f70cf2f2193fdf044f70d Mon Sep 17 00:00:00 2001 From: touyoutaaa <1849625991@qq.com> Date: Sun, 13 Apr 2025 17:00:23 +0800 Subject: [PATCH 4/5] fix:solve the copy button and warning problem --- src/app/settings/access/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/settings/access/page.tsx b/src/app/settings/access/page.tsx index bd7ae74..f8673d0 100644 --- a/src/app/settings/access/page.tsx +++ b/src/app/settings/access/page.tsx @@ -181,7 +181,7 @@ export default function NewAccess() { backgroundColor: 'var(--theme-button)', color: 'white', padding: '4px 8px', - fontSize: 'o.875rem', + fontSize: '0.875rem', height: '2rem', }, }} From bc485726715a77b8eff2ac788063123a800d8a15 Mon Sep 17 00:00:00 2001 From: touyoutaaa <1849625991@qq.com> Date: Sun, 13 Apr 2025 17:35:23 +0800 Subject: [PATCH 5/5] fix:solve the copy button and warning problem --- src/app/settings/access/page.tsx | 74 +++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/src/app/settings/access/page.tsx b/src/app/settings/access/page.tsx index f8673d0..b849663 100644 --- a/src/app/settings/access/page.tsx +++ b/src/app/settings/access/page.tsx @@ -23,7 +23,7 @@ export default function NewAccess() { description: "", }); const [GeneratedToken, setGeneratedToken] = useState(null); - + const [isCopied, setIsCopied] = useState(false); const Fetch = async () => { try { const res = await fetch("/api/v1/users/token", { @@ -91,6 +91,7 @@ export default function NewAccess() { }); setGeneratedToken(data.token.token); + setIsCopied(false); // 重置复制状态 open(); setEdit(false); await Fetch(); @@ -169,36 +170,61 @@ export default function NewAccess() { return (
- + { close(); setIsCopied(false); }} withCloseButton={false} size={"lg"}> {GeneratedToken && (

Generated Token:

This token will only be displayed once. Please copy it now.

-

{GeneratedToken}

- +
+
+ {GeneratedToken} +
+ +
)}
+ +

Personal Access Tokens

Personal access tokens allow you to authenticate with GitDataAI APIs and use Git over HTTPS.