diff --git a/src/app/manage/page.tsx b/src/app/manage/page.tsx index 77b09d8..c8b3f64 100644 --- a/src/app/manage/page.tsx +++ b/src/app/manage/page.tsx @@ -3,6 +3,8 @@ import { ManagePageContainer } from './views/ManagePageContainer'; import { SimpleButton } from '@/components/styled/SimpleButton'; import { apiUrl } from '@/config'; import { CustomFieldAccessResponse } from '@/types/customFieldAccess'; +import { Settings } from '@mui/icons-material'; +import { ProfileLinks } from '@/types/settings'; export const revalidate = 0; @@ -75,14 +77,16 @@ export default async function ManagePage({ searchParams }: { searchParams: { tok /> - Other settings + {settings && (settings.includes(ProfileLinks.PaymentMethod) || settings.includes(ProfileLinks.ProfileSetting)) && ( + Other settings + )} - {settings && settings.includes('profile_settings') && ( + {settings && settings.includes(ProfileLinks.PaymentMethod) && ( Set a payment method )} - {settings && settings.includes('payment_method') && ( + {settings && settings.includes(ProfileLinks.ProfileSetting) && ( Go to account settings diff --git a/src/app/views/Sidebar.tsx b/src/app/views/Sidebar.tsx index 5c72577..fdbf73f 100644 --- a/src/app/views/Sidebar.tsx +++ b/src/app/views/Sidebar.tsx @@ -12,32 +12,16 @@ export const Sidebar = () => { const handleMutableSettings = (selected: boolean, type: string) => { if (!selected) { - if (type === ProfileLinks.ProfileSetting) { - const newSettings = appState?.mutableSettings.filter((el: string) => el !== type); - appState?.setAppState((prev) => ({ ...prev, mutableSettings: newSettings })); - } - if (type === ProfileLinks.PaymentMethod) { - const newSettings = appState?.mutableSettings.filter((el: string) => el !== type); - appState?.setAppState((prev) => ({ ...prev, mutableSettings: newSettings })); - } + const newSettings = appState?.mutableSettings.filter((el: string) => el !== type); + appState?.setAppState((prev) => ({ ...prev, mutableSettings: newSettings })); } if (selected) { - if (type === ProfileLinks.ProfileSetting) { - appState?.setAppState((prev) => ({ - ...prev, - mutableSettings: appState?.mutableSettings.includes(type) - ? appState?.mutableSettings - : [...appState?.mutableSettings, type], - })); - } - if (type === ProfileLinks.PaymentMethod) { - appState?.setAppState((prev) => ({ - ...prev, - mutableSettings: appState?.mutableSettings.includes(type) - ? appState?.mutableSettings - : [...appState?.mutableSettings, type], - })); - } + appState?.setAppState((prev) => ({ + ...prev, + mutableSettings: appState?.mutableSettings.includes(type) + ? appState?.mutableSettings + : [...appState?.mutableSettings, type], + })); } };