Skip to content

Commit

Permalink
Merge pull request #314 from briefercloud/docs-link-on-sidebar
Browse files Browse the repository at this point in the history
docs link on sidebar
  • Loading branch information
lucasfcosta authored Jan 9, 2025
2 parents 855be36 + f5ab500 commit 4385444
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/web/src/components/ConfigurationsMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type BaseConfigurationsMenuProps = {

type ConfigurationsMenuLinkProps = BaseConfigurationsMenuProps & {
href: string
openInNewTab: boolean
}

type ConfigurationsMenuButtonProps = BaseConfigurationsMenuProps & {
Expand All @@ -21,6 +22,7 @@ const ConfigurationsMenuLink = (props: ConfigurationsMenuLinkProps) => {
return (
<Link
href={props.href}
target={props.openInNewTab ? '_blank' : undefined}
className={clsx(
router.pathname.startsWith(props.href)
? 'text-gray-800 bg-ceramic-100/50'
Expand Down
17 changes: 17 additions & 0 deletions apps/web/src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
PuzzlePieceIcon,
MagnifyingGlassIcon,
RocketLaunchIcon,
AcademicCapIcon,
} from '@heroicons/react/24/outline'
import clsx from 'clsx'
import Link from 'next/link'
Expand Down Expand Up @@ -60,6 +61,7 @@ type ConfigItem = {
icon: React.ComponentType<React.ComponentProps<any>>
hidden?: boolean
allowedRoles: Set<UserWorkspaceRole>
openInNewTab: boolean
}

const configs = (workspaceId: string): ConfigItem[] => [
Expand All @@ -70,41 +72,55 @@ const configs = (workspaceId: string): ConfigItem[] => [
hidden: true,
icon: CpuChipIcon,
allowedRoles: new Set<UserWorkspaceRole>(['admin']),
openInNewTab: false,
},
{
id: 'data-sources-sidebar-item',
name: 'Data sources',
href: `/workspaces/${workspaceId}/data-sources`,
icon: CircleStackIcon,
allowedRoles: new Set<UserWorkspaceRole>(['admin', 'editor']),
openInNewTab: false,
},
{
id: 'users-sidebar-item',
name: 'Users',
href: `/workspaces/${workspaceId}/users`,
icon: UsersIcon,
allowedRoles: new Set<UserWorkspaceRole>(['admin', 'editor', 'viewer']),
openInNewTab: false,
},
{
id: 'integrations-sidebar-item',
name: 'Integrations',
href: `/workspaces/${workspaceId}/integrations`,
icon: PuzzlePieceIcon,
allowedRoles: new Set<UserWorkspaceRole>(['admin', 'editor']),
openInNewTab: false,
},
{
id: 'docs-sidebar-item',
name: 'Documentation',
href: `https://docs.briefer.cloud`,
icon: AcademicCapIcon,
allowedRoles: new Set<UserWorkspaceRole>(['admin', 'editor', 'viewer']),
openInNewTab: true,
},
{
id: 'settings-sidebar-item',
name: 'Settings',
href: `/workspaces/${workspaceId}/settings`,
icon: AdjustmentsHorizontalIcon,
allowedRoles: new Set<UserWorkspaceRole>(['admin']),
openInNewTab: false,
},
{
id: 'thrash-sidebar-item',
name: 'Trash',
href: `/workspaces/${workspaceId}/trash`,
icon: TrashIcon,
allowedRoles: new Set<UserWorkspaceRole>(['admin', 'editor']),
openInNewTab: false,
},
]

Expand Down Expand Up @@ -436,6 +452,7 @@ export default function Layout({
href={item.href}
text={item.name}
icon={item.icon}
openInNewTab={item.openInNewTab}
blink={
item.id === 'data-sources-sidebar-item' &&
!hasUserDataSource
Expand Down

0 comments on commit 4385444

Please sign in to comment.