-
Notifications
You must be signed in to change notification settings - Fork 0
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
WIP:Results page #34
Merged
Merged
WIP:Results page #34
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
02296f0
results layout
546f2d3
Manually fix rebase
dabreegster 0ff6364
Work on TS check errors. Trying to share code between area and route
dabreegster 0ef8c36
Choose a different copy-paste CSS tradeoff for the moment
dabreegster abf096d
Get TS check to work
dabreegster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,166 @@ | ||
TODO | ||
<script lang="ts"> | ||
import { TextArea } from "govuk-svelte"; | ||
import { sum } from "$lib"; | ||
import { state, type Scorecard } from "../data"; | ||
import NetDifferenceResults from "./NetDifferenceResults.svelte"; | ||
import LevelOfServiceResults from "./LevelOfServiceResults.svelte"; | ||
|
||
const policyCheckComplete = | ||
$state.policyCheck.filter((policyCheckObject) => { | ||
return ( | ||
policyCheckObject.existing === "" || policyCheckObject.proposed === "" | ||
); | ||
}).length === 0; | ||
const policyIssuesForReview = $state.policyConflictLog.length; | ||
|
||
const safetyCheckComplete = isScorecardCompleted($state.safetyCheck); | ||
const safetyIssuesForReview = $state.criticalIssues.length; | ||
|
||
const streetCheckComplete = isScorecardCompleted($state.streetCheck); | ||
|
||
const streetPlacemakingCheckComplete = isScorecardCompleted( | ||
$state.streetPlacemakingCheck, | ||
); | ||
|
||
const pathCheckComplete = isScorecardCompleted($state.pathCheck); | ||
|
||
const pathPlacemakingCheckComplete = isScorecardCompleted( | ||
$state.pathPlacemakingCheck, | ||
); | ||
|
||
function isScorecardCompleted(scorecard: Scorecard): boolean { | ||
return ( | ||
!scorecard.existingScores.includes("") && | ||
!scorecard.proposedScores.includes("") | ||
); | ||
} | ||
|
||
function getScorecardDifference(scorecard: Scorecard): number { | ||
let existing = sum(scorecard.existingScores.map((x) => parseInt(x || "0"))); | ||
let proposed = sum(scorecard.proposedScores.map((x) => parseInt(x || "0"))); | ||
return proposed - existing; | ||
} | ||
</script> | ||
|
||
<div class="results-grid"> | ||
<!-- TODO No rows in the markup? --> | ||
<div class="header">Overview</div> | ||
<div class="header">Complete</div> | ||
<div class="header">Remaining Isuses for Review</div> | ||
<div class="header">Next Steps</div> | ||
|
||
<div class="header">Policy Conflicts</div> | ||
<div class="grid-box">{policyCheckComplete}</div> | ||
<div class="grid-box">{policyIssuesForReview}</div> | ||
<div class="grid-box"> | ||
{policyIssuesForReview > 0 || !policyCheckComplete | ||
? "View Comments in Policy Check and Policy Conflict Log tabs" | ||
: "No further Action"} | ||
</div> | ||
|
||
<div class="header">Critical Issues</div> | ||
<div class="grid-box">{safetyCheckComplete}</div> | ||
<div class="grid-box">{safetyIssuesForReview}</div> | ||
<div class="grid-box"> | ||
{safetyIssuesForReview > 0 || !safetyCheckComplete | ||
? "Complete Safety Check and Critical Issues Log" | ||
: "No further Action"} | ||
</div> | ||
|
||
<div class="header" /> | ||
<div class="header" style="grid-column: 2/5;">Net Difference</div> | ||
<NetDifferenceResults | ||
title="Safety Check" | ||
isComplete={safetyCheckComplete} | ||
netDifference={getScorecardDifference($state.safetyCheck)} | ||
summaryNoun="safety" | ||
/> | ||
<NetDifferenceResults | ||
title="Street Check" | ||
isComplete={streetCheckComplete} | ||
netDifference={getScorecardDifference($state.streetCheck)} | ||
summaryNoun="the route quality" | ||
/> | ||
<NetDifferenceResults | ||
title="Street Placemaking" | ||
isComplete={streetPlacemakingCheckComplete} | ||
netDifference={getScorecardDifference($state.streetPlacemakingCheck)} | ||
summaryNoun="the quality of place" | ||
/> | ||
<NetDifferenceResults | ||
title="Path Check" | ||
isComplete={pathCheckComplete} | ||
netDifference={getScorecardDifference($state.pathCheck)} | ||
summaryNoun="the route quality" | ||
/> | ||
<NetDifferenceResults | ||
title="Path Placemaking" | ||
isComplete={pathPlacemakingCheckComplete} | ||
netDifference={getScorecardDifference($state.pathPlacemakingCheck)} | ||
summaryNoun="the quality of place" | ||
/> | ||
<NetDifferenceResults | ||
title="Junction Assessment Tool" | ||
isComplete={false} | ||
netDifference={-105} | ||
summaryNoun="TODO" | ||
/> | ||
</div> | ||
|
||
<div class="level-of-service-results"> | ||
<div class="header" style="grid-column: 1/5; grid-row:1/2"> | ||
Street Check Level of Service | ||
</div> | ||
<div class="header" style="grid-column: 1/2; grid-row:2/3">Categories</div> | ||
<div class="header" style="grid-column: 2/3; grid-row:2/3"> | ||
Existing Layout | ||
</div> | ||
<div class="header" style="grid-column: 3/4; grid-row:2/3"> | ||
Proposed Layout | ||
</div> | ||
<div class="header" style="grid-column: 4/5; grid-row:2/3"> | ||
Net Difference | ||
</div> | ||
|
||
<LevelOfServiceResults title="Safety" existing={2} proposed={68} /> | ||
<LevelOfServiceResults title="Accessibility" existing={2} proposed={68} /> | ||
<LevelOfServiceResults title="Comfort" existing={2} proposed={68} /> | ||
<LevelOfServiceResults title="Directness" existing={2} proposed={68} /> | ||
<LevelOfServiceResults title="Attractiveness" existing={2} proposed={68} /> | ||
<LevelOfServiceResults title="Cohesion" existing={2} proposed={68} /> | ||
<div class="header" style="grid-column: 1/5" /> | ||
<LevelOfServiceResults title="Overall ATE Score" existing={2} proposed={68} /> | ||
</div> | ||
|
||
<!-- TODO Hint: "Use the space to provide overall feedback for the proposed scheme" --> | ||
<TextArea label="Review statement" bind:value={$state.resultsReviewStatement} /> | ||
|
||
<style> | ||
.results-grid { | ||
display: grid; | ||
|
||
grid-template-columns: repeat(4, 1fr); | ||
grid-template-rows: repeat(3, 2fr) 1fr repeat(6, 2fr); | ||
} | ||
.header { | ||
/* TODO Plumb from backgroundAndFontCombinations.green.background */ | ||
background-color: #006853; | ||
/* TODO Plumb from backgroundAndFontCombinations.green.font */ | ||
color: white; | ||
border: 1px solid white; | ||
text-align: center; | ||
} | ||
.grid-box { | ||
text-align: center; | ||
border: 1px solid black; | ||
} | ||
|
||
.level-of-service-results { | ||
display: grid; | ||
grid-template-columns: 2fr repeat(3, 1fr); | ||
grid-template-rows: repeat(2, 2f3) repeat(8, 1fr); | ||
} | ||
div { | ||
display: inline; | ||
} | ||
</style> |
27 changes: 27 additions & 0 deletions
27
src/routes/route_check/results_summary/LevelOfServiceResults.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script lang="ts"> | ||
export let title: string; | ||
export let existing: number; | ||
export let proposed: number; | ||
|
||
let netDifference = proposed - existing; | ||
</script> | ||
|
||
<div class="header"> | ||
{title} | ||
</div> | ||
<div class="grid-box">{existing}%</div> | ||
<div class="grid-box">{proposed}%</div> | ||
<div class="grid-box">{netDifference}%</div> | ||
|
||
<style> | ||
.header { | ||
background-color: #006853; | ||
color: white; | ||
border: 1px solid white; | ||
text-align: center; | ||
} | ||
.grid-box { | ||
text-align: center; | ||
border: 1px solid black; | ||
} | ||
</style> |
31 changes: 31 additions & 0 deletions
31
src/routes/route_check/results_summary/NetDifferenceResults.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<script lang="ts"> | ||
export let title: string; | ||
export let isComplete: boolean; | ||
export let netDifference: number; | ||
export let summaryNoun: string; | ||
|
||
let summary = | ||
netDifference > 0 | ||
? `The proposed design will likely improve ${summaryNoun}` | ||
: `The proposed design will likely reduce ${summaryNoun}`; | ||
</script> | ||
|
||
<div class="header"> | ||
{title} | ||
</div> | ||
<div class="grid-box">{isComplete}</div> | ||
<div class="grid-box">{netDifference}%</div> | ||
<div class="grid-box">{summary}</div> | ||
|
||
<style> | ||
.header { | ||
background-color: #006853; | ||
color: white; | ||
border: 1px solid white; | ||
text-align: center; | ||
} | ||
.grid-box { | ||
text-align: center; | ||
border: 1px solid black; | ||
} | ||
</style> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I had more time I would do this section like I do for the other rows below. It would make this page less cumbersome and we could easily and neatly switch to a link when there is an action for the user