From f4632859e02f271fa91a14a2fd576d993209b229 Mon Sep 17 00:00:00 2001 From: borja Date: Thu, 16 Oct 2025 09:59:18 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20a=C3=B1adir=20badge=20de=20responsables?= =?UTF-8?q?=20y=20popover=20con=20enlaces=20wa.me?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: aider (openrouter/openai/gpt-5) --- apps/web/src/lib/ui/data/TaskItem.svelte | 110 +++++++++++++++++-- apps/web/src/lib/ui/feedback/Popover.svelte | 111 ++++++++++++++++++++ apps/web/src/lib/utils/phone.ts | 8 ++ 3 files changed, 219 insertions(+), 10 deletions(-) create mode 100644 apps/web/src/lib/ui/feedback/Popover.svelte create mode 100644 apps/web/src/lib/utils/phone.ts diff --git a/apps/web/src/lib/ui/data/TaskItem.svelte b/apps/web/src/lib/ui/data/TaskItem.svelte index bcd1f25..6597b45 100644 --- a/apps/web/src/lib/ui/data/TaskItem.svelte +++ b/apps/web/src/lib/ui/data/TaskItem.svelte @@ -8,6 +8,8 @@ } from "$lib/utils/date"; import { success, error as toastError } from "$lib/stores/toasts"; import { tick } from "svelte"; + import Popover from "$lib/ui/feedback/Popover.svelte"; + import { normalizeDigits, buildWaMeUrl } from "$lib/utils/phone"; export let id: number; export let description: string; @@ -32,6 +34,15 @@ let dateValue: string = due_date ?? ""; let busy = false; + // Popover de responsables + let showAssignees = false; + let assigneesButtonEl: HTMLButtonElement | null = null; + $: assigneesCount = Array.isArray(assignees) ? assignees.length : 0; + $: assigneesLabel = + assigneesCount === 0 + ? "Sin responsable" + : `Responsables: ${assigneesCount}${isAssigned ? " (tú)" : ""}`; + // Edición de texto (inline) let editingText = false; let descEl: HTMLElement | null = null; @@ -270,13 +281,20 @@ {/if} - {#if assignees?.length} -
- {#each assignees as a} - 👤 - {/each} -
- {/if} +
+ +
{#if !completed} {#if !isAssigned} @@ -356,6 +374,28 @@ {/if} {/if}
+ { tick().then(() => assigneesButtonEl?.focus()); }}> +

Responsables

+ {#if assigneesCount === 0} +

No hay responsables asignados.

+ {:else} +
    + {#each assignees as a} +
  • + + {normalizeDigits(a)} + + {#if currentUserId && normalizeDigits(a) === normalizeDigits(currentUserId)} + + {/if} +
  • + {/each} +
+ {/if} +
+ +
+
diff --git a/apps/web/src/lib/ui/feedback/Popover.svelte b/apps/web/src/lib/ui/feedback/Popover.svelte new file mode 100644 index 0000000..f7ce341 --- /dev/null +++ b/apps/web/src/lib/ui/feedback/Popover.svelte @@ -0,0 +1,111 @@ + + +{#if open} +
+ +{/if} + + diff --git a/apps/web/src/lib/utils/phone.ts b/apps/web/src/lib/utils/phone.ts new file mode 100644 index 0000000..94de330 --- /dev/null +++ b/apps/web/src/lib/utils/phone.ts @@ -0,0 +1,8 @@ +export function normalizeDigits(input: string | null | undefined): string { + return String(input ?? '').replace(/\D+/g, ''); +} + +export function buildWaMeUrl(input: string): string { + const digits = normalizeDigits(input); + return `https://wa.me/${digits}`; +}