Skip to content

Commit 32aa7a6

Browse files
chin-flagscxalem
authored andcommitted
added user field to application, some improvements
1 parent 13350d8 commit 32aa7a6

File tree

5 files changed

+46
-77
lines changed

5 files changed

+46
-77
lines changed

app/applications/page.tsx

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { getApplications } from "@/lib/actions";
2+
import { notFound } from "next/navigation";
3+
import ApplicationsContainer from "@/components/ApplicationsContainer";
4+
5+
type PageProps = {
6+
searchParams: {
7+
user: string;
8+
};
9+
};
10+
11+
const MyApplications = async ({ searchParams }: PageProps) => {
12+
const user = searchParams.user;
13+
14+
if (!user) {
15+
return notFound();
16+
}
17+
18+
const applications = await getApplications(
19+
(applications) => applications.user === user
20+
);
21+
22+
return (
23+
<ApplicationsContainer applications={applications} className="mt-24" />
24+
);
25+
};
26+
27+
export default MyApplications;

components/AllApps.tsx

-24
This file was deleted.

components/EditorsPick.tsx

-31
This file was deleted.

components/Nav.tsx

+18-22
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
"use client";
22

33
import { Fragment, useState } from "react";
4-
import { useAccount } from "wagmi";
5-
import { Menu, Transition } from "@headlessui/react";
6-
import { Bars4Icon } from "@heroicons/react/24/outline";
4+
import { Dialog, Menu, Transition } from "@headlessui/react";
5+
import { Bars4Icon, CheckIcon } from "@heroicons/react/24/outline";
76
import NewApplication from "./NewApplication";
87
import Link from "next/link";
98
import PolisLogo from "./icons/PolisLogo";
109
import { ConnectButton } from "./ConnectButton";
1110

1211
export const Nav = () => {
1312
const [open, setOpen] = useState(false);
14-
const { isConnected, address } = useAccount();
1513

1614
return (
1715
<>
@@ -20,24 +18,22 @@ export const Nav = () => {
2018
<PolisLogo />
2119
<span className="text-2xl font-bold text-primary">Polis</span>
2220
</Link>
23-
<div className="hidden lg:flex">
24-
{isConnected && (
25-
<div className="flex items-center gap-7">
26-
<Link
27-
href={`/apps?user=${address}`}
28-
className="duration-200 ease-in-out hover:opacity-50"
29-
>
30-
My Applications
31-
</Link>
32-
<button
33-
className="duration-200 ease-in-out hover:opacity-50"
34-
onClick={() => setOpen(true)}
35-
>
36-
Submit New Application
37-
</button>
38-
</div>
39-
)}
40-
<ConnectButton />
21+
<div className="hidden lg:block">
22+
<div className="flex items-center gap-7">
23+
<Link
24+
href="/application"
25+
className="duration-200 ease-in-out hover:opacity-50"
26+
>
27+
My Application
28+
</Link>
29+
<button
30+
className="duration-200 ease-in-out hover:opacity-50"
31+
onClick={() => setOpen(true)}
32+
>
33+
Submit New Application
34+
</button>
35+
<ConnectButton />
36+
</div>
4137
</div>
4238
<div className="z-10 lg:hidden">
4339
<Menu as="div" className="relative inline-block text-left">

types/global.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ declare global {
77
user: string;
88
category: string[];
99
description: string;
10+
user: string;
1011
applicationUrl?: string;
1112
repoUrl?: string;
1213
logo?: string;

0 commit comments

Comments
 (0)