gitscope
← marzneshin / Diff · 7707f15 → 7707f15
Changes 7707f15..7707f15
Patch commit
diff --git a/dashboard/public/locales/en.json b/dashboard/public/locales/en.json
index 84469e9..21360a7 100644
--- a/dashboard/public/locales/en.json
+++ b/dashboard/public/locales/en.json
@@ -105,7 +105,9 @@
"data_limit_reset_strategy": "Data Limit Reset Strategy",
"online_at": "Online At",
"expire_date": "Expire Date",
+ "unlimited": "Unlimited",
"determined_expire": "Determined",
+ "expire_method": "Expiration method",
"onhold_expire": "On Hold",
"on_hold_expire_duration": "On Hold",
"on_hold_timeout": "On Hold Timeout",
diff --git a/dashboard/src/features/users/components/date-field.tsx b/dashboard/src/features/users/components/date-field.tsx
index 26da423..7db3077 100644
--- a/dashboard/src/features/users/components/date-field.tsx
+++ b/dashboard/src/features/users/components/date-field.tsx
@@ -48,7 +48,7 @@ export const DateField: FC<DateFieldProps> = ({ name, label }) => {
)}
>
{field.value ? (
- format(field.value, "PPP")
+ format(field.value + 'Z', "PPP")
) : (
<span>Pick a date</span>
)}
diff --git a/dashboard/src/features/users/dialogs/mutation/index.tsx b/dashboard/src/features/users/dialogs/mutation/index.tsx
index ed03687..9087c0b 100644
--- a/dashboard/src/features/users/dialogs/mutation/index.tsx
+++ b/dashboard/src/features/users/dialogs/mutation/index.tsx
@@ -8,7 +8,8 @@ import {
Button,
Tabs,
TabsTrigger,
- TabsContent
+ TabsContent,
+ FormLabel
} from '@marzneshin/components';
import { useTranslation } from 'react-i18next';
import {
@@ -70,13 +71,21 @@ export const UsersMutationDialog: FC<UsersMutationDialogProps> = ({
}, [services, form])
- const [selectedTab, setSelectedTab] = useState<'determined' | 'onhold' | string>('determined');
+ const [selectedTab, setSelectedTab] = useState<'determined' | 'onhold' | 'unlimited' | string>('determined');
useEffect(() => {
if (selectedTab === 'onhold') {
form.setValue("status", "on_hold")
form.setValue("expire", null);
form.clearErrors("expire");
+ } else if (selectedTab === "unlimited") {
+ form.setValue("status", "active")
+ form.setValue("expire", 0);
+ form.setValue("on_hold_expire_duration", 0);
+ form.setValue("on_hold_timeout", null);
+ form.clearErrors("expire");
+ form.clearErrors("on_hold_expire_duration");
+ form.clearErrors("on_hold_timeout");
} else {
form.setValue("status", "active")
form.setValue("on_hold_expire_duration", 0);
@@ -88,7 +97,7 @@ export const UsersMutationDialog: FC<UsersMutationDialogProps> = ({
return (
<Dialog open={open} onOpenChange={onOpenChange} defaultOpen={true}>
- <DialogContent>
+ <DialogContent className="sm:max-w-full md:max-w-[600px]">
<DialogHeader>
<DialogTitle className="text-primary">
{entity
@@ -105,6 +114,9 @@ export const UsersMutationDialog: FC<UsersMutationDialogProps> = ({
<DataLimitField />
{form.watch().data_limit !== 0 && <DataLimitResetStrategyField />}
</div>
+ <FormLabel>
+ {t('page.users.expire_method')}
+ </FormLabel>
<Tabs defaultValue="determined" onValueChange={setSelectedTab} className="mt-2 w-full">
<TabsList className="flex flex-row items-center p-1 w-full rounded-md bg-accent">
<TabsTrigger
@@ -117,6 +129,11 @@ export const UsersMutationDialog: FC<UsersMutationDialogProps> = ({
value="onhold">
{t('page.users.onhold_expire')}
</TabsTrigger>
+ <TabsTrigger
+ className="w-full"
+ value="unlimited">
+ {t('page.users.unlimited')}
+ </TabsTrigger>
</TabsList>
<TabsContent value="determined">
<ExpireDateField />