Optimized agents rules subfolders, dependencies updates (#355)
* Update AGENTS.md and CLAUDE.md for improved clarity and structure * Added MCP Server * Added missing triggers to tables that should have used them * Updated all dependencies * Fixed rare bug in React present in the Admin layout which prevents navigating to pages (sometimes...)
This commit is contained in:
committed by
GitHub
parent
9fae142f2d
commit
533dfba5b9
@@ -46,18 +46,18 @@ export function AdminAccountPage(props: {
|
||||
async function PersonalAccountPage(props: { account: Account }) {
|
||||
const adminClient = getSupabaseServerAdminClient();
|
||||
|
||||
const { data, error } = await adminClient.auth.admin.getUserById(
|
||||
props.account.id,
|
||||
);
|
||||
const [memberships, userResult] = await Promise.all([
|
||||
getMemberships(props.account.id),
|
||||
adminClient.auth.admin.getUserById(props.account.id),
|
||||
]);
|
||||
|
||||
if (!data || error) {
|
||||
throw new Error(`User not found`);
|
||||
if (userResult.error) {
|
||||
throw userResult.error;
|
||||
}
|
||||
|
||||
const memberships = await getMemberships(props.account.id);
|
||||
|
||||
const isBanned =
|
||||
'banned_until' in data.user && data.user.banned_until !== 'none';
|
||||
'banned_until' in userResult.data.user &&
|
||||
userResult.data.user.banned_until !== 'none';
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -168,6 +168,7 @@ function getColumns(): ColumnDef<Account>[] {
|
||||
cell: ({ row }) => {
|
||||
return (
|
||||
<Link
|
||||
prefetch={false}
|
||||
className={'hover:underline'}
|
||||
href={`/admin/accounts/${row.original.id}`}
|
||||
>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import { useState, useTransition } from 'react';
|
||||
|
||||
import { isRedirectError } from 'next/dist/client/components/redirect-error';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useForm } from 'react-hook-form';
|
||||
|
||||
@@ -77,11 +79,9 @@ function BanUserForm(props: { userId: string }) {
|
||||
onSubmit={form.handleSubmit((data) => {
|
||||
startTransition(async () => {
|
||||
try {
|
||||
const result = await banUserAction(data);
|
||||
|
||||
setError(!result.success);
|
||||
} catch {
|
||||
setError(true);
|
||||
await banUserAction(data);
|
||||
} catch (error) {
|
||||
setError(!isRedirectError(error));
|
||||
}
|
||||
});
|
||||
})}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import { useState, useTransition } from 'react';
|
||||
|
||||
import { isRedirectError } from 'next/dist/client/components/redirect-error';
|
||||
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useForm } from 'react-hook-form';
|
||||
|
||||
@@ -76,11 +78,9 @@ function ReactivateUserForm(props: { userId: string }) {
|
||||
onSubmit={form.handleSubmit((data) => {
|
||||
startTransition(async () => {
|
||||
try {
|
||||
const result = await reactivateUserAction(data);
|
||||
|
||||
setError(!result.success);
|
||||
} catch {
|
||||
setError(true);
|
||||
await reactivateUserAction(data);
|
||||
} catch (error) {
|
||||
setError(!isRedirectError(error));
|
||||
}
|
||||
});
|
||||
})}
|
||||
|
||||
@@ -47,9 +47,7 @@ export const banUserAction = adminAction(
|
||||
|
||||
revalidateAdmin();
|
||||
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
return redirect(`/admin/accounts/${userId}`);
|
||||
},
|
||||
{
|
||||
schema: BanUserSchema,
|
||||
@@ -83,9 +81,7 @@ export const reactivateUserAction = adminAction(
|
||||
|
||||
logger.info({ userId }, `Super Admin has successfully reactivated user`);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
return redirect(`/admin/accounts/${userId}`);
|
||||
},
|
||||
{
|
||||
schema: ReactivateUserSchema,
|
||||
|
||||
Reference in New Issue
Block a user