"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 { WorkingGroupActions } from "@/features/pswg/working-group/components/working-group-actions";
import {
  normalizeWorkingGroupLanguage,
  workingGroupText,
} from "@/features/pswg/working-group/working-group-i18n";

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

  const currentLanguage = normalizeWorkingGroupLanguage(language);
  const text = workingGroupText[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>

      <WorkingGroupActions />
    </Box>
  );
}