Files
task-stream/libs/web/tracker/presenters/src/lib/ui/vote.ts
Josep Piguillem f2001aca88 feat: formatted text, a list view, ticket details, public proposals and votes
Formatted text
- Descriptions, comments, replies and release notes render Markdown,
  sanitised with DOMPurify (tested against scripts, handlers and
  javascript: links). A pasted image is uploaded and written as
  ![name](attachment:<id>); the web fetches it with the reader's session,
  so it works on private projects. Every text box has a preview. The
  attachment upload now answers its attachmentId.

List view
- /p/:key/list: every ticket as rows, sortable by any column, filtered by
  text, open/closed, type, priority and assignee; status, priority and
  assignee change in place; bulk edit (the backlog's bar, now shared).

Ticket details
- Reactions on comments (GitHub's eight), for members and viewers.
- Duplicate a ticket: what it says, not where it stands.
- blockedBy: open tickets it waits for (BLOCKS / DEPENDS_ON), worked out
  when reading with one query per board or page; shown on cards, list
  rows and the ticket.

Public proposals
- A public project can take bug reports and ideas from anyone
  (acceptsProposals): POST /api/explore/projects/{project}/proposals and
  the form at /p/:key/proponer. They become tickets labelled «propuesta»,
  opened by TaskStream; a honeypot field and 5 per address every 15
  minutes keep spam out. No e-mail is asked: it would be public.

Votes
- Anyone signed in votes on a public project's tickets, members on a
  private one (voteIssue, PUT/DELETE /api/issues/{issue}/vote): votes and
  voted on each ticket, buttons on the ticket and the roadmap, a column
  in the list. The showcase carries votes and the open proposals.

MCP: vote_issue, duplicate_issue, react_to_comment; listings show
blockers and votes. Docs, Word and PDF updated; chat notifications
(Discord, Slack, Telegram) noted for later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 21:36:11 +02:00

79 lines
2.1 KiB
TypeScript

import {
ChangeDetectionStrategy,
Component,
input,
output,
} from '@angular/core';
/**
* ▲ 3: how many want a ticket. A button for whoever can vote (the
* signed-in, on a public project), the count alone for the rest.
*/
@Component({
selector: 'ts-vote',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
@if (canVote()) {
<button
type="button"
class="ts-vote"
[class.is-mine]="voted()"
[attr.aria-pressed]="voted()"
[attr.aria-label]="
(voted() ? 'Quitar mi voto · ' : 'Votar · ') + votes()
"
[title]="voted() ? 'Quitar mi voto' : 'Votar'"
(click)="voteChange.emit(!voted())"
>
▲ <span>{{ votes() }}</span>
</button>
} @else {
<span class="ts-vote is-static" title="Votos">▲ {{ votes() }}</span>
}
`,
styles: `
:host {
display: inline-flex;
}
/* @pi/ui styles every <button> (min-width, padding, radius, border) too
specifically to override without !important. */
.ts-vote {
display: inline-flex;
gap: 0.25rem;
align-items: center;
min-width: 0 !important;
height: auto !important;
padding: 0.0625rem 0.5rem !important;
border: 1px solid var(--ts-line) !important;
border-radius: 999px !important;
line-height: 1.5;
background: var(--ts-surface);
color: var(--ts-muted);
font: inherit;
font-family: var(--ts-font-mono, ui-monospace, monospace);
font-size: 0.75rem;
white-space: nowrap;
cursor: pointer;
&:hover:not(.is-static) {
border-color: var(--ts-brand);
color: var(--ts-ink);
}
&.is-mine {
border-color: var(--ts-brand) !important;
background: color-mix(in srgb, var(--ts-brand) 12%, var(--ts-surface));
color: var(--ts-brand);
}
&.is-static {
cursor: default;
}
}
`,
})
export class VoteComponent {
readonly votes = input.required<number>();
readonly voted = input(false);
readonly canVote = input(false);
/** The new state: true to vote, false to take it back. */
readonly voteChange = output<boolean>();
}