diff --git a/src/common/MenuLayout.tsx b/src/common/MenuLayout.tsx
index f7c3b137..092db5bb 100644
--- a/src/common/MenuLayout.tsx
+++ b/src/common/MenuLayout.tsx
@@ -6,7 +6,7 @@ import { useEffect } from 'react';
import { Navigate, Route, Routes, useLocation } from 'react-router-dom';
import { isReachableServer } from '../servers/data';
import { withSelectedServer } from '../servers/helpers/withSelectedServer';
-import { supportsDomainVisits, supportsNonOrphanVisits } from '../utils/helpers/features';
+import { useFeature } from '../utils/helpers/features';
import { useSwipeable, useToggle } from '../utils/helpers/hooks';
import type { AsideMenuProps } from './AsideMenu';
import { NotFound } from './NotFound';
@@ -46,8 +46,8 @@ export const MenuLayout = (
return ;
}
- const addNonOrphanVisitsRoute = supportsNonOrphanVisits(selectedServer);
- const addDomainVisitsRoute = supportsDomainVisits(selectedServer);
+ const addNonOrphanVisitsRoute = useFeature('nonOrphanVisits', selectedServer);
+ const addDomainVisitsRoute = useFeature('domainVisits', selectedServer);
const burgerClasses = classNames('menu-layout__burger-icon', { 'menu-layout__burger-icon--active': sidebarVisible });
const swipeableProps = useSwipeable(showSidebar, hideSidebar);
diff --git a/src/domains/helpers/DomainDropdown.tsx b/src/domains/helpers/DomainDropdown.tsx
index 15fda949..6d7ba670 100644
--- a/src/domains/helpers/DomainDropdown.tsx
+++ b/src/domains/helpers/DomainDropdown.tsx
@@ -6,7 +6,7 @@ import { DropdownItem } from 'reactstrap';
import type { SelectedServer } from '../../servers/data';
import { getServerId } from '../../servers/data';
import { DropdownBtnMenu } from '../../utils/DropdownBtnMenu';
-import { supportsDefaultDomainRedirectsEdition, supportsDomainVisits } from '../../utils/helpers/features';
+import { useFeature } from '../../utils/helpers/features';
import { useToggle } from '../../utils/helpers/hooks';
import { DEFAULT_DOMAIN } from '../../visits/reducers/domainVisits';
import type { Domain } from '../data';
@@ -23,8 +23,8 @@ export const DomainDropdown: FC = ({ domain, editDomainRedi
const [isOpen, toggle] = useToggle();
const [isModalOpen, toggleModal] = useToggle();
const { isDefault } = domain;
- const canBeEdited = !isDefault || supportsDefaultDomainRedirectsEdition(selectedServer);
- const withVisits = supportsDomainVisits(selectedServer);
+ const canBeEdited = !isDefault || useFeature('defaultDomainRedirectsEdition', selectedServer);
+ const withVisits = useFeature('domainVisits', selectedServer);
const serverId = getServerId(selectedServer);
return (
diff --git a/src/servers/Overview.tsx b/src/servers/Overview.tsx
index dfd39808..58f55668 100644
--- a/src/servers/Overview.tsx
+++ b/src/servers/Overview.tsx
@@ -10,7 +10,7 @@ import type { ShortUrlsList as ShortUrlsListState } from '../short-urls/reducers
import { ITEMS_IN_OVERVIEW_PAGE } from '../short-urls/reducers/shortUrlsList';
import type { ShortUrlsTableType } from '../short-urls/ShortUrlsTable';
import type { TagsList } from '../tags/reducers/tagsList';
-import { supportsNonOrphanVisits } from '../utils/helpers/features';
+import { useFeature } from '../utils/helpers/features';
import { prettify } from '../utils/helpers/numbers';
import type { VisitsOverview } from '../visits/reducers/visitsOverview';
import type { SelectedServer } from './data';
@@ -43,7 +43,7 @@ export const Overview = (
const { loading: loadingTags } = tagsList;
const { loading: loadingVisits, visitsCount, orphanVisitsCount } = visitsOverview;
const serverId = getServerId(selectedServer);
- const linkToNonOrphanVisits = supportsNonOrphanVisits(selectedServer);
+ const linkToNonOrphanVisits = useFeature('nonOrphanVisits', selectedServer);
const navigate = useNavigate();
useEffect(() => {
diff --git a/src/short-urls/ShortUrlForm.tsx b/src/short-urls/ShortUrlForm.tsx
index 1824ec99..eb2e2c23 100644
--- a/src/short-urls/ShortUrlForm.tsx
+++ b/src/short-urls/ShortUrlForm.tsx
@@ -11,7 +11,7 @@ import { Checkbox } from '../utils/Checkbox';
import type { DateTimeInputProps } from '../utils/dates/DateTimeInput';
import { DateTimeInput } from '../utils/dates/DateTimeInput';
import { formatIsoDate } from '../utils/helpers/date';
-import { supportsForwardQuery } from '../utils/helpers/features';
+import { useFeature } from '../utils/helpers/features';
import { SimpleCard } from '../utils/SimpleCard';
import type { OptionalString } from '../utils/utils';
import { handleEventPreventingDefault, hasValue } from '../utils/utils';
@@ -116,7 +116,7 @@ export const ShortUrlForm = (
>
);
- const showForwardQueryControl = supportsForwardQuery(selectedServer);
+ const showForwardQueryControl = useFeature('forwardQuery', selectedServer);
return (