Gisle Aune
2 years ago
20 changed files with 203 additions and 121 deletions
-
1entities/stat.go
-
36frontend/src/lib/components/common/LabeledProgress.svelte
-
8frontend/src/lib/components/common/Progress.svelte
-
15frontend/src/lib/components/history/HistoryGroupSection.svelte
-
19frontend/src/lib/components/layout/Main.svelte
-
19frontend/src/lib/components/layout/Section.svelte
-
38frontend/src/lib/components/layout/SubSection.svelte
-
52frontend/src/lib/components/layout/Title.svelte
-
4frontend/src/lib/components/project/ItemSubSection.svelte
-
7frontend/src/lib/components/project/RequirementSection.svelte
-
24frontend/src/lib/components/scope/StatSubSection.svelte
-
4frontend/src/lib/utils/items.ts
-
17frontend/src/routes/[scope=prettyid]/history/[interval].svelte
-
1ports/mysql/mysqlcore/models.go
-
17ports/mysql/mysqlcore/stats.sql.go
-
9ports/mysql/queries/stats.sql
-
8ports/mysql/stats.go
-
9scripts/goose-mysql/20220626114006_stat_column_primary.sql
-
34usecases/projects/result.go
-
2usecases/scopes/result.go
@ -0,0 +1,15 @@ |
|||
<script lang="ts"> |
|||
import type Item from "$lib/models/item"; |
|||
import type { ItemGroup } from "$lib/models/item"; |
|||
import Section from "../layout/Section.svelte"; |
|||
import ItemSubSection from "../project/ItemSubSection.svelte"; |
|||
|
|||
export let group: ItemGroup; |
|||
export let items: Item[]; |
|||
</script> |
|||
|
|||
<Section title={group.label}> |
|||
{#each group.list as ref (ref.idx)} |
|||
<ItemSubSection item={items[ref.idx]} event={ref.event} /> |
|||
{/each} |
|||
</Section> |
@ -0,0 +1,52 @@ |
|||
<script lang="ts"> |
|||
export let value = ""; |
|||
export let sub = ""; |
|||
export let small = false; |
|||
export let big = false; |
|||
|
|||
let titleChunks: string[]; |
|||
|
|||
$: { |
|||
const pos = value.indexOf(":"); |
|||
if (pos !== -1) { |
|||
titleChunks = [value.slice(0, pos + 1), value.slice(pos + 1).trim()]; |
|||
} else { |
|||
titleChunks = ["", value]; |
|||
} |
|||
|
|||
const last = titleChunks[titleChunks.length - 1]; |
|||
const pos2 = last.indexOf("("); |
|||
if (pos2 !== -1) { |
|||
titleChunks.pop(); |
|||
titleChunks.push(last.slice(0, pos2), last.slice(pos2)); |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<h2 class:big class:small> |
|||
<span class="sub">{titleChunks[0]}</span> |
|||
<span>{titleChunks[1]}</span> |
|||
<span class="sub">{titleChunks[2]||""}</span> |
|||
{#if sub != ""} |
|||
<span class="sub">{sub}</span> |
|||
{/if} |
|||
</h2> |
|||
|
|||
<style lang="sass"> |
|||
@import "../../css/colors" |
|||
|
|||
h2 |
|||
font-size: 1.25em |
|||
margin: 0 |
|||
color: $color-entry10 |
|||
|
|||
span.sub |
|||
color: $color-entry5 |
|||
|
|||
&.big |
|||
margin-top: 1em |
|||
font-size: 2em |
|||
|
|||
&.small |
|||
font-size: 1em |
|||
</style> |
@ -1,24 +1,24 @@ |
|||
<script lang="ts"> |
|||
import type Stat from "$lib/models/stat"; |
|||
import Amount from "../common/Amount.svelte"; |
|||
import AmountRow from "../common/AmountRow.svelte"; |
|||
import Markdown from "../common/Markdown.svelte"; |
|||
import Option from "../layout/Option.svelte"; |
|||
import OptionsRow from "../layout/OptionsRow.svelte"; |
|||
import SubSection from "../layout/SubSection.svelte"; |
|||
import Amount from "../common/Amount.svelte"; |
|||
import AmountRow from "../common/AmountRow.svelte"; |
|||
import Markdown from "../common/Markdown.svelte"; |
|||
import Option from "../layout/Option.svelte"; |
|||
import OptionsRow from "../layout/OptionsRow.svelte"; |
|||
import SubSection from "../layout/SubSection.svelte"; |
|||
|
|||
export let stat: Stat; |
|||
</script> |
|||
|
|||
<SubSection noProgress title={stat.name} subtitle="{stat.weight}x"> |
|||
<SubSection noProgress title={stat.name}> |
|||
<OptionsRow slot="right"> |
|||
<Option open={{name: "stat.edit", stat}}>Edit</Option> |
|||
<Option open={{name: "stat.delete", stat}} color="red">Delete</Option> |
|||
</OptionsRow> |
|||
<Markdown source={stat.description} /> |
|||
<AmountRow> |
|||
{#each (stat.allowedAmounts || []) as amount (amount.value)} |
|||
<Amount label={amount.label} value={amount.value} /> |
|||
{/each} |
|||
</AmountRow> |
|||
{#if stat.weight !== 1} |
|||
<AmountRow> |
|||
<Amount label="Weight" value={stat.weight} /> |
|||
</AmountRow> |
|||
{/if} |
|||
</SubSection> |
@ -0,0 +1,9 @@ |
|||
-- +goose Up |
|||
-- +goose StatementBegin |
|||
ALTER TABLE stat ADD COLUMN is_primary BOOLEAN NOT NULL DEFAULT 0; |
|||
-- +goose StatementEnd |
|||
|
|||
-- +goose Down |
|||
-- +goose StatementBegin |
|||
ALTER TABLE stat DROP COLUMN IF EXISTS is_primary; |
|||
-- +goose StatementEnd |
Write
Preview
Loading…
Cancel
Save
Reference in new issue