Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ input {
color: var(--text-main);
border-radius: var(--radius-sm);
padding: 10px 12px;
min-height: 44px;
outline: none;
}

Expand All @@ -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;
}
Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
<div class="table-scroll" *ngIf="entries.length > 0; else emptyState">
<table>
<thead>
<tr>
<th>Program</th>
<th>Team</th>
<th>Language</th>
<th>Activity</th>
<th>Subactivity</th>
<th>Start</th>
<th>End</th>
<th>Duration</th>
<th>Note</th>
<!-- The roles keep the table semantics when the CSS turns rows into cards on small screens. -->
<table role="table">
<thead role="rowgroup">
<tr role="row">
<th role="columnheader">Program</th>
<th role="columnheader">Team</th>
<th role="columnheader">Language</th>
<th role="columnheader">Activity</th>
<th role="columnheader">Subactivity</th>
<th role="columnheader">Start</th>
<th role="columnheader">End</th>
<th role="columnheader">Duration</th>
<th role="columnheader">Note</th>
</tr>
</thead>
<tbody>
<tbody role="rowgroup">
<tr
role="row"
*ngFor="let entry of sortedEntries; trackBy: trackByEntryId"
[class.row-running]="!entry.finishedAt"
>
<td>{{ entry.program.name }}</td>
<td>{{ entry.team.name }}</td>
<td>{{ entry.language.name }}</td>
<td>{{ entry.activity.name }}</td>
<td>{{ entry.subactivity.name }}</td>
<td>{{ entry.startedAt | date: 'shortTime' }}</td>
<td>{{ entry.finishedAt ? (entry.finishedAt | date: 'shortTime') : '-' }}</td>
<td>{{ entry.durationSeconds | duration }}</td>
<td>{{ entry.note || '-' }}</td>
<td role="cell" data-label="Program">{{ entry.program.name }}</td>
<td role="cell" data-label="Team">{{ entry.team.name }}</td>
<td role="cell" data-label="Language">{{ entry.language.name }}</td>
<td role="cell" data-label="Activity">{{ entry.activity.name }}</td>
<td role="cell" data-label="Subactivity">{{ entry.subactivity.name }}</td>
<td role="cell" data-label="Start">{{ entry.startedAt | date: 'shortTime' }}</td>
<td role="cell" data-label="End">{{ entry.finishedAt ? (entry.finishedAt | date: 'shortTime') : '-' }}</td>
<td role="cell" data-label="Duration">{{ entry.durationSeconds | duration }}</td>
<td role="cell" data-label="Note">{{ entry.note || '-' }}</td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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> = {}): 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<ActivityTableComponent>;
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[]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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;
}
Expand Down Expand Up @@ -93,6 +95,7 @@ h1 {
}

.panel {
min-width: 0;
background: var(--surface);
border: 1px solid var(--surface-border);
border-radius: var(--radius-lg);
Expand Down Expand Up @@ -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'
Expand All @@ -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%;
}
}