add more squil and rename Entry to CardEntry as its child components may be useful in other contexts.

This commit is contained in:
2022-04-04 18:50:33 +02:00
parent 87f77990e6
commit ad28d0f827
14 changed files with 98 additions and 31 deletions
+1 -1
View File
@@ -14,5 +14,5 @@ CREATE TABLE stat (
-- +goose Down
-- +goose StatementBegin
SELECT 'down SQL query';
DROP TABLE IF EXISTS stat;
-- +goose StatementEnd
@@ -1,7 +1,7 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE IF NOT EXISTS 'project' (
`id` INT NOT NULL AUTO_INCREMENT,
CREATE TABLE project (
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`scope_id` INT NOT NULL,
`author_id` CHAR(36) NOT NULL,
`name` VARCHAR(255) NOT NULL,
@@ -14,5 +14,5 @@ CREATE TABLE IF NOT EXISTS 'project' (
-- +goose Down
-- +goose StatementBegin
SELECT 'down SQL query';
DROP TABLE IF EXISTS project;
-- +goose StatementEnd
@@ -0,0 +1,16 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE project_requirement (
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`scope_id` INT NOT NULL,
`project_id` INT NOT NULL,
`name` VARCHAR(255) NOT NULL,
`status` INT NOT NULL,
`description` TEXT NOT NULL
)
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS project_requirement;
-- +goose StatementEnd
@@ -0,0 +1,19 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE item (
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`scope_id` INT NOT NULL,
`project_requirement_id` INT,
`name` VARCHAR(255) NOT NULL,
`description` TEXT NOT NULL,
`created_time` DATETIME NOT NULL,
`created_user_id` CHAR(36) NOT NULL,
`acquired_time` DATETIME,
`scheduled_date` DATE
)
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS item;
-- +goose StatementEnd
@@ -0,0 +1,17 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE item_stat_progress (
`item_id` INT NOT NULL,
`stat_id` INT NOT NULL,
`acquired` INT NOT NULL,
`required` INT NOT NULL,
PRIMARY KEY (`item_id`, `stat_id`),
UNIQUE (`stat_id`, `item_id`)
)
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS item_stat_progress;
-- +goose StatementEnd
@@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE project_requirement_stat (
`project_requirement_id` INT NOT NULL,
`stat_id` INT NOT NULL,
`required` INT NOT NULL,
PRIMARY KEY (`project_requirement_id`, `stat_id`)
)
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS project_requirement_stat;
-- +goose StatementEnd
+8 -8
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import type { StandaloneItem } from "$lib/models/item";
import Entry from "../layout/Entry.svelte";
import CardEntry from "../layout/CardEntry.svelte";
import EntryAmounts from "../layout/EntryAmounts.svelte";
import EntryButton from "../layout/EntryButton.svelte";
import EntryCompletionIcon from "../layout/EntryCompletionIcon.svelte";
@@ -27,8 +27,8 @@ import EntryDate from "../layout/EntryDate.svelte";
</script>
<a href={link}>
<Entry>
{#if !item.acquireDate}
<CardEntry>
{#if !item.acquireTime}
<EntryButton>
<Icon name="check" />
</EntryButton>
@@ -37,18 +37,18 @@ import EntryDate from "../layout/EntryDate.svelte";
<Icon name="pen" />
</EntryButton>
{/if}
<EntryCompletionIcon condition={!!item.acquireDate} />
<EntryCompletionIcon condition={!!item.acquireTime} />
<EntryName subtitle={subtitle}>{item.name}</EntryName>
{#if !compact}
{#if !!item.acquireDate}
<EntryDate green value={item.acquireDate} verb="Acquired" />
{#if !!item.acquireTime}
<EntryDate green value={item.acquireTime} verb="Acquired" />
{:else}
<EntryDate value={item.createdDate} verb="Created" />
<EntryDate value={item.createdTime} verb="Created" />
{/if}
<EntryDescription>{item.description}</EntryDescription>
{/if}
<EntryAmounts values={amounts} />
</Entry>
</CardEntry>
</a>
<style>
@@ -2,7 +2,7 @@
import type { StandaloneRequirement } from "$lib/models/project";
import Status from "$lib/models/status";
import Entry from "../layout/Entry.svelte";
import CardEntry from "../layout/CardEntry.svelte";
import EntryButton from "../layout/EntryButton.svelte";
import EntryDescription from "../layout/EntryDescription.svelte";
import EntryName from "../layout/EntryName.svelte";
@@ -18,7 +18,7 @@
</script>
<a href="/{requirement.scope.id}/{requirement.project.id}?requirement={requirement.id}">
<Entry>
<CardEntry>
{#if requirement.status === Status.Active}
<EntryButton>
<Icon name="plus" />
@@ -35,7 +35,7 @@
<EntryProgress boat={boat} name={stat.name} acquired={stat.acquired} required={stat.required} />
{/each}
</EntryProgressRow>
</Entry>
</CardEntry>
</a>
<style>
@@ -1,15 +1,15 @@
<script lang="ts">
import type { ScopeEntry } from "$lib/models/scope";
import Entry from "../layout/Entry.svelte";
import CardEntry from "../layout/CardEntry.svelte";
import EntryName from "../layout/EntryName.svelte";
export let scope: ScopeEntry
</script>
<a href="/{scope.id}/">
<Entry>
<CardEntry>
<EntryName subtitle={scope.abbreviation}>{scope.name}</EntryName>
</Entry>
</CardEntry>
</a>
<style>
@@ -5,16 +5,16 @@
import currentTime from "$lib/stores/currentTime";
import Entry from "../layout/Entry.svelte";
import CardEntry from "../layout/CardEntry.svelte";
import EntryDescription from "../layout/EntryDescription.svelte";
import EntryName from "../layout/EntryName.svelte";
import EntryProgress from "../layout/EntryProgress.svelte";
import EntryProgressRow from "../layout/EntryProgressRow.svelte";
import ItemLink from "./ItemLink.svelte";
import RequirementLink from "./RequirementLink.svelte";
import EntryButton from "../layout/EntryButton.svelte";
import Icon from "../layout/Icon.svelte";
import Status from "$lib/models/status";
import EntryButton from "../layout/EntryButton.svelte";
import Icon from "../layout/Icon.svelte";
import Status from "$lib/models/status";
export let sprint: Sprint
@@ -35,7 +35,7 @@ import Status from "$lib/models/status";
$: {
if (sprint.items != null) {
itemsAcquired = sprint.items.filter(i => !!i.acquireDate).length;
itemsAcquired = sprint.items.filter(i => !!i.acquireTime).length;
itemsRequired = sprint.items.length;
} else {
itemsAcquired = 0;
@@ -76,7 +76,7 @@ import Status from "$lib/models/status";
</script>
<a href="/{sprint.scope.id}/sprints?sprint={sprint.id}">
<Entry>
<CardEntry>
{#if sprint.kind === "stats"}
<EntryButton>
<Icon name="plus" />
@@ -114,7 +114,7 @@ import Status from "$lib/models/status";
{/if}
</EntryProgressRow>
{#each sprint.items as item (item.id)}
{#if !item.acquireDate}
{#if !item.acquireTime}
<ItemLink compact item={item} />
{/if}
{/each}
@@ -123,7 +123,7 @@ import Status from "$lib/models/status";
<RequirementLink compact boat={boat} requirement={requirement} />
{/if}
{/each}
</Entry>
</CardEntry>
</a>
<style lang="scss">
+1 -1
View File
@@ -9,7 +9,7 @@ export default class MysqlDB implements Database {
connection: Pool
userId: string;
private constructor(userId: string, connection: Connection) {
private constructor(userId: string, connection: Pool) {
this.userId = userId;
this.connection = connection;
}
-2
View File
@@ -33,8 +33,6 @@ export default class MysqlDBScopes implements ScopeRepo {
`, [id]).catch(() => []),
]);
console.log(scopeRows, statRows, statRows)
const r = scopeRows[0] as any;
if (!r) {
return null;
+4 -2
View File
@@ -6,8 +6,10 @@ export default interface Item {
id: number
name: string
description: string
acquireDate?: string
createdDate: string
createdTime: Date
createdBy: string
acquireTime?: Date
scheduledDate?: string
stats: StatProgressEntry[]
}