Skip to main content
  1. Projects/
  2. Maintenance Log/

Maintenance Log Frontend - Thirteenth Week: Employee Lists, Log Views, and LogCard Refactor

Jesper Andersen
Author
Jesper Andersen
Table of Contents
Maintenance Log - This article is part of a series.
Part : This Article

Devlog Week 13: Employee Lists, Log Views, and LogCard Refactor
#

This entry focuses on the employee list + employee log viewing flows, plus a refactor of LogCard to support reuse across more contexts (and avoid invalid nested interactive elements).

What Changed
#

  • EmployeeList implemented using the same fetch + filter pattern as AssetList
  • Active/inactive filter moved server-side via getEmployees(activeFilter)
  • Role filter handled client-side using Array.filter() (backend does not support role filtering)
  • Dynamic filter option lists derived from loaded data using Set for deduplication
  • EmployeeCard added with existing CSS module styling and navigable card behavior
  • EmployeeLogList fetches employee + logs in parallel (Promise.all) and supports client-side filtering
  • LogCard refactored to support showAssetName and improved keyboard accessibility

EmployeeList: Server-Side vs Client-Side Filtering
#

The EmployeeList page follows the same core structure as AssetList:

  • local state for loading, error, and the loaded employee array
  • a useEffect that refetches when filter state changes
  • filter UI built from reusable Select components

Filtering is intentionally split based on backend capability:

  • active/inactive is server-side (through getEmployees(activeFilter)), because it maps cleanly to the API and keeps payloads smaller
  • role filtering is client-side using Array.filter() on the already-loaded employees, because the backend does not currently expose role filtering

For role filter options, values are derived from the loaded list via Set to avoid duplicates and keep the UI resilient to data changes.

EmployeeCard: Clickable Cards Without Double Navigation
#

EmployeeCard reuses existing CSS module patterns and shows:

  • name + email
  • an active badge
  • a role badge

The card click navigates to /employees/:id. A secondary “View performed logs” action is rendered inside the card; it uses e.stopPropagation() to prevent the card click handler from firing at the same time.


EmployeeLogList: Parallel Fetch + Derived Filters
#

EmployeeLogList loads two independent datasets:

  • employee summary data
  • logs performed by that employee

These are fetched in parallel with Promise.all, keeping the page responsive.

Filtering is implemented client-side for:

  • status
  • task type
  • asset name

Asset name options are derived from the loaded logs using Set for deduplication (same idea as the role filter).

LogCard Refactor: Reuse + Accessibility
#

To support log lists in multiple contexts, LogCard was updated with a showAssetName prop.

Other refactor outcomes:

  • collapsed view includes the key metadata; expanded view now only shows additional info (log id and links)
  • asset and performer values are rendered as <Link> elements
  • e.stopPropagation() is applied to those links to avoid toggling the card when the link itself is clicked

Up Next
#

  • Add manager/admin-oriented pages (create asset/employee and domain-specific admin actions)
  • Tighten UX around failures (consistent error messages and session expiry handling)
Maintenance Log - This article is part of a series.
Part : This Article

Related

Maintenance Log Frontend - Eleventh Week: Assets, Logs, Filtering, and Creating Maintenance Entries

Devlog Week 11: Assets, Logs, Filtering, and Creating Maintenance Entries # This entry focuses on the asset/log workflow: fetching real data from the API, filtering lists, displaying asset details, and adding log creation behind role checks. What Changed # AssetList now fetches from the real backend API Active/inactive filtering implemented via a reusable Select component AssetDetail fetches asset + logs in parallel using Promise.all Status and task type filters wired to server-side filtering “Create log” is role-gated (TECHNICIAN+) and also hidden for inactive assets CreateLog includes client-side validation and prevents double-submit CSS Modules adopted for scoped styling Asset List: Fetch + Filter Pattern # AssetList implements a reusable pattern used elsewhere in the frontend:

Maintenance Log Frontend - Twelfth Week: User Profiles, Employee Admin Actions, and Form Patterns

Devlog Week 12: User Profiles, Employee Admin Actions, and Form Patterns # This entry covers the employee-facing parts of the UI: profile views, edit flows, admin actions, and the form patterns used to keep components maintainable. What Changed # UserProfile supports both “me” and viewing other employees via dynamic route params Profile page extracted into focused subcomponents: EditProfileForm, AdminActions, PasswordChangeForm Form handling uses a mix of controlled inputs and a FormData approach (when appropriate) useEffect race-condition prevention via an ignore flag to avoid setting state after unmount Admin-only employee actions (deactivate/reactivate) gated by role and disallowed on own profile User Profile: “Me” vs “Other Employee” # The profile route supports multiple entry points:

Maintenance Log Frontend - Tenth Week: Frontend Auth, Routing, and API Client Structure

Devlog Week 10: Frontend Auth, Routing, and API Client Structure # This entry covers the “plumbing” for the React frontend: the route layout, guarded routes by role, auth rehydration, and an API layer split by domain. What Changed # Vite + React + React Router setup with a domain-organized structure (pages/, components/, utils/, context/, styles/) Declarative nested routing with a layout route and <Outlet /> Auth context for user state, token rehydration, and role checks ProtectedRoute component for nestable route protection API layer split by domain with a shared apiRequest() helper Routing: Nested Layout + Guards # The router is set up as nested routes: