StealThis .dev

Shop — Discounts / Promo Codes

A back-office discounts manager for a storefront. A table lists each promo code with its type chip (percent, fixed amount or free shipping), value, a live usage progress bar against its limit, schedule window and a derived status of Active, Scheduled, Paused or Expired. Status filter tabs and live search narrow the view. Every row offers an activate toggle, copy-to-clipboard, edit and delete, and a slide-out editor with a code generator, segmented type control, validation and a live preview creates or updates codes in place.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Discounts / Promo Codes

A promo-code console for the fictional Northwind storefront. The main table lists each code with a copyable code chip, a type cell (percentage off, fixed amount or free shipping), the value with its minimum-spend note, a usage progress bar against the redemption limit, the schedule window and a status pill. Status is derived from the schedule and the active toggle, so codes resolve to Active, Scheduled, Paused or Expired automatically. A summary strip totals active codes, redemptions, estimated discount given and average usage rate, and updates as you edit.

Filter tabs across the top — All, Active, Scheduled, Expired and Paused — narrow the table, each carrying a live count, while the search box matches code names as you type. Every row has an activate/deactivate switch, a one-tap copy button, plus edit and delete actions, and all of them update the table and summary in place with a confirming toast.

The New code button and per-row edit open a slide-out drawer with a focus trap. It includes a random code generator, a segmented percent / fixed / free-ship control that reshapes the value field, minimum spend, usage limit, start and end dates, an active-on-save switch and a live preview. Inline validation guards empty or duplicate codes, out-of-range values and end-before-start dates before a record is created or saved. Everything reads from one in-memory model and the layout collapses the sidebar and drawer gracefully down to 360px.

Illustrative storefront UI only — fictional products, prices, and reviews. No real checkout.