Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/umami-software/umami into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscao633 committed Nov 3, 2023
2 parents 92f32ce + 02c3d2b commit 452777b
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 46 deletions.
37 changes: 36 additions & 1 deletion src/app/(main)/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand All @@ -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}>
Expand Down Expand Up @@ -49,7 +84,7 @@ export function NavBar() {
<ProfileButton />
</div>
<div className={styles.mobile}>
<HamburgerButton />
<HamburgerButton menuItems={menuItems} />
</div>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion src/app/(main)/Shell.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use client';
import Script from 'next/script';
import { usePathname } from 'next/navigation';
import UpdateNotice from 'components/common/UpdateNotice';
import { useRequireLogin, useConfig } from 'components/hooks';

import UpdateNotice from './UpdateNotice';

export function Shell({ children }) {
const { user } = useRequireLogin();
const config = useConfig();
Expand Down
File renamed without changes.
File renamed without changes.
39 changes: 1 addition & 38 deletions src/components/common/HamburgerButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
File renamed without changes.
File renamed without changes.
23 changes: 17 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';
Expand All @@ -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';

0 comments on commit 452777b

Please sign in to comment.