From 9294e1c823b8d53fd868b8b0c81c7e4326363b0f Mon Sep 17 00:00:00 2001 From: gbuomprisco Date: Fri, 21 Jun 2024 17:58:20 +0800 Subject: [PATCH] Refactor code for readability and order Made several changes across different files primarily focusing on readability. Arranged CSS classes in a standardized order for easier reading and maintenance. Arranged and formatted import lines, function declarations, and component return statements for legibility. Removed unnecessary React imports in some files. --- .../docs/_components/docs-navigation.tsx | 2 +- .../(marketing)/docs/_lib/server/docs.loader.ts | 2 +- .../_components/team-account-layout-sidebar.tsx | 1 + .../services/billing-strategy-provider.service.ts | 14 +++++++------- packages/billing/core/src/types/index.ts | 2 +- .../src/services/stripe-webhook-handler.service.ts | 8 ++------ .../email-templates/src/components/body-style.tsx | 2 -- .../email-templates/src/components/content.tsx | 3 +-- .../email-templates/src/components/cta-button.tsx | 3 +-- packages/email-templates/src/components/footer.tsx | 3 +-- packages/email-templates/src/components/header.tsx | 7 +------ .../email-templates/src/components/heading.tsx | 3 +-- .../email-templates/src/components/wrapper.tsx | 3 +-- .../auth/src/components/update-password-form.tsx | 6 +----- packages/ui/src/shadcn/form.tsx | 8 ++++++-- 15 files changed, 26 insertions(+), 41 deletions(-) diff --git a/apps/web/app/(marketing)/docs/_components/docs-navigation.tsx b/apps/web/app/(marketing)/docs/_components/docs-navigation.tsx index 99385ac0b..6fe22b971 100644 --- a/apps/web/app/(marketing)/docs/_components/docs-navigation.tsx +++ b/apps/web/app/(marketing)/docs/_components/docs-navigation.tsx @@ -112,7 +112,7 @@ export function DocsNavigation({ pages }: { pages: Cms.ContentItem[] }) { style={{ height: `calc(100vh - 64px)`, }} - className="sticky top-2 hidden w-80 shrink-0 border-r p-4 lg:flex overflow-y-auto" + className="sticky top-2 hidden w-80 shrink-0 overflow-y-auto border-r p-4 lg:flex" > diff --git a/apps/web/app/(marketing)/docs/_lib/server/docs.loader.ts b/apps/web/app/(marketing)/docs/_lib/server/docs.loader.ts index 88cec4ced..a0e3f69f2 100644 --- a/apps/web/app/(marketing)/docs/_lib/server/docs.loader.ts +++ b/apps/web/app/(marketing)/docs/_lib/server/docs.loader.ts @@ -15,7 +15,7 @@ async function docsLoader(language: string | undefined) { const { items: pages } = await cms.getContentItems({ collection: 'documentation', language, - limit: 500 + limit: 500, }); return pages; diff --git a/apps/web/app/home/[account]/_components/team-account-layout-sidebar.tsx b/apps/web/app/home/[account]/_components/team-account-layout-sidebar.tsx index d431f4fda..b254b4300 100644 --- a/apps/web/app/home/[account]/_components/team-account-layout-sidebar.tsx +++ b/apps/web/app/home/[account]/_components/team-account-layout-sidebar.tsx @@ -1,4 +1,5 @@ import { User } from '@supabase/supabase-js'; + import { Sidebar, SidebarContent } from '@kit/ui/sidebar'; import { ProfileAccountDropdownContainer } from '~/components//personal-account-dropdown-container'; diff --git a/packages/billing/core/src/services/billing-strategy-provider.service.ts b/packages/billing/core/src/services/billing-strategy-provider.service.ts index 1529a174a..792851ca4 100644 --- a/packages/billing/core/src/services/billing-strategy-provider.service.ts +++ b/packages/billing/core/src/services/billing-strategy-provider.service.ts @@ -67,11 +67,11 @@ export abstract class BillingStrategyProviderService { amount: number; }>; - abstract getSubscription( - subscriptionId: string, - ): Promise; + abstract getSubscription(subscriptionId: string): Promise< + UpsertSubscriptionParams & { + // we can't always guarantee that the target account id will be present + // so we need to make it optional and let the consumer handle it + target_account_id: string | undefined; + } + >; } diff --git a/packages/billing/core/src/types/index.ts b/packages/billing/core/src/types/index.ts index f62f12819..91ad00238 100644 --- a/packages/billing/core/src/types/index.ts +++ b/packages/billing/core/src/types/index.ts @@ -19,4 +19,4 @@ interface LineItem { } export type UpsertOrderParams = - Database['public']['Functions']['upsert_order']['Args']; \ No newline at end of file + Database['public']['Functions']['upsert_order']['Args']; diff --git a/packages/billing/stripe/src/services/stripe-webhook-handler.service.ts b/packages/billing/stripe/src/services/stripe-webhook-handler.service.ts index 11c2883b9..86df301f4 100644 --- a/packages/billing/stripe/src/services/stripe-webhook-handler.service.ts +++ b/packages/billing/stripe/src/services/stripe-webhook-handler.service.ts @@ -88,9 +88,7 @@ export class StripeWebhookHandlerService onSubscriptionDeleted: (subscriptionId: string) => Promise; onPaymentSucceeded: (sessionId: string) => Promise; onPaymentFailed: (sessionId: string) => Promise; - onInvoicePaid: ( - data: UpsertSubscriptionParams, - ) => Promise; + onInvoicePaid: (data: UpsertSubscriptionParams) => Promise; onEvent?(event: Stripe.Event): Promise; }, ) { @@ -294,9 +292,7 @@ export class StripeWebhookHandlerService private async handleInvoicePaid( event: Stripe.InvoicePaidEvent, - onInvoicePaid: ( - data: UpsertSubscriptionParams, - ) => Promise, + onInvoicePaid: (data: UpsertSubscriptionParams) => Promise, ) { const stripe = await this.loadStripe(); diff --git a/packages/email-templates/src/components/body-style.tsx b/packages/email-templates/src/components/body-style.tsx index 325cd746a..cdc28633d 100644 --- a/packages/email-templates/src/components/body-style.tsx +++ b/packages/email-templates/src/components/body-style.tsx @@ -1,5 +1,3 @@ -import * as React from 'react'; - export function BodyStyle() { return (