refactor: rename getPricePlans to usePricePlans for improved clarity and consistency

This commit is contained in:
javayhu 2025-09-05 00:05:10 +08:00
parent ba7b950c01
commit 6065c4af06
3 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
'use client';
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 {
PaymentTypes,
@ -36,7 +36,7 @@ export function PricingTable({
const [interval, setInterval] = useState<PlanInterval>(PlanIntervals.MONTH);
// Get price plans with translations
const pricePlans = getPricePlans();
const pricePlans = usePricePlans();
const plans = Object.values(pricePlans);
// Current plan ID for comparison

View File

@ -12,7 +12,7 @@ import {
CardTitle,
} from '@/components/ui/card';
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 { useCurrentPlan } from '@/hooks/use-payment';
import { LocaleLink, useLocaleRouter } from '@/i18n/navigation';
@ -50,7 +50,7 @@ export default function BillingCard() {
const subscription = paymentData?.subscription;
// Get price plans with translations - must be called here to maintain hook order
const pricePlans = getPricePlans();
const pricePlans = usePricePlans();
const plans = Object.values(pricePlans);
// Convert current plan to a plan with translations

View File

@ -16,7 +16,7 @@ import { websiteConfig } from './website';
*
* @returns The price plans with translated content
*/
export function getPricePlans(): Record<string, PricePlan> {
export function usePricePlans(): Record<string, PricePlan> {
const t = useTranslations('PricePlans');
const priceConfig = websiteConfig.price;
const plans: Record<string, PricePlan> = {};