refactor: rename getPricePlans to usePricePlans for improved clarity and consistency
This commit is contained in:
parent
ba7b950c01
commit
6065c4af06
@ -1,7 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
|
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
|
||||||
import { getPricePlans } from '@/config/price-config';
|
import { usePricePlans } from '@/config/price-config';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import {
|
import {
|
||||||
PaymentTypes,
|
PaymentTypes,
|
||||||
@ -36,7 +36,7 @@ export function PricingTable({
|
|||||||
const [interval, setInterval] = useState<PlanInterval>(PlanIntervals.MONTH);
|
const [interval, setInterval] = useState<PlanInterval>(PlanIntervals.MONTH);
|
||||||
|
|
||||||
// Get price plans with translations
|
// Get price plans with translations
|
||||||
const pricePlans = getPricePlans();
|
const pricePlans = usePricePlans();
|
||||||
const plans = Object.values(pricePlans);
|
const plans = Object.values(pricePlans);
|
||||||
|
|
||||||
// Current plan ID for comparison
|
// Current plan ID for comparison
|
||||||
|
@ -12,7 +12,7 @@ import {
|
|||||||
CardTitle,
|
CardTitle,
|
||||||
} from '@/components/ui/card';
|
} from '@/components/ui/card';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
import { getPricePlans } from '@/config/price-config';
|
import { usePricePlans } from '@/config/price-config';
|
||||||
import { useMounted } from '@/hooks/use-mounted';
|
import { useMounted } from '@/hooks/use-mounted';
|
||||||
import { useCurrentPlan } from '@/hooks/use-payment';
|
import { useCurrentPlan } from '@/hooks/use-payment';
|
||||||
import { LocaleLink, useLocaleRouter } from '@/i18n/navigation';
|
import { LocaleLink, useLocaleRouter } from '@/i18n/navigation';
|
||||||
@ -50,7 +50,7 @@ export default function BillingCard() {
|
|||||||
const subscription = paymentData?.subscription;
|
const subscription = paymentData?.subscription;
|
||||||
|
|
||||||
// Get price plans with translations - must be called here to maintain hook order
|
// Get price plans with translations - must be called here to maintain hook order
|
||||||
const pricePlans = getPricePlans();
|
const pricePlans = usePricePlans();
|
||||||
const plans = Object.values(pricePlans);
|
const plans = Object.values(pricePlans);
|
||||||
|
|
||||||
// Convert current plan to a plan with translations
|
// Convert current plan to a plan with translations
|
||||||
|
@ -16,7 +16,7 @@ import { websiteConfig } from './website';
|
|||||||
*
|
*
|
||||||
* @returns The price plans with translated content
|
* @returns The price plans with translated content
|
||||||
*/
|
*/
|
||||||
export function getPricePlans(): Record<string, PricePlan> {
|
export function usePricePlans(): Record<string, PricePlan> {
|
||||||
const t = useTranslations('PricePlans');
|
const t = useTranslations('PricePlans');
|
||||||
const priceConfig = websiteConfig.price;
|
const priceConfig = websiteConfig.price;
|
||||||
const plans: Record<string, PricePlan> = {};
|
const plans: Record<string, PricePlan> = {};
|
||||||
|
Loading…
Reference in New Issue
Block a user