Using npm
(or your package-manager of choice - such as pnpm
), you can install and run the server directly as the built frontend application is included and available thru:
cd server ; npm i ; babel-node index.js
Then browse to http://localhost:3000
npm i ; npm run dev
Google Chrome will pop up if you're using Windows. Otherwise, navigate to http://localhost:5173
npm run build
You should then be able to deploy/containerize all contents under server
─ src
├─ api: axios wrapper on server endpoints
├─ assets: Images
├─ components
│ ├─ data-table
│ │ ├─ container.jsx: Container component that orchestrates table UI
│ │ ├─ crud-dialogs.jsx: Presentational component for Dialogs/Popups/Modals
│ │ ├─ index.js: Named exports
│ │ └─ ... rest of the module's components ...
│ └─ shadcn
│ └─ ... Modified shadcn (Radix + Tailwind) components ...
├─ layouts
├─ lib
├─ table-page.jsx: Integrates API fetchers with UI loading state
└─ ... rest of React files ...
The look and feel of the app should not be affected by device width. However, on slow connections the Skeleton
animation will load longer.
Capacity units get simplified to their nearest higher unit with two decimals above 1024GB
on the table. However, their raw values delimited by commas are still available once you hover over a row.
Maintaining the raw data allows for future unit changes and migrations. The max allowed by the UI is:
which is roughtly equivalent to1.208 * 10
24
GB
1024 GeB
(1024 Geopbytes [1][2]). No next unit was included as its naming is not settled as of yet, and what was was included should be enough for the 2020s-2030s data needs.
The first input field in the table options row searches for anything within the devices
data, and includes both raw and simplified capacity units. Also matches apple
to Mac Workstations.
The q=[value]
query parameter is attached to the table's filter. It's removed when any of the filter two buttons are used. It persists on a hard reload / refresh.
The filter dropdown has search capabilities for the workstation types, and also shows faceted (uniques post filters) values.
The main 3 fields (system_name
, type
, and hdd_capacity
) within devices.json
can be uniquely sorted. Each has its own button instead of a combined dropdown sort.
Note: Multi-sort was not implemented. When a new field's sort is toggled, the previous one is removed.
Each row, filter and sorting button, and the reset button will show useful content on hover.
-
TypeScript wasn't used/added
-
Feature: Server responses are purposely slowed down on first render to show
Skeleton
animation -
The imported components from
shadcn
used on this project are a bit complex/voluminous for the task at hand. But they do look nice! A few are in TypeScript -
The endpoint
GET api/devices/:id
is not used -
The table options (filters + sorting) overflow into a new line if device is small
-
There are a few naming / text inconsistencies between
CRUD
named-expansions and text / variable-names:Add
in the UI meansCreate
Edit
in the UI meanUpdate
Delete
in the UI usesremove
as variable/prop names in the code, asdelete
is a reserved keyword in JS. Camel case variables however do start withdelete
.
-
There might be an overuse of
memo
anduseCallback
. The app was flickering too much when using React/TanStack Query. RQ usage was scraped but the memoization hooks stayed. Premature optimizations might also include usage ofObject.freeze
. -
The styles in all
skeleton
components will need to be kept in sync manually -
After you click on each table-options sorting button, the tooltip that shows the
Next filter: ...
will disappear Per research fixing this seemed seemed beyond its UX value -
The select dropdown for device types in dialogs/modals doesn't show the OS's icons like in the table options filter. This was one of the last components done, so it was left on the simplest acceptable form
-
No other filter besides the deep-search/big-search-field is parametrized on the URL
-
Exceptions are not caught/resolved, and
ErrorBoundary
's fallback is not useful -
Didn't implement a Dark Mode - although there's a Chrome extension that automatically forces dark mode on most websites
-
Environment variables (
PORT
, etc) support was not implemented