Browse Source

add a few fixes and tweaks related to the previous commit.

main
Gisle Aune 4 years ago
parent
commit
ef94b1556a
  1. 2
      svelte-ui/src/components/Composition.svelte
  2. 5
      svelte-ui/src/components/IconSelect.svelte
  3. 8
      svelte-ui/src/components/ProjectEntry.svelte
  4. 2
      svelte-ui/src/components/ProjectProgress.svelte
  5. 2
      svelte-ui/src/external/icons.ts
  6. 10
      svelte-ui/src/forms/ProjectForm.svelte
  7. 4
      svelte-ui/src/forms/TaskForm.svelte

2
svelte-ui/src/components/Composition.svelte

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import type { GoalCompositionMode, GoalLogResult } from "../models/goal";
import type { GoalCompositionMode } from "../models/goal";
import type { LogResult } from "../models/log"; import type { LogResult } from "../models/log";
interface CompositionItem { interface CompositionItem {

5
svelte-ui/src/components/IconSelect.svelte

@ -15,7 +15,7 @@
<div class:disabled class="icon-select"> <div class:disabled class="icon-select">
{#each commonIcons as iconName (iconName)} {#each commonIcons as iconName (iconName)}
<div class="icon-item common" class:selected={value===iconName} on:click={() => {if (!disabled) { value = iconName }}}>
<div class="icon-item" class:selected={value===iconName} on:click={() => {if (!disabled) { value = iconName }}}>
<Icon name={iconName} /> <Icon name={iconName} />
</div> </div>
{/each} {/each}
@ -53,9 +53,6 @@ div.icon-item {
cursor: pointer; cursor: pointer;
} }
div.icon-item.uncommon {
color: #888;
}
div.icon-item:hover { div.icon-item:hover {
background-color: #292929; background-color: #292929;
} }

8
svelte-ui/src/components/ProjectEntry.svelte

@ -22,8 +22,8 @@
let activeTasks: TaskResult[] = []; let activeTasks: TaskResult[] = [];
let inactiveTasks: TaskResult[] = []; let inactiveTasks: TaskResult[] = [];
let completedTasks: TaskResult[] = [];
let todoTasks: TaskResult[] = []; let todoTasks: TaskResult[] = [];
let completedTasks: TaskResult[] = [];
let onholdTasks: TaskResult[] = []; let onholdTasks: TaskResult[] = [];
let failedTasks: TaskResult[] = []; let failedTasks: TaskResult[] = [];
@ -37,14 +37,14 @@
if (!hideInactive) { if (!hideInactive) {
inactiveTasks = project.tasks.filter(t => !t.active); inactiveTasks = project.tasks.filter(t => !t.active);
completedTasks = inactiveTasks.filter(t => t.statusTag === "completed" || t.statusTag == null);
todoTasks = inactiveTasks.filter(t => t.statusTag === "to do" || t.statusTag === "idea"); todoTasks = inactiveTasks.filter(t => t.statusTag === "to do" || t.statusTag === "idea");
completedTasks = inactiveTasks.filter(t => t.statusTag === "completed" || t.statusTag == null);
onholdTasks = inactiveTasks.filter(t => t.statusTag === "on hold" || t.statusTag === "postponed"); onholdTasks = inactiveTasks.filter(t => t.statusTag === "on hold" || t.statusTag === "postponed");
failedTasks = inactiveTasks.filter(t => t.statusTag === "failed" || t.statusTag === "declined" || t.statusTag === "wont do"); failedTasks = inactiveTasks.filter(t => t.statusTag === "failed" || t.statusTag === "declined" || t.statusTag === "wont do");
} else { } else {
inactiveTasks = []; inactiveTasks = [];
completedTasks = [];
todoTasks = []; todoTasks = [];
completedTasks = [];
onholdTasks = []; onholdTasks = [];
failedTasks = []; failedTasks = [];
} }
@ -72,8 +72,8 @@
<TaskList header="" tasks={activeTasks} project={project} showAllOptions={showAllOptions} /> <TaskList header="" tasks={activeTasks} project={project} showAllOptions={showAllOptions} />
{:else} {:else}
<TaskList header="Active" tasks={activeTasks} project={project} showAllOptions={showAllOptions} /> <TaskList header="Active" tasks={activeTasks} project={project} showAllOptions={showAllOptions} />
<TaskList header="Completed" tasks={completedTasks} project={project} showAllOptions={showAllOptions} />
<TaskList header="To Do" tasks={todoTasks} project={project} showAllOptions={showAllOptions} /> <TaskList header="To Do" tasks={todoTasks} project={project} showAllOptions={showAllOptions} />
<TaskList header="Completed" tasks={completedTasks} project={project} showAllOptions={showAllOptions} />
<TaskList header="On Hold" tasks={onholdTasks} project={project} showAllOptions={showAllOptions} /> <TaskList header="On Hold" tasks={onholdTasks} project={project} showAllOptions={showAllOptions} />
<TaskList header="Failed" tasks={failedTasks} project={project} showAllOptions={showAllOptions} /> <TaskList header="Failed" tasks={failedTasks} project={project} showAllOptions={showAllOptions} />
{/if} {/if}

2
svelte-ui/src/components/ProjectProgress.svelte

@ -12,7 +12,7 @@
let progressAmount: number; let progressAmount: number;
let progressTarget: number; let progressTarget: number;
$: progressAmount = (project.tasks||[]).map(t => t.active
$: progressAmount = (project.tasks||[]).map(t => (t.active || t.statusTag === "to do" || t.statusTag === "on hold")
? Math.min(t.completedAmount, t.itemAmount) * t.item.groupWeight ? Math.min(t.completedAmount, t.itemAmount) * t.item.groupWeight
: t.itemAmount * t.item.groupWeight : t.itemAmount * t.item.groupWeight
).reduce((n,m) => n+m, 0); ).reduce((n,m) => n+m, 0);

2
svelte-ui/src/external/icons.ts

@ -224,7 +224,7 @@ export const commonIcons: IconName[] = [
export type IconName = keyof typeof icons; export type IconName = keyof typeof icons;
export const iconNames = Object.keys(icons).sort() as IconName[]; export const iconNames = Object.keys(icons).sort() as IconName[];
export const DEFAULT_ICON = iconNames[0] as IconName;
export const DEFAULT_ICON = commonIcons[0];
export const uncommonIcons = iconNames.filter(n => !commonIcons.includes(n)); export const uncommonIcons = iconNames.filter(n => !commonIcons.includes(n));

10
svelte-ui/src/forms/ProjectForm.svelte

@ -1,10 +1,9 @@
<script lang="ts"> <script lang="ts">
import stuffLogClient from "../clients/stufflog"; import stuffLogClient from "../clients/stufflog";
import Checkbox from "../components/Checkbox.svelte";
import IconSelect from "../components/IconSelect.svelte"; import IconSelect from "../components/IconSelect.svelte";
import Modal from "../components/Modal.svelte"; import Modal from "../components/Modal.svelte";
import StatusTagSelect from "../components/StatusTagSelect.svelte";
import { iconNames } from "../external/icons";
import StatusTagSelect from "../components/StatusTagSelect.svelte";
import { DEFAULT_ICON } from "../external/icons";
import type { ProjectResult } from "../models/project"; import type { ProjectResult } from "../models/project";
import markStale from "../stores/markStale"; import markStale from "../stores/markStale";
import modalStore from "../stores/modal"; import modalStore from "../stores/modal";
@ -19,8 +18,9 @@ import StatusTagSelect from "../components/StatusTagSelect.svelte";
id: "", id: "",
name: "", name: "",
description: "", description: "",
icon: iconNames[0],
active: true,
icon: DEFAULT_ICON,
active: false,
statusTag: "to do",
createdTime: "", createdTime: "",
tasks: [], tasks: [],
} }

4
svelte-ui/src/forms/TaskForm.svelte

@ -21,12 +21,12 @@
name: "", name: "",
description: "", description: "",
icon: iconNames[0], icon: iconNames[0],
active: true,
active: false,
createdTime: "", createdTime: "",
item: null, item: null,
logs: [], logs: [],
completedAmount: 0, completedAmount: 0,
statusTag: null,
statusTag: "to do",
} }
let verb = "Add"; let verb = "Add";
if (md.name === "task.edit" || md.name === "task.delete") { if (md.name === "task.edit" || md.name === "task.delete") {

Loading…
Cancel
Save