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:
@ -1,4 +1,3 @@
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
IconCalendarEvent,
|
||||
IconDotsVertical,
|
||||
@ -13,9 +12,11 @@ import { ConnectedAccount } from '@/accounts/types/ConnectedAccount';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useDestroyOneRecord } from '@/object-record/hooks/useDestroyOneRecord';
|
||||
import { useTriggerApisOAuth } from '@/settings/accounts/hooks/useTriggerApiOAuth';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
|
||||
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
|
||||
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
|
||||
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
|
||||
|
||||
type SettingsAccountsRowDropdownMenuProps = {
|
||||
account: ConnectedAccount;
|
||||
@ -26,7 +27,7 @@ export const SettingsAccountsRowDropdownMenu = ({
|
||||
}: SettingsAccountsRowDropdownMenuProps) => {
|
||||
const dropdownId = `settings-account-row-${account.id}`;
|
||||
|
||||
const navigate = useNavigate();
|
||||
const navigate = useNavigateSettings();
|
||||
const { closeDropdown } = useDropdown(dropdownId);
|
||||
|
||||
const { destroyOneRecord } = useDestroyOneRecord({
|
||||
@ -49,7 +50,7 @@ export const SettingsAccountsRowDropdownMenu = ({
|
||||
LeftIcon={IconMail}
|
||||
text="Emails settings"
|
||||
onClick={() => {
|
||||
navigate(`/settings/accounts/emails`);
|
||||
navigate(SettingsPath.AccountsEmails);
|
||||
closeDropdown();
|
||||
}}
|
||||
/>
|
||||
@ -57,7 +58,7 @@ export const SettingsAccountsRowDropdownMenu = ({
|
||||
LeftIcon={IconCalendarEvent}
|
||||
text="Calendar settings"
|
||||
onClick={() => {
|
||||
navigate(`/settings/accounts/calendars`);
|
||||
navigate(SettingsPath.AccountsCalendars);
|
||||
closeDropdown();
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user