diff --git a/README-zh.md b/README-zh.md index 293c015..24654eb 100644 --- a/README-zh.md +++ b/README-zh.md @@ -109,6 +109,10 @@ pnpm db:push Follow https://localhost:3000/setup +## Environment Variables + +查看 [开发者文档](https://wr.do/docs/developer). + ## 社区群组 - Discord: https://discord.gg/AHPQYuZu3m diff --git a/README.md b/README.md index ddd1575..97b0ac8 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,10 @@ pnpm db:push Follow https://localhost:3000/setup +## Environment Variables + +Via [Installation For Developer](https://wr.do/docs/developer). + ## Community Group - Discord: https://discord.gg/AHPQYuZu3m diff --git a/app/(protected)/dashboard/records/record-list.tsx b/app/(protected)/dashboard/records/record-list.tsx index 8905a83..1fac363 100644 --- a/app/(protected)/dashboard/records/record-list.tsx +++ b/app/(protected)/dashboard/records/record-list.tsx @@ -40,10 +40,7 @@ import { import { FormType, RecordForm } from "@/components/forms/record-form"; import { EmptyPlaceholder } from "@/components/shared/empty-placeholder"; import { Icons } from "@/components/shared/icons"; -import { - LinkInfoPreviewer, - LinkPreviewer, -} from "@/components/shared/link-previewer"; +import { LinkInfoPreviewer } from "@/components/shared/link-previewer"; import { PaginationWrapper } from "@/components/shared/pagination"; export interface RecordListProps { @@ -53,7 +50,7 @@ export interface RecordListProps { function TableColumnSekleton() { return ( - + @@ -72,6 +69,9 @@ function TableColumnSekleton() { + + + @@ -92,7 +92,7 @@ export default function UserRecordsList({ user, action }: RecordListProps) { const { mutate } = useSWRConfig(); - const { data, error, isLoading } = useSWR<{ + const { data, isLoading } = useSWR<{ total: number; list: UserRecordFormData[]; }>(`${action}?page=${currentPage}&size=${pageSize}`, fetcher, { @@ -109,7 +109,7 @@ export default function UserRecordsList({ user, action }: RecordListProps) { setChecked: (value: boolean) => void, ) => { const originalState = record.active === 1; - setChecked(checked); // 立即更新 UI + setChecked(checked); const res = await fetch(`/api/record/update`, { method: "PUT", @@ -201,7 +201,7 @@ export default function UserRecordsList({ user, action }: RecordListProps) { - + Type @@ -217,6 +217,9 @@ export default function UserRecordsList({ user, action }: RecordListProps) { Status + + User + Updated @@ -238,7 +241,7 @@ export default function UserRecordsList({ user, action }: RecordListProps) { data.list.map((record) => ( @@ -316,6 +319,18 @@ export default function UserRecordsList({ user, action }: RecordListProps) { )} + + + + + {record.user.name ?? record.user.email} + + + {record.user.name ?? record.user.email} + + + + {timeAgo(record.modified_on as unknown as Date)} diff --git a/components/forms/record-form.tsx b/components/forms/record-form.tsx index 28869f2..f226b45 100644 --- a/components/forms/record-form.tsx +++ b/components/forms/record-form.tsx @@ -103,25 +103,28 @@ export function RecordForm({ }); const handleCreateRecord = async (data: CreateDNSRecord) => { - startTransition(async () => { - const response = await fetch(`${action}/add`, { - method: "POST", - body: JSON.stringify({ - records: [data], - email, - }), - }); - - if (!response.ok || response.status !== 200) { - toast.error("Created Failed!", { - description: await response.text(), + if (siteConfig.enableSubdomainApply && data.comment!.length < 20) { + toast.warning("Apply reason must be at least 20 characters!"); + } else { + startTransition(async () => { + const response = await fetch(`${action}/add`, { + method: "POST", + body: JSON.stringify({ + records: [data], + email, + }), }); - } else { - toast.success(`Created successfully!`); - setShowForm(false); - onRefresh(); - } - }); + if (!response.ok || response.status !== 200) { + toast.error("Created Failed!", { + description: await response.text(), + }); + } else { + toast.success(`Created successfully!`); + setShowForm(false); + onRefresh(); + } + }); + } }; const handleUpdateRecord = async (data: CreateDNSRecord) => { @@ -203,7 +206,6 @@ export function RecordForm({
{type === "add" ? "Create" : "Edit"} record
- {siteConfig.enableSubdomainApply && (
  • The administrator has enabled application mode.
  • @@ -213,7 +215,6 @@ export function RecordForm({
)} -
{isAdmin && (
@@ -245,7 +246,7 @@ export function RecordForm({
)} - {siteConfig.enableSubdomainApply && initData?.active === 2 && ( + {siteConfig.enableSubdomainApply && ( )} -
{isLoading ? ( @@ -326,7 +326,6 @@ export function RecordForm({

Required.

-
@@ -398,7 +397,6 @@ export function RecordForm({
-