Merge branch 'filip-refactor-users-table' into filip-dry-subscription-status

This commit is contained in:
Filip Sodić 2025-02-24 15:26:51 +01:00
commit 490f32b43a
4 changed files with 24 additions and 28 deletions

View File

@ -1,14 +1,6 @@
--- template/app/src/admin/dashboards/users/UsersTable.tsx
+++ opensaas-sh/app/src/admin/dashboards/users/UsersTable.tsx
@@ -9,6 +9,7 @@
const [skip, setskip] = useState(0);
const [page, setPage] = useState(1);
const [email, setEmail] = useState<string | undefined>(undefined);
+
const [isAdminFilter, setIsAdminFilter] = useState<boolean | undefined>(undefined);
const [statusOptions, setStatusOptions] = useState<SubscriptionStatus[]>([]);
const { data, isLoading, error } = useQuery(getPaginatedUsers, {
@@ -211,7 +212,7 @@
@@ -202,7 +202,7 @@
<p className='text-sm text-black dark:text-white'>{user.subscriptionStatus}</p>
</div>
<div className='col-span-2 flex items-center'>

View File

@ -1,18 +1,18 @@
--- template/app/src/user/operations.ts
+++ opensaas-sh/app/src/user/operations.ts
@@ -41,7 +41,10 @@
@@ -34,10 +34,7 @@
};
type GetPaginatedUsersOutput = {
- users: Pick<User, 'id' | 'email' | 'username' | 'subscriptionStatus' | 'paymentProcessorUserId'>[];
+ users: Pick<
+ User,
+ 'id' | 'email' | 'username' | 'subscriptionStatus' | 'stripeId'
+ >[];
- users: Pick<
- User,
- 'id' | 'email' | 'username' | 'subscriptionStatus' | 'paymentProcessorUserId' | 'isAdmin'
- >[];
+ users: Pick<User, 'id' | 'email' | 'username' | 'subscriptionStatus' | 'stripeId' | 'isAdmin'>[];
totalPages: number;
};
@@ -85,6 +88,7 @@
@@ -85,6 +82,7 @@
mode: 'insensitive',
},
isAdmin,
@ -20,7 +20,7 @@
},
{
OR: [
@@ -108,7 +112,7 @@
@@ -106,7 +104,7 @@
username: true,
isAdmin: true,
subscriptionStatus: true,
@ -28,12 +28,4 @@
+ stripeId: true,
},
orderBy: {
id: 'desc',
@@ -124,6 +128,7 @@
mode: 'insensitive',
},
isAdmin,
+ isMockUser: true,
},
{
OR: [
username: 'asc',

View File

@ -8,7 +8,13 @@ function SwitcherOne({ isOn, onChange }: { isOn: boolean; onChange: (value: bool
<div className='relative'>
<label htmlFor={id} className='flex cursor-pointer select-none items-center'>
<div className='relative'>
<input id={id} type='checkbox' className='sr-only' onChange={(e) => onChange(e.target.checked)} />
<input
id={id}
type='checkbox'
className='sr-only'
checked={isOn}
onChange={(e) => onChange(e.target.checked)}
/>
<div className='reblock h-8 w-14 rounded-full bg-meta-9 dark:bg-[#5A616B]'></div>
<div
className={cn('absolute left-1 top-1 h-6 w-6 rounded-full bg-white dark:bg-gray-400 transition', {

View File

@ -8,7 +8,13 @@ function SwitcherTwo({ isOn, onChange }: { isOn: boolean; onChange: (value: bool
<div>
<label htmlFor={id} className='flex cursor-pointer select-none items-center'>
<div className='relative'>
<input type='checkbox' id={id} className='sr-only' onChange={(e) => onChange(e.target.checked)} />
<input
type='checkbox'
id={id}
className='sr-only'
checked={isOn}
onChange={(e) => onChange(e.target.checked)}
/>
<div className='block h-8 w-14 rounded-full bg-meta-9 dark:bg-[#5A616B]'></div>
<div
className={cn(