mirror of
https://github.com/Radiquum/YAMPD.git
synced 2025-05-20 23:59:35 +05:00
feat: start pack view page
This commit is contained in:
parent
e109b5393a
commit
bb9ccaa6f1
6 changed files with 173 additions and 36 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue