feat(settings): adjust document actions layout to prevent button wrapping

This commit is contained in:
PeymanHonarjoo
2026-10-12 17:30:23 +03:30
parent 9e8dd33927
commit b3eb4a6de5
3 changed files with 51 additions and 6 deletions
+19
View File
@@ -500,6 +500,25 @@
border-bottom: none; border-bottom: none;
} }
/*
* Row actions: the buttons must not be squeezed by the fixed column.
* Flex items shrink by default, which used to wrap «تلاش‌مجدد» / «بازبینی سند»
* mid-word (the cell's `overflow-wrap: anywhere` leaked into the button), so
* each button keeps its intrinsic width and the cell wraps to a new line only
* when there is genuinely no room.
*/
.documents-actions {
align-items: flex-start;
flex-wrap: wrap;
}
.documents-actions > .btn {
flex: 0 0 auto;
white-space: nowrap;
overflow-wrap: normal;
word-break: normal;
}
/* Status badges */ /* Status badges */
.status-queued { .status-queued {
background: var(--color-warning)/15; background: var(--color-warning)/15;
+6 -6
View File
@@ -499,12 +499,12 @@
<div class="documents-table-wrapper rounded-xl border border-[var(--color-card-border)] bg-[var(--card-bg)]"> <div class="documents-table-wrapper rounded-xl border border-[var(--color-card-border)] bg-[var(--card-bg)]">
<table class="documents-table w-full table-fixed text-sm text-right"> <table class="documents-table w-full table-fixed text-sm text-right">
<colgroup> <colgroup>
<col class="w-[26%]" /> <col class="w-[24%]" />
<col class="w-[18%]" /> <col class="w-[17%]" />
<col class="w-[10%]" /> <col class="w-[9%]" />
<col class="w-[16%]" /> <col class="w-[16%]" />
<col class="w-[15%]" /> <col class="w-[14%]" />
<col class="w-[15%]" /> <col class="w-[20%]" />
</colgroup> </colgroup>
<thead class="bg-[var(--sidebar-hover)]"> <thead class="bg-[var(--sidebar-hover)]">
<tr> <tr>
@@ -590,7 +590,7 @@
} }
</td> </td>
<td class="px-3 py-2.5 align-top"> <td class="px-3 py-2.5 align-top">
<div class="flex items-center gap-1.5"> <div class="documents-actions flex items-center gap-1.5">
@if (isReviewNeeded(doc) && doc.status === 'failed') { @if (isReviewNeeded(doc) && doc.status === 'failed') {
<button <button
type="button" type="button"
@@ -140,6 +140,32 @@ describe('SettingsPage — document filters', () => {
expect(el.querySelector('.documents-table tbody tr')?.children.length).toBe(6); expect(el.querySelector('.documents-table tbody tr')?.children.length).toBe(6);
}); });
it('keeps row action buttons unwrapped inside the narrow عملیات column', () => {
// Regression: the actions column used to be only 15% wide and inherited the
// table's `overflow-wrap: anywhere`, so «تلاش‌مجدد» / «بازبینی سند» broke in
// the middle of the word and the button looked broken.
const fixture = TestBed.createComponent(SettingsPage);
fixture.detectChanges();
const el = fixture.nativeElement as HTMLElement;
const actionsCell = el.querySelector('.documents-table tbody tr td:last-child') as HTMLElement;
expect(actionsCell).not.toBeNull();
const wrapper = actionsCell.querySelector('.documents-actions') as HTMLElement;
expect(wrapper).not.toBeNull();
// Whatever renders inside must stay on a single line per button.
const actionButtons = Array.from(wrapper.querySelectorAll('button'));
expect(actionButtons.length).toBeGreaterThan(0);
for (const button of actionButtons) {
const style = getComputedStyle(button);
if (button.classList.contains('btn')) {
expect(style.whiteSpace).toBe('nowrap');
expect(style.overflowWrap).toBe('normal');
}
}
});
it('confirms before removing: the bin button opens a modal, cancel keeps the doc, confirm shows the MVP notice', () => { it('confirms before removing: the bin button opens a modal, cancel keeps the doc, confirm shows the MVP notice', () => {
const fixture = TestBed.createComponent(SettingsPage); const fixture = TestBed.createComponent(SettingsPage);
fixture.detectChanges(); fixture.detectChanges();