refactor: overhaul home UI and audio playback reliability

Redesign the home page and voice stream panel into a compact dock
layout to improve the chat experience. Implement a flush mechanism in
the PCM playback worklet to handle the resampler tail, preventing
premature session termination due to phantom outstanding playback.
Fix document filter visibility in settings to ensure controls remain
accessible when no results match, and refactor transcript insertion
to maintain correct user/assistant ordering.
This commit is contained in:
PeymanHonarjoo
2026-10-10 17:47:51 +03:30
parent be17544f2d
commit 28590c6dce
16 changed files with 1092 additions and 534 deletions
+51 -19
View File
@@ -435,7 +435,7 @@
</div>
}
@if (documents().length > 0) {
@if (documents().length > 0 || hasActiveFilters()) {
<div class="documents-filters mb-3 flex items-center justify-between gap-2">
<div class="flex items-center gap-2">
<select
@@ -456,22 +456,43 @@
</label>
<span class="text-xs text-[var(--text-muted)]">فقط فعال</span>
</div>
<button type="button" class="btn btn--outline" (click)="refreshDocuments()" [disabled]="documentsLoading()">
<svg
class="w-4 h-4"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M20 7v5h-5" />
<path d="M4 17v-5h5" />
<path d="M5.6 9a7 7 0 0 1 11.55-2.6L20 12" />
<path d="M4 12l2.85 5.6A7 7 0 0 0 18.4 15" />
</svg>
<span>به‌روزرسانی</span>
<button
type="button"
class="btn btn--outline"
(click)="refreshDocuments()"
[disabled]="documentsLoading()"
[attr.aria-busy]="documentsLoading()"
>
@if (documentsLoading()) {
<svg
class="w-4 h-4 animate-spin"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
aria-hidden="true"
>
<circle cx="12" cy="12" r="9" stroke-opacity="0.2" />
<path d="M21 12a9 9 0 0 0-9-9" />
</svg>
} @else {
<svg
class="w-4 h-4"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M20 7v5h-5" />
<path d="M4 17v-5h5" />
<path d="M5.6 9a7 7 0 0 1 11.55-2.6L20 12" />
<path d="M4 12l2.85 5.6A7 7 0 0 0 18.4 15" />
</svg>
}
<span>{{ documentsLoading() ? 'در حال به‌روزرسانی…' : 'به‌روزرسانی' }}</span>
</button>
</div>
@@ -614,18 +635,29 @@
</div>
</td>
</tr>
} @empty {
@if (!documentsLoading()) {
<tr>
<td
colspan="7"
class="px-3 py-10 text-center text-sm text-[var(--text-muted)]"
>
هیچ سندی با فیلتر انتخاب‌شده مطابقت ندارد.
</td>
</tr>
}
}
</tbody>
</table>
</div>
@if (!hasMoreDocuments() && !documentsLoading()) {
@if (documents().length > 0 && !hasMoreDocuments() && !documentsLoading()) {
<p class="text-xs text-[var(--text-muted)] text-center mt-3">
{{ documents().length }} سند ثبت شده
</p>
}
@if (hasMoreDocuments() && !documentsLoading()) {
@if (documents().length > 0 && hasMoreDocuments() && !documentsLoading()) {
<div class="documents-pagination mt-3 text-center">
<button type="button" class="btn btn--outline" (click)="loadMoreDocuments()">
بیشتر بارگذاری