initial admin/moderation interface

This commit is contained in:
Grant 2024-03-02 19:06:44 -07:00
parent a4d30467c8
commit eda1eeb69e
43 changed files with 5704 additions and 874 deletions

4761
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,8 @@
"version": "1.0.0",
"description": "",
"workspaces": [
"packages/client-next",
"packages/admin",
"packages/client",
"packages/server",
"packages/lib"
],

View File

@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}

24
packages/admin/.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

3
packages/admin/README.md Normal file
View File

@ -0,0 +1,3 @@
# Canvas Admin Interface
Heavily based on [nextui-dashboard-template](https://github.com/Siumauricio/nextui-dashboard-template/tree/main)

13
packages/admin/index.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

View File

@ -0,0 +1,42 @@
{
"name": "@sc07-canvas/admin",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@nextui-org/react": "^2.2.9",
"framer-motion": "^11.0.5",
"localforage": "^1.10.0",
"match-sorter": "^6.3.4",
"next-themes": "^0.2.1",
"react": "^18.2.0",
"react-apexcharts": "^1.4.1",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.1",
"sort-by": "^1.2.0"
},
"devDependencies": {
"@types/react": "^18.2.56",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.17",
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"postcss": "^8.4.35",
"tailwindcss": "^3.4.1",
"typescript": "^5.2.2",
"vite": "^5.1.4"
}
}

View File

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

101
packages/admin/src/App.tsx Normal file
View File

@ -0,0 +1,101 @@
import { Card, CardBody, Link } from "@nextui-org/react";
import "./App.css";
import { ChartTest } from "./components/ChartTest";
import { CardAgents } from "./components/CardAgents";
import { CardTransactions } from "./components/CardTransactions";
import { TableWrapper } from "./components/table/TableWrapper";
const CardTest = () => {
return (
<Card className="xl:max-w-sm bg-primary rounded-xl shadow-md px-3 w-full">
<CardBody className="py-5">
<div className="flex gap-2.5">
{/* <Community /> */}
<div className="flex flex-col">
<span className="text-white">Auto Insurance</span>
<span className="text-white text-xs">1311 Cars</span>
</div>
</div>
<div className="flex gap-2.5 py-2 items-center">
<span className="text-white text-xl font-semibold">$45,910</span>
<span className="text-success text-xs">+ 4.5%</span>
</div>
<div className="flex items-center gap-6">
<div>
<div>
<span className="font-semibold text-success text-xs">{"↓"}</span>
<span className="text-xs text-white">100,930</span>
</div>
<span className="text-white text-xs">USD</span>
</div>
<div>
<div>
<span className="font-semibold text-danger text-xs">{"↑"}</span>
<span className="text-xs text-white">54,120</span>
</div>
<span className="text-white text-xs">USD</span>
</div>
<div>
<div>
<span className="font-semibold text-danger text-xs">{"⭐"}</span>
<span className="text-xs text-white">125</span>
</div>
<span className="text-white text-xs">VIP</span>
</div>
</div>
</CardBody>
</Card>
);
};
function App() {
return (
<div className="h-full lg:px-6">
<div className="flex justify-center gap-4 xl:gap-6 pt-3 px-4 lg:px-0 flex-wrap xl:flex-nowrap sm:pt-10 max-w-[90rem] mx-auto w-full">
<div className="mt-6 gap-6 flex flex-col w-full">
{/* Card Section Top */}
<div className="flex flex-col gap-2">
<h3 className="text-xl font-semibold">Available Balance</h3>
<div className="grid md:grid-cols-2 grid-cols-1 2xl:grid-cols-3 gap-5 justify-center w-full">
<CardTest />
<CardTest />
<CardTest />
</div>
</div>
{/* Chart */}
<div className="h-full flex flex-col gap-2">
<h3 className="text-xl font-semibold">Statistics</h3>
<div className="w-full bg-default-50 shadow-lg rounded-2xl p-6 ">
<ChartTest />
</div>
</div>
</div>
{/* Left Section */}
<div className="mt-4 gap-2 flex flex-col xl:max-w-md w-full">
<h3 className="text-xl font-semibold">Section</h3>
<div className="flex flex-col justify-center gap-4 flex-wrap md:flex-nowrap md:flex-col">
<CardAgents />
<CardTransactions />
</div>
</div>
</div>
{/* Table Latest Users */}
<div className="flex flex-col justify-center w-full py-5 px-4 lg:px-0 max-w-[90rem] mx-auto gap-3">
<div className="flex flex-wrap justify-between">
<h3 className="text-center text-xl font-semibold">Latest Users</h3>
<Link href="/accounts" color="primary" className="cursor-pointer">
View All
</Link>
</div>
<TableWrapper />
</div>
</div>
);
}
export default App;

View File

@ -0,0 +1,14 @@
import { Outlet } from "react-router-dom";
import { NavbarWrapper } from "./components/navbar/NavbarWrapper";
import { SidebarWrapper } from "./components/sidebar/Sidebar";
export const Root = () => {
return (
<section className="flex">
<SidebarWrapper />
<NavbarWrapper>
<Outlet />
</NavbarWrapper>
</section>
);
};

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,32 @@
import { Avatar, AvatarGroup, Card, CardBody } from "@nextui-org/react";
export const CardAgents = () => {
return (
<Card className=" bg-default-50 rounded-xl shadow-md px-4 py-6 w-full">
<CardBody className="py-5 gap-6">
<div className="flex gap-2.5 justify-center">
<div className="flex flex-col border-dashed border-2 border-divider py-2 px-6 rounded-xl">
<span className="text-default-900 text-xl font-semibold">
{" "}
{"⭐"}Agents
</span>
</div>
</div>
<div className="flex items-center gap-6 flex-col">
<span className="text-xs">
Meet your agenda and see their ranks to get the best results
</span>
<AvatarGroup isBordered>
<Avatar src="https://i.pravatar.cc/150?u=a042581f4e29026024d" />
<Avatar src="https://i.pravatar.cc/150?u=a04258a2462d826712d" />
<Avatar src="https://i.pravatar.cc/150?u=a042581f4e29026704d" />
<Avatar src="https://i.pravatar.cc/150?u=a04258114e29026302d" />
<Avatar src="https://i.pravatar.cc/150?u=a04258114e29026702d" />
<Avatar src="https://i.pravatar.cc/150?u=a04258114e29026708c" />
</AvatarGroup>
</div>
</CardBody>
</Card>
);
};

View File

@ -0,0 +1,75 @@
import { Avatar, Card, CardBody } from "@nextui-org/react";
import React from "react";
const items = [
{
name: "Jose Perez",
picture: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
amount: "4500 USD",
date: "9/20/2021",
},
{
name: "Jose Perez",
picture: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
amount: "4500 USD",
date: "9/20/2021",
},
{
name: "Jose Perez",
picture: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
amount: "4500 USD",
date: "9/20/2021",
},
{
name: "Jose Perez",
picture: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
amount: "4500 USD",
date: "9/20/2021",
},
{
name: "Jose Perez",
picture: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
amount: "4500 USD",
date: "9/20/2021",
},
];
export const CardTransactions = () => {
return (
<Card className=" bg-default-50 rounded-xl shadow-md px-3">
<CardBody className="py-5 gap-4">
<div className="flex gap-2.5 justify-center">
<div className="flex flex-col border-dashed border-2 border-divider py-2 px-6 rounded-xl">
<span className="text-default-900 text-xl font-semibold">
Latest Transactions
</span>
</div>
</div>
<div className="flex flex-col gap-6 ">
{items.map((item) => (
<div key={item.name} className="grid grid-cols-4 w-full">
<div className="w-full">
<Avatar
isBordered
color="secondary"
src="https://i.pravatar.cc/150?u=a042581f4e29026024d"
/>
</div>
<span className="text-default-900 font-semibold">
{item.name}
</span>
<div>
<span className="text-success text-xs">{item.amount}</span>
</div>
<div>
<span className="text-default-500 text-xs">{item.date}</span>
</div>
</div>
))}
</div>
</CardBody>
</Card>
);
};

View File

@ -0,0 +1,86 @@
import Chart, { Props } from "react-apexcharts";
const state: Props["series"] = [
{
name: "Series1",
data: [31, 40, 28, 51, 42, 109, 100],
},
{
name: "Series2",
data: [11, 32, 45, 32, 34, 52, 41],
},
];
const options: Props["options"] = {
chart: {
type: "area",
animations: {
easing: "linear",
speed: 300,
},
sparkline: {
enabled: false,
},
brush: {
enabled: false,
},
id: "basic-bar",
foreColor: "hsl(var(--nextui-default-800))",
stacked: true,
toolbar: {
show: false,
},
},
xaxis: {
categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999],
labels: {
// show: false,
style: {
colors: "hsl(var(--nextui-default-800))",
},
},
axisBorder: {
color: "hsl(var(--nextui-nextui-default-200))",
},
axisTicks: {
color: "hsl(var(--nextui-nextui-default-200))",
},
},
yaxis: {
labels: {
style: {
// hsl(var(--nextui-content1-foreground))
colors: "hsl(var(--nextui-default-800))",
},
},
},
tooltip: {
enabled: false,
},
grid: {
show: true,
borderColor: "hsl(var(--nextui-default-200))",
strokeDashArray: 0,
position: "back",
},
stroke: {
curve: "smooth",
fill: {
colors: ["red"],
},
},
// markers: false,
};
export const ChartTest = () => {
return (
<>
<div className="w-full z-20">
<div id="chart">
<Chart options={options} series={state} type="area" height={425} />
</div>
</div>
</>
);
};

View File

@ -0,0 +1,78 @@
import { Input, Link, Navbar, NavbarContent } from "@nextui-org/react";
import React from "react";
// import { FeedbackIcon } from "../icons/navbar/feedback-icon";
// import { GithubIcon } from "../icons/navbar/github-icon";
// import { SupportIcon } from "../icons/navbar/support-icon";
// import { SearchIcon } from "../icons/searchicon";
import { BurguerButton } from "./burguer-button";
import { NotificationsDropdown } from "./notifications-dropdown";
import { UserDropdown } from "./user-dropdown";
interface Props {
children: React.ReactNode;
}
const Blank = () => {
return <div>blank</div>;
};
const FeedbackIcon = Blank;
const GithubIcon = Blank;
const SupportIcon = Blank;
const SearchIcon = Blank;
export const NavbarWrapper = ({ children }: Props) => {
return (
<div className="relative flex flex-col flex-1 overflow-y-auto overflow-x-hidden">
<Navbar
isBordered
className="w-full"
classNames={{
wrapper: "w-full max-w-full",
}}
>
<NavbarContent className="md:hidden">
<BurguerButton />
</NavbarContent>
<NavbarContent className="w-full max-md:hidden">
<Input
startContent={<SearchIcon />}
isClearable
className="w-full"
classNames={{
input: "w-full",
mainWrapper: "w-full",
}}
placeholder="Search..."
/>
</NavbarContent>
<NavbarContent
justify="end"
className="w-fit data-[justify=end]:flex-grow-0"
>
<div className="flex items-center gap-2 max-md:hidden">
<FeedbackIcon />
<span>Feedback?</span>
</div>
<NotificationsDropdown />
<div className="max-md:hidden">
<SupportIcon />
</div>
<Link
href="https://github.com/Siumauricio/nextui-dashboard-template"
target={"_blank"}
>
<GithubIcon />
</Link>
<NavbarContent>
<UserDropdown />
</NavbarContent>
</NavbarContent>
</Navbar>
{children}
</div>
);
};

View File

@ -0,0 +1,3 @@
export const BurguerButton = () => {
return <div>burgur</div>;
};

View File

@ -0,0 +1,57 @@
import {
Dropdown,
DropdownItem,
DropdownMenu,
DropdownSection,
DropdownTrigger,
NavbarItem,
} from "@nextui-org/react";
import React from "react";
// import { NotificationIcon } from "../icons/navbar/notificationicon";
export const NotificationsDropdown = () => {
return (
<Dropdown placement="bottom-end">
<DropdownTrigger>
<NavbarItem>
{/* <NotificationIcon /> */}
icon
</NavbarItem>
</DropdownTrigger>
<DropdownMenu className="w-80" aria-label="Avatar Actions">
<DropdownSection title="Notificacions">
<DropdownItem
classNames={{
base: "py-2",
title: "text-base font-semibold",
}}
key="1"
description="Sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim."
>
📣 Edit your information
</DropdownItem>
<DropdownItem
key="2"
classNames={{
base: "py-2",
title: "text-base font-semibold",
}}
description="Sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim."
>
🚀 Say goodbye to paper receipts!
</DropdownItem>
<DropdownItem
key="3"
classNames={{
base: "py-2",
title: "text-base font-semibold",
}}
description="Sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim."
>
📣 Edit your information
</DropdownItem>
</DropdownSection>
</DropdownMenu>
</Dropdown>
);
};

View File

@ -0,0 +1,53 @@
import {
Avatar,
Dropdown,
DropdownItem,
DropdownMenu,
DropdownTrigger,
Navbar,
NavbarItem,
} from "@nextui-org/react";
import React from "react";
// import { DarkModeSwitch } from "./darkmodeswitch";
export const UserDropdown = () => {
return (
<Dropdown>
<NavbarItem>
<DropdownTrigger>
<Avatar
as="button"
color="secondary"
size="md"
src="https://i.pravatar.cc/150?u=a042581f4e29026704d"
/>
</DropdownTrigger>
</NavbarItem>
<DropdownMenu
aria-label="User menu actions"
onAction={(actionKey) => console.log({ actionKey })}
>
<DropdownItem
key="profile"
className="flex flex-col justify-start w-full items-start"
>
<p>Signed in as</p>
<p>zoey@example.com</p>
</DropdownItem>
<DropdownItem key="settings">My Settings</DropdownItem>
<DropdownItem key="team_settings">Team Settings</DropdownItem>
<DropdownItem key="analytics">Analytics</DropdownItem>
<DropdownItem key="system">System</DropdownItem>
<DropdownItem key="configurations">Configurations</DropdownItem>
<DropdownItem key="help_and_feedback">Help & Feedback</DropdownItem>
<DropdownItem key="logout" color="danger" className="text-danger ">
Log Out
</DropdownItem>
<DropdownItem key="switch">
{/* <DarkModeSwitch /> */}
switch
</DropdownItem>
</DropdownMenu>
</Dropdown>
);
};

View File

@ -0,0 +1,139 @@
import React, { useState } from "react";
import { Sidebar } from "./sidebar.styles";
import { SidebarItem } from "./sidebar-item";
import { SidebarMenu } from "./sidebar-menu";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faChartBar,
faClock,
faCog,
faHashtag,
faHome,
faServer,
faShieldHalved,
faSquare,
faUsers,
} from "@fortawesome/free-solid-svg-icons";
import { useLocation } from "react-router-dom";
import { CollapseItems } from "./collapse-items";
export const SidebarWrapper = () => {
const { pathname } = useLocation();
// const { collapsed, setCollapsed } = useSidebarContext();
const [collapsed, setCollapsed] = useState(false);
return (
<aside className="h-screen z-[202] sticky top-0">
{collapsed ? (
<div className={Sidebar.Overlay()} onClick={() => setCollapsed(true)} />
) : null}
<div
className={Sidebar({
collapsed: collapsed,
})}
>
<div className={Sidebar.Header()}>
<div className="flex items-center gap-2">
<FontAwesomeIcon icon={faSquare} />
<div className="flex flex-col gap-4">
<h3 className="text-xl font-medium m-0 text-default-900 -mb-4 whitespace-nowrap">
Canvas
</h3>
<span className="text-xs font-medium text-default-500">
{window.location.host}
</span>
</div>
</div>
</div>
<div className="flex flex-col justify-between h-full">
<div className={Sidebar.Body()}>
<SidebarItem
title="Home"
icon={<FontAwesomeIcon icon={faHome} />}
isActive={pathname === "/"}
href="/"
/>
<CollapseItems
icon={<FontAwesomeIcon icon={faChartBar} />}
title="Stats"
items={["Pixels"]}
/>
<SidebarMenu title="Accounts">
<SidebarItem
isActive={pathname === "/accounts"}
title="Accounts"
icon={<FontAwesomeIcon icon={faUsers} />}
href="/accounts"
/>
<SidebarItem
isActive={pathname === "/instances"}
title="Instances"
icon={<FontAwesomeIcon icon={faServer} />}
href="/instances"
/>
<SidebarItem
isActive={pathname === "/accounts/settings"}
title="Settings"
icon={<FontAwesomeIcon icon={faCog} />}
href="/accounts/settings"
/>
</SidebarMenu>
<SidebarMenu title="Clans">
<SidebarItem
isActive={pathname === "/clans"}
title="Clans"
icon={<FontAwesomeIcon icon={faShieldHalved} />}
href="/clans"
/>
<SidebarItem
isActive={pathname === "/clans/settings"}
title="Settings"
icon={<FontAwesomeIcon icon={faCog} />}
href="/clans/settings"
/>
</SidebarMenu>
<SidebarMenu title="Chat">
<SidebarItem
isActive={pathname === "/chat/rooms"}
title="Rooms"
icon={<FontAwesomeIcon icon={faHashtag} />}
href="/chat/rooms"
/>
<SidebarItem
isActive={pathname === "/chat/settings"}
title="Settings"
icon={<FontAwesomeIcon icon={faCog} />}
href="/chat/settings"
/>
</SidebarMenu>
<SidebarMenu title="Service">
<SidebarItem
isActive={pathname === "/chat/rooms"}
title="Shards"
icon={<FontAwesomeIcon icon={faServer} />}
href="/chat/rooms"
/>
<SidebarItem
isActive={pathname === "/chat/rooms"}
title="Timelapse"
icon={<FontAwesomeIcon icon={faClock} />}
href="/chat/rooms"
/>
<SidebarItem
isActive={pathname === "/chat/settings"}
title="Settings"
icon={<FontAwesomeIcon icon={faCog} />}
href="/chat/settings"
/>
</SidebarMenu>
</div>
<div className={Sidebar.Footer()}></div>
</div>
</div>
</aside>
);
};

View File

@ -0,0 +1,141 @@
"use client";
import React, { useState } from "react";
// import { ChevronUpIcon } from "../icons/sidebar/chevron-up-icon";
import { Accordion, AccordionItem } from "@nextui-org/react";
import clsx from "clsx";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faChevronDown, faChevronUp } from "@fortawesome/free-solid-svg-icons";
interface Props {
icon: React.ReactNode;
title: string;
items: string[];
}
export const CollapseItems = ({ icon, items, title }: Props) => {
const [open, setOpen] = useState(false);
return (
<div className="flex gap-4 h-full items-center cursor-pointer">
<Accordion className="px-0">
<AccordionItem
indicator={<FontAwesomeIcon icon={faChevronDown} />}
classNames={{
indicator: "data-[open=true]:-rotate-180",
trigger:
"py-0 min-h-[44px] hover:bg-default-100 rounded-xl active:scale-[0.98] transition-transform px-3.5",
title:
"px-0 flex text-base gap-2 h-full items-center cursor-pointer",
}}
aria-label="Accordion 1"
title={
<div className="flex flex-row gap-2">
<span>{icon}</span>
<span>{title}</span>
</div>
}
>
<div className="pl-12">
{items.map((item, index) => (
<span
key={index}
className="w-full flex text-default-500 hover:text-default-900 transition-colors"
>
{item}
</span>
))}
</div>
</AccordionItem>
</Accordion>
{/* <Accordion
title={
<div
className="flex items-center justify-between w-full py-5 px-7 rounded-8 transition-all duration-150 ease-in-out cursor-pointer hover:bg-accents2 active:scale-98"
// css={{
// gap: "$6",
// width: "100%",
// py: "$5",
// px: "$7",
// borderRadius: "8px",
// transition: "all 0.15s ease",
// "&:active": {
// transform: "scale(0.98)",
// },
// "&:hover": {
// bg: "$accents2",
// },
// }}
// justify={"between"}
onClick={handleToggle}
>
<div className="flex gap-4">
{icon}
<span
className="text-default-900 font-medium text-base"
// span
// weight={"normal"}
// size={"$base"}
// css={{
// color: "$accents9",
// }}
>
{title}
</span>
</div>
<ChevronUpIcon
className={clsx(
open ? "rotate-180" : "rotate-0",
"transition-all duration-300 ease-in-out transform"
)}
// css={{
// transition: "transform 0.3s ease",
// transform: open ? "rotate(-180deg)" : "rotate(0deg)",
// }}
/>
</div>
}
// css={{
// width: "100%",
// "& .nextui-collapse-view": {
// p: "0",
// },
// "& .nextui-collapse-content": {
// marginTop: "$1",
// padding: "0px",
// },
// }}
divider={false}
showArrow={false}
>
{items.map((item, index) => (
<div
className="flex flex-col pl-8"
key={index}
// direction={"column"}
// css={{
// paddingLeft: "$16",
// }}
>
<span
className="text-default-400 font-normal text-md"
// span
// weight={"normal"}
// size={"$md"}
// css={{
// color: "$accents8",
// cursor: "pointer",
// "&:hover": {
// color: "$accents9",
// },
// }}
>
{item}
</span>
</div>
))}
</Accordion> */}
</div>
);
};

View File

@ -0,0 +1,136 @@
"use client";
import {
Dropdown,
DropdownItem,
DropdownMenu,
DropdownSection,
DropdownTrigger,
} from "@nextui-org/react";
import React, { useState } from "react";
// import { AcmeIcon } from "../icons/acme-icon";
// import { AcmeLogo } from "../icons/acmelogo";
// import { BottomIcon } from "../icons/sidebar/bottom-icon";
interface Company {
name: string;
location: string;
logo: React.ReactNode;
}
const Blank = () => {
return <div>blank</div>;
};
const AcmeIcon = Blank;
const AcmeLogo = Blank;
const BottomIcon = Blank;
export const CompaniesDropdown = () => {
const [company, setCompany] = useState<Company>({
name: "Acme Co.",
location: "Palo Alto, CA",
logo: <AcmeIcon />,
});
return (
<Dropdown
classNames={{
base: "w-full min-w-[260px]",
}}
>
<DropdownTrigger className="cursor-pointer">
<div className="flex items-center gap-2">
{company.logo}
<div className="flex flex-col gap-4">
<h3 className="text-xl font-medium m-0 text-default-900 -mb-4 whitespace-nowrap">
{company.name}
</h3>
<span className="text-xs font-medium text-default-500">
{company.location}
</span>
</div>
<BottomIcon />
</div>
</DropdownTrigger>
<DropdownMenu
onAction={(e) => {
if (e === "1") {
setCompany({
name: "Facebook",
location: "San Fransico, CA",
logo: <AcmeIcon />,
});
}
if (e === "2") {
setCompany({
name: "Instagram",
location: "Austin, Tx",
logo: <AcmeLogo />,
});
}
if (e === "3") {
setCompany({
name: "Twitter",
location: "Brooklyn, NY",
logo: <AcmeIcon />,
});
}
if (e === "4") {
setCompany({
name: "Acme Co.",
location: "Palo Alto, CA",
logo: <AcmeIcon />,
});
}
}}
aria-label="Avatar Actions"
>
<DropdownSection title="Companies">
<DropdownItem
key="1"
startContent={<AcmeIcon />}
description="San Fransico, CA"
classNames={{
base: "py-4",
title: "text-base font-semibold",
}}
>
Facebook
</DropdownItem>
<DropdownItem
key="2"
startContent={<AcmeLogo />}
description="Austin, Tx"
classNames={{
base: "py-4",
title: "text-base font-semibold",
}}
>
Instagram
</DropdownItem>
<DropdownItem
key="3"
startContent={<AcmeIcon />}
description="Brooklyn, NY"
classNames={{
base: "py-4",
title: "text-base font-semibold",
}}
>
Twitter
</DropdownItem>
<DropdownItem
key="4"
startContent={<AcmeIcon />}
description="Palo Alto, CA"
classNames={{
base: "py-4",
title: "text-base font-semibold",
}}
>
Acme Co.
</DropdownItem>
</DropdownSection>
</DropdownMenu>
</Dropdown>
);
};

View File

@ -0,0 +1,37 @@
import React from "react";
// import { useSidebarContext } from "../layout/layout-context";
import clsx from "clsx";
import { Link } from "react-router-dom";
interface Props {
title: string;
icon: React.ReactNode;
isActive?: boolean;
href?: string;
}
export const SidebarItem = ({ icon, title, isActive, href = "" }: Props) => {
// const { collapsed, setCollapsed } = useSidebarContext();
const handleClick = () => {
if (window.innerWidth < 768) {
// setCollapsed();
}
};
return (
<Link to={href} className="text-default-900 active:bg-none max-w-full">
<div
className={clsx(
isActive
? "bg-primary-100 [&_svg_path]:fill-primary-500"
: "hover:bg-default-100",
"flex gap-2 w-full min-h-[44px] h-full items-center px-3.5 rounded-xl cursor-pointer transition-all duration-150 active:scale-[0.98]"
)}
onClick={handleClick}
>
{icon}
<span className="text-default-900">{title}</span>
</div>
</Link>
);
};

View File

@ -0,0 +1,15 @@
import React from "react";
interface Props {
title: string;
children?: React.ReactNode;
}
export const SidebarMenu = ({ title, children }: Props) => {
return (
<div className="flex gap-2 flex-col">
<span className="text-xs font-normal ">{title}</span>
{children}
</div>
);
};

View File

@ -0,0 +1,50 @@
import { tv } from "@nextui-org/react";
export const SidebarWrapper = tv({
base: "bg-background transition-transform h-full fixed -translate-x-full w-64 shrink-0 z-[202] overflow-y-auto border-r border-divider flex-col py-6 px-3 md:ml-0 md:flex md:static md:h-screen md:translate-x-0 ",
variants: {
collapsed: {
true: "translate-x-0 ml-0 [display:inherit]",
},
},
// ""
// "@md": {
// marginLeft: "0",
// display: "flex",
// position: "static",
// height: "100vh",
// transform: "translateX(0)",
// },
// variants: {
// collapsed: {
// true: {
// display: "inherit",
// marginLeft: "0 ",
// transform: "translateX(0)",
// },
// },
// },
});
export const Overlay = tv({
base: "bg-[rgb(15_23_42/0.3)] fixed inset-0 z-[201] opacity-80 transition-opacity md:hidden md:z-auto md:opacity-100",
});
export const Header = tv({
base: "flex gap-8 items-center px-6",
});
export const Body = tv({
base: "flex flex-col gap-6 mt-9 px-2",
});
export const Footer = tv({
base: "flex items-center justify-center gap-6 pt-16 pb-8 px-8 md:pt-10 md:pb-0",
});
export const Sidebar = Object.assign(SidebarWrapper, {
Header,
Body,
Overlay,
Footer,
});

View File

@ -0,0 +1,42 @@
import {
Table,
TableBody,
TableCell,
TableColumn,
TableHeader,
TableRow,
} from "@nextui-org/react";
import React from "react";
import { RenderCell } from "./render-cell";
import { columns, users } from "./data";
export const TableWrapper = () => {
return (
<div className=" w-full flex flex-col gap-4">
<Table aria-label="Example table with custom cells">
<TableHeader columns={columns}>
{(column) => (
<TableColumn
key={column.uid}
hideHeader={column.uid === "actions"}
align={column.uid === "actions" ? "center" : "start"}
>
{column.name}
</TableColumn>
)}
</TableHeader>
<TableBody items={users}>
{(item) => (
<TableRow>
{(columnKey) => (
<TableCell>
{RenderCell({ user: item, columnKey: columnKey })}
</TableCell>
)}
</TableRow>
)}
</TableBody>
</Table>
</div>
);
};

View File

@ -0,0 +1,169 @@
export const columns = [
{ name: "NAME", uid: "name" },
{ name: "ROLE", uid: "role" },
{ name: "STATUS", uid: "status" },
{ name: "ACTIONS", uid: "actions" },
];
export const users = [
{
id: 1,
name: "Tony Reichert",
role: "CEO",
team: "Management",
status: "active",
age: "29",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
email: "tony.reichert@example.com",
},
{
id: 2,
name: "Zoey Lang",
role: "Technical Lead",
team: "Development",
status: "paused",
age: "25",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026704d",
email: "zoey.lang@example.com",
},
{
id: 3,
name: "Jane Fisher",
role: "Senior Developer",
team: "Development",
status: "active",
age: "22",
avatar: "https://i.pravatar.cc/150?u=a04258114e29026702d",
email: "jane.fisher@example.com",
},
{
id: 4,
name: "William Howard",
role: "Community Manager",
team: "Marketing",
status: "vacation",
age: "28",
avatar: "https://i.pravatar.cc/150?u=a048581f4e29026701d",
email: "william.howard@example.com",
},
{
id: 5,
name: "Kristen Copper",
role: "Sales Manager",
team: "Sales",
status: "active",
age: "24",
avatar: "https://i.pravatar.cc/150?u=a092581d4ef9026700d",
email: "kristen.cooper@example.com",
},
{
id: 6,
name: "Tony Reichert",
role: "CEO",
team: "Management",
status: "active",
age: "29",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
email: "tony.reichert@example.com",
},
{
id: 10,
name: "Kristen Copper",
role: "Sales Manager",
team: "Sales",
status: "active",
age: "24",
avatar: "https://i.pravatar.cc/150?u=a092581d4ef9026700d",
email: "kristen.cooper@example.com",
},
{
id: 8,
name: "Jane Fisher",
role: "Senior Developer",
team: "Development",
status: "active",
age: "22",
avatar: "https://i.pravatar.cc/150?u=a04258114e29026702d",
email: "jane.fisher@example.com",
},
{
id: 7,
name: "Zoey Lang",
role: "Technical Lead",
team: "Development",
status: "paused",
age: "25",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026704d",
email: "zoey.lang@example.com",
},
{
id: 9,
name: "William Howard",
role: "Community Manager",
team: "Marketing",
status: "vacation",
age: "28",
avatar: "https://i.pravatar.cc/150?u=a048581f4e29026701d",
email: "william.howard@example.com",
},
{
id: 11,
name: "Tony Reichert",
role: "CEO",
team: "Management",
status: "active",
age: "29",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
email: "tony.reichert@example.com",
},
{
id: 12,
name: "Kristen Copper",
role: "Sales Manager",
team: "Sales",
status: "active",
age: "24",
avatar: "https://i.pravatar.cc/150?u=a092581d4ef9026700d",
email: "kristen.cooper@example.com",
},
{
id: 13,
name: "Jane Fisher",
role: "Senior Developer",
team: "Development",
status: "active",
age: "22",
avatar: "https://i.pravatar.cc/150?u=a04258114e29026702d",
email: "jane.fisher@example.com",
},
{
id: 14,
name: "Zoey Lang",
role: "Technical Lead",
team: "Development",
status: "paused",
age: "25",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026704d",
email: "zoey.lang@example.com",
},
{
id: 15,
name: "Tony Reichert",
role: "CEO",
team: "Management",
status: "active",
age: "29",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
email: "tony.reichert@example.com",
},
{
id: 16,
name: "Kristen Copper",
role: "Sales Manager",
team: "Sales",
status: "active",
age: "24",
avatar: "https://i.pravatar.cc/150?u=a092581d4ef9026700d",
email: "kristen.cooper@example.com",
},
];

View File

@ -0,0 +1,84 @@
import { User, Tooltip, Chip } from "@nextui-org/react";
import React from "react";
import { users } from "./data";
interface Props {
user: (typeof users)[number];
columnKey: string | React.Key;
}
export const RenderCell = ({ user, columnKey }: Props) => {
// @ts-expect-error test
const cellValue = user[columnKey];
switch (columnKey) {
case "name":
return (
<User
avatarProps={{
src: "https://i.pravatar.cc/150?u=a04258114e29026702d",
}}
name={cellValue}
>
{user.email}
</User>
);
case "role":
return (
<div>
<div>
<span>{cellValue}</span>
</div>
<div>
<span>{user.team}</span>
</div>
</div>
);
case "status":
return (
<Chip
size="sm"
variant="flat"
color={
cellValue === "active"
? "success"
: cellValue === "paused"
? "danger"
: "warning"
}
>
<span className="capitalize text-xs">{cellValue}</span>
</Chip>
);
case "actions":
return (
<div className="flex items-center gap-4 ">
<div>
<Tooltip content="Details">
<button onClick={() => console.log("View user", user.id)}>
{/* <EyeIcon size={20} fill="#979797" /> */}
</button>
</Tooltip>
</div>
<div>
<Tooltip content="Edit user" color="secondary">
<button onClick={() => console.log("Edit user", user.id)}>
{/* <EditIcon size={20} fill="#979797" /> */}
</button>
</Tooltip>
</div>
<div>
<Tooltip
content="Delete user"
color="danger"
onClick={() => console.log("Delete user", user.id)}
>
<button>{/* <DeleteIcon size={20} fill="#FF0080" /> */}</button>
</Tooltip>
</div>
</div>
);
default:
return cellValue;
}
};

View File

@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

View File

@ -0,0 +1,36 @@
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.scss";
import { NextUIProvider } from "@nextui-org/react";
import { ThemeProvider } from "next-themes";
import { RouterProvider, createBrowserRouter } from "react-router-dom";
import { Root } from "./Root.tsx";
import { HomePage } from "./pages/Home/page.tsx";
import { AccountsPage } from "./pages/Accounts/Accounts/page.tsx";
const router = createBrowserRouter([
{
path: "/",
element: <Root />,
children: [
{
path: "/",
element: <HomePage />,
},
{
path: "/accounts",
element: <AccountsPage />,
},
],
},
]);
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<NextUIProvider>
<ThemeProvider defaultTheme="system">
<RouterProvider router={router} />
</ThemeProvider>
</NextUIProvider>
</React.StrictMode>
);

View File

@ -0,0 +1,42 @@
import {
Table,
TableBody,
TableCell,
TableColumn,
TableHeader,
TableRow,
User,
} from "@nextui-org/react";
export const AccountsTable = () => {
return (
<div className=" w-full flex flex-col gap-4">
<Table aria-label="Example table with custom cells">
<TableHeader>
<TableColumn>Name</TableColumn>
<TableColumn>Factions</TableColumn>
<TableColumn>Registered</TableColumn>
<TableColumn>Activity</TableColumn>
<TableColumn>Actions</TableColumn>
</TableHeader>
<TableBody>
<TableRow key="1">
<TableCell>
<User
avatarProps={{
src: "https://i.pravatar.cc/150?u=a04258114e29026702d",
}}
name={"@grant"}
description="@toast.ooo"
></User>
</TableCell>
<TableCell>none</TableCell>
<TableCell>1 hour ago</TableCell>
<TableCell>1 pixel placed in the last hour</TableCell>
<TableCell>action</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
);
};

View File

@ -0,0 +1,45 @@
import { faFile } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { BreadcrumbItem, Breadcrumbs, Button, Input } from "@nextui-org/react";
import { TableWrapper } from "../../../components/table/TableWrapper";
import { AccountsTable } from "./AccountsTable";
export const AccountsPage = () => {
return (
<div className="my-14 lg:px-6 max-w-[95rem] mx-auto w-full flex flex-col gap-4">
<Breadcrumbs>
<BreadcrumbItem href="/">Home</BreadcrumbItem>
<BreadcrumbItem>Accounts</BreadcrumbItem>
</Breadcrumbs>
<h3 className="text-xl font-semibold">All Accounts</h3>
<div className="flex justify-between flex-wrap gap-4 items-center">
<div className="flex items-center gap-3 flex-wrap md:flex-nowrap">
<Input
classNames={{
input: "w-full",
mainWrapper: "w-full",
}}
placeholder="Search users"
/>
{/* <SettingsIcon />
<TrashIcon />
<InfoIcon />
<DotsIcon /> */}
</div>
<div className="flex flex-row gap-3.5 flex-wrap">
{/* <AddUser /> */}
<Button
color="primary"
startContent={<FontAwesomeIcon icon={faFile} />}
>
Export to CSV
</Button>
</div>
</div>
<div className="max-w-[95rem] mx-auto w-full">
<AccountsTable />
</div>
</div>
);
};

View File

@ -0,0 +1,48 @@
import { faUsers } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Card, CardBody } from "@nextui-org/react";
export const HomeCard = () => {
return (
<Card className="xl:max-w-sm bg-primary rounded-xl shadow-md px-3 w-full">
<CardBody className="py-5">
<div className="flex gap-2.5">
<FontAwesomeIcon icon={faUsers} />
<div className="flex flex-col">
<span className="text-white">Auto Insurance</span>
<span className="text-white text-xs">1311 Cars</span>
</div>
</div>
<div className="flex gap-2.5 py-2 items-center">
<span className="text-white text-xl font-semibold">$45,910</span>
<span className="text-success text-xs">+ 4.5%</span>
</div>
<div className="flex items-center gap-6">
<div>
<div>
<span className="font-semibold text-success text-xs">{"↓"}</span>
<span className="text-xs text-white">100,930</span>
</div>
<span className="text-white text-xs">USD</span>
</div>
<div>
<div>
<span className="font-semibold text-danger text-xs">{"↑"}</span>
<span className="text-xs text-white">54,120</span>
</div>
<span className="text-white text-xs">USD</span>
</div>
<div>
<div>
<span className="font-semibold text-danger text-xs">{"⭐"}</span>
<span className="text-xs text-white">125</span>
</div>
<span className="text-white text-xs">VIP</span>
</div>
</div>
</CardBody>
</Card>
);
};

View File

@ -0,0 +1,37 @@
import { faTableCells } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Card, CardBody } from "@nextui-org/react";
export const PixelsCard = () => {
return (
<Card
className="xl:max-w-sm bg-primary rounded-xl shadow-md px-3 w-full"
isPressable
>
<CardBody className="py-5">
<div className="flex gap-2.5 items-center">
<FontAwesomeIcon icon={faTableCells} size="lg" />
<div className="flex flex-col">
<span className="text-white">Pixel Placements</span>
{/* <span className="text-white text-xs">1.5k Placements</span> */}
</div>
</div>
<div className="flex gap-2.5 py-2 items-center">
<span className="text-white text-xl font-semibold">
123,456 pixels
</span>
<span className="text-success text-xs">+400 hour</span>
</div>
<div className="flex items-center gap-6">
<div>
<div>
<span className="font-semibold text-success text-xs">{"↓"}</span>
<span className="text-xs text-white">123</span>
</div>
<span className="text-white text-xs">Empty Pixels</span>
</div>
</div>
</CardBody>
</Card>
);
};

View File

@ -0,0 +1,26 @@
import { faFlag } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Card, CardBody } from "@nextui-org/react";
export const ReportsCard = () => {
return (
<Card
className="xl:max-w-sm bg-default-50 rounded-xl shadow-md px-3 w-full"
isPressable
>
<CardBody className="py-5">
<div className="flex gap-2.5 items-center">
<FontAwesomeIcon icon={faFlag} size="lg" />
<div className="flex flex-col">
<span className="text-white">Reports</span>
{/* <span className="text-white text-xs">3k online</span> */}
</div>
</div>
<div className="flex gap-2.5 py-2 items-center">
<span className="text-white text-xl font-semibold">10 reports</span>
<span className="text-danger text-xs">+400 hour</span>
</div>
</CardBody>
</Card>
);
};

View File

@ -0,0 +1,37 @@
import { faUsers } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Card, CardBody } from "@nextui-org/react";
export const UsersCard = () => {
return (
<Card
className="xl:max-w-sm bg-default-50 rounded-xl shadow-md px-3 w-full"
isPressable
>
<CardBody className="py-5">
<div className="flex gap-2.5 items-center">
<FontAwesomeIcon icon={faUsers} size="lg" />
<div className="flex flex-col">
<span className="text-white">Users</span>
<span className="text-white text-xs">3k online</span>
</div>
</div>
<div className="flex gap-2.5 py-2 items-center">
<span className="text-white text-xl font-semibold">
123,456 users
</span>
<span className="text-success text-xs">+400 hour</span>
</div>
<div className="flex items-center gap-6">
<div>
<div>
<span className="font-semibold text-success text-xs">{"↑"}</span>
<span className="text-xs text-white">123</span>
</div>
<span className="text-white text-xs">Instances</span>
</div>
</div>
</CardBody>
</Card>
);
};

View File

@ -0,0 +1,59 @@
import { CardAgents } from "../../components/CardAgents";
import { CardTransactions } from "../../components/CardTransactions";
import { ChartTest } from "../../components/ChartTest";
import { TableWrapper } from "../../components/table/TableWrapper";
import { PixelsCard } from "./cards/PixelsCard";
import { ReportsCard } from "./cards/ReportsCard";
import { UsersCard } from "./cards/UsersCard";
export const HomePage = () => {
return (
<div className="h-full lg:px-6">
<div className="flex justify-center gap-4 xl:gap-6 pt-3 px-4 lg:px-0 flex-wrap xl:flex-nowrap sm:pt-10 max-w-[90rem] mx-auto w-full">
<div className="mt-6 gap-6 flex flex-col w-full">
{/* Card Section Top */}
<div className="flex flex-col gap-2">
<div className="grid md:grid-cols-2 grid-cols-1 2xl:grid-cols-3 gap-5 justify-center w-full">
<PixelsCard />
<UsersCard />
<ReportsCard />
</div>
</div>
{/* Chart */}
<div className="h-full flex flex-col gap-2">
<h3 className="text-xl font-semibold">Statistics</h3>
<div className="w-full bg-default-50 shadow-lg rounded-2xl p-6 ">
<ChartTest />
</div>
</div>
</div>
{/* Left Section */}
<div className="mt-4 gap-2 flex flex-col xl:max-w-md w-full">
<h3 className="text-xl font-semibold">Section</h3>
<div className="flex flex-col justify-center gap-4 flex-wrap md:flex-nowrap md:flex-col">
<CardAgents />
<CardTransactions />
</div>
</div>
</div>
{/* Table Latest Users */}
<div className="flex flex-col justify-center w-full py-5 px-4 lg:px-0 max-w-[90rem] mx-auto gap-3">
<div className="flex flex-wrap justify-between">
<h3 className="text-center text-xl font-semibold">Latest Users</h3>
{/* <Link
href="/accounts"
as={NextLink}
color="primary"
className="cursor-pointer"
>
View All
</Link> */}
</div>
<TableWrapper />
</div>
</div>
);
};

1
packages/admin/src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@ -0,0 +1,17 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable no-undef */
const { nextui } = require("@nextui-org/react");
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
"./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}",
"../../node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [nextui()],
};

View File

@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}

View File

@ -0,0 +1,11 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": ["vite.config.ts"]
}

View File

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})