All files / client/src/markdown/components HelpDesks.tsx

87.5% Statements 7/8
100% Branches 2/2
100% Functions 2/2
87.5% Lines 7/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38                    356x                         356x 2x 2x 2x         6x 6x          
import { ReactNode } from "react";
import { useTranslation } from "react-i18next";
import { config } from "shared/config";
import { EventName } from "shared/config/eventConfigTypes";
 
interface HelpDesk {
  nameFi: string;
  nameEn: string;
}
 
const helpDesksByEvent: Record<EventName, HelpDesk[]> = {
  [EventName.ROPECON]: [
    { nameFi: "Larp- ja Roolipelitiski", nameEn: "Larp & RPG Desk" },
    { nameFi: "Pelitiski", nameEn: "Gaming Desk" },
    { nameFi: "Info", nameEn: "Info Desk" },
  ],
  [EventName.HITPOINT]: [{ nameFi: "Roolipelitiski", nameEn: "RPG Desk" }],
  [EventName.TRACON]: [{ nameFi: "Roolipelitiski", nameEn: "RPG Desk" }],
  [EventName.SOLMUKOHTA]: [
    { nameFi: "Ohjelmatiski", nameEn: "Programme Desk" },
  ],
};
 
export const HelpDesks = (): ReactNode => {
  const { i18n } = useTranslation();
  const helpDesks = helpDesksByEvent[config.event().eventName];
  const isFinnish = i18n.language === "fi";
 
  return (
    <ul>
      {helpDesks.map((desk) => {
        const name = isFinnish ? desk.nameFi : desk.nameEn;
        return <li key={name}>{name}</li>;
      })}
    </ul>
  );
};