diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-07-06 15:54:49 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2025-07-06 16:32:35 +0000 |
| commit | 384432d31e7bee6bf35d8af6b7165410303ffda4 (patch) | |
| tree | ddb845aa8dacbf00151ee3fda8a233d0620d6ab1 /apps/web/components/admin/UpdateUserDialog.tsx | |
| parent | 47624547f8cb352426d597537c11e7a4550aa91e (diff) | |
| download | karakeep-384432d31e7bee6bf35d8af6b7165410303ffda4.tar.zst | |
feat: Add per user storage quota
Diffstat (limited to 'apps/web/components/admin/UpdateUserDialog.tsx')
| -rw-r--r-- | apps/web/components/admin/UpdateUserDialog.tsx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/web/components/admin/UpdateUserDialog.tsx b/apps/web/components/admin/UpdateUserDialog.tsx index 82a239ca..7093ccda 100644 --- a/apps/web/components/admin/UpdateUserDialog.tsx +++ b/apps/web/components/admin/UpdateUserDialog.tsx @@ -41,12 +41,14 @@ interface UpdateUserDialogProps { userId: string; currentRole: "user" | "admin"; currentQuota: number | null; + currentStorageQuota: number | null; children?: React.ReactNode; } export default function UpdateUserDialog({ userId, currentRole, currentQuota, + currentStorageQuota, children, }: UpdateUserDialogProps) { const apiUtils = api.useUtils(); @@ -55,6 +57,7 @@ export default function UpdateUserDialog({ userId, role: currentRole, bookmarkQuota: currentQuota, + storageQuota: currentStorageQuota, }; const form = useForm<UpdateUserSchema>({ resolver: zodResolver(updateUserSchema), @@ -149,6 +152,29 @@ export default function UpdateUserDialog({ /> <FormField control={form.control} + name="storageQuota" + render={({ field }) => ( + <FormItem> + <FormLabel>Storage Quota (bytes)</FormLabel> + <FormControl> + <Input + type="number" + min="0" + placeholder="Unlimited (leave empty)" + {...field} + value={field.value ?? ""} + onChange={(e) => { + const value = e.target.value; + field.onChange(value === "" ? null : parseInt(value)); + }} + /> + </FormControl> + <FormMessage /> + </FormItem> + )} + /> + <FormField + control={form.control} name="userId" render={({ field }) => ( <FormItem> |
