Skip to content

Commit

Permalink
fix(repo): all eslint, prettier, and typecheck errors
Browse files Browse the repository at this point in the history
  • Loading branch information
not-ani committed Jul 27, 2024
1 parent 85af6f9 commit 813241e
Show file tree
Hide file tree
Showing 38 changed files with 659 additions and 571 deletions.
2 changes: 1 addition & 1 deletion apps/nextjs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ createJiti(fileURLToPath(import.meta.url))("./src/env");
const config = {
reactStrictMode: true,
images: {
domains: ["lh3.googleusercontent.com"]
domains: ["lh3.googleusercontent.com"],
},

/** Enables hot reloading for local packages without a build step */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
'use client'
import { usePathname } from "next/navigation";
"use client";

import { memo } from "react";
import { captilize } from "~/lib/utils";
import { usePathname } from "next/navigation";

import { captilize } from "~/lib/utils";

function GetLastBreadCrumb(props: {
id: string
}) {
const { id } = props
const pathname = usePathname()
let ending = pathname[-1]
function GetLastBreadCrumb(props: { id: string }) {
const { id } = props;
const pathname = usePathname();
let ending = pathname[-1];

if (!ending || ending === id) {
ending = "Overview Page"
ending = "Overview Page";
}

return (
<div>{captilize(ending)}</div>
)
return <div>{captilize(ending)}</div>;
}

export default memo(GetLastBreadCrumb)
export default memo(GetLastBreadCrumb);
71 changes: 32 additions & 39 deletions apps/nextjs/src/app/(dashboard)/project/[id]/(root)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,64 +1,60 @@
import { Input } from '@amaxa/ui/input'
import { Tooltip, TooltipTrigger, TooltipContent } from '@amaxa/ui/tooltip'
import GetLastBreadCrumb from "./_components/LastItem"
import React, { cache } from "react";
import Link from "next/link";
import { notFound } from "next/navigation";
import { Home, Package2, Search, Settings, Workflow } from "lucide-react";

import { db } from "@amaxa/db/client";
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator
} from '@amaxa/ui/breadcrumb'
import {
Home,
Package2,
Search,
Settings,
Workflow
} from "lucide-react"
import Link from 'next/link'
import React, { cache } from 'react'
import { UserMenu } from '~/components/UserMenu'
import { db } from '@amaxa/db/client'
import { notFound } from 'next/navigation'
import ComingSoon from '~/components/ComingSoon'
BreadcrumbSeparator,
} from "@amaxa/ui/breadcrumb";
import { Input } from "@amaxa/ui/input";
import { Tooltip, TooltipContent, TooltipTrigger } from "@amaxa/ui/tooltip";

import ComingSoon from "~/components/ComingSoon";
import { UserMenu } from "~/components/UserMenu";
import GetLastBreadCrumb from "./_components/LastItem";

const getProjectInfo = cache(async () => {
const data = await db.query.Projects.findFirst({
columns: {
name: true,
id: true
}
})
return data
})
id: true,
},
});
return data;
});

export default async function Layout({
children,
params
params,
}: {
children: React.ReactNode,
children: React.ReactNode;
params: {
id: string;
}
};
}) {
const { id } = params
const data = await getProjectInfo()
const { id } = params;
const data = await getProjectInfo();

if (!data) {
return notFound()
return notFound();
}

return (
<div className='flex min-h-screen w-full flex-col '>
<div className="flex min-h-screen w-full flex-col ">
<aside className="fixed inset-y-0 left-0 z-10 hidden w-14 flex-col border-r bg-background sm:flex">
<nav className="flex flex-col items-center gap-4 px-2 sm:py-4">
<Link
href="#"
className="group flex h-9 w-9 shrink-0 items-center justify-center gap-2 rounded-full bg-primary text-lg font-semibold text-primary-foreground md:h-8 md:w-8 md:text-base"
>
<Package2 className="h-4 w-4 transition-all group-hover:scale-110" />
<span className="sr-only">{data?.name}</span>
<span className="sr-only">{data.name}</span>
</Link>
<Tooltip>
<TooltipTrigger asChild>
Expand Down Expand Up @@ -97,7 +93,6 @@ export default async function Layout({
</TooltipTrigger>
<TooltipContent side="right">Tasks</TooltipContent>
</Tooltip>

</nav>
<nav className="mt-auto flex flex-col items-center gap-4 px-2 sm:py-4">
<Tooltip>
Expand All @@ -116,7 +111,6 @@ export default async function Layout({
</aside>

<div className="flex flex-col sm:gap-4 sm:py-4 sm:pl-14">

<header className="sticky top-0 z-30 flex h-14 items-center gap-4 border-b bg-background px-4 sm:static sm:h-auto sm:border-0 sm:bg-transparent sm:px-6">
<Breadcrumb className="hidden md:flex">
<BreadcrumbList>
Expand All @@ -133,12 +127,14 @@ export default async function Layout({
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbPage><GetLastBreadCrumb id={data.id} /></BreadcrumbPage>
<BreadcrumbPage>
<GetLastBreadCrumb id={data.id} />
</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
<ComingSoon>
<div className="relative ml-auto flex-1 md:grow-0" >
<div className="relative ml-auto flex-1 md:grow-0">
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
<Input
type="search"
Expand All @@ -149,12 +145,9 @@ export default async function Layout({
</div>
</ComingSoon>
<UserMenu />

</header>
{children}
</div>
</div>

)
);
}

74 changes: 39 additions & 35 deletions apps/nextjs/src/app/(dashboard)/project/[id]/(root)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
"use client"
import type { Metadata, ResolvingMetadata } from "next";
import { TrendingUp, TrendingDown } from "lucide-react"

import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@amaxa/ui/card";
"use client";

import { TrendingUp } from "lucide-react";
import {
Area,
AreaChart,
Expand All @@ -14,32 +11,38 @@ import {
Pie,
PieChart,
XAxis,
YAxis
} from "recharts"
YAxis,
} from "recharts";

import type { ChartConfig } from "@amaxa/ui/chart";
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@amaxa/ui/card";
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from "@amaxa/ui/chart"
} from "@amaxa/ui/chart";

interface ProjectPageProps {
params: {
id: string;
};
}


const chartConfig = {
tasksFinished: {
label: "Tasks Finished",
color: "hsl(var(--primary))",
},
} satisfies ChartConfig

} satisfies ChartConfig;


const COLORS = ['#0088FE', '#00C49F', '#FFBB28', '#FF8042']
const COLORS = ["#0088FE", "#00C49F", "#FFBB28", "#FF8042"];
const getTaskData = () => {
return [
{ month: "January", tasksFinished: 18 },
Expand All @@ -48,26 +51,25 @@ const getTaskData = () => {
{ month: "April", tasksFinished: 7 },
{ month: "May", tasksFinished: 20 },
{ month: "June", tasksFinished: 21 },
]
}
];
};

const getPriorityData = () => {
return [
{ priority: "Low", count: 15 },
{ priority: "Medium", count: 30 },
{ priority: "High", count: 20 },
]
}
];
};

const getStatusData = () => {
return [
{ status: "todo", count: 10 },
{ status: "in-progress", count: 15 },
{ status: "done", count: 40 },
{ status: "unable-to-complete", count: 5 },
]
}

];
};

export default function HomePage({ params }: ProjectPageProps) {
const { id } = params;
Expand All @@ -76,11 +78,10 @@ export default function HomePage({ params }: ProjectPageProps) {
const statusData = getStatusData();
return (
<main className="px-10">

<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
<Card className="col-span-2">
<CardHeader>
<CardTitle>Tasks Finished Over Time</CardTitle>
<CardTitle>Tasks Finished Over Time project {id}</CardTitle>
<CardDescription>
Number of tasks completed each month
</CardDescription>
Expand All @@ -100,15 +101,21 @@ export default function HomePage({ params }: ProjectPageProps) {
<XAxis dataKey="month" />
<YAxis />
<ChartTooltip content={<ChartTooltipContent />} />
<Area type="monotone" dataKey="tasksFinished" stroke="#8884d8" fill="#8884d8" />
<Area
type="monotone"
dataKey="tasksFinished"
stroke="#8884d8"
fill="#8884d8"
/>
</AreaChart>
</ChartContainer>
</CardContent>
<CardFooter>
<div className="flex w-full items-start gap-2 text-sm">
<div className="grid gap-2">
<div className="flex items-center gap-2 font-medium leading-none">
Trending up by 10% this month <TrendingUp className="h-4 w-4" />
Trending up by 10% this month{" "}
<TrendingUp className="h-4 w-4" />
</div>
<div className="flex items-center gap-2 leading-none text-muted-foreground">
January - June 2024
Expand All @@ -121,9 +128,7 @@ export default function HomePage({ params }: ProjectPageProps) {
<Card>
<CardHeader>
<CardTitle>Task Priority Distribution</CardTitle>
<CardDescription>
Breakdown of tasks by priority
</CardDescription>
<CardDescription>Breakdown of tasks by priority</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer config={chartConfig} className="h-[300px] w-full">
Expand All @@ -138,24 +143,23 @@ export default function HomePage({ params }: ProjectPageProps) {
dataKey="count"
>
{priorityData.map((entry, index) => (
<Cell key={`cell-${index}`} fill={COLORS[index % COLORS.length]} />
<Cell
key={`cell-${index}`}
fill={COLORS[index % COLORS.length]}
/>
))}
</Pie>
<ChartTooltip content={<ChartTooltipContent />} />
</PieChart>
</ChartContainer>
</CardContent>
<CardFooter>
Low, Medium, and High priority tasks
</CardFooter>
<CardFooter>Low, Medium, and High priority tasks</CardFooter>
</Card>

<Card className="col-span-full">
<CardHeader>
<CardTitle>Task Status Overview</CardTitle>
<CardDescription>
Current status of all tasks
</CardDescription>
<CardDescription>Current status of all tasks</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer config={chartConfig} className="h-[300px] w-full">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import { Button } from '@amaxa/ui/button'
import { Dialog, DialogContent, DialogHeader, DialogTrigger } from '@amaxa/ui/dialog'
import React from 'react'
import React from "react";

import { Button } from "@amaxa/ui/button";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTrigger,
} from "@amaxa/ui/dialog";

export default function PermissionsModal({
projectId,
userId,
defaultPermissions,
}: {
projectId: string
userId: string
defaultPermissions: string[]
projectId: string;
userId: string;
defaultPermissions: string[];
}) {

return (
<Dialog>
<DialogTrigger>
Expand All @@ -25,11 +30,8 @@ export default function PermissionsModal({
</DialogHeader>
</DialogContent>
<div>
{defaultPermissions.map((permission) => (
`Permission: ${permission}`
))}
{defaultPermissions.map((permission) => `Permission: ${permission}`)}
</div>
</Dialog>
)
);
}

Loading

0 comments on commit 813241e

Please sign in to comment.