Skip to content
Merged
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
16 changes: 1 addition & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,4 @@ For full production setup (Traefik + DNS + Plausible CE + maintenance), see [PRO
### Notes
- Linting: `npm run lint`.
- If the map on the landing page does not render, ensure WebGL is available/enabled in your browser.

## PR preview deployments

This repository includes a GitHub Actions workflow (`.github/workflows/pr-preview.yml`) that:
- triggers on PR `opened`, `synchronize`, and `reopened`;
- builds the app with `npm ci` and `npm run build`;
- deploys the built `dist/` to `gh-pages` under `pr-<PR_NUMBER>/`;
- creates or updates a PR comment with the preview URL;
- on PR close, updates that comment to mark the preview as no longer maintained (lightweight cleanup).

Expected preview URL format:
`https://<owner>.github.io/<repo>/pr-<PR_NUMBER>/`

Repository setting required once:
- **Settings → Pages**: source must be the `gh-pages` branch (root folder).
- PR website preview builds are deployed automatically via GitHub Actions at `https://ai4up.github.io/cities-learning-explorer/pr-<PR#>/`.
14 changes: 11 additions & 3 deletions src/components/TypeMetricsPlot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,25 @@ const TypeMetricsPlot = ({ cities, activeType }) => {
};
});

Plotly.newPlot(plotRef.current, traces, layout, {
const plotElement = plotRef.current;

Plotly.newPlot(plotElement, traces, layout, {
displayModeBar: false,
responsive: true,
});

const resize = () => Plotly.Plots.resize(plotRef.current);
const resize = () => {
if (plotElement) {
Plotly.Plots.resize(plotElement);
}
};
window.addEventListener("resize", resize);

return () => {
window.removeEventListener("resize", resize);
Plotly.purge(plotRef.current);
if (plotElement) {
Plotly.purge(plotElement);
}
};
}, [cities, activeType]);

Expand Down
Loading