Shifts Aster
v1.0A minimal SaaS rota app for a three-café chain: a week grid of shifts you drag between days and people, staff, time off, swaps, timesheets and labor reports, in stone neutrals with one coral accent.
نشانی صفحه: /
داخلی
آنچه میگیرید- روشن و تیرهاز رنگهای تم شما استفاده میکند
- دسکتاپ، تبلت، و گوشیصفحهنمایشهایی که برایشان ساخته شده
- پکیجها…
- حجم کد…
- کممصرف برای باتری30 فریم بر ثانیه، در حالت ساکن متوقف
- در حالت پنهان متوقف میشودخارج از صفحه یا تب دیگر
- کاهش حرکتآرام برای کسانی که بخواهند
با هر تغییر بررسی میشود
بررسی امنیتی 3 دسامبر- بررسی نوعTypeScript strict
- لینت و قالببندیESLint · Prettier
- تست و بیلدتصاویر روشن و تیره
- ممیزی امنیتیبدون هشدار بالا یا بحرانی
- قدمت پکیجهر نسخه حداقل 7 روز عمومی بوده
- پردازنده در حالت بیکارکمتر از نیم هسته در حالت ساکن، حداکثر 30 فریم بر ثانیه
کد
shifts-asterReact
- shifts-aster.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.
- overview.tsxThe overview: a greeting with the day's state, the KPI strip, today's shifts as they happen, labor by day, the live feed, and three panels that end level: what needs you, open shifts and the sites.
- reports.tsxReports (#/reports): labor cost as a share of sales over the last 12 weeks against the target, this week's hours by role and cost by site, who is close to overtime and who clocked in late lately.
- schedule.tsxThe schedule (#/schedule): the week's rota for all sites or one (?site=mill), the open shifts alone (?open=1), and a new shift. Wide screens get the week grid you drag shifts around on; phones get one day at a time (?day=), each shift opening its dialog to move it.
- settings.tsxSettings (#/settings): the cafés (name, opening hours, the week's sales forecast), the roles (name, color, default rate), the labor target and overtime line, the publish notice, and Appearance. Sites and roles edit in place; one still in use can't be removed.
- 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.
- staff.tsxStaff (#/staff): everyone on the rota, filtered by role (?role=barista), site (?site=mill) or a name, with their hours this week, rate and next shift. Tick rows to move them to another site or set them inactive; a name opens the person's sheet; Add person opens the form.
- swaps.tsxSwaps (#/swaps): shifts people offered up, by stage (?stage=offered): an offer waits for a colleague to take it, an accepted one waits on a manager (Approve moves the shift to them), done ones show how they ended. Offer a swap opens the form (?new=swap).
- time-off.tsxTime off (#/time-off): every request filtered by state (?status=pending), each pending one with Approve and Decline, an approved one with Cancel; beside it who is off each day this week and how each site is covered. Request time off opens the form (?new=off).
- timesheets.tsxTimesheets (#/timesheets): who is on the clock now (their time ticking, Clock out), who is due to clock in (Clock in), and the week's hours per person and day against the rota, each row approved on its own or all at once.
- 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).
- bottom-tabs.tsxThe phone's tab bar: the four pages used most, and More for the rest (the sidebar in a sheet). It sticks to the bottom of the screen under the page.
- feed.tsxThe live feed: who did what, newest first, on two lines (the person and what happened, then the site and the shift, muted); a row that arrives (a clock-in, a claimed shift, a request) slides in at the top.
- kpi-strip.tsxThe KPI strip: four numbers in one bordered box, each a link to the list behind it, with its line under it and a sparkline or a progress bar; a changed number rolls to its new value.
- needs-you.tsxWhat waits on a manager: time-off requests and swaps both colleagues agreed, each with its actions as words (Approve, Decline). Used by the overview, Time off and Swaps.
- person-form.tsxA person's profile form: name, email, phone, home site, roles, hourly rate, weekly hours and whether they are on the rota. The sheet's Profile tab edits with it; Add person (?new=person) opens it in a dialog.
- person-sheet.tsxA person in the side sheet (?person=P-104), from any page: their name and week at the top, then tabs (?dtab=) for the profile form, when they can work, their shifts this week and next, and pay with recent clock punches. Remove takes them off the rota after an in-app confirm and opens their shifts.
- request-dialogs.tsxThe two request forms: time off for someone (?new=off: who, what kind, from and to, a note) and a swap offer for a shift (?new=swap: the shift and why). Each lands as pending in its list and the feed.
- shift-dialog.tsxThe shift form in a dialog: a new shift (?new=shift, from New shift, ⌘K or a tap on an empty cell, which fills its day and person) or an edit (?shift=S-4120) with Delete behind an in-app confirm and an Undo. Moving a shift on a phone happens here: pick another day or person.
- sidebar.tsxThe sidebar: the workspace, search with the ⌘K shortcut, the pages in two groups with their counts and a pill that glides to the current one, Settings, and the live strap with its pause.
- 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: the menu button on tablets, where you are, the week stepper (last week, this week, next week's draft), the live dot, search, the theme switch, Publish with the number of changes waiting, and the account menu. It frosts only once the page scrolls under it.
- week-grid.tsxThe week grid: one row per person (grouped by site) plus the open-shifts row on top, one column per day, each shift a block you drag to another day or person (or to Open). While a block moves, the week's hours, labor cost and labor % above the grid, the person's hours and the day totals all follow where it would land, rolling to the new numbers. A tap opens the shift; a tap on an empty cell starts a new one there.
- partsWhat several sections share.
- buildWhat several sections share.
- cardsWhat several sections share.
- unfold.tsThe unfold card style: cards unfold downward from their top edge, their contents fading in.
- rowsWhat several sections share.
- unfold.tsThe unfold row motion: each row on screen opens down from its top edge, from faint.
- 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 backdrop behind the app: Aster is Solid, so it stays faded out on the still ground; with followBackground it paints your background instead.
- bar-chart.tsxA bar chart: bars grow in one after another, 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. The plot fills the height its panel gives it, so panels side by side end level.
- command-palette.tsxThe command palette (⌘K or Ctrl K): type to find a page or an action, then Enter.
- 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.
- drag-grid.tsDrag shifts between the cells of the week grid (a person × a day, or the open row): mouse and pen at once, touch after a short press (a swipe still scrolls), the lifted copy kept under the grab point and following 1:1, its slot moving cell to cell as it goes, the copy gliding into the slot on drop, the page and the grid scrolling near their edges, Escape to cancel, and a keyboard path (Space lifts, arrows move a day or a person, Space drops).
- 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 or filters: 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, so a page scroll never reads as a move.
- format.tsHow numbers, times and dates are written: by Intl, the current language's way ("1,240", "1.240"; "Nov 19", "19 nov."; "6:30 AM", "6:30"). Add a helper here when a page needs a new kind.
- icons.tsxThe logo and the line icons, drawn on a 24-unit grid with round ends.
- 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 smooth line chart with a soft area under it, in the primary, and a dashed target line: the line draws itself in, the latest point marked, and new values roll the line to its new shape. The plot fills the height its panel gives it.
- 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 someone on the rota does something (data/live.ts) and every page reloads in place; every 15 the relative times 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.
- overlays.tsxEverything that opens over the page from the address: a person in the side sheet (?person=P-104), and the forms (a shift, a new person, a time-off request, a swap offer). Any page can open one by adding its query.
- read.tsOne read of the fake API by its key, through useApi: useRead("overview"), useRead<"deal">(`deal:${id}`). Each key keeps one load function, so a page that mounts again finds its answer.
- rota.tsxWhat the rota pages share: the role colours, a shift's status chip, the page head, the fresh-row marker, and the names every form and list looks up.
- 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.
- side-sheet.tsxThe detail sheet: a modal panel that slides in from the end edge over the page (a person, a shift), with tabs whose underline glides to the one picked. Escape, a tap outside or its close button slides it away; the address keeps what it shows (?person=P-104&dtab=shifts).
- 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.
- 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.
- api.tsThe fake API: every page loads and saves through these functions, so wiring a real backend happens here only.
- calc.tsThe sums every view shares: paid hours, labor cost and labor % (cost as a share of the sales forecast) for a shift, a day, a person or a week.
- db.tsThe pretend database and every change to it: shifts, publishing, staff, time off, swaps, clock punches and settings. Each change that a team would see adds a row to the live feed. data/api.ts calls these after a short wait; swap them for your backend.
- live.tsThe live demo: the café day going on while you watch. Each call is one thing staff do (clock in for a shift that is starting, claim an open shift, clock out at the end, ask for time off) through the same database the pages read. Wire your backend's events here instead.
- now.tsThe demo's "now": today at 11:40 plus the real time since the app loaded, so the café is mid-rush at any hour; every seeded date is set from it. Wire your backend and use the real time.
- seed-people.tsThe pretend café chain: three sites, four roles and 38 hourly staff. Demo data stays in English.
- seed-week.tsThe pretend rota: last week, this week and a draft of next week for the three sites, built from each site's daily shift pattern and who can work; plus clock punches up to now, time off, swaps and today's feed. Demo data stays in English.
- types.tsThe shapes the fake API reads and saves: sites, roles, staff, shifts, time off, swaps, clock punches and the live feed. A real backend returns the same shapes.
- views.tsWhat each page reads, worked out from the pretend database: the overview, the week's rota, staff, time off, swaps, timesheets, reports and settings. data/api.ts serves these by key.
- 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}).
shifts-aster.tsx
The page: the sections in order.
در حال بارگذاری…
- مناسب برای
- Cafés, shops and small chains that plan hourly staff by the week and want labor cost in view as they build the rota.
- چگونه کار میکند
- Drag a shift to another day or person: it glides into the slot and the week's labor cost and percent roll to the new total.
- نحوه استفاده
- Edit words in content.ts and colors in theme.ts, and swap the bodies in data/api.ts for calls to your backend.