Бэкенд: регистрация со входом сразу и /api/config, профиль и смена пароля, свои папки, PATCH письма (прочитано, флажок, перенос; Спам ставит отметку), корзина и очистка, черновики, несколько адресатов и копия, вложения черновика уходят с письмом, вложения и заголовки To/Cc входящих сохраняются, письма заблокированных — в Спам. Исправлено: загрузка файла (415), колонка content_id (500 на любых вложениях), SPA-маршрут с точкой. Фронтенд переписан: все таблицы — грид, оформление — шаблон synthwave-design-showcase.html. α Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import { Injectable, signal } from '@angular/core';
|
|
import { Observable } from 'rxjs';
|
|
|
|
export interface DialogRequest {
|
|
title: string;
|
|
message?: string;
|
|
confirmLabel?: string;
|
|
danger?: boolean;
|
|
/** Set — the dialog asks for a text (prompt); the value is the initial text. */
|
|
input?: string;
|
|
inputLabel?: string;
|
|
required?: boolean;
|
|
}
|
|
|
|
interface OpenDialog extends DialogRequest { resolve: (value: string | null) => void; }
|
|
|
|
/** One glass dialog at a time: confirm (resolves '' or null) and prompt (the text or null). */
|
|
@Injectable({ providedIn: 'root' })
|
|
export class DialogService {
|
|
readonly current = signal<OpenDialog | null>(null);
|
|
|
|
ask(request: DialogRequest): Observable<string | null> {
|
|
return new Observable<string | null>(subscriber => {
|
|
this.current()?.resolve(null);
|
|
this.current.set({
|
|
...request,
|
|
resolve: value => {
|
|
this.current.set(null);
|
|
subscriber.next(value);
|
|
subscriber.complete();
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
confirm(title: string, message: string, confirmLabel = 'Confirm', danger = false): Observable<string | null> {
|
|
return this.ask({ title, message, confirmLabel, danger });
|
|
}
|
|
|
|
prompt(title: string, inputLabel: string, value = '', confirmLabel = 'Save'): Observable<string | null> {
|
|
return this.ask({ title, inputLabel, input: value, confirmLabel, required: true });
|
|
}
|
|
}
|