Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/app/(main)/App.tsx
This commit is contained in:
Mike Cao 2023-11-11 20:46:41 -08:00
commit 70cee9f5e8
9 changed files with 56 additions and 47 deletions

View File

@ -14,6 +14,7 @@ import styles from './NavBar.module.css';
export function NavBar() {
const pathname = usePathname();
const { formatMessage, labels } = useMessages();
const cloudMode = Boolean(process.env.cloudMode);
const links = [
{ label: formatMessage(labels.dashboard), url: '/dashboard' },
@ -22,6 +23,40 @@ export function NavBar() {
{ label: formatMessage(labels.settings), url: '/settings' },
].filter(n => n);
const menuItems = [
{
label: formatMessage(labels.dashboard),
url: '/dashboard',
},
!cloudMode && {
label: formatMessage(labels.settings),
url: '/settings',
children: [
{
label: formatMessage(labels.websites),
url: '/settings/websites',
},
{
label: formatMessage(labels.teams),
url: '/settings/teams',
},
{
label: formatMessage(labels.users),
url: '/settings/users',
},
{
label: formatMessage(labels.profile),
url: '/settings/profile',
},
],
},
cloudMode && {
label: formatMessage(labels.profile),
url: '/settings/profile',
},
!cloudMode && { label: formatMessage(labels.logout), url: '/logout' },
].filter(n => n);
return (
<div className={styles.navbar}>
<div className={styles.logo}>
@ -49,7 +84,7 @@ export function NavBar() {
<ProfileButton />
</div>
<div className={styles.mobile}>
<HamburgerButton />
<HamburgerButton menuItems={menuItems} />
</div>
</div>
);

View File

@ -5,7 +5,7 @@ import ReferrersTable from 'components/metrics/ReferrersTable';
import BrowsersTable from 'components/metrics/BrowsersTable';
import OSTable from 'components/metrics/OSTable';
import DevicesTable from 'components/metrics/DevicesTable';
import WorldMap from 'components/common/WorldMap';
import WorldMap from 'components/metrics/WorldMap';
import CountriesTable from 'components/metrics/CountriesTable';
import EventsTable from 'components/metrics/EventsTable';
import EventsChart from 'components/metrics/EventsChart';

View File

@ -5,7 +5,7 @@ import firstBy from 'thenby';
import { Grid, GridRow } from 'components/layout/Grid';
import Page from 'components/layout/Page';
import RealtimeChart from 'components/metrics/RealtimeChart';
import WorldMap from 'components/common/WorldMap';
import WorldMap from 'components/metrics/WorldMap';
import RealtimeLog from './RealtimeLog';
import RealtimeHeader from './RealtimeHeader';
import RealtimeUrls from './RealtimeUrls';

View File

@ -2,46 +2,9 @@ import { Button, Icon } from 'react-basics';
import { useState } from 'react';
import MobileMenu from './MobileMenu';
import Icons from 'components/icons';
import useMessages from 'components/hooks/useMessages';
export function HamburgerButton() {
const { formatMessage, labels } = useMessages();
export function HamburgerButton({ menuItems }) {
const [active, setActive] = useState(false);
const cloudMode = Boolean(process.env.cloudMode);
const menuItems = [
{
label: formatMessage(labels.dashboard),
url: '/dashboard',
},
!cloudMode && {
label: formatMessage(labels.settings),
url: '/settings',
children: [
{
label: formatMessage(labels.websites),
url: '/settings/websites',
},
{
label: formatMessage(labels.teams),
url: '/settings/teams',
},
{
label: formatMessage(labels.users),
url: '/settings/users',
},
{
label: formatMessage(labels.profile),
url: '/settings/profile',
},
],
},
cloudMode && {
label: formatMessage(labels.profile),
url: '/settings/profile',
},
!cloudMode && { label: formatMessage(labels.logout), url: '/logout' },
].filter(n => n);
const handleClick = () => setActive(state => !state);
const handleClose = () => setActive(false);

View File

@ -1,18 +1,15 @@
export * from 'components/hooks/useApi';
export * from 'components/hooks/useConfig';
export * from 'components/hooks/useCountryNames';
export * from 'components/hooks/useDateRange';
export * from 'components/hooks/useDocumentClick';
export * from 'components/hooks/useEscapeKey';
export * from 'components/hooks/useFilterQuery';
export * from 'components/hooks/useFilters';
export * from 'components/hooks/useForceUpdate';
export * from 'components/hooks/useFormat';
export * from 'components/hooks/useLanguageNames';
export * from 'components/hooks/useLocale';
export * from 'components/hooks/useMessages';
export * from 'components/hooks/useNavigation';
export * from 'components/hooks/useReport';
export * from 'components/hooks/useReports';
export * from 'components/hooks/useRequireLogin';
export * from 'components/hooks/useShareToken';
export * from 'components/hooks/useSticky';
@ -21,7 +18,7 @@ export * from 'components/hooks/useTimezone';
export * from 'components/hooks/useUser';
export * from 'components/hooks/useWebsite';
export * from './app/(main)/settings/teams/[id]/TeamWebsiteAddForm';
export * from 'app/(main)/settings/teams/[id]/TeamWebsiteAddForm';
export * from 'app/(main)/settings/teams/[id]/TeamEditForm';
export * from 'app/(main)/settings/teams/[id]/TeamMemberRemoveButton';
export * from 'app/(main)/settings/teams/[id]/TeamMembers';
@ -44,8 +41,22 @@ export * from 'app/(main)/settings/websites/[id]/TrackingCode';
export * from 'app/(main)/settings/websites/[id]/WebsiteDeleteForm';
export * from 'app/(main)/settings/websites/[id]/WebsiteEditForm';
export * from 'app/(main)/settings/websites/[id]/WebsiteResetForm';
export * from 'app/(main)/settings/websites/WebsiteAddForm';
export * from 'app/(main)/settings/websites/WebsitesHeader';
export * from 'app/(main)/settings/websites/WebsiteSettings';
export * from './app/(main)/settings/websites/WebsitesDataTable';
export * from 'app/(main)/settings/websites/WebsitesDataTable';
export * from 'app/(main)/settings/websites/WebsitesTable';
export * from 'components/common/ConfirmDeleteForm';
export * from 'components/common/DataTable';
export * from 'components/common/Empty';
export * from 'components/common/ErrorBoundary';
export * from 'components/common/Favicon';
export * from 'components/common/FilterButtons';
export * from 'components/common/FilterLink';
export * from 'components/common/HamburgerButton';
export * from 'components/common/HoverTooltip';
export * from 'components/common/LinkButton';
export * from 'components/common/MobileMenu';
export * from 'components/common/Pager';