From 5c8280d88e85da1d671c6505da84e5addfa2d08f Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Sun, 6 Mar 2022 16:34:45 +0100 Subject: [PATCH] add date. --- src/lib/components/colors.sass | 6 ++ src/lib/components/frontpage/ItemLink.svelte | 6 ++ .../components/frontpage/SprintLink.svelte | 11 ++- src/lib/components/layout/Entry.svelte | 2 +- src/lib/components/layout/EntryAmounts.svelte | 2 +- src/lib/components/layout/EntryBgIcon.svelte | 2 +- src/lib/components/layout/EntryDate.svelte | 67 +++++++++++++++++++ src/lib/components/layout/EntryName.svelte | 3 +- .../components/layout/EntryProgress.svelte | 9 ++- src/lib/models/item.ts | 1 + src/routes/index.svelte | 8 --- src/routes/indexdata.json.ts | 5 +- 12 files changed, 105 insertions(+), 17 deletions(-) create mode 100644 src/lib/components/layout/EntryDate.svelte diff --git a/src/lib/components/colors.sass b/src/lib/components/colors.sass index d3f65c7..4dd64d2 100644 --- a/src/lib/components/colors.sass +++ b/src/lib/components/colors.sass @@ -12,3 +12,9 @@ $color-entry10: hsl(240, 5%, 77%) $color-entry11: hsl(240, 5%, 84%) $color-entry12: hsl(240, 5%, 91%) $color-entry13: hsl(240, 5%, 98%) + +$opacity-entry4: 0.40 +$opacity-entry5: 0.60 + +$color-green: hsl(120, 50%, 74%) +$color-green-dark: hsl(120, 50%, 35%) \ No newline at end of file diff --git a/src/lib/components/frontpage/ItemLink.svelte b/src/lib/components/frontpage/ItemLink.svelte index 54f8b20..d921788 100644 --- a/src/lib/components/frontpage/ItemLink.svelte +++ b/src/lib/components/frontpage/ItemLink.svelte @@ -4,6 +4,7 @@ import EntryAmounts from "../layout/EntryAmounts.svelte"; import EntryButton from "../layout/EntryButton.svelte"; import EntryCompletionIcon from "../layout/EntryCompletionIcon.svelte"; +import EntryDate from "../layout/EntryDate.svelte"; import EntryDescription from "../layout/EntryDescription.svelte"; import EntryName from "../layout/EntryName.svelte"; import Icon from "../layout/Icon.svelte"; @@ -39,6 +40,11 @@ {item.name} {#if !compact} + {#if !!item.acquireDate} + + {:else} + + {/if} {item.description} {/if} diff --git a/src/lib/components/frontpage/SprintLink.svelte b/src/lib/components/frontpage/SprintLink.svelte index 652318c..5b7a2ba 100644 --- a/src/lib/components/frontpage/SprintLink.svelte +++ b/src/lib/components/frontpage/SprintLink.svelte @@ -14,6 +14,7 @@ import RequirementLink from "./RequirementLink.svelte"; import EntryButton from "../layout/EntryButton.svelte"; import Icon from "../layout/Icon.svelte"; +import Status from "$lib/models/status"; export let sprint: Sprint @@ -49,7 +50,11 @@ import Icon from "../layout/Icon.svelte"; break; } case "requirements": { - aggregate = calculateAggregate(sprint.requirements.map(r => r.stats).flat()); + aggregate = calculateAggregate(sprint.requirements.map(r => ( + r.status >= Status.Completed + ? r.stats.map(s => ({...s, acquired: s.required})) + : r.stats + )).flat()); break; } case "stats": { @@ -113,7 +118,9 @@ import Icon from "../layout/Icon.svelte"; {/if} {/each} {#each sprint.requirements as requirement (requirement.id)} - + {#if requirement.status < Status.Completed} + + {/if} {/each} diff --git a/src/lib/components/layout/Entry.svelte b/src/lib/components/layout/Entry.svelte index dfadaf6..3b25eef 100644 --- a/src/lib/components/layout/Entry.svelte +++ b/src/lib/components/layout/Entry.svelte @@ -18,7 +18,7 @@ } div.entry:hover { background-color: $color-entry2; - color: $color-entry13; + color: $color-entry11; } :global(div.entry div.entry) { diff --git a/src/lib/components/layout/EntryAmounts.svelte b/src/lib/components/layout/EntryAmounts.svelte index bf18aa9..738cc3d 100644 --- a/src/lib/components/layout/EntryAmounts.svelte +++ b/src/lib/components/layout/EntryAmounts.svelte @@ -37,6 +37,6 @@ } span.label { - color: $color-entry6; + opacity: $opacity-entry4; } \ No newline at end of file diff --git a/src/lib/components/layout/EntryBgIcon.svelte b/src/lib/components/layout/EntryBgIcon.svelte index 4f76296..80cc288 100644 --- a/src/lib/components/layout/EntryBgIcon.svelte +++ b/src/lib/components/layout/EntryBgIcon.svelte @@ -19,6 +19,6 @@ margin-left: auto; background: none; pointer-events: none; - opacity: 0.10; + opacity: 0.05; } \ No newline at end of file diff --git a/src/lib/components/layout/EntryDate.svelte b/src/lib/components/layout/EntryDate.svelte new file mode 100644 index 0000000..52c053e --- /dev/null +++ b/src/lib/components/layout/EntryDate.svelte @@ -0,0 +1,67 @@ + + +
+ {verb} + {dateStr} + at + {timeStr} +
+ + + + diff --git a/src/lib/components/layout/EntryName.svelte b/src/lib/components/layout/EntryName.svelte index 46a45f0..51381c1 100644 --- a/src/lib/components/layout/EntryName.svelte +++ b/src/lib/components/layout/EntryName.svelte @@ -17,14 +17,13 @@ span.abbreviation { font-size: 1em; - color: $color-entry4; + opacity: $opacity-entry4; } @media screen and (max-width: 1500px) { span.abbreviation { display: block; font-size: 0.75em; - margin-bottom: 0.5em; } } \ No newline at end of file diff --git a/src/lib/components/layout/EntryProgress.svelte b/src/lib/components/layout/EntryProgress.svelte index 0bddde3..4953720 100644 --- a/src/lib/components/layout/EntryProgress.svelte +++ b/src/lib/components/layout/EntryProgress.svelte @@ -198,10 +198,17 @@ &.green { background-color: #8ef88e; opacity: 0.8; } &.red { background-color: hsl(0, 95%, 70%); opacity: 0.8; } &.off {opacity: 0.30; } + + @media (-webkit-min-device-pixel-ratio: 1.3) { + border-width: 0.5px; + } + @media (-webkit-min-device-pixel-ratio: 1.8) { + border-width: 0.25px; + } } } span.ackreq { - color: $color-entry4; + opacity: $opacity-entry4; } \ No newline at end of file diff --git a/src/lib/models/item.ts b/src/lib/models/item.ts index 20c3b5e..4ca3c61 100644 --- a/src/lib/models/item.ts +++ b/src/lib/models/item.ts @@ -7,6 +7,7 @@ export default interface Item { name: string description: string acquireDate?: string + createdDate: string stats: StatProgressEntry[] } diff --git a/src/routes/index.svelte b/src/routes/index.svelte index 76680f8..81bee7c 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -1,11 +1,6 @@
@@ -59,7 +52,6 @@

Today

When you mark an item as aquired today, it will appear here.

-

TIP: {tip}

diff --git a/src/routes/indexdata.json.ts b/src/routes/indexdata.json.ts index 2164fd6..e4e00ba 100644 --- a/src/routes/indexdata.json.ts +++ b/src/routes/indexdata.json.ts @@ -21,6 +21,7 @@ export const get: RequestHandler = async({}) => { name: "Table", description: "A table for the Redrock rec-room.", acquireDate: "2022-03-14T00:00:00Z", + createdDate: new Date(Date.now() - 3623511).toISOString(), stats: [ {id: 1, name: "Asset", weight: 0.2, required: 1, acquired: 1}, {id: 2, name: "Complexity", weight: 1, required: 3, acquired: 5}, @@ -35,6 +36,7 @@ export const get: RequestHandler = async({}) => { id: 2, scope: scopes[0], name: "Datapad Set", description: "I need one, at least, but more is better.", + createdDate: new Date(Date.now() - 3623511).toISOString(), stats: [ {id: 1, name: "Asset", weight: 0.2, required: 1, acquired: 0}, {id: 2, name: "Complexity", weight: 1, required: 3, acquired: 0}, @@ -50,6 +52,7 @@ export const get: RequestHandler = async({}) => { id: 3, scope: scopes[1], name: "Enila/Renala: Technicalities", description: "Renala is answering Leah's concern and takes the shift at the Respite.", + createdDate: new Date(Date.now() - 3623511).toISOString(), stats: [ {id: 1, name: "Story", weight: 3, required: 1, acquired: 0}, {id: 2, name: "Story Word", weight: 0.002, required: 500, acquired: 0}, @@ -89,7 +92,7 @@ export const get: RequestHandler = async({}) => { name: "Background Stories", status: Status.Active }, - status: Status.Active, + status: Status.Completed, stats: [ {id: 1, name: "Story", weight: 3, required: 10, acquired: 3}, {id: 2, name: "Story Word", weight: 0.002, required: 5000, acquired: 2173},