Files
myeasycms-v2/packages/billing/gateway/src/components/current-plan-alert.tsx
Giancarlo Buomprisco 1c31e7ffab Update Calendar component and update dependencies and updated Agents MD files (#269)
* Update Calendar component and update dependencies

* Refactor AGENTS.md and CLAUDE.md for clarity and consistency

- Streamlined project overview and architecture sections in both AGENTS.md and CLAUDE.md to enhance readability.
- Updated command sections to reflect essential commands and improved formatting for better usability.
- Clarified multi-tenant architecture details and database operations, ensuring accurate representation of the project's structure.
- Enhanced component organization and security guidelines for better developer onboarding and adherence to best practices.

* Refactor code for consistency and readability

- Improved formatting in `env-variables-model.ts` for better description clarity.
- Enhanced readability of `current-plan-alert.tsx` and `current-plan-badge.tsx` by adjusting the status badge mapping.
- Standardized object syntax in `lemon-squeezy-webhook-handler.service.ts` for consistency.
- Refined className ordering in `account-selector.tsx` for better maintainability.
- Ensured proper syntax in `console.ts` with consistent object export.
- Reorganized imports in `calendar.tsx` for clarity and structure.
- Improved className formatting in `sidebar.tsx` for better readability.

* Update package version to 2.10.0 in package.json
2025-06-08 14:31:49 +08:00

42 lines
1007 B
TypeScript

import { Enums } from '@kit/supabase/database';
import { Alert, AlertDescription, AlertTitle } from '@kit/ui/alert';
import { Trans } from '@kit/ui/trans';
const statusBadgeMap: Record<
Enums<'subscription_status'>,
`success` | `destructive` | `warning`
> = {
active: 'success',
trialing: 'success',
past_due: 'destructive',
canceled: 'destructive',
unpaid: 'destructive',
incomplete: 'warning',
incomplete_expired: 'destructive',
paused: 'warning',
};
export function CurrentPlanAlert(
props: React.PropsWithoutRef<{
status: Enums<'subscription_status'>;
}>,
) {
const prefix = 'billing:status';
const text = `${prefix}.${props.status}.description`;
const title = `${prefix}.${props.status}.heading`;
const variant = statusBadgeMap[props.status];
return (
<Alert variant={variant}>
<AlertTitle>
<Trans i18nKey={title} />
</AlertTitle>
<AlertDescription>
<Trans i18nKey={text} />
</AlertDescription>
</Alert>
);
}