Skip to content

Place card

Restaurants, shops, museums — rating, price level, distance, and whether a place is open now, worked out from its hours.

On this page
Open
The place card, in an aparté chat The place card, in an aparté chat

A place as a person decides on it: its photo and kind, its rating and price level, how far it is, and whether it is open — worked out from its hours at the moment the card is drawn, across midnight, on the place’s own clock when the data gives its offset. Open the frame at another time of day and the line changes.

Open

One row per place.

Open

One place with the week’s hours, today first, and Directions and Website buttons when the data allows them (Call too, with a phone number).

Open
bash
npm install @aparte/plugin-cards @aparte/core
ts
import { setupPlaceCard } from '@aparte/plugin-cards/place';

setupPlaceCard({ tool: 'find_places', currencySymbol: '€' });

A price level is a tier, not an amount: currencySymbol is the sign it is drawn with ($ by default). The reader takes both generations of Google Places and Yelp; the fields and the hours helpers are in the guide.

Without a photo, the card draws a map of its own and fetches nothing. Give it your map tiles and a place with coordinates sits on a real one, under its marker:

ts
setupPlaceCard({
  tool: 'find_places',
  mapTiles: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
  mapAttribution: '© OpenStreetMap contributors',
});
  • Your provider, your choice. Any server that cuts tiles the usual way: OpenStreetMap’s, with no key but a usage policy that rules out heavy traffic; MapTiler’s or Stadia’s, with your key in the address; your own. Each tile is a request from your visitor’s browser to that server, which sees the visitor and the place — which is why the card fetches none unless you ask. The tiles are your configuration, so the chat’s image policy does not apply to them; a place’s photo does follow it.
  • The credit. mapAttribution is shown in a corner of the map; most providers require one.
  • How close. mapZoom (16 by default) is the tile server’s zoom: 16 is a street and its neighbours, 13 a district.
  • What stays. A photo still wins over the map. A place without coordinates keeps the drawn map, and so does a card whose tile fails to load. The dark scheme keeps the tiles as they are; --aparte-place-map-filter takes a CSS filter to dim them (brightness(0.85)).