Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
sayandedotcom committed Nov 20, 2024
1 parent 4a5c8fa commit a668ee3
Show file tree
Hide file tree
Showing 40 changed files with 1,341 additions and 233 deletions.
7 changes: 7 additions & 0 deletions apps/web/app/(portals)/dashboard/analytics/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use client";

function AnalyticsDashboard() {
return <div>AnalyticsDashboard</div>;
}

export default AnalyticsDashboard;
7 changes: 0 additions & 7 deletions apps/web/app/(portals)/dashboard/chart/page.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/web/app/(portals)/dashboard/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Metadata } from "next";
import DashboardProvider from "./providers";

export const metadata: Metadata = {
title: "Dashboard • Refhired.com",
title: "Dashboard",
description: "Get job referrals to the top best companies of the world",
robots: {
index: false,
Expand Down
37 changes: 33 additions & 4 deletions apps/web/app/(portals)/dashboard/overview/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
"use client";

import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@referrer/ui";
import { TrendingUp } from "lucide-react";

import {
BarChartComponent,
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@referrer/ui";

import { RecentSales } from "@/components/dashboard/components/recent-sales";

const chartData = [
{ month: "January", desktop: 186, mobile: 80 },
{ month: "February", desktop: 305, mobile: 200 },
{ month: "March", desktop: 237, mobile: 120 },
{ month: "April", desktop: 73, mobile: 190 },
{ month: "May", desktop: 209, mobile: 130 },
{ month: "June", desktop: 214, mobile: 140 },
];
function OverviewDashboard() {
return (
<>
Expand Down Expand Up @@ -92,12 +110,23 @@ function OverviewDashboard() {
</CardContent>
</Card>
</div>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-7">
<div className="mt-1 grid gap-4 md:grid-cols-2 lg:grid-cols-7">
<Card className="col-span-4">
<CardHeader>
<CardTitle>Overview</CardTitle>
<CardTitle>Conversion Rate</CardTitle>
<CardDescription>January - June 2024</CardDescription>
</CardHeader>
<CardContent className="pl-2">Hi</CardContent>
<CardContent className="">
<BarChartComponent chartData={chartData} />
</CardContent>
<CardFooter className="flex-col items-start gap-2 p-3 text-sm">
<div className="flex gap-2 font-medium leading-none">
Trending up by 5.2% this month <TrendingUp className="h-4 w-4" />
</div>
<div className="text-muted-foreground leading-none">
Showing total visitors for the last 6 months
</div>
</CardFooter>
</Card>
<Card className="col-span-3">
<CardHeader>
Expand Down
49 changes: 16 additions & 33 deletions apps/web/app/(portals)/dashboard/requests/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import * as React from "react";
import { useState } from "react";

import { Search } from "lucide-react";

Expand All @@ -17,29 +17,21 @@ import {
TooltipProvider,
} from "@referrer/ui";

import { MailDisplay } from "@/components/dashboard/requests/components/mail-display";
import { MailList } from "@/components/dashboard/requests/components/mail-list";
import { PostsList } from "@/components/dashboard/requests/components/post-list";
import { RequestsDisplay } from "@/components/dashboard/requests/components/request-display";
import { RequestsList } from "@/components/dashboard/requests/components/request-list";
import { mails } from "@/components/dashboard/requests/data";

function RequestsDashboard() {
const mail = {
id: "6c84fb90-12c4-11e1-840d-7b25c5ee775a",
name: "William Smith",
email: "williamsmith@example.com",
subject: "Meeting Tomorrow",
text: "Hi, let's have a meeting tomorrow to discuss the project. I've been reviewing the project details and have some ideas I'd like to share. It's crucial that we align on our next steps to ensure the project's success.\n\nPlease come prepared with any questions or insights you may have. Looking forward to our meeting!\n\nBest regards, William",
date: "2023-10-22T09:00:00",
read: true,
labels: ["meeting", "work", "important"],
};
const [postId, setPostId] = useState();

return (
<TooltipProvider delayDuration={0}>
<ResizablePanelGroup
direction="horizontal"
onLayout={(sizes: number[]) => {
document.cookie = `react-resizable-panels:layout:mail=${JSON.stringify(sizes)}`;
}}
// onLayout={(sizes: number[]) => {
// document.cookie = `react-resizable-panels:layout:mail=${JSON.stringify(sizes)}`;
// }}
style={{ height: "calc(100vh-65px)" }}
className="h-[calc(100vh-65px)] items-stretch">
<ResizablePanel defaultSize={30} minSize={20}>
Expand All @@ -57,10 +49,7 @@ function RequestsDashboard() {
</div>
<Separator />
<TabsContent value="all" className="mt-2">
<MailList items={mails} />
</TabsContent>
<TabsContent value="unread" className="mt-2">
<MailList items={mails?.filter((item) => !item.read)} />
<PostsList postId={postId} setPostId={setPostId} />
</TabsContent>
</Tabs>
</ResizablePanel>
Expand All @@ -83,27 +72,21 @@ function RequestsDashboard() {
</TabsList>
</div>
<Separator />
{/* <div className="bg-background/95 p-4 backdrop-blur supports-[backdrop-filter]:bg-background/60">
<form>
<div className="relative">
<Search className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
<Input placeholder="Search" className="pl-8" />
</div>
</form>
</div> */}
<TabsContent value="all" className="mt-2">
<MailList items={mails} />
<RequestsList items={mails} postId={postId} />
</TabsContent>
<TabsContent value="unread" className="mt-2">
<MailList items={mails?.filter((item) => !item.read)} />
<RequestsList items={mails?.filter((item) => !item.read)} />
</TabsContent>
<TabsContent value="notresponded" className="mt-2">
<RequestsList items={mails?.filter((item) => !item.read)} />
</TabsContent>
</Tabs>
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel defaultSize={40} minSize={40}>
<MailDisplay
mail={mail}
// mail={mails.find((item) => item.id === mails.selected) || null}
<RequestsDisplay
// mail={mails.find((item) => item.id === mails.selected) || null}
/>
</ResizablePanel>
</ResizablePanelGroup>
Expand Down
36 changes: 35 additions & 1 deletion apps/web/app/(portals)/dashboard/revenue/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
"use client";

import { TrendingUp } from "lucide-react";

import {
AreaChartComponent,
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@referrer/ui";

function RevenueDashboard() {
return <div>RevenueDashboard</div>;
return (
<Card>
<CardHeader>
<CardTitle>Area Chart - Gradient</CardTitle>
<CardDescription>Showing total visitors for the last 6 months</CardDescription>
</CardHeader>
<CardContent>
<AreaChartComponent />
</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 5.2% this month <TrendingUp className="h-4 w-4" />
</div>
<div className="text-muted-foreground flex items-center gap-2 leading-none">
January - June 2024
</div>
</div>
</div>
</CardFooter>
</Card>
);
}

export default RevenueDashboard;
4 changes: 1 addition & 3 deletions apps/web/app/(portals)/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ export default function Home() {
isAuthor={session?.user?.id === data.userId}
/>
<Navigate userName={data.user.userName} postId={data.id}>
<PostCard.Description showMore={true}>
{data.description.substring(0, 350).concat(" ...")}
</PostCard.Description>
<PostCard.Description showMore={true}>{data.description}</PostCard.Description>
</Navigate>
<PostCard.Tags
allTags={false}
Expand Down
48 changes: 48 additions & 0 deletions apps/web/app/api/v1/dashboard/requests/[postId]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { NextRequest, NextResponse } from "next/server";

import prisma from "@referrer/prisma";

export async function GET(request: NextRequest, { params }: { params: { postId: string } }) {
const { postId } = params;

// const { user } = await getServerAuthSession();

// const cachedAllRequests = await redis.get(`USER:REQUESTS:${userId}`);
// if (cachedAllRequests) return JSON.parse(cachedAllRequests);
const data = await prisma.posts.findUnique({
where: {
id: postId,
},
select: {
applied: {
select: {
id: true,
applyInfo: true,
appliedAt: true,
reply: true,
status: true,
visibility: true,
user: {
select: {
name: true,
userName: true,
image: true,
email: true,
},
},
},
},
},
});
// await redis.set(`USER:REQUESTS:${userId}`, JSON.stringify(requests), "EX", cacheTime);

return NextResponse.json(
{ data: data },
{
status: 200,
headers: {
"Content-Type": "application/json",
},
}
);
}
42 changes: 42 additions & 0 deletions apps/web/app/api/v1/dashboard/requests/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { NextRequest, NextResponse } from "next/server";

import prisma from "@referrer/prisma";

export async function GET(request: NextRequest) {
const searchParams = request.nextUrl.searchParams;
const id = searchParams.get("userId");

// const { user } = await getServerAuthSession();

// const cachedAllRequests = await redis.get(`USER:REQUESTS:${userId}`);
// if (cachedAllRequests) return JSON.parse(cachedAllRequests);
const data = await prisma.user.findUnique({
where: {
id: id,
},
select: {
posts: {
select: {
id: true,
description: true,
stars: true,
createdAt: true,
totalApplied: true,
acceptLimit: true,
expiresAt: true,
},
},
},
});
// await redis.set(`USER:REQUESTS:${userId}`, JSON.stringify(requests), "EX", cacheTime);

return NextResponse.json(
{ data: data },
{
status: 200,
headers: {
"Content-Type": "application/json",
},
}
);
}
43 changes: 43 additions & 0 deletions apps/web/app/api/v1/og/route.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { ImageResponse } from "next/og";

// import { Icons } from "@/components/icons/icons";

// import { siteConfig } from "@/config";

export async function GET(request: Request) {
try {
const { searchParams } = new URL(request.url);

// ?title=<title>

const title = searchParams.has("title") && searchParams.get("title")?.slice(0, 100);
const image = searchParams.get("image") || "";

return new ImageResponse(
(
<div
style={{
backgroundColor: "hsl(var(--foreground))",
height: "100%",
width: "100%",
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
fontSize: 32,
fontWeight: 600,
}}>
<svg width="75" viewBox="0 0 75 65" fill="#000" style={{ margin: "0 75px" }}>
<path d="M37.59.25l36.95 64H.64l36.95-64z"></path>
</svg>
<div style={{ marginTop: 40, fontFamily: "hsl(var(--font-heading))" }}>Hello, World</div>
</div>
)
);
} catch (e: any) {
console.log(`${e.message}`);
return new Response(`Failed to generate the image`, {
status: 500,
});
}
}
Loading

0 comments on commit a668ee3

Please sign in to comment.