Added misc url (Discord)

This commit is contained in:
Théo 2023-04-11 11:23:12 +02:00
parent 8023dc2987
commit 284c2934d7

View file

@ -41,6 +41,18 @@ export default function Sidenav({ isOpen, toggle }: { isOpen: boolean; toggle: (
</div> </div>
<div className="px-4 pt-4"> <div className="px-4 pt-4">
<ul className="space-y-4"> <ul className="space-y-4">
<li>
<NavItem
item={{
name: 'Discord',
slug: 'https://discord.gg/72vuHcwUkE',
icon: 'discord-fill',
disabled: false
}}
isOpen={isOpen}
onClick={toggle}
/>
</li>
<li> <li>
<NavItem <NavItem
item={{ item={{
@ -70,10 +82,15 @@ function NavItem({
onClick?: () => void; onClick?: () => void;
}) { }) {
const segment = useSelectedLayoutSegment(); const segment = useSelectedLayoutSegment();
const isActive = segment?.split('/').pop() === item.slug || (item.slug === '' && !segment); const pathname = segment?.split('/').pop() || '';
const isHttp = item.slug.includes('http');
const isActive = pathname === item.slug || (item.slug === '' && !segment);
return ( return (
<AppLink <AppLink
href={item.disabled ? '/dashboard' : `/dashboard/${item.slug}`} aria-disabled={item.disabled}
href={isHttp ? item.slug : `dashboard/${item.slug}`}
target={isHttp ? '_blank' : undefined}
rel={isHttp ? 'noopener noreferrer' : undefined}
className={cn('flex justify-center rounded-md px-3 py-3 text-sm lg:justify-start', { className={cn('flex justify-center rounded-md px-3 py-3 text-sm lg:justify-start', {
'text-muted hover:text-secondary': !isActive, 'text-muted hover:text-secondary': !isActive,
'bg-highlight-primary text-secondary': isActive, 'bg-highlight-primary text-secondary': isActive,