Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter PMP by stage. #94 #95

Merged
merged 3 commits into from
Dec 4, 2024
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
12 changes: 12 additions & 0 deletions src/routes/route_check/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,18 @@ function validate(state: State) {

// Not entirely sure how, but at least one old file is missing this property and causing problems, so fill it in
state.summary.networkMap ||= { type: "FeatureCollection", features: [] };

// Ensure any design-stage problems are unresolved
for (let x of state.policyConflictLog) {
if (x.stage == "Design") {
x.resolved = "";
}
}
for (let x of state.criticalIssues) {
if (x.stage == "Design") {
x.resolved = "";
}
}
}

function describe(state: State): string {
Expand Down
74 changes: 44 additions & 30 deletions src/routes/route_check/problems_map/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
WarningButton,
CollapsibleCard,
Checkbox,
CheckboxGroup,
IconButton,
} from "govuk-svelte";
import { tick } from "svelte";
Expand Down Expand Up @@ -66,6 +67,7 @@
let hoveringSidebar: ID | null = null;
let streetviewOn = false;
let showRoute = true;
let showResolved = true;

$: if (map) {
map.getCanvas().style.cursor =
Expand Down Expand Up @@ -291,6 +293,10 @@
}
}
}

function show(showResolved: boolean, resolved: "Yes" | "No" | "") {
return showResolved || resolved != "Yes";
}
</script>

<svelte:window on:keydown={onKeyDown} />
Expand All @@ -311,6 +317,10 @@
<Checkbox bind:checked={showRoute}>Show route</Checkbox>
</CollapsibleCard>

<CheckboxGroup small>
<Checkbox bind:checked={showResolved}>Show resolved problems</Checkbox>
</CheckboxGroup>

<div style="background-color: grey; padding: 4px">
<h3>Critical Issue Log</h3>
{#each $state.criticalIssues as critical, idx}
Expand Down Expand Up @@ -425,39 +435,43 @@
{/if}

{#each $state.criticalIssues as critical, idx}
<Marker
draggable
bind:lngLat={critical.point}
on:click={() => select({ kind: "critical", idx })}
on:dragend={() => select({ kind: "critical", idx })}
>
<svg width="40" height="40" xmlns="http://www.w3.org/2000/svg">
<rect width="40" height="40" fill={colors.critical.background} />
<text
x="50%"
y="50%"
style:fill="white"
style:font="bold 15px sans-serif"
dominant-baseline="middle"
text-anchor="middle"
>
{critical.criticalIssue}
</text>
</svg>
</Marker>
{#if show(showResolved, critical.resolved)}
<Marker
draggable
bind:lngLat={critical.point}
on:click={() => select({ kind: "critical", idx })}
on:dragend={() => select({ kind: "critical", idx })}
>
<svg width="40" height="40" xmlns="http://www.w3.org/2000/svg">
<rect width="40" height="40" fill={colors.critical.background} />
<text
x="50%"
y="50%"
style:fill="white"
style:font="bold 15px sans-serif"
dominant-baseline="middle"
text-anchor="middle"
>
{critical.criticalIssue}
</text>
</svg>
</Marker>
{/if}
{/each}

{#each $state.policyConflictLog as conflict, idx}
<Marker
draggable
bind:lngLat={conflict.point}
on:click={() => select({ kind: "conflict", idx })}
on:dragend={() => select({ kind: "conflict", idx })}
>
<span class="dot" style:background={policyConflictColor}>
{conflict.conflict}
</span>
</Marker>
{#if show(showResolved, conflict.resolved)}
<Marker
draggable
bind:lngLat={conflict.point}
on:click={() => select({ kind: "conflict", idx })}
on:dragend={() => select({ kind: "conflict", idx })}
>
<span class="dot" style:background={policyConflictColor}>
{conflict.conflict}
</span>
</Marker>
{/if}
{/each}

<GeoJSON data={hoverGj}>
Expand Down
5 changes: 5 additions & 0 deletions src/routes/route_check/problems_map/ConflictForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import { policyConflictChoices } from "../lists";

export let idx: number;

// By definition, design-stage problems are unresolved
$: if ($state.policyConflictLog[idx].stage == "Design") {
$state.policyConflictLog[idx].resolved = "";
}
</script>

<div style="display: flex; justify-content: space-evenly">
Expand Down
5 changes: 5 additions & 0 deletions src/routes/route_check/problems_map/CriticalForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import { criticalIssueChoices } from "../lists";

export let idx: number;

// By definition, design-stage problems are unresolved
$: if ($state.criticalIssues[idx].stage == "Design") {
$state.criticalIssues[idx].resolved = "";
}
</script>

<div style="display: flex; justify-content: space-evenly">
Expand Down
Loading