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

@@ -1,9 +1,25 @@
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
import { If } from '@kit/ui/if';
import { PageBody, PageHeader } from '@kit/ui/page';
import { Trans } from '@kit/ui/trans';
import { loadOrganizationWorkspace } from '~/(dashboard)/home/[account]/_lib/load-workspace';
import { BillingPortalForm } from '~/(dashboard)/home/[account]/billing/_components/billing-portal-form';
import { withI18n } from '~/lib/i18n/with-i18n';
function OrganizationAccountBillingPage() {
import { TeamAccountCheckoutForm } from './_components/team-account-checkout-form';
interface Params {
params: {
account: string;
};
}
async function OrganizationAccountBillingPage({ params }: Params) {
const workspace = await loadOrganizationWorkspace(params.account);
const accountId = workspace.account.id;
const customerId = await loadCustomerIdFromAccount(accountId);
return (
<>
<PageHeader
@@ -11,9 +27,31 @@ function OrganizationAccountBillingPage() {
description={<Trans i18nKey={'common:billingTabDescription'} />}
/>
<PageBody></PageBody>
<PageBody>
<TeamAccountCheckoutForm accountId={accountId} />
<If condition={customerId}>
<BillingPortalForm accountId={accountId} />
</If>
</PageBody>
</>
);
}
export default withI18n(OrganizationAccountBillingPage);
async function loadCustomerIdFromAccount(accountId: string) {
const client = getSupabaseServerComponentClient();
const { data, error } = await client
.from('billing_customers')
.select('customer_id')
.eq('account_id', accountId)
.maybeSingle();
if (error) {
throw error;
}
return data?.customer_id;
}