From 384432d31e7bee6bf35d8af6b7165410303ffda4 Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Sun, 6 Jul 2025 15:54:49 +0000
Subject: feat: Add per user storage quota

---
 apps/web/components/admin/UpdateUserDialog.tsx | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

(limited to 'apps/web/components/admin/UpdateUserDialog.tsx')

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),
@@ -147,6 +150,29 @@ export default function UpdateUserDialog({
                   </FormItem>
                 )}
               />
+              <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"
-- 
cgit v1.2.3-70-g09d2

