mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-06 21:42:06 +00:00
Some checks are pending
* feat(locations): derive site areas from state * chore(locations): keep ticket keys out of source comments --------- Co-authored-by: Codex Review Integration <codex-review@local.invalid>
35 lines
881 B
TypeScript
35 lines
881 B
TypeScript
import { Stack, Typography } from "@mui/material";
|
|
import { getAreaForState, normalizeStateCode } from "@/data/areas";
|
|
|
|
/** State abbreviation with the derived area as secondary text. */
|
|
export function StateAreaCell({ state }: { state?: string | null }) {
|
|
const code = normalizeStateCode(state);
|
|
const area = code === null ? null : getAreaForState(code);
|
|
|
|
if (code === null) {
|
|
return (
|
|
<Typography variant="body2" component="span">
|
|
{state?.trim() || "—"}
|
|
</Typography>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Stack spacing={0}>
|
|
<Typography variant="body2" component="span">
|
|
{code}
|
|
</Typography>
|
|
{area !== null && (
|
|
<Typography
|
|
variant="caption"
|
|
component="span"
|
|
sx={{
|
|
color: "text.secondary",
|
|
}}
|
|
>
|
|
{area}
|
|
</Typography>
|
|
)}
|
|
</Stack>
|
|
);
|
|
}
|