new version
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import Header from "@/components/header";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { useLocale, useTranslations } from "next-intl";
|
||||
import type { AdminUser, Consent, Document, Permission, Position, User } from "@/types";
|
||||
import type { AdminUser, Citizen, Consent, Permission, Position, User } from "@/types";
|
||||
import { AppWindowMacIcon, BriefcaseBusinessIcon, FileUserIcon, LogOutIcon, ShieldIcon, UserIcon } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
@@ -13,11 +13,9 @@ import Profile from "./items/profile";
|
||||
import Applications from "./items/applications";
|
||||
import Positions from "./items/positions";
|
||||
import Admin from "./items/admin";
|
||||
import Documents from "./items/documents";
|
||||
|
||||
interface Props {
|
||||
userData: User | null;
|
||||
documentsData: Document[] | null;
|
||||
consentsData: Consent[] | null;
|
||||
permissionsData: Permission[] | null;
|
||||
positionsData: Position[] | null;
|
||||
@@ -30,7 +28,6 @@ interface Props {
|
||||
|
||||
export default function MeClient({
|
||||
userData,
|
||||
documentsData,
|
||||
consentsData,
|
||||
permissionsData,
|
||||
positionsData,
|
||||
@@ -45,7 +42,6 @@ export default function MeClient({
|
||||
const hydratedRef = useRef(false)
|
||||
|
||||
const [user, setUser] = useState(userData);
|
||||
const [documents, setDocuments] = useState(documentsData);
|
||||
const [consents, setConsents] = useState(consentsData);
|
||||
const [permissions, setPermissions] = useState(permissionsData);
|
||||
const [positions, setPositions] = useState(positionsData);
|
||||
@@ -55,7 +51,6 @@ export default function MeClient({
|
||||
|
||||
const baseItems = useMemo(() => [
|
||||
{ name: t("items.profile.title"), icon: <UserIcon />, component: <Profile user={user} setUser={setUser} /> },
|
||||
{ name: "Documents", icon: <FileUserIcon/>, component: <Documents documents={documents} /> },
|
||||
{ name: t("items.applications.title"), icon: <AppWindowMacIcon />, component: <Applications consents={consents} setConsents={setConsents} /> },
|
||||
{ name: t("items.positions.title"), icon: <BriefcaseBusinessIcon />, component: <Positions /> },
|
||||
], [t, user, consents])
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
"use client"
|
||||
|
||||
import { useLocale, useTranslations } from "next-intl";
|
||||
import type { Document } from "@/types";
|
||||
import { Item, ItemActions, ItemContent, ItemDescription, ItemTitle } from "@/components/ui/item";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { localeMap } from "@/types";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { format } from "date-fns";
|
||||
import { revokeConsent } from "@/actions/consents";
|
||||
import { useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { Check, X } from "lucide-react";
|
||||
|
||||
interface Props {
|
||||
documents: Document[] | null;
|
||||
}
|
||||
|
||||
export default function Documents({ documents }: Props) {
|
||||
const t = useTranslations("MePage.items.applications");
|
||||
|
||||
const locale = useLocale();
|
||||
|
||||
return (
|
||||
<div className="w-full lg:max-w-sm flex flex-col gap-4">
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-xl">Documents</h1>
|
||||
<p className="text-sm text-muted-foreground">There you can find all of your documents issued by the European Federation</p>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import MeComponent from "./component";
|
||||
import { fetchConsents } from "@/actions/consents";
|
||||
import { fetchAllPositions, fetchAllPermissions, fetchAdminUsers, fetchMyPositions } from "@/actions/positions";
|
||||
import { getLocale } from "next-intl/server";
|
||||
import { Document } from "@/types";
|
||||
|
||||
export default async function Me() {
|
||||
const locale = await getLocale();
|
||||
@@ -14,8 +13,6 @@ export default async function Me() {
|
||||
redirect("/api/auth/initiate");
|
||||
}
|
||||
|
||||
const documents: Document[] = [];
|
||||
|
||||
const [consents, myPositions] = await Promise.all([
|
||||
fetchConsents(),
|
||||
fetchMyPositions(locale),
|
||||
@@ -35,7 +32,6 @@ export default async function Me() {
|
||||
return (
|
||||
<MeComponent
|
||||
userData={user}
|
||||
documentsData={documents}
|
||||
consentsData={consents}
|
||||
permissionsData={permissions}
|
||||
positionsData={positions}
|
||||
|
||||
Reference in New Issue
Block a user