"use client" import { useEffect, useState } from "react" import { useLocale, useTranslations } from "next-intl" import type { Position } from "@/types" import { Item, ItemContent, ItemDescription, ItemTitle } from "@/components/ui/item" import { Badge } from "@/components/ui/badge" import { Spinner } from "@/components/ui/spinner" import { getMyPositions } from "@/actions/positions" export default function Positions() { const t = useTranslations("MePage.items.positions") const locale = useLocale() const [positions, setPositions] = useState(null) const [loading, setLoading] = useState(true) useEffect(() => { getMyPositions(locale) .then(setPositions) .finally(() => setLoading(false)) }, [locale]) return (

{t("title")}

{loading && (
{t("loading")}
)} {!loading && (
{positions && positions.length > 0 ? ( positions.map((position) => ( {position.name} {position.description && ( {position.description} )} {position.permissions.length > 0 && (
{position.permissions.map((perm) => ( {perm.code} ))}
)}
)) ) : (

{t("empty")}

)}
)}
) }