Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/components/EntranceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ interface EntranceCardProps {
workplaceEntrance: OlmapWorkplaceEntrance;
workplace: OlmapWorkplace;
label: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
translateComponent: (record: any, fieldName: string) => JSX.Element;
onEntranceSelected: (entranceId: number) => void;
onUnloadingPlaceSelected: (unloadingPlace: OlmapUnloadingPlace) => void;
onViewDetails: (note: OlmapNote) => void;
Expand All @@ -30,6 +32,7 @@ const EntranceCard: React.FC<EntranceCardProps> = ({
workplaceEntrance,
workplace,
label,
translateComponent,
onEntranceSelected,
onUnloadingPlaceSelected,
onViewDetails,
Expand Down Expand Up @@ -85,12 +88,15 @@ const EntranceCard: React.FC<EntranceCardProps> = ({
<span>{label}</span>
</Avatar>
}
title={`${[
workplaceEntrance.description_translated,
workplaceEntrance.delivery_types.join("; "),
]
.filter((x) => x)
.join(": ")}`}
title={
<>
{translateComponent(workplaceEntrance, "description")}
{workplaceEntrance.description && workplaceEntrance.delivery_types
? ": "
: ""}
{workplaceEntrance.delivery_types.join("; ")}
</>
}
subheader={workplaceEntrance.delivery_hours || workplace.delivery_hours}
// The following backgrounds are in case a long word overlaps the floated photo
titleTypographyProps={{
Expand All @@ -102,7 +108,7 @@ const EntranceCard: React.FC<EntranceCardProps> = ({
/>
<CardContent style={{ padding: 0 }}>
<Typography variant="body2" color="textSecondary" component="p">
{workplaceEntrance.delivery_instructions_translated}
{translateComponent(workplaceEntrance, "delivery_instructions")}
</Typography>
</CardContent>
<CardActions style={{ padding: 0 }}>
Expand Down Expand Up @@ -150,7 +156,7 @@ const EntranceCard: React.FC<EntranceCardProps> = ({
>
<CardContent style={{ padding: 0 }}>
<Typography variant="body2" color="textSecondary" component="p">
{unloadingPlace.description_translated}
{translateComponent(unloadingPlace, "description")}
</Typography>
</CardContent>
<CardActions style={{ padding: 0 }}>
Expand Down
3 changes: 3 additions & 0 deletions src/components/VenueDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ const VenueDialog: React.FC<VenueDialogProps> = ({
onUnloadingPlaceSelected={onUnloadingPlaceSelected}
onViewDetails={onViewDetails}
label={romanize(index + 1)}
translateComponent={(record, fieldName) =>
translatedText(record, fieldName, onLocaleSelected)
}
/>
))}
</DialogContent>
Expand Down