Glossary: treetracker-web-map-client
Generated by .github/scripts/build-glossary.mjs from domain-graph.json (source commit 42b3a9a). Do not edit by hand.
This glossary lists the business terms of treetracker-web-map-client. Each term links to its domain, which says what the domain does, its rules, and its flows. The estate glossary shows which other repos use the same terms.
Terms
- Capture: Entity Profiles
- Continent: Search and Discovery
- Country: Entity Profiles
- Country leaderboard entry: Search and Discovery
- Dashboard config (navbar items, logo URL, map initial location): Authentication and Admin
- Embed code (iframe): Sharing and Embedding
- Embed flag: Sharing and Embedding
- Facebook like: Sharing and Embedding
- Featured organization: Search and Discovery
- Featured planter: Search and Discovery
- Featured tree: Search and Discovery
- Featured wallet: Search and Discovery
- Grower account: Entity Profiles
- Keycloak token: Authentication and Admin
- Keyword (tree id): Search and Discovery
- Layout: Map Exploration
- Map (treetracker-web-map-core): Map Exploration
- Map bounds: Map Exploration
- Map filters (userid, map_name, wallet, timeline): Map Exploration
- Navbar config: Map Exploration
- OIDC user: Authentication and Admin
- Organization: Entity Profiles
- Organization 178: Authentication and Admin
- Parent window message: Sharing and Embedding
- Planter (grower): Entity Profiles
- RPT permission: Authentication and Admin
- Runtime env (tile server URL, subdomains, web map API): Map Exploration
- Share URL: Sharing and Embedding
- Species: Entity Profiles
- Stakeholder: Entity Profiles
- Theme object: Authentication and Admin
- Timeline (start and end date): Search and Discovery
- Token: Entity Profiles
- Transaction: Entity Profiles
- Tree: Entity Profiles
- Tree marker: Map Exploration
- Wallet: Entity Profiles
Domains
Map Exploration
The interactive tree map that the public desktop layouts and LayoutMobile mount. `_app.js` picks the layout, `App.js` builds the `treetracker-web-map-core` Map with runtime tile settings, and `mapContext.js` shares it so pages can filter, zoom and select trees. A tree click resolves to a tree, token or wallet-token route, and each map move writes `?bounds=` into the URL.
Terms: Map (treetracker-web-map-core), Tree marker, Map bounds, Map filters (userid, map_name, wallet, timeline), Runtime env (tile server URL, subdomains, web map API), Navbar config, Layout
Rules:
- `getEnv` accepts only the three allowlisted tile keys and prefers `window.__RUNTIME_ENV__` (served by `/api/runtime-env`) over the build-time value; any other key throws.
- Each map move end rewrites the URL to `?bounds=` and keeps `timeline`, `embed=true` and `tree_id`; admin routes skip this update.
- The home, spotlight, planter, organization and wallet pages fly to `?bounds=` when it is present. Otherwise `/` and `/top` open at `gotoView(0, 0, 2)`, and planter, organization and wallet pages open at `map.getInitialView()` of the filtered map (the wallet page raises the zoom to at least 2).
- Among the public layouts only `Layout`, `LayoutEmbed` and `LayoutMobile` mount the map; the mobile home page (`LayoutMobileB`) and the mobile search page (`LayoutMobileC`) show no map.
- A tree click on a planter or organization page keeps that context (for example `/planters/:id/trees/:treeId`), and Next.js rewrites serve those paths with the tree page. On a wallet page the click goes to `/wallets/:id/tokens?tree_id=`, which rewrites to `/tokens/idfromquery`.
- Navbar links come from the `testing-config` entry of a hard-coded dev `map_config` URL that `getInitialProps` fetches, or from `defaultConfig` when `NEXT_PUBLIC_SERVER_CONFIG_DISABLED` is set or no entry matches.
Flows:
- Load Map (
Page load of / (and of every public route)): Loads a public page with the live tree map. `_app.js` detects the device, loads the navbar config and picks a layout; the layout loads `App.js` through `next/dynamic` with `ssr: false`. `App.js` builds the map with runtime tile settings and shares it through `mapContext.js`, the home page sets the first view, and each move end writes the bounds into the URL. The mobile home and mobile search layouts mount no map. - Open Tree From Map (Tree marker click in the map (`onClickTree`)): A click on a tree marker goes to `handleClickTree` in `App.js`. It notifies host windows, loads the full tree, resolves the next route with `getPathWhenClickTree` and calls `router.push` when the route changes. `_app.js` shows a progress bar while the next page loads.
Entity Profiles
Detail pages for trees, planters, organizations, wallets, tokens and version 2 captures. Pages load data on the server through `api.js` and `requestAPI`, degrade with `PageLoadError` or `SectionUnavailable` when the API fails, and drive the shared map to the entity.
Terms: Tree, Planter (grower), Organization, Wallet, Token, Transaction, Capture, Grower account, Stakeholder, Species, Country
Rules:
- Tree, planter, organization, wallet and capture pages use ISR with no prebuilt paths and `fallback: 'blocking'`; they and `/top` revalidate every 300 s unless `NEXT_CACHE_REVALIDATION_OVERRIDE` is set.
- `wrapper` maps an API 404 to `notFound` and any other error to `loadError` with a 30 s revalidate; the page then shows `PageLoadError` with a Retry button.
- The token page uses `getServerSideProps` and returns `notFound` for any error.
- Requests through `api.js` and `requestAPI` time out after 15 s (`API_TIMEOUT_MS`); the direct axios calls in the token and search pages set no timeout.
- `getOrgLinks` uses `Promise.allSettled`, so a failed featured-trees, associates or species request shows `SectionUnavailable`; the wallet page uses `Promise.all`, so one failed request fails the whole page.
- `getPlanterName` shows a grower as first name plus last initial on the planter page, in the planter breadcrumbs of the tree and capture pages and in `TreeInfoDialog`. The planter cards of the tree, token and capture pages show the full last name.
- Planter and organization badges ('Verified Planter', 'Seeking Orgs', 'Verified Organization', 'Seeking Planter') are hard-coded; tree badges come from `approved` and `token_id`.
- A token shows 'Can be transferred' only when it is not claimed and has no pending transfer.
Flows:
- View Tree Detail (
GET /trees/[treeid]): Renders `/trees/[treeid]` with Incremental Static Regeneration. `getStaticProps` loads the tree, its planter and its organization through `api.js`, and `wrapper` turns errors into `notFound` or `loadError`. The page focuses the tree on the shared map and shows verification and token badges, like and share controls, and planter and organization cards. - View Grower or Organization Profile (
GET /planters/[planterid], /organizations/[organizationid], /wallets/[walletid]): Renders the planter, organization and wallet profile pages with ISR through `wrapper`. Planter and organization pages load their linked featured trees, associates and species with `getOrgLinks` and show `SectionUnavailable` for failed parts; the wallet page loads species, tokens, region counts and trees with `Promise.all`. Each page filters the shared map to the entity. - View Token or Capture (
GET /tokens/[tokenid] (also /wallets/:id/tokens/:tokenId through a rewrite) and GET /v2/captures/[captureid]): Renders token pages with `getServerSideProps` and version 2 capture pages with ISR. The token page loads the token, wallet, transactions, tree and planter, focuses the token tree on the map and shows claim and transferability tags. The capture page loads the capture, grower, country and stakeholder; no page links to `/v2/captures`, so users open it by URL.
Search and Discovery
Ways to find trees other than panning the map: the keyword search page, the date filters (the map `Timeline` and the `/filter` page) and the Tree Spotlight page with featured trees, organizations, planters, wallets and a country leaderboard. Every layout hides the search bar, so the search page is reachable only by URL.
Terms: Keyword (tree id), Timeline (start and end date), Featured tree, Featured planter, Featured organization, Featured wallet, Country leaderboard entry, Continent
Rules:
- A timeline start date must not be after its end date; `Timeline` and `Filter` both reject it, and `Timeline` allows dates up to today only.
- `Timeline` renders only on `/` and `/top`, and it sends its filter to the map with `map.setFilters({ timeline })` only; it does not change the URL.
- The keyword search treats the keyword as a tree id: `/search` GETs `/trees/:keyword` and lists one result.
- No layout renders the search bar: `LayoutEmbed` gates `SearchFilter` behind `false &&`, `LayoutMobile` comments it out, and `/top` hides `SearchButton` and its `Filter` behind `false &&`.
- `NEXT_PUBLIC_COUNTRY_LEADER_BOARD_DISABLED=true` skips both leaderboard requests; the leaderboard heading, the continent chips and the table header still render with no rows. `.env.production` sets this flag to true, so the production build shows no leaderboard rows.
- `/filter` prints the start date on the 'End Date' line and a fixed 'Found trees: 1,000,000'; it does not filter the map.
Flows:
- Search by Keyword (
GET /search?keyword=<tree id> (by URL only)): Looks up one tree by id. No layout shows the search bar, so a user must open `/search?keyword=<id>` (or `/filter`) by URL to see `SearchFilter`. The server GETs `/trees/:keyword` with axios, and the page lists the result as a link to the tree page. - Filter by Date Range (
Date change in the map Timeline on / or /top): Filters trees by date. On `/` and `/top` the map `Timeline` validates the range and calls `map.setFilters({ timeline })`. The `Filter` form inside `SearchFilter` (only on `/search` and `/filter`) pushes `/filter?timeline=`, and that page only prints the dates. The `Filter` copy on `/top` is hidden behind `false &&`. - Browse Tree Spotlight (
GET /top): `/top` (the home page button 'Let's Find a Tree' links to it) loads featured trees, organizations, planters and wallets plus the country leaderboard with ISR, resets the map to the global view and lets users pick a continent or fly to a country. A load failure shows a warning with Retry. `.env.production` sets `NEXT_PUBLIC_COUNTRY_LEADER_BOARD_DISABLED=true`, so the production leaderboard has no rows. In embed mode the page content is hidden (`isFloatingDisabled`).
Sharing and Embedding
Lets visitors share a tree, token or capture page by link, email, Facebook, Twitter or iframe code, like it on Facebook, and run the map in embed mode inside another site or app. Embed mode comes from `embed=true` in the URL or from the fullscreen flag in localStorage.
Terms: Share URL, Embed code (iframe), Facebook like, Embed flag, Parent window message
Rules:
- `Share` uses `window.location.href` as it is: the copied link, the social URLs and the iframe embed code do not add `embed=true` and are not URL-encoded.
- `Share` and `LikeButton` appear only on tree, token and capture pages and in `TreeInfoDialog`; planter, organization and wallet pages have no share control.
- Embed mode is on when the URL contains `embed=true` (`useEmbed`) or when the localStorage flag `greenstand-web-map-client-embed` is true (set by the fullscreen icon).
- `LayoutEmbed` is desktop only; on mobile the normal layouts stay, and `embed=true` makes `Navbar` return null.
- In URL embed mode, internal links, search routes and the move-end URL keep `embed=true`.
- The Copy button reads 'Copied!' for 1.5 s after a copy.
Flows:
- Share Page (
Click on the share icon of a tree, token or capture page): On a tree, token or capture page the share icon opens the `Share` dialog with embed, Facebook, Twitter and email buttons and a read-only link with a Copy button. The embed button opens a second dialog with editable iframe code and its own Copy button. A Facebook like button sits next to the share icon. - View Embedded Map (
GET of a public page with ?embed=true, or a click on the fullscreen icon): Runs the web map inside another site or app. `_app.js` treats a page as embedded when the URL has `embed=true` or the fullscreen flag is set in localStorage, and on desktop it renders `LayoutEmbed` with a full-screen map, a toggleable drawer and a 'Powered by Greenstand' badge. On mobile the normal layouts stay and only the navbar hides. Map clicks post the clicked tree to the host window.
Authentication and Admin
OIDC sign-in wiring for the public app, which the code currently hides, and the admin pages: `/admin` (Keycloak login and permission buttons), `/admin/global` (navbar, logo and map location settings) and `/admin/theme` (theme playground). Admin pages render inside `LayoutDashboard`, where the Keycloak provider is commented out.
Terms: OIDC user, Keycloak token, RPT permission, Dashboard config (navbar items, logo URL, map initial location), Theme object, Organization 178
Rules:
- The public sign-in UI is hidden: `Navbar` comments out `LoginLogoutToggle` and `UserAvatar` ('hide login temporarily'), although `AuthProvider` still wraps every page.
- `LayoutDashboard` comments out `SSRKeycloakProvider` ('disable keycloak for now'), while `/admin` and `/admin/theme` still call `useKeycloak`; the theme buttons on `/admin` show only for an RPT that lists the `web-map-theme` resource.
- Dashboard config lives in the localStorage key `greenstand-web-map-client-config`, and no public page reads it. The admin map location only drives the map inside `/admin/global`.
- `/admin/global` always loads organization 178 (hard-coded) and resets the logo URL to that organization's logo on mount; its Theme tab shows only a heading.
- A map location must be numbers with lat from -90 to 90, lon from -180 to 180 and zoom from 2 to 20.
- Navbar items must have unique titles and URLs; a new item is 'New Url' at '/new-url' and is not added twice.
- A playground preview reaches public pages only in the same browser, through the localStorage key `greenstand-web-map-client-themeObject`.
- Saving a theme posts to `NEXT_PUBLIC_CONFIG_API/organizations/<organization_id>/theme` and needs the Keycloak user and RPT that `load()` sets 10 s after mount.
Flows:
- Sign In and Out (
None in the public UI (the toggle is hidden); Login button on /admin): OIDC sign-in through `react-oidc-context` is wired but turned off in the UI. `_app.js` wraps every page in `AuthProvider`, but `Navbar` comments out `LoginLogoutToggle`, so no public page shows a sign-in or sign-out button. The `/admin` page has its own Keycloak Login and Logout buttons, but no Keycloak provider wraps it. - Configure Global Map (
GET /admin/global): `/admin/global` lets an admin edit navbar items, a logo URL and an initial map location for organization 178. The edits go through `configReducer` into the `DashboardProvider` state, which persists to localStorage. Only this admin page reads that state: the Map tab applies the location to its own map, and no public page uses the navbar or map settings. The Theme tab shows only a heading. - Edit Theme in Playground (
GET /admin/theme): `/admin/theme` is a theme playground: an admin edits palette, typography and fonts and previews them on `/top` in an iframe. A preview stores the theme in localStorage, and `CustomThemeProvider` applies it to public pages in the same browser. Save and load to the config API need a Keycloak user and RPT, which depend on the disabled Keycloak provider.