Skip to content

Commit

Permalink
Merge branch 'main' into jleedev-relieved
Browse files Browse the repository at this point in the history
  • Loading branch information
claysmalley authored Jan 6, 2025
2 parents b951717 + 17d6bc0 commit 8a88597
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
- name: Generate map diff sample clips
id: map-diff-samples
run: |
npm exec tsx scripts/folder_diff ../samples-main ../samples-pr https://preview.ourmap.us/pr/${{ github.event.pull_request.number }}/ ${{ github.event.pull_request.head.sha }}
npm exec tsx scripts/folder_diff ../samples-main ../samples-pr https://preview.americanamap.org/pr/${{ github.event.pull_request.number }}/ ${{ github.event.pull_request.head.sha }}
mv pr_preview-extra.md ../pr/
cat ../pr/pr_preview-extra.md
mv samples-diff ../dist/
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/deploy-pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,32 +85,32 @@ jobs:
- name: Wait for PR Preview Upload (1x Sprite)
uses: cygnetdigital/[email protected]
with:
url: "https://preview.ourmap.us/pr/${{ env.PR_NUM }}/sprites/sprite.png"
url: "https://preview.americanamap.org/pr/${{ env.PR_NUM }}/sprites/sprite.png"
responseCode: "200"
timeout: 120000
interval: 500
- name: Wait for PR Preview Upload (2x Sprite)
uses: cygnetdigital/[email protected]
with:
url: "https://preview.ourmap.us/pr/${{ env.PR_NUM }}/sprites/[email protected]"
url: "https://preview.americanamap.org/pr/${{ env.PR_NUM }}/sprites/[email protected]"
responseCode: "200"
timeout: 120000
interval: 500
- name: Generate Preview text
run: |
echo "## Live PR Preview:
* [Map](https://preview.ourmap.us/pr/${{ env.PR_NUM }}/)
* [Shield Test](https://preview.ourmap.us/pr/${{ env.PR_NUM }}/shieldtest.html)
* [style.json](https://preview.ourmap.us/pr/${{ env.PR_NUM }}/style.json)
* [shields.json](https://preview.ourmap.us/pr/${{ env.PR_NUM }}/shields.json)
* [taginfo.json](https://preview.ourmap.us/pr/${{ env.PR_NUM }}/taginfo.json)
* [Map](https://preview.americanamap.org/pr/${{ env.PR_NUM }}/)
* [Shield Test](https://preview.americanamap.org/pr/${{ env.PR_NUM }}/shieldtest.html)
* [style.json](https://preview.americanamap.org/pr/${{ env.PR_NUM }}/style.json)
* [shields.json](https://preview.americanamap.org/pr/${{ env.PR_NUM }}/shields.json)
* [taginfo.json](https://preview.americanamap.org/pr/${{ env.PR_NUM }}/taginfo.json)
Live previews are automatically removed once the PR is merged.
## Sprite Sheets:
<img src="https://preview.ourmap.us/pr/${{ env.PR_NUM }}/sprites/sprite.png" />
<img src="https://preview.ourmap.us/pr/${{ env.PR_NUM }}/sprites/[email protected]" />
<img src="https://preview.americanamap.org/pr/${{ env.PR_NUM }}/sprites/sprite.png" />
<img src="https://preview.americanamap.org/pr/${{ env.PR_NUM }}/sprites/[email protected]" />
" > pr_preview.md
[ -f pr_preview-extra.md ] && cat pr_preview-extra.md >> pr_preview.md || echo "No extra PR preview found."
- uses: tibdex/github-app-token@v1
Expand All @@ -125,7 +125,7 @@ jobs:
sha: ${{ env.PR_SHA }}
token: ${{ steps.checks_token.outputs.token }}
name: PR Preview
details_url: https://preview.ourmap.us/pr/${{ env.PR_NUM }}/
details_url: https://preview.americanamap.org/pr/${{ env.PR_NUM }}/
conclusion: neutral
output: |
{"summary":"Preview map changes introduced by this PR", "title":"View live map and artifacts"}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions shieldlib/src/shield_helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export function triangleDownShield(
rectWidth: number
): Partial<ShieldDefinition> {
textColor = textColor ?? strokeColor;
radius = radius ?? 2;
radius = radius ?? 3;

return {
shapeBlank: {
Expand All @@ -232,10 +232,10 @@ export function triangleDownShield(
},
textLayout: textConstraint("triangleDown"),
padding: {
left: 1,
right: 1,
top: 2,
bottom: 1,
left: 0,
right: 0,
top: 3,
bottom: 0,
},
textColor,
};
Expand Down
14 changes: 12 additions & 2 deletions src/js/legend_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,10 @@ export default class LegendControl {
let unrecognizedNetworks = new Set();
for (let image of images) {
if (!(image.network in imagesByNetwork)) {
imagesByNetwork[image.network] = { overridesByRef: {} };
imagesByNetwork[image.network] = {
overridesByRef: {},
overridesByName: {},
};
}
let networkImages = imagesByNetwork[image.network];

Expand All @@ -476,6 +479,12 @@ export default class LegendControl {
if (!networkImages.overridesByRef[image.ref]) {
networkImages.overridesByRef[image.ref] = image.imageName;
}
} else if (image.name && shieldDef?.overrideByName?.[image.name]) {
// Store a different image for each override in the shield definition.
if (!networkImages.overridesByName[image.name]) {
networkImages.overridesByName[image.name] =
shieldDef.overrideByName[image.name].spriteBlank;
}
} else if (!networkImages.ref && image.ref) {
// Store the numbered variant of a shield if required by the shield
// definition.
Expand All @@ -498,9 +507,10 @@ export default class LegendControl {
let images = imagesByNetwork[network];
if (!images) return [];
return [
images.noRef,
Object.values(images.overridesByName).length > 0 ? "" : images.noRef,
images.ref,
...Object.values(images.overridesByRef),
...Object.values(images.overridesByName),
].filter((i) => i);
};

Expand Down

0 comments on commit 8a88597

Please sign in to comment.