Skip to content

Commit

Permalink
Merge pull request #4132 from signalco-io/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
AleksandarDev authored Dec 16, 2023
2 parents a32fc54 + 77c22b1 commit 53baed1
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion web/apps/app/components/layouts/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IconButton } from '@signalco/ui-primitives/IconButton';
import { cx } from '@signalco/ui-primitives/cx';
import { Minimize } from '@signalco/ui-icons';
import { useSearchParam } from '@signalco/hooks/useSearchParam';
import { PageTitle } from '../navigation/PageTitle';
import { PageTitle } from '../navigation/titles/PageTitle';
import NavProfile from '../navigation/NavProfile';
import { AuthWrapper } from './AuthWrapper';
import { AppClientWrapper } from './AppClientWrapper';
Expand Down
34 changes: 15 additions & 19 deletions web/apps/app/components/navigation/MobileMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,21 @@ export function MobileMenu({ open, items, active, onClose }: { open: boolean; it
open && 'animate-in slide-in-from-top-3'
)}>
<Stack>
{items.map((ni, index) => {
const ItemIcon = ni.icon;

return (
<Tooltip title={t(ni.label)} key={index + 1}>
<Link href={ni.path}>
<Button
fullWidth
aria-label={t(ni.label)}
variant={ni === active ? 'soft' : 'plain'}
size="lg"
onClick={onClose}
startDecorator={(<ItemIcon />)}>
{ni.label}
</Button>
</Link>
</Tooltip>
);
})}
{items.map((ni, index) => (
<Tooltip title={t(ni.label)} key={index + 1}>
<Link href={ni.path}>
<Button
fullWidth
aria-label={t(ni.label)}
variant={ni === active ? 'soft' : 'plain'}
size="lg"
onClick={onClose}
startDecorator={(<ni.icon />)}>
{ni.label}
</Button>
</Link>
</Tooltip>
))}
</Stack>
</div>
);
Expand Down
46 changes: 27 additions & 19 deletions web/apps/app/components/navigation/NavProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { UserProfileAvatar } from '../users/UserProfileAvatar';
import { KnownPages } from '../../src/knownPages';
import useLocale from '../../src/hooks/useLocale';
import { useActiveNavItem } from './useActiveNavItem';
import { PageTitle } from './PageTitle';
import { PageTitle } from './titles/PageTitle';
import NavLink from './NavLink';
import { MobileMenu } from './MobileMenu';
import { FloatingNavContainer } from './FloatingNavContainer';
Expand All @@ -17,39 +17,46 @@ export type NavItem = {
label: string,
path: string,
icon: React.FunctionComponent,
hidden?: boolean | undefined;
end?: boolean | undefined;
}

export const navItems: NavItem[] = [
{ label: 'Channels', path: KnownPages.Channels, icon: Channel, hidden: true },
{ label: 'Settings', path: KnownPages.Settings, icon: Settings, hidden: true },
{ label: 'Spaces', path: KnownPages.Spaces, icon: Dashboard },
{ label: 'Entities', path: KnownPages.Entities, icon: Device }
{ label: 'Entities', path: KnownPages.Entities, icon: Device },
{ label: 'Channels', path: KnownPages.Channels, icon: Channel, end: true },
{ label: 'Settings', path: KnownPages.Settings, icon: Settings, end: true },
];

export default function NavProfile() {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const activeNavItem = useActiveNavItem();
const visibleNavItems = navItems.filter(ni => ni === activeNavItem || !ni.hidden);
const { t } = useLocale('App', 'Nav');

return (
<FloatingNavContainer>
<div className="flex h-full min-h-[60px] flex-row items-center justify-between gap-3 sm:flex-col sm:justify-start sm:pl-0 sm:pt-2">
<div className="flex h-full min-h-[60px] flex-row items-center justify-between gap-3 sm:flex-col sm:justify-start sm:py-2 sm:pl-0">
<Suspense>
<UserProfileAvatar />
</Suspense>
<div className="hidden w-full sm:block">
<Stack>
{visibleNavItems
.map((ni, index) => (
<NavLink
key={index + 1}
path={ni.path}
Icon={ni.icon}
active={ni === activeNavItem}
label={t(ni.label)} />
))}
<div className="hidden h-full w-full sm:block">
<Stack className="h-full">
{navItems.filter(ni => !ni.end).map((ni, index) => (
<NavLink
key={index + 1}
path={ni.path}
Icon={ni.icon}
active={ni === activeNavItem}
label={t(ni.label)} />
))}
<div className="grow" />
{navItems.filter(ni => ni.end).map((ni, index) => (
<NavLink
key={index + 1}
path={ni.path}
Icon={ni.icon}
active={ni === activeNavItem}
label={t(ni.label)} />
))}
</Stack>
</div>
<div className="absolute left-1/2 -translate-x-1/2 sm:hidden">
Expand All @@ -60,6 +67,7 @@ export default function NavProfile() {
<div className="sm:hidden">
<IconButton
variant="plain"
size="lg"
onClick={() => setMobileMenuOpen((curr) => !curr)}
aria-label="Toggle menu">
{mobileMenuOpen ? <Close /> : <MenuIcon />}
Expand All @@ -68,7 +76,7 @@ export default function NavProfile() {
</div>
<MobileMenu
open={mobileMenuOpen}
items={visibleNavItems}
items={navItems}
active={activeNavItem}
onClose={() => setMobileMenuOpen(false)} />
</FloatingNavContainer>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SelectItems } from '@signalco/ui-primitives/SelectItems';
import { useSearchParam } from '@signalco/hooks/useSearchParam';
import { EntityIconByType } from '../shared/entity/EntityIcon';
import { EntityIconByType } from '../../shared/entity/EntityIcon';

const entityTypes = [
{ value: '1', label: 'Devices' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import EntityIconLabel from '../shared/entity/EntityIconLabel';
import EntityIconLabel from '../../shared/entity/EntityIconLabel';

export function EntityTitle({ entityId }: { entityId: string; }) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { usePathname } from 'next/navigation';
import { Typography } from '@signalco/ui-primitives/Typography';
import { Row } from '@signalco/ui-primitives/Row';
import { Avatar } from '@signalco/ui-primitives/Avatar';
import { KnownPages } from '../../src/knownPages';
import { useActiveNavItem } from './useActiveNavItem';
import { useActiveNavItem } from '../useActiveNavItem';
import { KnownPages } from '../../../src/knownPages';
import { SpaceTitle } from './SpaceTitle';
import { EntityTitle } from './EntityTitle';
import { EntitiesTitle } from './EntitiesTitle';
Expand Down Expand Up @@ -48,10 +48,10 @@ export function PageTitle({ fullPage = false }: { fullPage?: boolean }) {
<NavItemIcon />
</Avatar>
) : (
<NavItemIcon />
<NavItemIcon />
)
)}
<Typography level={fullPage ? 'h4' : 'h6'}>{activeNavItem?.label}</Typography>
<Typography level={fullPage ? 'h4' : 'body1'}>{activeNavItem?.label}</Typography>
</Row>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import React from 'react';
import { Row } from '@signalco/ui-primitives/Row';
import { useSearchParam } from '@signalco/hooks/useSearchParam';
import DashboardSelector from '../dashboards/DashboardSelector';
import DashboardSelector from '../../dashboards/DashboardSelector';

export function SpaceTitle() {
const [,setIsEditing] = useSearchParam('editing');
const [, setIsEditing] = useSearchParam('editing');
const [, setIsDashboardSettingsOpen] = useSearchParam('settings');
const handleEditWidgets = () => setIsEditing('true');
const handleSettings = () => setIsDashboardSettingsOpen('true');
Expand Down
8 changes: 2 additions & 6 deletions web/apps/app/components/users/UserProfileAvatar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@signalco/ui-primitives/Menu';
import { LogOut, Settings } from '@signalco/ui-icons';
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@signalco/ui-primitives/Menu';
import { LogOut } from '@signalco/ui-icons';
import { KnownPages } from '../../src/knownPages';
import useLocale from '../../src/hooks/useLocale';
import UserProfileAvatarButton from './UserProfileAvatarButton';
Expand All @@ -13,10 +13,6 @@ export function UserProfileAvatar() {
<UserProfileAvatarButton />
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem href={KnownPages.Settings} startDecorator={<Settings />}>
{t('Settings')}
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem href={KnownPages.Logout} startDecorator={<LogOut />}>
{t('Logout')}
</DropdownMenuItem>
Expand Down

6 comments on commit 53baed1

@vercel
Copy link

@vercel vercel bot commented on 53baed1 Dec 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

signalco-blog – ./web/apps/blog

blog.signalco.io
signalco-blog.vercel.app
signalco-blog-signalco.vercel.app
signalco-blog-git-main-signalco.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 53baed1 Dec 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

signalco-slco – ./web/apps/slco

signalco-slco-signalco.vercel.app
slco.signalco.io
signalco-slco.vercel.app
signalco-slco-git-main-signalco.vercel.app
slco.io

@vercel
Copy link

@vercel vercel bot commented on 53baed1 Dec 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

signalco-app – ./web/apps/app

signalco-app.vercel.app
signalco-app-git-main-signalco.vercel.app
app.signalco.io
signalco-app-signalco.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 53baed1 Dec 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 53baed1 Dec 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 53baed1 Dec 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.