Browse Source

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

mian
Gisle Aune 2 years ago
parent
commit
ad28d0f827
  1. 2
      scripts/goose-mysql/20220326173144_stat.sql
  2. 6
      scripts/goose-mysql/20220326174046_project.sql
  3. 16
      scripts/goose-mysql/20220404144911_project_requirement.sql
  4. 19
      scripts/goose-mysql/20220404144914_item.sql
  5. 17
      scripts/goose-mysql/20220404144947_item_stat_progress.sql
  6. 15
      scripts/goose-mysql/20220404184237_project_requirement_stat.sql
  7. 16
      src/lib/components/frontpage/ItemLink.svelte
  8. 6
      src/lib/components/frontpage/RequirementLink.svelte
  9. 6
      src/lib/components/frontpage/ScopeLink.svelte
  10. 16
      src/lib/components/frontpage/SprintLink.svelte
  11. 0
      src/lib/components/layout/CardEntry.svelte
  12. 2
      src/lib/database/mysql/database.ts
  13. 2
      src/lib/database/mysql/scopes.ts
  14. 6
      src/lib/models/item.ts

2
scripts/goose-mysql/20220326173144_stat.sql

@ -14,5 +14,5 @@ CREATE TABLE stat (
-- +goose Down
-- +goose StatementBegin
SELECT 'down SQL query';
DROP TABLE IF EXISTS stat;
-- +goose StatementEnd

6
scripts/goose-mysql/20220326174046_project.sql

@ -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

16
scripts/goose-mysql/20220404144911_project_requirement.sql

@ -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

19
scripts/goose-mysql/20220404144914_item.sql

@ -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

17
scripts/goose-mysql/20220404144947_item_stat_progress.sql

@ -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

15
scripts/goose-mysql/20220404184237_project_requirement_stat.sql

@ -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

16
src/lib/components/frontpage/ItemLink.svelte

@ -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>

6
src/lib/components/frontpage/RequirementLink.svelte

@ -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>

6
src/lib/components/frontpage/ScopeLink.svelte

@ -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>

16
src/lib/components/frontpage/SprintLink.svelte

@ -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">

0
src/lib/components/layout/Entry.svelte → src/lib/components/layout/CardEntry.svelte

2
src/lib/database/mysql/database.ts

@ -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
src/lib/database/mysql/scopes.ts

@ -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;

6
src/lib/models/item.ts

@ -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[]
}

Loading…
Cancel
Save