2024-03-16 14:56:58 -05:00
|
|
|
import React from 'react';
|
2024-03-13 17:45:55 -05:00
|
|
|
import { Accordion, AccordionTab } from 'primereact/accordion';
|
|
|
|
import { useRouter } from 'next/router';
|
|
|
|
import 'primeicons/primeicons.css';
|
|
|
|
|
|
|
|
const Sidebar = () => {
|
|
|
|
const router = useRouter();
|
|
|
|
|
2024-03-16 14:56:58 -05:00
|
|
|
// Helper function to determine if the path matches the current route
|
|
|
|
const isActive = (path) => {
|
|
|
|
return router.pathname === path;
|
|
|
|
};
|
|
|
|
|
2024-03-13 17:45:55 -05:00
|
|
|
return (
|
2024-03-17 16:16:47 -05:00
|
|
|
<div className='max-mob:hidden max-tab:hidden w-[15vw] bg-gray-800 p-4 h-screen'>
|
2024-03-16 14:56:58 -05:00
|
|
|
<div onClick={() => router.push('/')} className={`w-full cursor-pointer hover:bg-gray-700 rounded-lg ${isActive('/') ? 'bg-gray-700' : ''}`}>
|
|
|
|
<p className="p-2 my-2 pl-5 rounded-md font-bold"><i className="pi pi-home" /> Home</p>
|
2024-03-13 17:45:55 -05:00
|
|
|
</div>
|
2024-03-16 14:56:58 -05:00
|
|
|
<div onClick={() => router.push('/content')} className={`w-full cursor-pointer hover:bg-gray-700 rounded-lg ${isActive('/content') ? 'bg-gray-700' : ''}`}>
|
|
|
|
<p className="p-2 my-2 pl-5 rounded-md font-bold"><i className="pi pi-video" /> Content</p>
|
2024-03-13 17:45:55 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<Accordion
|
|
|
|
activeIndex={0}
|
|
|
|
pt={{
|
|
|
|
tab: {
|
|
|
|
header: ({ context }) => ({
|
|
|
|
className: 'border-none bg-transparent hover:bg-gray-700 rounded-lg',
|
|
|
|
}),
|
|
|
|
headerAction: ({ context }) => ({
|
2024-03-16 14:56:58 -05:00
|
|
|
className: 'border-none bg-transparent py-3 my-2',
|
2024-03-13 17:45:55 -05:00
|
|
|
}),
|
|
|
|
content: { className: 'border-none bg-transparent pt-0' }
|
|
|
|
}
|
|
|
|
}}
|
2024-03-16 14:56:58 -05:00
|
|
|
className="unstyled border-none bg-transparent">
|
2024-03-13 17:45:55 -05:00
|
|
|
<AccordionTab header={"Chat"}>
|
2024-03-16 14:56:58 -05:00
|
|
|
<div onClick={() => router.push('/chat/general')} className={`w-full cursor-pointer hover:bg-gray-700 rounded-lg ${isActive('/chat/general') ? 'bg-gray-700' : ''}`}>
|
|
|
|
<p className="p-2 my-2 rounded-md font-bold"><i className="pi pi-hashtag"></i> general</p>
|
|
|
|
</div>
|
|
|
|
<div onClick={() => router.push('/chat/nostr')} className={`w-full cursor-pointer hover:bg-gray-700 rounded-lg ${isActive('/chat/nostr') ? 'bg-gray-700' : ''}`}>
|
|
|
|
<p className="p-2 my-2 rounded-md font-bold"><i className="pi pi-hashtag"></i> nostr</p>
|
|
|
|
</div>
|
|
|
|
<div onClick={() => router.push('/chat/discord')} className={`w-full cursor-pointer hover:bg-gray-700 rounded-lg ${isActive('/chat/discord') ? 'bg-gray-700' : ''}`}>
|
|
|
|
<p className="p-2 my-2 rounded-md font-bold"><i className="pi pi-hashtag"></i> discord</p>
|
|
|
|
</div>
|
|
|
|
<div onClick={() => router.push('/chat/stackernews')} className={`w-full cursor-pointer hover:bg-gray-700 rounded-lg ${isActive('/chat/stackernews') ? 'bg-gray-700' : ''}`}>
|
|
|
|
<p className="p-2 my-2 rounded-md font-bold"><i className="pi pi-hashtag"></i> stackernews</p>
|
|
|
|
</div>
|
2024-03-13 17:45:55 -05:00
|
|
|
</AccordionTab>
|
|
|
|
</Accordion>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Sidebar;
|