import React from "react";
import { useTranslation } from "react-i18next";
import { Tag } from "@local-logic/design-system";
import { SchoolName } from "../../SchoolName";
import * as styles from "./styles";
import { useNeighborhoodSchools } from "~/sdks/NeighborhoodSchools/context";
import { formatAddress } from "~/utils/primitives/stringUtils";
export const Body = ({ schools, headers, }) => {
    const { t } = useTranslation("neighborhoodSchools");
    const { hasCategories } = useNeighborhoodSchools();
    return (React.createElement(React.Fragment, null, schools === null || schools === void 0 ? void 0 : schools.map((school) => {
        var _a, _b, _c, _d, _e, _f;
        return (React.createElement("tr", { key: `row-${school.name}`, className: styles.rows },
            React.createElement("td", null,
                React.createElement(SchoolName, { school: school })),
            React.createElement("td", null,
                React.createElement("div", { className: styles.badges }, (_b = (_a = school.school_attributes) === null || _a === void 0 ? void 0 : _a.types) === null || _b === void 0 ? void 0 : _b.map((type) => (React.createElement(Tag, { key: `${school.name}-${type}` }, type))))),
            headers.indexOf("languages") !== -1 && (React.createElement("td", null,
                React.createElement("div", { className: styles.badges }, (_d = (_c = school.school_attributes) === null || _c === void 0 ? void 0 : _c.languages) === null || _d === void 0 ? void 0 : _d.map((language) => (React.createElement(Tag, { key: `${school.name}-${language}`, variant: "light" }, language === "fr" ? t("french") : t("english"))))))),
            React.createElement("td", null,
                React.createElement("div", { className: styles.badges }, (_f = (_e = school.school_attributes) === null || _e === void 0 ? void 0 : _e.levels) === null || _f === void 0 ? void 0 : _f.map((level) => (React.createElement(Tag, { key: `${school.name}-${level}`, variant: "light" }, level))))),
            hasCategories && (React.createElement("td", null,
                React.createElement("div", { className: styles.badges },
                    React.createElement(Tag, { isVisible: !!school.is_advanced_placement }, t("categories.advancedPlacement")),
                    React.createElement(Tag, { isVisible: !!school.is_charter }, t("categories.charter")),
                    React.createElement(Tag, { isVisible: !!school.is_magnet }, t("categories.magnet"))))),
            React.createElement("td", null,
                React.createElement("p", { className: styles.mediumText }, formatAddress({
                    street: school.address,
                    city: school.city,
                    state: school.province,
                })))));
    })));
};
//# sourceMappingURL=index.js.map