New useNavigateApp (#9729)
Todo : - replace all instances of useNavigate( - remove getSettingsPagePath - add eslint rule to enfore usage of useNavigateApp instead of useNavigate
This commit is contained in:
@ -11,9 +11,6 @@ export const AppRouter = () => {
|
||||
const isFreeAccessEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IsFreeAccessEnabled,
|
||||
);
|
||||
const isCRMMigrationEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IsCrmMigrationEnabled,
|
||||
);
|
||||
const isServerlessFunctionSettingsEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IsFunctionSettingsEnabled,
|
||||
);
|
||||
@ -29,7 +26,6 @@ export const AppRouter = () => {
|
||||
<RouterProvider
|
||||
router={useCreateAppRouter(
|
||||
isBillingPageEnabled,
|
||||
isCRMMigrationEnabled,
|
||||
isServerlessFunctionSettingsEnabled,
|
||||
isAdminPageEnabled,
|
||||
)}
|
||||
|
||||
@ -2,7 +2,6 @@ import { lazy, Suspense } from 'react';
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
|
||||
import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';
|
||||
import { AppPath } from '@/types/AppPath';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
|
||||
const SettingsAccountsCalendars = lazy(() =>
|
||||
@ -226,14 +225,6 @@ const SettingsObjectFieldEdit = lazy(() =>
|
||||
),
|
||||
);
|
||||
|
||||
const SettingsCRMMigration = lazy(() =>
|
||||
import('~/pages/settings/crm-migration/SettingsCRMMigration').then(
|
||||
(module) => ({
|
||||
default: module.SettingsCRMMigration,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
const SettingsSecurity = lazy(() =>
|
||||
import('~/pages/settings/security/SettingsSecurity').then((module) => ({
|
||||
default: module.SettingsSecurity,
|
||||
@ -264,14 +255,12 @@ const SettingsAdminContent = lazy(() =>
|
||||
|
||||
type SettingsRoutesProps = {
|
||||
isBillingEnabled?: boolean;
|
||||
isCRMMigrationEnabled?: boolean;
|
||||
isServerlessFunctionSettingsEnabled?: boolean;
|
||||
isAdminPageEnabled?: boolean;
|
||||
};
|
||||
|
||||
export const SettingsRoutes = ({
|
||||
isBillingEnabled,
|
||||
isCRMMigrationEnabled,
|
||||
isServerlessFunctionSettingsEnabled,
|
||||
isAdminPageEnabled,
|
||||
}: SettingsRoutesProps) => (
|
||||
@ -310,34 +299,22 @@ export const SettingsRoutes = ({
|
||||
/>
|
||||
<Route path={SettingsPath.NewObject} element={<SettingsNewObject />} />
|
||||
<Route path={SettingsPath.Developers} element={<SettingsDevelopers />} />
|
||||
{isCRMMigrationEnabled && (
|
||||
<Route
|
||||
path={SettingsPath.CRMMigration}
|
||||
element={<SettingsCRMMigration />}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Route
|
||||
path={AppPath.DevelopersCatchAll}
|
||||
element={
|
||||
<Routes>
|
||||
<Route
|
||||
path={SettingsPath.DevelopersNewApiKey}
|
||||
element={<SettingsDevelopersApiKeysNew />}
|
||||
/>
|
||||
<Route
|
||||
path={SettingsPath.DevelopersApiKeyDetail}
|
||||
element={<SettingsDevelopersApiKeyDetail />}
|
||||
/>
|
||||
<Route
|
||||
path={SettingsPath.DevelopersNewWebhook}
|
||||
element={<SettingsDevelopersWebhooksNew />}
|
||||
/>
|
||||
<Route
|
||||
path={SettingsPath.DevelopersNewWebhookDetail}
|
||||
element={<SettingsDevelopersWebhooksDetail />}
|
||||
/>
|
||||
</Routes>
|
||||
}
|
||||
path={SettingsPath.DevelopersNewApiKey}
|
||||
element={<SettingsDevelopersApiKeysNew />}
|
||||
/>
|
||||
<Route
|
||||
path={SettingsPath.DevelopersApiKeyDetail}
|
||||
element={<SettingsDevelopersApiKeyDetail />}
|
||||
/>
|
||||
<Route
|
||||
path={SettingsPath.DevelopersNewWebhook}
|
||||
element={<SettingsDevelopersWebhooksNew />}
|
||||
/>
|
||||
<Route
|
||||
path={SettingsPath.DevelopersNewWebhookDetail}
|
||||
element={<SettingsDevelopersWebhooksDetail />}
|
||||
/>
|
||||
{isServerlessFunctionSettingsEnabled && (
|
||||
<>
|
||||
|
||||
@ -28,7 +28,6 @@ import { SyncEmails } from '~/pages/onboarding/SyncEmails';
|
||||
|
||||
export const useCreateAppRouter = (
|
||||
isBillingEnabled?: boolean,
|
||||
isCRMMigrationEnabled?: boolean,
|
||||
isServerlessFunctionSettingsEnabled?: boolean,
|
||||
isAdminPageEnabled?: boolean,
|
||||
) =>
|
||||
@ -63,7 +62,6 @@ export const useCreateAppRouter = (
|
||||
element={
|
||||
<SettingsRoutes
|
||||
isBillingEnabled={isBillingEnabled}
|
||||
isCRMMigrationEnabled={isCRMMigrationEnabled}
|
||||
isServerlessFunctionSettingsEnabled={
|
||||
isServerlessFunctionSettingsEnabled
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user