diff --git a/frontend/src/app/features/worklog/components/activity-form/activity-form.component.scss b/frontend/src/app/features/worklog/components/activity-form/activity-form.component.scss index 0f77d02..9229bb9 100644 --- a/frontend/src/app/features/worklog/components/activity-form/activity-form.component.scss +++ b/frontend/src/app/features/worklog/components/activity-form/activity-form.component.scss @@ -17,6 +17,7 @@ input { color: var(--text-main); border-radius: var(--radius-sm); padding: 10px 12px; + min-height: 44px; outline: none; } @@ -41,6 +42,7 @@ button { color: var(--text-main); border-radius: var(--radius-sm); padding: 10px 16px; + min-height: 44px; font-weight: 600; cursor: pointer; } @@ -55,3 +57,23 @@ button:disabled { color: var(--text-muted); font-size: 0.88rem; } + +/* Tablets: two columns (Program|Team, Language|Activity, Subactivity|Note) */ +@media (min-width: 600px) and (max-width: 900px) { + .activity-form { + grid-template-columns: 1fr 1fr; + column-gap: 16px; + } + + button, + .form-locked-message { + grid-column: 1 / -1; + } +} + +/* Phones: the submit button uses the full width */ +@media (max-width: 480px) { + button { + justify-self: stretch; + } +} diff --git a/frontend/src/app/features/worklog/components/activity-table/activity-table.component.html b/frontend/src/app/features/worklog/components/activity-table/activity-table.component.html index 0966ed8..9e52183 100644 --- a/frontend/src/app/features/worklog/components/activity-table/activity-table.component.html +++ b/frontend/src/app/features/worklog/components/activity-table/activity-table.component.html @@ -1,32 +1,34 @@
- - - - - - - - - - - - + +
ProgramTeamLanguageActivitySubactivityStartEndDurationNote
+ + + + + + + + + + + - + - - - - - - - - - + + + + + + + + +
ProgramTeamLanguageActivitySubactivityStartEndDurationNote
{{ entry.program.name }}{{ entry.team.name }}{{ entry.language.name }}{{ entry.activity.name }}{{ entry.subactivity.name }}{{ entry.startedAt | date: 'shortTime' }}{{ entry.finishedAt ? (entry.finishedAt | date: 'shortTime') : '-' }}{{ entry.durationSeconds | duration }}{{ entry.note || '-' }}{{ entry.program.name }}{{ entry.team.name }}{{ entry.language.name }}{{ entry.activity.name }}{{ entry.subactivity.name }}{{ entry.startedAt | date: 'shortTime' }}{{ entry.finishedAt ? (entry.finishedAt | date: 'shortTime') : '-' }}{{ entry.durationSeconds | duration }}{{ entry.note || '-' }}
diff --git a/frontend/src/app/features/worklog/components/activity-table/activity-table.component.scss b/frontend/src/app/features/worklog/components/activity-table/activity-table.component.scss index 398d3a6..e61ccea 100644 --- a/frontend/src/app/features/worklog/components/activity-table/activity-table.component.scss +++ b/frontend/src/app/features/worklog/components/activity-table/activity-table.component.scss @@ -49,3 +49,58 @@ p { min-width: 760px; } } + +/* Phones: each activity becomes a card (label on the left, value on the right) */ +@media (max-width: 640px) { + table { + min-width: 0; + } + + /* Header row hidden visually but still available to screen readers */ + thead { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip: rect(0 0 0 0); + } + + table, + tbody, + tr, + td { + display: block; + width: 100%; + } + + tbody tr { + margin-bottom: 10px; + padding: 4px 0; + border: 1px solid rgba(111, 168, 255, 0.2); + border-radius: var(--radius-md); + background: rgba(8, 15, 27, 0.5); + } + + tbody tr.row-running { + background: rgba(87, 255, 162, 0.1); + border-color: rgba(87, 255, 162, 0.4); + } + + td { + display: flex; + justify-content: space-between; + gap: 16px; + padding: 6px 12px; + border-bottom: none; + text-align: right; + overflow-wrap: anywhere; + } + + td::before { + content: attr(data-label); + flex: 0 0 auto; + color: var(--accent); + font-weight: 600; + text-align: left; + } +} diff --git a/frontend/src/app/features/worklog/components/activity-table/activity-table.component.spec.ts b/frontend/src/app/features/worklog/components/activity-table/activity-table.component.spec.ts new file mode 100644 index 0000000..98a29cb --- /dev/null +++ b/frontend/src/app/features/worklog/components/activity-table/activity-table.component.spec.ts @@ -0,0 +1,66 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ActivityEntryResponse } from '../../models/worklog.model'; +import { ActivityTableComponent } from './activity-table.component'; + +const item = { id: 1, name: 'Item' }; + +function entry(id: number, startedAt: string, overrides: Partial = {}): ActivityEntryResponse { + return { + id, + program: { id: 1, name: 'Orion Platform' }, + team: { id: 1, name: 'Core Backend' }, + language: { id: 1, name: 'Java' }, + activity: item, + subactivity: { ...item, activityId: 1 }, + startedAt, + finishedAt: null, + durationSeconds: null, + note: null, + ...overrides, + }; +} + +describe('ActivityTableComponent', () => { + let fixture: ComponentFixture; + let element: HTMLElement; + + function render(entries: ActivityEntryResponse[]): void { + fixture.componentRef.setInput('entries', entries); + fixture.detectChanges(); + } + + beforeEach(() => { + fixture = TestBed.createComponent(ActivityTableComponent); + element = fixture.nativeElement; + }); + + it('shows the empty state when there are no activities', () => { + render([]); + + expect(element.querySelector('table')).toBeNull(); + expect(element.textContent).toContain('No activities logged yet'); + }); + + it('lists the newest activity first and highlights the running one', () => { + render([ + entry(1, '2026-03-10T08:00:00Z', { finishedAt: '2026-03-10T09:00:00Z', durationSeconds: 3600 }), + entry(2, '2026-03-10T09:00:00Z'), + ]); + + const rows = element.querySelectorAll('tbody tr'); + expect(rows.length).toBe(2); + expect(rows[0].classList).toContain('row-running'); + expect(rows[1].classList).not.toContain('row-running'); + }); + + it('labels every cell with its column name (used by the card layout on phones)', () => { + render([entry(1, '2026-03-10T08:00:00Z')]); + + const headers = Array.from(element.querySelectorAll('thead th')).map((th) => th.textContent?.trim()); + const labels = Array.from(element.querySelectorAll('tbody tr:first-child td')).map((td) => + td.getAttribute('data-label') + ); + + expect(labels).toEqual(headers as string[]); + }); +}); diff --git a/frontend/src/app/features/worklog/pages/worklog-page/worklog-page.component.scss b/frontend/src/app/features/worklog/pages/worklog-page/worklog-page.component.scss index c91f57b..70dce1f 100644 --- a/frontend/src/app/features/worklog/pages/worklog-page/worklog-page.component.scss +++ b/frontend/src/app/features/worklog/pages/worklog-page/worklog-page.component.scss @@ -34,6 +34,7 @@ color: var(--text-main); border-radius: var(--radius-sm); padding: 10px 40px 10px 12px; + min-height: 44px; min-width: 220px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239fb0c9' d='M1.4 0L6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E"); @@ -60,6 +61,7 @@ h1 { color: var(--text-main); border-radius: var(--radius-sm); padding: 10px 16px; + min-height: 44px; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; } @@ -93,6 +95,7 @@ h1 { } .panel { + min-width: 0; background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); @@ -137,7 +140,8 @@ h2 { } .grid { - grid-template-columns: 1fr; + /* minmax(0, 1fr): without it the column grows to the table's min-width and the whole page scrolls sideways */ + grid-template-columns: minmax(0, 1fr); grid-template-areas: 'form' 'timer' @@ -160,3 +164,22 @@ h2 { width: 100%; } } + +/* Phones */ +@media (max-width: 480px) { + .worklog-page { + padding: 14px; + } + + .panel { + padding: 14px; + } + + .grid { + gap: 12px; + } + + .save-button { + width: 100%; + } +}