@@ -194,7 +194,7 @@ export default async function Page({ params }: { params: Promise<{ type: string;
This page is archived
- It can be seen only by admins. Make any edits to make it visible again.
+ It can be seen only by administrators. Make any edits to make it visible again.
)}
{blocks.map((block) => (
diff --git a/app/account/deleteDialog.tsx b/app/account/deleteDialog.tsx
new file mode 100644
index 0000000..4106742
--- /dev/null
+++ b/app/account/deleteDialog.tsx
@@ -0,0 +1,44 @@
+"use client"
+
+import { useTransition } from "react";
+import {
+ Dialog, DialogClose, DialogContent, DialogDescription,
+ DialogFooter, DialogHeader, DialogTitle, DialogTrigger,
+} from "@/components/ui/dialog";
+import deleteUserAction from "../actions/delete";
+import { Button } from "@/components/ui/button";
+import { Spinner } from "@/components/ui/spinner";
+
+export function DeleteDialog({ userId }: { userId: string }) {
+ const [isPending, startTransition] = useTransition();
+
+ return (
+
+ );
+}
\ No newline at end of file
diff --git a/app/account/logoutButton.tsx b/app/account/logoutButton.tsx
new file mode 100644
index 0000000..2d5316a
--- /dev/null
+++ b/app/account/logoutButton.tsx
@@ -0,0 +1,20 @@
+"use client"
+
+import { useTransition } from "react";
+import { Button } from "@/components/ui/button";
+import { Spinner } from "@/components/ui/spinner";
+import logout from "../actions/logout";
+
+export function LogoutButton() {
+ const [isPending, startTransition] = useTransition();
+
+ return (
+
+ );
+}
\ No newline at end of file
diff --git a/app/account/page.tsx b/app/account/page.tsx
new file mode 100644
index 0000000..bb754d9
--- /dev/null
+++ b/app/account/page.tsx
@@ -0,0 +1,87 @@
+import Footer from "@/components/footer";
+import Header from "@/components/header";
+import { Button } from "@/components/ui/button";
+import { Separator } from "@/components/ui/separator";
+import { getCurrentUser } from "@/lib/user";
+import { formatDate } from "@/lib/utils";
+import { BookOpenTextIcon, SignatureIcon, UserIcon } from "lucide-react";
+import { redirect } from "next/navigation";
+import { DeleteDialog } from "./deleteDialog";
+import { LogoutButton } from "./logoutButton";
+
+function ProfileField({ label, value }: { label: string; value: string }) {
+ return (
+
+ );
+}
+
+export default async function Account() {
+ const user = await getCurrentUser();
+ if (!user) redirect("/");
+
+ return (
+ <>
+
+
+
+
+
+
Profile
+
+
+
+
Citizenship
+
+
+
+
Signature
+
+
+
+
+
+
Personal details
+
+ Synced from your Kotosoft ID account. To correct any details, update them there first, then click Update below.
+
+
+
+
+
+
+
+ {user.isAdmin &&
}
+
+
+
+
+
Update personal details
+
Syncs your name, email, and birthday from Kotosoft ID
+
+
+
+
+
+
Log out
+
Log out from your account on this device
+
+
+
+
+
+
+
Delete account
+
Permanently delete your account and all associated data
+
+
+
+
+
+
+
+ >
+ );
+}
\ No newline at end of file
diff --git a/app/actions/delete.tsx b/app/actions/delete.tsx
new file mode 100644
index 0000000..8cf5a4b
--- /dev/null
+++ b/app/actions/delete.tsx
@@ -0,0 +1,9 @@
+"use server"
+
+import { deleteUser } from "@/lib/user/repository"
+import logout from "./logout";
+
+export default async function deleteUserAction(userId: string ) {
+ await deleteUser(userId);
+ await logout();
+}
\ No newline at end of file
diff --git a/app/api/callback/route.ts b/app/api/callback/route.ts
index a93c8af..687e1dd 100644
--- a/app/api/callback/route.ts
+++ b/app/api/callback/route.ts
@@ -39,7 +39,7 @@ export async function GET(request: NextRequest) {
await createSession(user.id);
await deleteOAuthCookies();
- return NextResponse.redirect(new URL("/", request.url));
+ return NextResponse.redirect(new URL("/account", request.url));
} catch (e) {
console.error("OAuth callback error:", e);
return NextResponse.redirect(new URL("/callback/error", request.url));
diff --git a/app/create/client.tsx b/app/create/client.tsx
index 2868756..51b77bd 100644
--- a/app/create/client.tsx
+++ b/app/create/client.tsx
@@ -38,7 +38,7 @@ export default function CreatePageClient() {
return (
-
Create page
+
Create page
-
News
+
News
{user?.isAdmin && (
diff --git a/app/page.tsx b/app/page.tsx
index 2eef71a..527e306 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -12,34 +12,34 @@ export default async function Home() {
<>
-
Welcome to the European Federation!
+
Welcome to the European Federation!
-
-
Become a citizen
+
-
Learn more about the President
+ Learn more about the President
-
Acknowledge with the Federal Government
+ Acknowledge with the Federal Government
-
Regions of the Federation
+ Regions of the Federation
-
Receive consular services abroad
+ Receive consular services abroad
-
Recent news
+
Recent news
{
news.length > 0 ? news.map((n) => (
@@ -47,7 +47,7 @@ export default async function Home() {
)) :
There are no news yet...
}
-
See all news
+
See all news
diff --git a/components/editor.tsx b/components/editor.tsx
index 3c580c1..69e8acc 100644
--- a/components/editor.tsx
+++ b/components/editor.tsx
@@ -137,7 +137,7 @@ export default function Editor({ page, initialBlocks = [], onChange }: EditorPro
return (
-
Content
+
Content
{blocks.length === 0 && (
No blocks yet. Add one below.
)}
diff --git a/components/header.tsx b/components/header.tsx
index 3730ed0..9fd8fe3 100644
--- a/components/header.tsx
+++ b/components/header.tsx
@@ -2,7 +2,6 @@ import Image from "next/image";
import { Button } from "./ui/button";
import login from "@/app/actions/login";
import { getCurrentUser } from "@/lib/user";
-import logout from "@/app/actions/logout";
import Link from "next/link";
import { getNavLinks } from "@/lib/navlinks/repository";
@@ -30,9 +29,7 @@ export default async function Header() {
{
user ? (
-
+
) : (