Assets Pewter
v1.0An IT asset desk for hardware and licenses, in a quiet pewter-grey look: check a spare out and its status pill morphs while the in-stock count rolls down.
Adres strony: /
Wbudowane
Co dostajesz- Jasny i ciemnyUżywa kolorów twojego motywu
- Komputer, tablet i telefonEkrany, dla których powstał
- Pakiety…
- Rozmiar kodu…
- Oszczędza baterię30 fps, bezczynny w spoczynku
- Pauza, gdy niewidocznyPoza ekranem lub w innej karcie
- Mniej ruchuSpokojny dla osób, które o to proszą
Sprawdzane przy każdej zmianie
Bezpieczeństwo sprawdzone: 3 gru- Sprawdzanie typówTypeScript w trybie strict
- Lint i formatowanieESLint · Prettier
- Testy i buildZrzuty ekranu w jasnym i ciemnym
- Audyt bezpieczeństwaBrak ostrzeżeń wysokich i krytycznych
- Wiek pakietówKażda wersja publiczna od 7+ dni
- CPU w spoczynkuPoniżej pół rdzenia w spoczynku, ≤ 30 fps
Kod
assets-pewterReact
- assets-pewter.tsxThe page: the sections in order.
- content.tsEvery word and number: brand, nav links, each section's copy and lists.
- theme.tsThe colors as CSS variables, and the shared class strings.
- README.mdHow to install it, and where to change the text, colors and form.
- pagesOne file per page: the sections it shows, in order.
- assets.tsxAssets: every device, by status in tabs (All counts what is in service, as the sidebar does), narrowed by a search and type and place filters, picked for bulk actions, opened in a sheet (#/assets/<id>), and added from New asset (?new=1).
- licenses.tsxLicenses: seats in use and what they cost a year up top, then all software soonest renewal first, each with its seat bar moving live as people take and free seats; a sheet for each (#/licenses/<id>) and the New form (?new=1).
- overview.tsxOverview: the desk at a glance. The KPI strip, the spares ready to hand out next to the fleet by status and type, then renewals coming up next to the live feed. It keeps the live clock running, so check-ins and seat changes land while you watch.
- people.tsxPeople: everyone at the company with their team, what they hold and its value, narrowed by a search and a team; a sheet per person (#/people/<id>) and New person (?new=1).
- repairs.tsxRepairs: the tickets by step (Open, At vendor, Done) in tabs, each row the asset, what's wrong, the vendor, how long it has been and the bill; a sheet per ticket (#/repairs/<id>) and New repair (?new=1).
- reports.tsxReports: what the fleet is worth month by month, how old it is, devices by type, how full each software plan is and who holds the most. Export CSV is the top bar's action here.
- settings.tsxSettings: the desk's own lists (device types, locations, repair vendors) and Appearance (theme and language).
- sign-in.tsxThe sign-in page (#/sign-in): the logo and the form on one card over the backdrop, without the sidebar and top bar: one quiet card, as plain as the desk.
- sectionsOne file per page section.
- account-menu.tsxThe account menu under the avatar in the top bar: who is signed in, Settings and Sign out; the arrow keys move through it, Escape, Tab or a click outside closes it.
- appearance.tsxSettings → Appearance: the theme (System, Dark or Light), each choice shown as a small preview, and the language (System or one of locales/list.ts).
- asset-actions.tsxWhat you can do to one asset from its sheet: check it out or in, send it to repair and edit it at the top; retire or delete it at the foot, each asked first.
- asset-form.tsxNew asset and Edit asset: name, type, serial, cost, purchase day, warranty and location, checked on submit with an error under each field (no browser popups).
- asset-sheet.tsxOne asset's sheet (#/assets/<id>): its tag and status, the actions, then Details, History and Repairs as tabs. Its pill morphs when the status changes while it is open.
- asset-table.tsxThe assets table: a box to pick each row, the device with its tag, status, who has it, where, cost and the last change. On a phone a row takes two lines: the device and status, then holder, place and cost.
- bottom-tabs.tsxThe phone's bottom tabs: Overview, Assets, People and Repairs, and More for the rest (the sidebar in its sheet). Frosted over the page that scrolls under it, with a top edge.
- bulk-bar.tsxThe bar that rises when rows are picked in the assets table: how many, then check in, send to repair, retire, export or delete them all at once.
- checkout-dialog.tsxCheck out: pick who gets a spare from a list you can type to narrow (name, team or title), then confirm. The dialog only picks; what happens next (the pill's morph, the save) is the caller's.
- confirm.tsxThe ask before something that can't be undone (delete, retire): what will happen in a sentence, Cancel and the red action.
- feed.tsxThe live feed: what the desk did, newest first, as sentences with the person and the device or software in them; a row that arrives while you watch slides in with a short wash, and the times redraw as they age.
- fleet.tsxOverview's fleet panel: every asset by status as bars that grow in (each with its glyph and word, so no status rests on colour), then the active ones by type, how many of each sit in stock.
- hand-out.tsHanding a spare out and taking it back, the same from the Overview list and the asset's sheet: save, reload every page in place (counts roll, the feed gets its row), and a toast with Undo.
- kpi-strip.tsxOverview's KPI strip: four cells in one bordered box split by hairlines, each a label, its number rolling to new values, the week's change in words and colour, and a sparkline; each cell opens its filtered list.
- license-form.tsxThe software form (New and Edit on Licenses): name, vendor, seats, the price of a seat, how it bills and the next renewal, checked on submit with an error under each field.
- license-sheet.tsxThe sheet for one piece of software (#/licenses/<id>): seats in use, what it costs and when it renews, who holds a seat (each with Free), a way to give one more seat, then Renew, Edit and Delete.
- person-form.tsxNew person and Edit person: name, work email, team, title and where they work, checked on submit with an error under each field.
- person-sheet.tsxOne person's sheet (#/people/<id>): who they are, the devices they hold (each with Check in) and their software seats, then Edit and Delete; deleting brings their devices back to the store room and frees their seats.
- ready-list.tsxOverview's Ready to assign: the spares on the shelf, the latest back first. Check out picks a person; then the row's pill morphs from In stock to Assigned with who got it, the row steps out, the rest glide up and the In stock count rolls down.
- renewals.tsxOverview's Renewals soon: software renewals in the next 90 days and warranties ending in 30, soonest first, each with when (in words, and a warning glyph inside two weeks), its cost and, for software, the seats in use.
- repair-dialog.tsxSend to repair: a vendor and what's wrong, for one asset or several picked in the table; opened from Repairs it asks which asset too. Each asset gets its own ticket and leaves whoever held it.
- repair-sheet.tsxOne repair ticket's sheet (#/repairs/<id>): the asset and what's wrong, its step (Open, At vendor, Done) as a three-part switch, the vendor and the bill, notes in order, then Delete. Done puts the asset back in stock.
- report-export.tsReports → Export CSV (the top bar's main action on Reports): every asset with its status, holder, cost and warranty, loaded through the API.
- seat-meter.tsxThe seat meter on Licenses: the used count rolling to new values over the total, and a bar that glides as seats are taken or freed. When every seat is taken it says Full in words, not only in colour.
- settings-lists.tsxSettings → the desk's lists: device types (with the drawing each shows), locations and repair vendors (with a phone). Each row renames in place or deletes (refused while something uses it); a line at the foot adds one.
- sidebar.tsxThe sidebar: the mark and workspace, search with the command palette shortcut, the page links in two groups with their counts, and a pill that glides to the current page; collapsed, only the icons show.
- sign-in-form.tsxThe sign-in form: email and password with their errors under them, show or hide the password, keep me signed in, and the demo account to fill in; a wrong pair says so above the fields.
- top-bar.tsxThe top bar: where you are, the live strap with its pause, search on narrow screens, the theme switch, the page's one main action and the account menu. At rest it is bare; once the page scrolls it frosts over what passes under it.
- partsWhat several sections share.
- buildWhat several sections share.
- cardsWhat several sections share.
- odometer.tsxThe odometer card style: cards rise while every number rolls digit by digit to its value.
- rowsWhat several sections share.
- center.tsThe center row motion: the middle row on screen rises first, then the ripple spreads up and down.
- core.tsxThe page's build-in: on first load and on every page switch the cards arrive in the app's card style and their contents build: bars grow, lines draw, rings fill, the list rows on screen ripple in in the app's row motion, numbers count. The two picks are wired in ./index.ts.
- index.tsThe app's two build-in picks, wired here and nowhere else: its card style (cards/) and its row motion (rows/). npm run new-app copies only the two it is given (--cards, --rows).
- appearance.tsHow the app looks right now: dark or light, Glass or Solid, from Settings → Appearance, the page around it and the Style setting.
- avatar.tsxA person's initials in a round badge, tinted with the primary.
- backdrop.tsxThe Glass style's backdrop: what shows through the see-through panels, faded out in Solid; with followBackground it paints your background instead.
- bar-chart.tsxA bar chart: bars grow in, and the picked bar (in the primary), its guide line and tooltip glide to the bar you point at or pick with the arrow keys; a new range morphs the bars instead of drawing them again.
- command-palette.tsxThe command palette (⌘K or Ctrl K): type to find a page or an action, then Enter.
- csv.tsExport CSV: turns rows into a CSV file and hands it to the browser to save.
- dialog.tsxA centered modal dialog (a form, a confirm): rises in, plays its way out, Escape or a tap outside closes it, and the focus goes back where it was.
- drawer.tsxA drawer from the right: a full-height native <dialog> for one thing's details (a client, an order). It springs in, slides out, closes on Esc, the close button or a click beside it, and keeps showing its thing while it slides away.
- field.tsxA labeled form field (a text input or a select) with its error line under it, tied together for screen readers.
- flip.tsFLIP for a list that re-sorts, filters or loses a row: after each change every row that stayed glides from where it was to where it is now. Rows carry data-flip="<id>"; positions are measured inside the list (and again when it resizes), so a page scroll or a late font never reads as a move.
- format.tsHow numbers and dates are written: by Intl, the current language's way ("1,240", "1.240"; "Nov 19", "19 nov."). Add a helper here when a page needs money, times or a list.
- icons.tsxThe logo and the line icons, drawn on a 24-unit grid with round ends: the pages, the device kinds and the row actions.
- language.tsThe app's language: the words every page reads (useWords), how dates and numbers are written (parts/format.ts) and the reading direction. Picked in Settings → Appearance (or System: the page's own language) and kept in this browser; English is built in, any other language loads only when it shows (locales/list.ts).
- line-chart.tsxA line chart with a soft area under it, in the primary: the line draws itself in, the latest point marked, and new values roll the line to its new shape.
- live-clock.tsxOne shared clock for everything live: it ticks only while something on screen listens, the tab is visible and live isn't paused, and the bare button that pauses it. What a tick does (move the demo's time, bring in an event, reload) is the app's, passed to liveClock.
- live.tsThe app's one live clock: every 6 seconds the IT desk does something (data/live.ts) and every page reloads in place; every 30 the times on screen ("4 min ago") redraw. It rests while nothing live is on screen, the tab is hidden or live is paused.
- moments.tsThe animations the sidebar, the sign-in card, menus, dialogs, the phone sheet and toasts play, timed by their moments in theme.ts.
- motion.tsMotion helpers: the reduced-motion check, live, and run-once-in-view.
- popover.tsxA menu that unfolds from its button (a row's actions, the alerts, a sort pick): drawn in the window layer so no table or card clips it; arrow keys walk it, Escape, Tab, a click outside or a scroll folds it away, and it plays its way out unless motion is reduced.
- router.tsThe page switcher: reads the app's page from the address hash (#/settings, #/?status=open).
- scroll-to-view.tsScrolls an element into view moving only its own scroll container, never the page around it.
- select-box.tsxA native select dressed to match the app: no browser arrow, a drawn chevron instead.
- session.tsWhether someone is signed in: a first visit is signed in as the demo account; Sign out holds until the next sign-in, and a sign-in without Keep me signed in lasts only this tab.
- sheet.tsxThe phone sheet: a modal panel that springs in from the left with the sidebar; Escape, a tap outside or its close button slides it away.
- spark.tsxA tiny sparkline: a smooth line (Catmull-Rom as cubic Béziers, never a zigzag) with a soft area under it and a dot on today; it rolls to new values in place.
- states.tsxThe data states every page shares: a calm skeleton while loading, an error with Try again, and an empty note with a way out.
- status.tsxThe status glyphs and pills: a ring for In stock, a filled dot for Assigned, a half ring for In repair, a struck ring for Retired, each with its word, so a status never rests on colour alone. Repairs read Open, At vendor and Done the same way.
- store.tsThe app-wide state several parts share: the theme mode and style (kept in the browser) and the toasts.
- ticker.tsxA number that counts up while its page builds in, and rolls to its new value whenever it changes.
- toasts.tsxThe toasts: short notes that confirm what just happened, at the bottom end.
- use-api.tsLoads data through the fake API with loading, error and retry, remembering each answer so a page you come back to shows at once.
- use-dialog.tsOpens and closes a native <dialog> as a modal; on close it plays its way out first (data-closing), so dialogs, sheets and the palette never vanish in one frame.
- dataThe pretend data and the fake API: swap it for your backend.
- account.tsThe demo account: who is signed in (the account menu shows them) and the email and password the sign-in page takes. Chloe runs Harbor & Finch's three-person IT team (person p291 in data/seed.ts).
- api.tsThe fake API: every page loads and saves through these functions, so wiring a real backend happens here only.
- db.tsThe pretend database every page reads and saves through (data/api.ts calls these): assets with their check outs and repairs, people, software seats and the settings lists, each change logged to the activity feed. Swap it for your backend.
- live.tsThe live demo: the IT desk at work while you watch. Each call is one thing that happens (a laptop handed back, a spare checked out, a seat claimed or freed, a repair sent to its vendor) through the same database the pages read. Wire your backend's events here instead.
- now.tsThe demo's "now": today at 10:40 plus the real time since the app loaded, so today is busy at any hour; every seeded date is set from it. Wire your backend and use the real time.
- seed-assets.tsHarbor & Finch's devices, software seats, open repairs and the morning's activity, built once from data/seed.ts so every number agrees: each person's laptop, phones for sales and support, desk monitors in the offices, spares in the store room and a few retired machines.
- seed.tsThe pretend company behind the demo: Harbor & Finch, 200 people in two offices and at home, the device models the IT team buys, its locations and repair vendors. Assets, licenses and repairs are built from these in data/seed-assets.ts.
- types.tsThe shapes of the IT desk's data: assets and their types, the people who hold them, software licenses, repair tickets and the activity feed.
- views.tsWhat the pages show, worked out from the database in one place, so a number and the list it opens always count by the same rule: KPIs and their sparklines, ready-to-assign spares, renewals, the feed, each page's rows and the reports.
- localesEvery word the app shows, one JSON file a language; list.ts names them.
- en.jsonOne language's words, with the keys of en.json.
- es.jsonOne language's words, with the keys of en.json.
- list.tsThe languages the app offers, in the picker's order: one JSON file each, en.json the source. To remove one, delete its file and its line; to add one, copy es.json, translate it and add a line. English is built in; the rest load only when picked. TypeScript checks each file has en.json's keys, scripts/check/check-locales.mjs the rest (no extra keys, plural forms, {slots}).
assets-pewter.tsx
The page: the sections in order.
Ładowanie…
- Dobry do
- A small IT team tracking every laptop, phone and license seat at a company of a few hundred people.
- Jak to działa
- Spares, holders, seats and repairs on one desk; check-ins and seat changes land live in the feed and the counts roll.
- Jak używać
- Edit words in locales/ and colors in theme.ts, and swap the bodies in data/api.ts for calls to your backend.