"use client";

import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import { useTheme } from "@mui/material/styles";

import { useAppLanguage } from "@/components/providers/app-language-provider";
import { PlenaryActions } from "@/features/pswg/plenary/components/plenary-actions";
import {
  normalizePlenaryLanguage,
  plenaryText,
} from "@/features/pswg/plenary/plenary-i18n";

export function PlenaryHeader() {
  const theme = useTheme();
  const { language } = useAppLanguage();

  const currentLanguage = normalizePlenaryLanguage(language);
  const text = plenaryText[currentLanguage];

  return (
    <Box
      sx={{
        display: "flex",
        flexWrap: "wrap",
        alignItems: { xs: "flex-start", md: "flex-start" },
        justifyContent: "space-between",
        gap: 2,
      }}
    >
      <Box>
        <Typography
          sx={{
            color: theme.palette.text.primary,
            fontSize: { xs: 34, md: 40 },
            fontWeight: 700,
            lineHeight: 1,
          }}
        >
          {text.dashboard}
        </Typography>

        <Typography
          sx={{
            mt: 1.25,
            color: theme.palette.text.secondary,
            fontSize: 14,
          }}
        >
          {text.dashboardSubtitle}
        </Typography>
      </Box>

      <PlenaryActions />
    </Box>
  );
}