fix(web): a poll says how it is published, and needs no text of its own
With a poll open the button reads «Publicar encuesta» and two options are enough. The «Más» menu keeps the page's gutter on a phone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,8 @@
|
||||
.ts-menu {
|
||||
display: grid;
|
||||
width: min(22rem, calc(100vw - 2rem));
|
||||
// Pushed against the screen's edge on a phone: keep the page's gutter.
|
||||
margin-inline-start: 1rem;
|
||||
padding: 0.375rem;
|
||||
border: 1px solid var(--ts-line);
|
||||
border-radius: 0.75rem;
|
||||
@@ -1052,6 +1054,12 @@ a.ts-key {
|
||||
}
|
||||
}
|
||||
|
||||
.ts-poll-editor__hint {
|
||||
margin: 0 0 0.875rem;
|
||||
color: var(--ts-muted);
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.ts-poll-editor__row {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
|
||||
@@ -1364,6 +1364,10 @@ const MAX_FILE_BYTES = 25 * 1024 * 1024;
|
||||
@if (pollOn()) {
|
||||
<fieldset class="ts-poll-editor">
|
||||
<legend>Encuesta · de 2 a 6 opciones</legend>
|
||||
<p class="ts-poll-editor__hint">
|
||||
La pregunta va en el texto de arriba. Se publica con el
|
||||
comentario, al pulsar «Publicar encuesta».
|
||||
</p>
|
||||
@for (option of pollOptions(); track $index) {
|
||||
<div class="ts-poll-editor__row">
|
||||
<pi-text-field
|
||||
@@ -1439,8 +1443,12 @@ const MAX_FILE_BYTES = 25 * 1024 * 1024;
|
||||
<div>
|
||||
<pi-action-button
|
||||
color="primary"
|
||||
text="Comentar"
|
||||
[disabled]="!commentBody().trim() && !commentFiles().length"
|
||||
[text]="pollOn() ? 'Publicar encuesta' : 'Comentar'"
|
||||
[disabled]="
|
||||
pollOn()
|
||||
? pollReady() < 2
|
||||
: !commentBody().trim() && !commentFiles().length
|
||||
"
|
||||
(execute)="addComment()"
|
||||
/>
|
||||
</div>
|
||||
@@ -2578,6 +2586,8 @@ export class IssuePage {
|
||||
// Only files (a recording, say) need no words: their names say it.
|
||||
const body =
|
||||
this.commentBody().trim() ||
|
||||
// A poll alone asks its own question.
|
||||
(this.pollOn() ? '📊 ¿Qué opción preferís?' : '') ||
|
||||
(files.length === 1
|
||||
? `📎 ${files[0].name}`
|
||||
: files.length
|
||||
@@ -2600,6 +2610,10 @@ export class IssuePage {
|
||||
/** A quick poll in the new comment: its options while it is written. */
|
||||
protected readonly pollOn = signal(false);
|
||||
protected readonly pollOptions = signal<string[]>(['', '']);
|
||||
/** Options written so far: two make a poll ready to publish. */
|
||||
protected readonly pollReady = computed(
|
||||
() => this.pollOptions().filter((o) => o.trim()).length,
|
||||
);
|
||||
|
||||
protected startPoll(): void {
|
||||
this.pollOptions.set(['', '']);
|
||||
|
||||
Reference in New Issue
Block a user