feat: start pack view page

This commit is contained in:
Kentai Radiquum 2025-05-05 23:03:57 +05:00
parent e109b5393a
commit bb9ccaa6f1
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
6 changed files with 173 additions and 36 deletions

View file

@ -1,21 +1,26 @@
"use client";
import { PACKS_ENDPOINT } from "@/api/ENDPOINTS";
import { Pack } from "@/types/pack";
import {
Sidebar,
SidebarItem,
SidebarItemGroup,
SidebarItems,
} from "flowbite-react";
import {
// HiArrowSmRight,
HiChartPie,
HiPlusCircle
// HiInbox,
// HiShoppingBag,
// HiTable,
// HiUser,
// HiViewBoards,
} from "react-icons/hi";
import { useEffect, useState } from "react";
import { HiChartPie, HiPlusCircle } from "react-icons/hi";
export const Menu = () => {
const [packsData, setPacksData] = useState<Pack[]>([]);
useEffect(() => {
async function _getPacksData() {
const res = await fetch(PACKS_ENDPOINT("getPacks"));
setPacksData(await res.json());
}
_getPacksData();
}, []);
return (
<Sidebar aria-label="Default sidebar example">
<SidebarItems>
@ -23,32 +28,20 @@ export const Menu = () => {
<SidebarItem href="/" icon={HiChartPie}>
Dashboard
</SidebarItem>
{packsData &&
packsData.map((pack) => {
return (
<SidebarItem href={`/pack/?id=${pack._id}`} key={pack._id}>
<p className="line-clamp-1">{pack.title}</p>
<p className="text-sm text-gray-400 line-clamp-1">
by {pack.author}
</p>
</SidebarItem>
);
})}
<SidebarItem href="/pack/new" icon={HiPlusCircle}>
New mod pack
</SidebarItem>
{/* <SidebarItem
href="#"
icon={HiViewBoards}
label="Pro"
labelColor="dark"
>
Kanban
</SidebarItem>
<SidebarItem href="#" icon={HiInbox} label="3">
Inbox
</SidebarItem>
<SidebarItem href="#" icon={HiUser}>
Users
</SidebarItem>
<SidebarItem href="#" icon={HiShoppingBag}>
Products
</SidebarItem>
<SidebarItem href="#" icon={HiArrowSmRight}>
Sign In
</SidebarItem>
<SidebarItem href="#" icon={HiTable}>
Sign Up
</SidebarItem> */}
</SidebarItemGroup>
</SidebarItems>
</Sidebar>