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.
This commit is contained in:
gbuomprisco
2024-06-21 17:58:20 +08:00
parent 8c929e6685
commit 9294e1c823
15 changed files with 26 additions and 41 deletions

View File

@@ -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"
>
<Tree pages={pages} level={0} activePath={activePath} />
</aside>

View File

@@ -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;

View File

@@ -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';

View File

@@ -67,11 +67,11 @@ export abstract class BillingStrategyProviderService {
amount: number;
}>;
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;
}>;
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;
}
>;
}

View File

@@ -19,4 +19,4 @@ interface LineItem {
}
export type UpsertOrderParams =
Database['public']['Functions']['upsert_order']['Args'];
Database['public']['Functions']['upsert_order']['Args'];

View File

@@ -88,9 +88,7 @@ export class StripeWebhookHandlerService
onSubscriptionDeleted: (subscriptionId: string) => Promise<unknown>;
onPaymentSucceeded: (sessionId: string) => Promise<unknown>;
onPaymentFailed: (sessionId: string) => Promise<unknown>;
onInvoicePaid: (
data: UpsertSubscriptionParams,
) => Promise<unknown>;
onInvoicePaid: (data: UpsertSubscriptionParams) => Promise<unknown>;
onEvent?(event: Stripe.Event): Promise<unknown>;
},
) {
@@ -294,9 +292,7 @@ export class StripeWebhookHandlerService
private async handleInvoicePaid(
event: Stripe.InvoicePaidEvent,
onInvoicePaid: (
data: UpsertSubscriptionParams,
) => Promise<unknown>,
onInvoicePaid: (data: UpsertSubscriptionParams) => Promise<unknown>,
) {
const stripe = await this.loadStripe();

View File

@@ -1,5 +1,3 @@
import * as React from 'react';
export function BodyStyle() {
return (
<style>

View File

@@ -1,5 +1,4 @@
import { Container } from '@react-email/components';
import * as React from 'react';
export function EmailContent(
props: React.PropsWithChildren<{
@@ -9,7 +8,7 @@ export function EmailContent(
return (
<Container
className={
'rounded-xl my-[8px] px-[24px] py-[12px] mx-auto border border-solid border-[#eeeeee] ' +
'mx-auto my-[8px] rounded-xl border border-solid border-[#eeeeee] px-[24px] py-[12px] ' +
props.className || ''
}
>

View File

@@ -1,5 +1,4 @@
import { Button } from '@react-email/components';
import * as React from 'react';
export function CtaButton(
props: React.PropsWithChildren<{
@@ -8,7 +7,7 @@ export function CtaButton(
) {
return (
<Button
className="w-full bg-[#000000] rounded text-white text-[14px] font-semibold no-underline text-center py-3"
className="w-full rounded bg-[#000000] py-3 text-center text-[14px] font-semibold text-white no-underline"
href={props.href}
>
{props.children}

View File

@@ -1,10 +1,9 @@
import { Container, Text } from '@react-email/components';
import * as React from 'react';
export function EmailFooter(props: React.PropsWithChildren) {
return (
<Container>
<Text className="text-[12px] leading-[24px] text-gray-300 px-4">
<Text className="px-4 text-[12px] leading-[24px] text-gray-300">
{props.children}
</Text>
</Container>

View File

@@ -1,10 +1,5 @@
import { Container } from '@react-email/components';
import * as React from 'react';
export function EmailHeader(props: React.PropsWithChildren) {
return (
<Container>
{props.children}
</Container>
);
return <Container>{props.children}</Container>;
}

View File

@@ -1,9 +1,8 @@
import * as React from 'react';
import { Heading } from '@react-email/components';
export function EmailHeading(props: React.PropsWithChildren) {
return (
<Heading className="text-black font-sans tracking-tight text-[20px] font-normal p-0 mx-0">
<Heading className="mx-0 p-0 font-sans text-[20px] font-normal tracking-tight text-black">
{props.children}
</Heading>
);

View File

@@ -1,5 +1,4 @@
import { Container } from '@react-email/components';
import * as React from 'react';
export function EmailWrapper(
props: React.PropsWithChildren<{
@@ -21,7 +20,7 @@ export function EmailWrapper(
backgroundColor: '#fff',
margin: 'auto',
}}
className={'my-[36px] mx-auto px-4 ' + props.className || ''}
className={'mx-auto my-[36px] px-4 ' + props.className || ''}
>
{props.children}
</Container>

View File

@@ -3,11 +3,7 @@
import Link from 'next/link';
import { zodResolver } from '@hookform/resolvers/zod';
import {
CheckIcon,
ExclamationTriangleIcon,
} from '@radix-ui/react-icons';
import { CheckIcon, ExclamationTriangleIcon } from '@radix-ui/react-icons';
import { ArrowRightIcon } from 'lucide-react';
import { useForm } from 'react-hook-form';
import type { z } from 'zod';

View File

@@ -7,9 +7,9 @@ import { Slot } from '@radix-ui/react-slot';
import type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
import { Controller, FormProvider, useFormContext } from 'react-hook-form';
import { Trans } from '../makerkit/trans';
import { cn } from '../utils';
import { Label } from './label';
import {Trans} from "../makerkit/trans";
const Form = FormProvider;
@@ -157,7 +157,11 @@ const FormMessage = React.forwardRef<
className={cn('text-[0.8rem] font-medium text-destructive', className)}
{...props}
>
{typeof body === 'string' ? <Trans i18nKey={body} defaults={body} /> : body}
{typeof body === 'string' ? (
<Trans i18nKey={body} defaults={body} />
) : (
body
)}
</p>
);
});