From 545cac1967f6882780021407a474690fea3f11ed Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Tue, 1 Jul 2025 22:51:59 +0000
Subject: feat: Add per user bookmark count quota

---
 apps/web/components/admin/UserList.tsx | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

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

diff --git a/apps/web/components/admin/UserList.tsx b/apps/web/components/admin/UserList.tsx
index c32c13e3..a3b4d94f 100644
--- a/apps/web/components/admin/UserList.tsx
+++ b/apps/web/components/admin/UserList.tsx
@@ -19,8 +19,8 @@ import { useSession } from "next-auth/react";
 
 import ActionConfirmingDialog from "../ui/action-confirming-dialog";
 import AddUserDialog from "./AddUserDialog";
-import ChangeRoleDialog from "./ChangeRoleDialog";
 import ResetPasswordDialog from "./ResetPasswordDialog";
+import UpdateUserDialog from "./UpdateUserDialog";
 
 function toHumanReadableSize(size: number) {
   const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
@@ -71,6 +71,7 @@ export default function UsersSection() {
           <TableHead>{t("common.name")}</TableHead>
           <TableHead>{t("common.email")}</TableHead>
           <TableHead>{t("admin.users_list.num_bookmarks")}</TableHead>
+          <TableHead>{t("common.quota")}</TableHead>
           <TableHead>{t("admin.users_list.asset_sizes")}</TableHead>
           <TableHead>{t("common.role")}</TableHead>
           <TableHead>{t("admin.users_list.local_user")}</TableHead>
@@ -84,6 +85,9 @@ export default function UsersSection() {
               <TableCell className="py-1">
                 {userStats[u.id].numBookmarks}
               </TableCell>
+              <TableCell className="py-1">
+                {u.bookmarkQuota ?? t("admin.users_list.unlimited")}
+              </TableCell>
               <TableCell className="py-1">
                 {toHumanReadableSize(userStats[u.id].assetSizes)}
               </TableCell>
@@ -132,15 +136,19 @@ export default function UsersSection() {
                     <KeyRound size={16} color="red" />
                   </ButtonWithTooltip>
                 </ResetPasswordDialog>
-                <ChangeRoleDialog userId={u.id} currentRole={u.role!}>
+                <UpdateUserDialog
+                  userId={u.id}
+                  currentRole={u.role!}
+                  currentQuota={u.bookmarkQuota}
+                >
                   <ButtonWithTooltip
-                    tooltip={t("admin.users_list.change_role")}
+                    tooltip="Edit User"
                     variant="outline"
                     disabled={session!.user.id == u.id}
                   >
                     <Pencil size={16} color="red" />
                   </ButtonWithTooltip>
-                </ChangeRoleDialog>
+                </UpdateUserDialog>
               </TableCell>
             </TableRow>
           ))}
-- 
cgit v1.2.3-70-g09d2

