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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 11x 11x 2x 11x 10x 10x 10x | import { SavedPlacesList, type SavedPlaceItem } from "@overworld/ui";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import React from "react";
import { Link } from "react-router-dom";
import {
categoryName,
placeCategoryForId,
placeDetailLink,
} from "@overworld/places/catalog";
import { useSavedPlaces } from "@overworld/places/savedPlaces";
import PlacesLoadStatus from "../../nearby/components/PlacesLoadStatus";
import { placeIconDefinition } from "../../nearby/util/mapbox/placeIcons";
export default function BookmarkedPlaces() {
const { saved, error, remove, retry } = useSavedPlaces();
const places = Object.entries(saved).sort(
([aId, aName], [bId, bName]) =>
aName.localeCompare(bName) || aId.localeCompare(bId),
);
return (
<SavedPlacesList
onRemove={remove}
status={
<PlacesLoadStatus
label="Saved places"
issues={
error ? [{ label: "Saved places", message: error, retry }] : []
}
/>
}
emptyContent={
!error && (
<p>
Save a place from <Link to="/nearby/places">Places nearby</Link> to
see it here.
</p>
)
}
places={places.map<SavedPlaceItem>(([id, name]) => {
const category = placeCategoryForId(id);
return {
id,
name,
secondary: category && categoryName(category),
icon: category && (
<FontAwesomeIcon
icon={placeIconDefinition(category)}
aria-hidden="true"
className={`transit-place-icon transit-place-icon--${category}`}
/>
),
renderLink: (props) => <Link {...props} to={placeDetailLink(id)} />,
};
})}
/>
);
}
|