Remove admin functionality related code

The admin functionality related code has been removed which includes various user and organization functionalities like delete, update, ban etc. This includes action logic, UI components and supportive utility functions. Notable deletions include the server action files, dialog components for actions like banning and deleting, and related utility functions. This massive cleanup is aimed at simplifying the codebase and the commit reflects adherence to project restructuring.
This commit is contained in:
giancarlo
2024-03-25 15:40:43 +08:00
parent 752259ab17
commit 95793c42b4
135 changed files with 1062 additions and 2872 deletions

View File

@@ -36,7 +36,7 @@ export function PersonalAccountDropdown({
paths,
}: {
className?: string;
session: Session | undefined;
session: Session | null;
signOutRequested: () => unknown;
showProfileName?: boolean;
paths: {

View File

@@ -28,12 +28,13 @@ const AccountInfoSchema = z.object({
export function UpdateAccountDetailsForm({
displayName,
onUpdate,
userId,
}: {
displayName: string;
userId: string;
onUpdate: (user: Partial<UpdateUserDataParams>) => void;
}) {
const updateAccountMutation = useUpdateAccountData();
const updateAccountMutation = useUpdateAccountData(userId);
const { t } = useTranslation();
const form = useForm({

View File

@@ -29,7 +29,7 @@ export function UpdateAccountImageContainer() {
return (
<UploadProfileAvatarForm
currentPhotoURL={accountData.data.picture_url}
pictureUrl={accountData.data.picture_url ?? null}
userId={accountData.data.id}
onAvatarUpdated={revalidateUserDataQuery}
/>
@@ -37,7 +37,7 @@ export function UpdateAccountImageContainer() {
}
function UploadProfileAvatarForm(props: {
currentPhotoURL: string | null;
pictureUrl: string | null;
userId: string;
onAvatarUpdated: () => void;
}) {
@@ -58,10 +58,9 @@ function UploadProfileAvatarForm(props: {
const onValueChange = useCallback(
(file: File | null) => {
const removeExistingStorageFile = () => {
if (props.currentPhotoURL) {
if (props.pictureUrl) {
return (
deleteProfilePhoto(client, props.currentPhotoURL) ??
Promise.resolve()
deleteProfilePhoto(client, props.pictureUrl) ?? Promise.resolve()
);
}
@@ -108,7 +107,7 @@ function UploadProfileAvatarForm(props: {
);
return (
<ImageUploader value={props.currentPhotoURL} onValueChange={onValueChange}>
<ImageUploader value={props.pictureUrl} onValueChange={onValueChange}>
<div className={'flex flex-col space-y-1'}>
<span className={'text-sm'}>
<Trans i18nKey={'profile:profilePictureHeading'} />

View File

@@ -1,11 +1,16 @@
'use client';
import { useUser } from '@kit/supabase/hooks/use-user';
import { LoadingOverlay } from '@kit/ui/loading-overlay';
import { UpdateEmailForm } from './update-email-form';
export function UpdateEmailFormContainer(props: { callbackPath: string }) {
const { data: user } = useUser();
const { data: user, isPending } = useUser();
if (isPending) {
return <LoadingOverlay />;
}
if (!user) {
return null;

View File

@@ -2,6 +2,7 @@
import { useUser } from '@kit/supabase/hooks/use-user';
import { Alert } from '@kit/ui/alert';
import { LoadingOverlay } from '@kit/ui/loading-overlay';
import { Trans } from '@kit/ui/trans';
import { UpdatePasswordForm } from './update-password-form';
@@ -11,10 +12,10 @@ export function UpdatePasswordFormContainer(
callbackPath: string;
}>,
) {
const { data: user } = useUser();
const { data: user, isPending } = useUser();
if (!user) {
return null;
if (isPending) {
return <LoadingOverlay />;
}
const canUpdatePassword = user.identities?.some(