diff --git a/apps/web/app/orgs/[orgslug]/dash/payments/[subpage]/page.tsx b/apps/web/app/orgs/[orgslug]/dash/payments/[subpage]/page.tsx index 173ececd..7d52fd43 100644 --- a/apps/web/app/orgs/[orgslug]/dash/payments/[subpage]/page.tsx +++ b/apps/web/app/orgs/[orgslug]/dash/payments/[subpage]/page.tsx @@ -1,10 +1,10 @@ 'use client' -import React, { useState, useEffect } from 'react' +import React from 'react' import { motion } from 'framer-motion' import BreadCrumbs from '@components/Dashboard/Misc/BreadCrumbs' import Link from 'next/link' import { getUriWithOrg } from '@services/config/config' -import { CreditCard, Settings, Repeat, BookOpen, Users, DollarSign, Gem } from 'lucide-react' +import { Settings, Users, Gem } from 'lucide-react' import { useLHSession } from '@components/Contexts/LHSessionContext' import { useOrg } from '@components/Contexts/OrgContext' import PaymentsConfigurationPage from '@components/Dashboard/Pages/Payments/PaymentsConfigurationPage' @@ -20,18 +20,37 @@ export type PaymentsParams = { function PaymentsPage({ params }: { params: PaymentsParams }) { const session = useLHSession() as any const org = useOrg() as any - const [selectedSubPage, setSelectedSubPage] = useState(params.subpage || 'general') - const [H1Label, setH1Label] = useState('') - const [H2Label, setH2Label] = useState('') + const subpage = params.subpage || 'customers' const isPaymentsEnabled = useFeatureFlag({ path: ['features', 'payments', 'enabled'], defaultValue: false }) - useEffect(() => { - handleLabels() - }, [selectedSubPage]) + const getPageTitle = () => { + switch (subpage) { + case 'customers': + return { + h1: 'Customers', + h2: 'View and manage your customer information' + } + case 'paid-products': + return { + h1: 'Paid Products', + h2: 'Manage your paid products and pricing' + } + case 'configuration': + return { + h1: 'Payment Configuration', + h2: 'Set up and manage your payment gateway' + } + default: + return { + h1: 'Payments', + h2: 'Overview of your payment settings and transactions' + } + } + } if (!isPaymentsEnabled) { return ( @@ -45,66 +64,41 @@ function PaymentsPage({ params }: { params: PaymentsParams }) { ) } - function handleLabels() { - if (selectedSubPage === 'general') { - setH1Label('Payments') - setH2Label('Overview of your payment settings and transactions') - } - if (selectedSubPage === 'configuration') { - setH1Label('Payment Configuration') - setH2Label('Set up and manage your payment gateway') - } - if (selectedSubPage === 'subscriptions') { - setH1Label('Subscriptions') - setH2Label('Manage your subscription plans') - } - if (selectedSubPage === 'paid-products') { - setH1Label('Paid Products') - setH2Label('Manage your paid products and pricing') - } - if (selectedSubPage === 'customers') { - setH1Label('Customers') - setH2Label('View and manage your customer information') - } - } + const { h1, h2 } = getPageTitle() return (