From e42fce5bd1d7503576040ef2bf82565e8ce4bd88 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Sun, 1 Feb 2026 19:22:54 +0800 Subject: [PATCH] update --- .../apps/modules/permission/DatePicker.tsx | 15 ++--- .../modules/permission/PermissionManager.tsx | 54 ++++++++---------- src/app/apps/modules/permission/TagsInput.tsx | 18 +++--- src/app/apps/modules/permission/key-parse.ts | 56 ++++++++----------- 4 files changed, 62 insertions(+), 81 deletions(-) diff --git a/src/app/apps/modules/permission/DatePicker.tsx b/src/app/apps/modules/permission/DatePicker.tsx index 84283bd..58cf952 100644 --- a/src/app/apps/modules/permission/DatePicker.tsx +++ b/src/app/apps/modules/permission/DatePicker.tsx @@ -16,19 +16,14 @@ interface DatePickerProps { } export function DatePicker({ className, value, onChange }: DatePickerProps) { - const [date, setDate] = React.useState( - value ? new Date(typeof value === 'string' ? value : value.toISOString()) : undefined - ) + const toDate = (val: string | Dayjs | undefined): Date | undefined => { + if (!val) return undefined + return new Date(typeof val === 'string' ? val : val.toISOString()) + } - React.useEffect(() => { - if (value) { - const dateValue = typeof value === 'string' ? value : value.toISOString() - setDate(new Date(dateValue)) - } - }, [value]) + const date = toDate(value) const handleSelect = (selectedDate: Date | undefined) => { - setDate(selectedDate) if (selectedDate && onChange) { onChange(dayjs(selectedDate)) } diff --git a/src/app/apps/modules/permission/PermissionManager.tsx b/src/app/apps/modules/permission/PermissionManager.tsx index 6e65d1b..53712eb 100644 --- a/src/app/apps/modules/permission/PermissionManager.tsx +++ b/src/app/apps/modules/permission/PermissionManager.tsx @@ -22,6 +22,24 @@ import { TooltipTrigger, } from "@/components/ui/tooltip" +const LabelWithTooltip = ({ label, tips }: { label: string; tips?: string }) => ( +
+ + {tips && ( + + + + + +

{tips}

+
+
+ )} +
+); + export const KeyShareSelect = ({ value, onChange }: { value: string; onChange?: (value: string) => void }) => { return (