import React, {ReactElement, useState} from 'react'; import {useRouter} from 'next/router'; import {AnimatePresence, motion} from 'framer-motion'; import Link from 'next/link'; import {ProjectSelector} from '../../index'; import Image from 'next/image'; import logo from '../../../../public/assets/logo.png'; import {Home, LayoutTemplate, LineChart, LogOut, Send, Settings, TerminalSquare, Users2, Workflow} from 'lucide-react'; interface SidebarLinkType { to: string; text: string; disabled: boolean; highlight?: boolean; position: 'top' | 'bottom'; icon: ReactElement; } interface SidebarLinkProps { active?: boolean; to: string; text: string; disabled?: boolean; highlight?: boolean; svgPath: React.ReactElement; } export interface SidebarProps { mobileOpen: boolean; onSidebarVisibilityChange: () => void; } const links: SidebarLinkType[] = [ { to: '/', text: 'Dashboard', disabled: false, position: 'top', icon: , }, { to: '/contacts', text: 'Contacts', disabled: false, position: 'top', icon: , }, { to: '/analytics', text: 'Analytics', disabled: false, position: 'top', icon: , }, // { // to: '/developers', // text: 'Developers', // disabled: false, // position: 'top', // icon: , // }, { to: '/settings/project', text: 'Project Settings', disabled: false, position: 'top', icon: , }, { to: '/events', text: 'Events', disabled: false, position: 'top', icon: , }, { to: '/templates', text: 'Templates', disabled: false, position: 'top', icon: , }, { to: '/actions', text: 'Actions', disabled: false, position: 'top', icon: , }, { to: '/campaigns', text: 'Campaigns', disabled: false, position: 'top', icon: , }, // { // to: '/settings/account', // text: 'Account Settings', // disabled: false, // position: 'bottom', // icon: ( // <> // // // ), // }, ]; /** * @param root0 * @param root0.active * @param root0.to * @param root0.text * @param root0.disabled * @param root0.svgPath * @param root0.highlight */ function SidebarLink({active, to, text, disabled, highlight, svgPath}: SidebarLinkProps) { if (to.startsWith('http')) { return ( window.open(to, '_blank')?.focus()} className={`${ active ? 'cursor-default bg-neutral-100 text-neutral-700' : disabled ? 'text-neutral-200' : 'cursor-pointer text-neutral-400 hover:bg-neutral-50 hover:text-neutral-700' } flex items-center gap-x-3 rounded p-2 text-sm font-medium transition ease-in-out`} >
{svgPath}
{text} {highlight &&
New
}
); } return (
{svgPath}
{text} {highlight &&
New
} ); } /** * @param root0 * @param root0.mobileOpen * @param root0.onSidebarVisibilityChange */ export default function Sidebar({mobileOpen, onSidebarVisibilityChange}: SidebarProps) { const router = useRouter(); const projectSelectorRef = React.createRef(); const [projectSelectorOpen, setProjectSelectorOpen] = useState(false); return ( <> {mobileOpen && (
Logo
setProjectSelectorOpen(!projectSelectorOpen)} ref={projectSelectorRef} />
)} {/* Static sidebar for desktop */}
Logo
setProjectSelectorOpen(!projectSelectorOpen)} ref={projectSelectorRef} />
Sign out
); }