News
+
{user?.isAdmin && (
@@ -31,12 +42,12 @@ export default async function News() {
- {
- news.length > 0 ? news.map((n) => (
-
- )) :
There are no news yet...
- }
+ {
+ filteredNews.length > 0 ? filteredNews.map((n) => (
+
+ )) : There are no news yet...
+ }
);
-}
+}
\ No newline at end of file
diff --git a/app/news/searchBar.tsx b/app/news/searchBar.tsx
new file mode 100644
index 0000000..7e54032
--- /dev/null
+++ b/app/news/searchBar.tsx
@@ -0,0 +1,45 @@
+"use client"
+
+import { SearchIcon } from "lucide-react";
+import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
+import { Field } from "@/components/ui/field";
+import { usePathname, useRouter, useSearchParams } from "next/navigation";
+import { useState, useTransition } from "react";
+
+export default function SearchBar() {
+ const router = useRouter();
+ const pathname = usePathname();
+ const searchParams = useSearchParams();
+ const [value, setValue] = useState(searchParams.get("q") ?? "");
+ const [, startTransition] = useTransition();
+
+ function handleChange(next: string) {
+ setValue(next);
+
+ const params = new URLSearchParams(searchParams.toString());
+ if (next) {
+ params.set("q", next);
+ } else {
+ params.delete("q");
+ }
+
+ startTransition(() => {
+ router.replace(`${pathname}?${params.toString()}`, { scroll: false });
+ });
+ }
+
+ return (
+
+
+ handleChange(e.target.value)}
+ />
+
+
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/lib/citizenship/repository.ts b/lib/citizenship/repository.ts
index 8e5de33..4fa18c4 100644
--- a/lib/citizenship/repository.ts
+++ b/lib/citizenship/repository.ts
@@ -77,9 +77,8 @@ export async function getUserApplications(userId: string) {
});
}
-export async function getPendingApplications() {
+export async function getAllApplications() {
return prisma.citizenshipApplication.findMany({
- where: { status: "PENDING" },
orderBy: { createdAt: "desc" },
include: {
user: {
diff --git a/lib/citizenship/types.ts b/lib/citizenship/types.ts
index 9b0a7e1..bb9e5fb 100644
--- a/lib/citizenship/types.ts
+++ b/lib/citizenship/types.ts
@@ -43,4 +43,5 @@ export type CitizenshipApplicationWithWarning = CitizenshipApplication & {
previousCitizenship: boolean;
profileUrl: string;
signatureUrl: string;
-};
+ reviewer: { firstName: string; secondName: string } | null;
+};
\ No newline at end of file