Skip to content

Commit

Permalink
hide unusable actions on archive page
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur committed Nov 17, 2024
1 parent 445cff2 commit 3c39565
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/components/list.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ let isEditing = false;
) as task}
<Task
{task}
{page}
onCopy={(sourceTask) => {
taskToCopy = sourceTask;
isAddOpen = true;
Expand Down
23 changes: 13 additions & 10 deletions src/components/task.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
let showUncleConfirm = false;
export let task: TaskType;
export let page: 'next' | 'archive';
export let onCopy: (task: TaskType) => void;
export let onEdit: (task: TaskType) => void;
export let onUncle: (task: TaskType) => void;
Expand All @@ -27,16 +28,18 @@
<div class="task-container">
<div class="menu">
<button on:click={() => onCopy(task)} title="Copy"><IconCopy /></button>
<button
on:click={() => onEdit(task)}
disabled={!task.id || task.status !== 'pending'}
title="Edit"><IconEdit /></button>
<button
on:click={() => {
showUncleConfirm = true;
}}
disabled={task.status !== 'pending'}
title="Charge immediately"><IconCharge /></button>
{#if page === 'next'}
<button
on:click={() => onEdit(task)}
disabled={!task.id || task.status !== 'pending'}
title="Edit"><IconEdit /></button>
<button
on:click={() => {
showUncleConfirm = true;
}}
disabled={task.status !== 'pending'}
title="Charge immediately"><IconCharge /></button>
{/if}
</div>
<input
type="checkbox"
Expand Down

0 comments on commit 3c39565

Please sign in to comment.