Affiliates Marigold
v1.0A minimal SaaS affiliate program for a skincare brand: partners and tiers, links and codes, live conversions, payout batches, applications and reports, in cream and saffron.
عنوان الصفحة: /
مدمج
ما تحصل عليه- فاتح وداكنيستخدم ألوان سمتك
- سطح المكتب والجهاز اللوحي والهاتفالشاشات المصمّم لها
- الحزم…
- حجم الكود…
- خفيف على البطارية30 إطارًا في الثانية، ويهدأ حين يسكن
- يتوقّف حين يُخفىخارج الشاشة أو في تبويب آخر
- تقليل الحركةهادئ لمن يطلب ذلك
يُفحص مع كل تغيير
فُحص أمنيًا في 3 ديسمبر- فحص الأنواعTypeScript strict
- التدقيق والتنسيقESLint · Prettier
- الاختبارات والبناءلقطات شاشة بالوضعين الفاتح والداكن
- تدقيق أمنيلا تحذيرات عالية أو حرجة
- عمر الحزمكل إصدار منشور منذ أكثر من 7 أيام
- المعالج عند السكونأقل من نصف نواة عند السكون، ≤ 30 إطارًا في الثانية
الكود
affiliates-marigoldReact
- affiliates-marigold.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.
- applications.tsxApplications: creators who want to join, in a queue beside the one you are reading (?app=). Approve with a tier and rate (suggested from their audience) or decline; Undo puts them back. The next one opens on its own.
- conversions.tsxConversions: every sale partners brought, newest first and arriving live; approve or reverse one from its row or many at once, open one for its details.
- home.tsxThe overview: a greeting, the KPI strip, the top-partners leaderboard beside the live feed, then clicks over 14 days and what needs review. It keeps the live clock running while it is on screen.
- links.tsxLinks & codes: every tracking link and discount code with its partner, landing page and 30-day clicks, orders, conversion rate and revenue; copy, edit or delete each.
- partners.tsxPartners: every creator and site in the program, by status tab, searchable and filterable by tier, sortable; pick rows to pause, activate or re-tier them at once.
- payouts.tsxPayouts: what is owed now and who is over the threshold, the payout batches (draft, approved, paid) and who is owed most, by payout method.
- reports.tsxReports over 7, 30 or 60 days (?range=): the totals, partner revenue by day, the top ten partners, the links and codes that convert, earnings per click by week and revenue by tier.
- settings.tsxThe settings page: the program's rules, then 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; kept plain, one quiet card.
- 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).
- batch-sheet.tsxOne payout batch in the side sheet (?batch=B-2611): its total, status and a line per partner; a draft is approved or deleted, an approved one marked as paid.
- bottom-tabs.tsxThe phone's tab bar: the four pages used most and More, which opens the full menu. Hidden on wide screens, where the sidebar shows.
- conversion-sheet.tsxOne sale in the side sheet (?conv=#48120): its order, partner, link or code, value and commission; approve it, or reverse it with a reason.
- kpi-strip.tsxThe overview's KPI strip: four cells in one bordered box (partner revenue, clicks today, conversion rate, owed to partners), each with its delta and a 14-day sparkline. The live ones roll like odometers as clicks and sales land.
- leaderboard.tsxThe top-partners leaderboard: today or the last 30 days, each partner's revenue with a share bar. As sales land, rows glide to their new places (FLIP) and a changed total flashes once.
- link-form.tsxThe link or code form in a dialog (?new=link, ?link=L-2004): whose it is, a tracking link or a discount code, its slug or code, where it lands and the shopper's discount; the address it makes shows as you type.
- live-feed.tsxThe live activity feed: clicks and sales as they stream in, each with the partner's avatar, what happened and how long ago; a new event slides in on top. Under it, the next payout run.
- needs-review.tsxWhat waits on you: pending conversions (the newest three, with Approve all) and applications in the queue, each a short list that links on to its page.
- overlays.tsxEverything that opens over a page, each kept in the address so Back closes it and a link can share it: the partner, sale and batch side sheets (?partner=, ?conv=, ?batch=), the partner and link forms (?new=partner, ?edit=, ?new=link, ?link=) and the approve-all confirm (?confirm=approve). The forms and the confirm load their lists only once first opened.
- partner-form.tsxThe partner form in a dialog (?new=partner, ?edit=P-1042): name, contact, channel and handle, tier and rate, status and payout method; checked on save, each error under its field.
- partner-sheet.tsxOne partner in the side sheet (?partner=P-1042): who they are, their 30-day numbers and trend, then tabs for their links, sales and payouts; Edit, Pause or Activate, and Delete with a confirm.
- partner-table.tsxThe partners table: pick rows with their boxes, sort by a column, open a partner in the side sheet. 40px rows, numbers right-aligned and tabular; the status shows as a glyph and a word.
- program-settings.tsxSettings → Program rules: commission by tier, the cookie window, the payout threshold and schedule, when sales approve themselves and whether a new partner's first sale waits for review. Checked on save.
- sidebar.tsxThe sidebar: the brand, search with the command palette shortcut, and the page links in their groups with live counts; a soft pill glides to the page you are on. 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: the menu button on narrow screens, where you are, the live dot with its pause, the theme switch, the page's one main action and the account menu.
- partsWhat several sections share.
- buildWhat several sections share.
- cardsWhat several sections share.
- deal.tsThe deal card style: each card is dealt from the side of the current nav item, a short slide toward its place, one quickly after another.
- rowsWhat several sections share.
- spot.tsThe spot row motion: each row on screen lights up from faint as a soft primary glow passes it.
- 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 on a quiet fill; the face a row's avatar motion pops first.
- backdrop.tsxThe Glass style's backdrop: what shows through the see-through panels, faded out in Solid; with followBackground it paints your background instead.
- bulk-bar.tsxThe bar that rises at the bottom while rows are picked: how many, the actions for them and Clear.
- command-palette.tsxThe command palette (⌘K or Ctrl K): type to find a page or an action, then Enter.
- confirm.tsxA confirm dialog for a step that is hard to undo (delete a partner, approve every pending sale): what happens, Cancel and the action, which waits while it saves.
- 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.
- 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 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.
- glyphs.tsxThe small marks every list shares: a status glyph (ring, half ring, filled, crossed), a tier chip, the live dot, a smooth sparkline and a delta line. State never shows by color alone: each glyph has its own shape and a word for screen readers.
- 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 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 2 seconds shoppers click partner links, every 5 a sale may land, and every few minutes a creator applies (data/live.ts); each event reloads what is on screen in place. 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.
- odometer.tsxA number whose digits roll like an odometer: on first show they roll up from zero, and each new value rolls only the digits that change. At rest it is the plain number, one word; only a roll splits it into digit windows, each holding the old and the new digit, for a short CSS animation.
- page-head.tsxA page's title and one-line intro, with room at the end for its filters.
- read.tsOne read of the fake API by its key, through useApi: useRead("overview"), useRead<"partner">(`partner:${id}`). Each key keeps one load function, so a page that mounts again finds its answer.
- 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 partner, a conversion, a payout batch), 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 (?partner=P-1042&dtab=links).
- 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.
- live.tsThe program at work: shoppers click partner links and buy, and now and then a creator applies. Each event is saved like a real one (a click on its link, a pending sale on Conversions, an application in the queue) and the feed keeps the latest.
- names.tsThe words the pretend program is made from: partners' first and last names, the affiliate sites, and the pitches applicants write (data/seed.ts mixes them).
- reads.tsWhat every load answers, worked out from the pretend data: the totals, leaderboards, lists and reports each page reads by its key (data/api.ts get).
- seed.tsThe pretend program: Sola Skin, a DTC skincare brand, with 350 partners (creators and affiliate sites), their links and codes, 60 days of sales, past payout batches and the applications waiting. Made from a fixed seed, so every visit shows the same program.
- types.tsThe shapes the fake API answers with: partners, their links and codes, the sales they bring (conversions), payout batches, applications and the program's rules.
- 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}).
affiliates-marigold.tsx
The page: the sections in order.
جارٍ التحميل…
- مناسب لـ
- DTC brands running a creator and affiliate program who track partners, codes, sales and monthly payouts in one calm place.
- كيف يعمل
- Clicks and sales stream in with avatars, the top-partners board glides to its new order and the Owed total rolls up like an odometer.
- طريقة الاستخدام
- Edit words in content.ts and colors in theme.ts, and swap the bodies in data/api.ts for calls to your backend.