Compare commits

...

No commits in common. "main" and "feature/newstart" have entirely different histories.

264 changed files with 8610 additions and 28940 deletions

View File

@ -1,11 +0,0 @@
node_modules
dist
build
.git
.gitignore
Dockerfile
.dockerignore
README.md
.env
.env.*
!.env.example

View File

@ -1,61 +0,0 @@
kind: pipeline
type: docker
name: Validate and deploy frontend
steps:
- name: Validate Nginx configuration
image: nginx:alpine
commands:
- printf 'events {}\nhttp { server { listen 8080; include /drone/src/deploy/nginx-locations.conf; } }\n' > /tmp/manicandles-nginx.conf
- nginx -t -c /tmp/manicandles-nginx.conf
- name: Quality gates
image: node:24-alpine
environment:
# Keep jsdom suites from competing for CPU on the Drone runner.
VITEST_MAX_WORKERS: "1"
commands:
- npm ci
- npm audit --audit-level=high
- npm run check
- apk add --no-cache util-linux
- sh test/deployment.test.sh
- printf '%s\n' '${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA}' > dist/release.txt
- name: Upload frontend release
image: appleboy/drone-scp
settings:
host: server1.midastix.com
username: mihir
key:
from_secret: manicandles_deploy_key
port: 22
source: dist,scripts/deploy-frontend.sh
target: /var/www/manicandles/incoming/${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA}
when:
branch:
- main
event:
- push
- name: Activate and verify frontend
image: appleboy/drone-ssh
settings:
host: server1.midastix.com
username: mihir
key:
from_secret: manicandles_deploy_key
port: 22
command_timeout: 5m
script_stop: true
script:
- sh /var/www/manicandles/incoming/${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA}/scripts/deploy-frontend.sh /var/www/manicandles '${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA}' manicandles.midastix.com
when:
branch:
- main
event:
- push

View File

@ -1 +0,0 @@
VITE_ORGANIZATION_ID=

1
.gitattributes vendored
View File

@ -1 +0,0 @@
*.sh text eol=lf

35
.gitignore vendored
View File

@ -1,15 +1,24 @@
node_modules/ # Logs
dist/ logs
.pnp.*
.yarn/*
!.yarn/patches/
!.yarn/plugins/
!.yarn/releases/
!.yarn/sdks/
!.yarn/versions/
*.log *.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store .DS_Store
.env* *.suo
!.env.example *.ntvs*
*.njsproj
*.sln
*.sw?

8
.oxlintrc.json Normal file
View File

@ -0,0 +1,8 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "oxc"],
"rules": {
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }]
}
}

View File

@ -1,5 +0,0 @@
{
"recommendations": [
"arcanis.vscode-zipfs"
]
}

View File

@ -1,6 +0,0 @@
{
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
}
}

View File

@ -1,5 +0,0 @@
# This file is automatically generated by @yarnpkg/sdks.
# Manual changes might be lost!
integrations:
- vscode

View File

@ -1 +0,0 @@
Read CONSTRAINTS.md before writing code. Do not weaken it to make a change pass.

View File

@ -1,10 +0,0 @@
# Changelog
## Phase 2 — 13 October 2026
- Add private addresses, versioned carts, reviewed/idempotent checkout, own and staff order history/details/cancellation.
- Add permission-gated user/role/audit, product/group/variant, finished-stock/warehouse/ledger/reservation, coupon and pricing tools.
- Add account recovery/reset with fragment-token removal.
- Fix decimal output compatibility, immediate private session cleanup, permission downgrade privacy and stale request/intent races.
- Add lazy routes, build-size gate, lint/component/workflow/accessibility tests, dependency audit in CI and Nginx security headers.
- Production acceptance still requires provisioned UAT accounts, approved pricing/SMTP and verified deployment/rollback.

View File

@ -1,17 +0,0 @@
# Production quality constraints
Reviewed 12 October 2026. User accepted strict types, workflow tests, security, keyboard/responsive and deployment/rollback checks; no UAT account is provisioned yet.
| Gate | Required result | Evidence |
| ------------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| Types | Zero errors, strict mode retained | npm run typecheck |
| Lint | Zero errors on source/tests | npm run lint |
| Tests | All contract/workflow/component tests pass; no skipped tests | npm test |
| Dependency security | Zero high/critical findings | npm audit --audit-level=high |
| Build | Successful; no oversized chunk warnings; each JS chunk below 500 kB | npm run build |
| Accessibility | Keyboard flows, labels/errors, contrast; zero serious/critical axe findings on tested routes | component accessibility tests and browser checklist |
| Responsive | No horizontal overflow at 320, 768, 1024, 1440 px | Browser UAT evidence |
| Deployment | Nginx validates; container/deep links/API verified; HTTPS ingress | container smoke checks + deployed UAT |
| Release | No unresolved critical/high defects; permissions/privacy/conflicts exercised; rollback verified | docs/RELEASE-CHECKLIST.md |
No new type/lint suppressions, unimplemented stubs, disabled tests or secrets. Do not weaken these gates to make changes pass. Pending environment checks stay pending and block a production-ready claim. Backend business rules, tax/shipping policy approval, SMTP, account provisioning and deployment access remain explicit external gates.

View File

@ -1,23 +0,0 @@
FROM node:24-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run check
FROM nginx:alpine
RUN apk add --no-cache ca-certificates
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
RUN nginx -t
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,38 +1,32 @@
# Mani Candles frontend # React + TypeScript + Vite
The existing ManiCandles site upgraded against the deployed Nest API. Its purple/gold design, branding, and marketing pages are retained. Phase 2 adds customer commerce, permission-gated administration, account recovery and enforced release checks. This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
## Development Currently, two official plugins are available:
Use Node 24 and npm 11. The canonical lockfile is package-lock.json, matching the Docker npm workflow; the outdated Yarn lock/config were removed. - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
```sh ## React Compiler
npm ci
npm run dev The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
npm run typecheck
npm test ## Expanding the Oxlint configuration
npm run build
If you are developing a production application, we recommend enabling type-aware lint rules by installing `oxlint-tsgolint` and editing `.oxlintrc.json`:
```json
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "oxc"],
"options": {
"typeAware": true
},
"rules": {
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }]
}
}
``` ```
Open the printed local URL. Set your organization UUID on `/connection`, or set VITE_ORGANIZATION_ID in `.env.local`. Only the UUID is persisted; passwords and session tokens remain in memory. Existing approved staff sign in at `/workspace`. Navigation preserves the session; reloads discard it. Logout revokes the backend session. See the [Oxlint rules documentation](https://oxc.rs/docs/guide/usage/linter/rules) for the full list of rules and categories.
## Deployment
Development proxies `/api` to `https://manicandles-backend.midastix.com`. Docker Nginx provides the same HTTPS upstream with certificate verification, Authorization forwarding, and SPA deep-link fallback. HTTPS must terminate at the deployment ingress. `vite preview` is static preview only and does not provide the development API proxy.
```sh
docker build -t manicandles-frontend:uat .
docker run --rm -p 8080:80 manicandles-frontend:uat
```
After the one-time [server setup](docs/STATIC-DEPLOYMENT.md), main-branch Drone pushes upload the checked static build over SSH and activate it through the existing Nginx HTTPS site. Readiness failure restores the previous release. Drone requires the `manicandles_deploy_key` secret. Feature branches run validation without uploading or activating a release.
Storefront list returns id/name/slug and the main photo; details return prices/attributes/groups and all photos. Staff upload up to 8 JPEG/PNG/WebP photos per product (2 MiB each) under Admin catalog; products without photos show a branded placeholder. Existing marketing imagery remains intact.
Addresses, cart/checkout, orders, catalog, access, stock, coupons and pricing tools are available after sign-in. Customers can create their own account at `/workspace` (requires the backend `/auth/register` endpoint). There is no contact-message endpoint; simulated success was replaced with an availability notice. Newsletter signup awaits consent/messaging flows.
See [delivery phases](docs/PHASES.md) and [UAT evidence](docs/UAT-RESULTS.md).
Phase 2 commands: `npm run check` runs lint, strict types, contract/component/workflow tests and the measured production build. Dependency security is checked with `npm audit --audit-level=high` in CI. See [Phase 2 evidence](docs/UAT-PHASE2.md) and [release checklist](docs/RELEASE-CHECKLIST.md).
Set the backend RECOVERY_URL to your HTTPS frontend /reset-password route. Pending checkout and stock commands survive navigation within an active session; reload discards local credentials and intents. If interrupted, check orders/ledger before starting a new command.

View File

@ -1,20 +0,0 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "",
"css": "src/index.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
}
}

View File

@ -1,48 +0,0 @@
# Include inside the existing HTTPS server block for manicandles.midastix.com.
# This supplies the root and locations. Keep the existing TLS directives.
root /var/www/manicandles/current;
index index.html;
add_header X-Content-Type-Options nosniff always;
add_header Referrer-Policy strict-origin-when-cross-origin always;
add_header X-Frame-Options DENY always;
add_header Cache-Control "no-cache" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https://www.transparenttextures.com; connect-src 'self'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
location /api/ {
proxy_pass https://manicandles-backend.midastix.com;
proxy_ssl_server_name on;
proxy_ssl_verify on;
proxy_ssl_verify_depth 3;
proxy_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
proxy_set_header Host manicandles-backend.midastix.com;
proxy_set_header Authorization $http_authorization;
# The backend rate-limits per client IP; it trusts this hop via TRUST_PROXY.
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 10s;
proxy_read_timeout 20s;
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Credentials;
location ~ "^/api/v1/(?:(?:supplier-documents|b2b/artworks)/[0-9a-fA-F-]{36}/versions|products/[0-9a-fA-F-]{36}/images)$" {
client_max_body_size 3m;
proxy_pass https://manicandles-backend.midastix.com;
}
}
location = /release.txt {
try_files $uri =404;
}
location /assets/ {
try_files $uri @previous_assets;
}
# Existing browser tabs may still request the preceding release's chunks.
location @previous_assets {
root /var/www/manicandles/previous;
try_files $uri =404;
}
location / {
try_files $uri $uri/ /index.html;
}

View File

@ -1,67 +0,0 @@
# Frontend phases
Canonical implementation: this checkout from ssh://git@git.midastix.com:2212/internal/ManiCandles.git. The standalone frontend created earlier is superseded for ongoing development.
| Phase | Scope | Acceptance gate |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| 1 — Existing-site foundation | Preserve branding, connect home/catalog/search/pagination/variants, staff login/me/logout/expiry, organization setup, health checks, API proxy and SPA routing | Real published records and approved account; loading/empty/failure states; keyboard and responsive verification |
| 2 — Commerce and administration | Users/roles/audit, products/groups/variants/stock, addresses/cart/coupons/checkout/orders, recovery | Permission failures, conflicts, exact totals and expiry; no simulated live payment |
| 3 — Procurement and production | Suppliers/materials, POs/receipts/QC, invoices/payments/documents, BOMs/batches/usage/packaging/costing, warehouse stock | Supplier-to-finished-goods journey; independent review; partials/idempotency; stock invariants |
| 4 — B2B | Verification, price lists/MOQ, quotes/credit/samples/artwork, partner orders/payments, custom requests/reports | Independent approvals, expiry, reversals and currency/account boundaries |
| 5 — Growth and reporting | Wishlist/reviews, campaigns/discounts, recovery/consent, blog/segments/forum, analytics/forecast/accounting | Publication/moderation, consent, private data and report verification |
| 6 — Complete UAT and release | Dedicated deployment, disposable fixtures, role matrix, end-to-end scripts, accessibility/security review, defect retests and release/rollback runbook | Critical journeys pass; no critical/high defects; owner acceptance |
## Phase 1 setup
No UAT organization/account has been provisioned in this session. On the deployed backend host with its intended UAT database, securely set ORGANIZATION_NAME, OWNER_NAME, OWNER_EMAIL and OWNER_PASSWORD (15–128 characters); run `pnpm bootstrap:owner`; record organizationId; remove bootstrap secrets. This is a one-time operation. If an owner already exists, retrieve that organization and provision approved staff instead. Never put database credentials or owner secrets in frontend environment files.
Enter the UUID at `/connection`, then credentials at `/workspace`. Published products and active variants are required for catalog checks. Phase 2 enables admin fixture setup. Live authenticated acceptance remains pending until provisioning.
## Contract and quality
Reference: deployed `/api/docs-json` and backend source API guides. Storefront lists are arrays; detail includes decimal price strings, currency, attributes and nested groups. Zod validates returned shapes. Errors preserve code/requestId. React escapes API content; request timeout is 15 seconds. Session tokens/passwords are not persisted. UUID is configuration, not an authorization boundary; backend permissions remain authoritative.
Use existing MUI theme and React Query. Query keys include organization. Search is bounded to 100 characters; catalog pages contain 12 records and respect the API offset cap. No product-image mapping is invented. Nginx forwards `/api/` to the known HTTPS upstream, verifies TLS and handles SPA deep links. No public owner/account creation is exposed.
## Phase 2 implementation status — 12 October 2026
Customer and administration screens are implemented, with recovery, pricing, stock lifecycle and quality gates. See UAT-PHASE2.md and RELEASE-CHECKLIST.md. Authenticated UAT, container/ingress verification and production sign-off remain pending.
## Phase 3 implementation status
- Supplier and material directories support listing, creation and editing. Supplier material terms include SKU, lead time, minimum order quantity and unit price.
- Staff can create a purchase order draft from supplier terms, review the backend price snapshots, then issue or cancel the draft.
- Issued orders support partial goods receipts and final quality inspections, with exact accepted and rejected quantities and rejection reasons.
- Inspected receipts support idempotent posting to a warehouse. Staff can review material balances and movement ledgers.
- Issued orders support supplier invoices, payment records, reversals and voids. The backend enforces accepted quantities, outstanding balances and correction rules.
- Private supplier PDFs support version uploads, independent review decisions, and authenticated downloads.
- Production and packaging BOMs support separate revision histories, draft creation, material snapshots and confirmed activation.
- Production batches support draft planning, start, completion, cancellation, and exact planned material quantities. Staff can log consumption and waste and reconcile the results against the plan.
- Completed batches support packaging runs, production and packaging material debits, and receipt of good finished pieces into warehouse stock.
- Costing supports immutable material rate revisions, current-rate BOM estimates, and completed-batch cost snapshots with exact totals and saved rate revisions.
- Material warehouse transfers post matched debits and credits. Authorized adjusters can record signed corrections with reasons, including positive corrections for materials with no balance at the selected warehouse.
- Live acceptance requires an organization and procurement test users. Exercise read-only and manage roles, inactive suppliers and materials, mixed currencies, below-minimum quantities, price snapshots and purchase order state conflicts.
- Supplier document UAT requires an uploader, an independent reviewer, and a read-only account. Through the deployed ingress, upload a valid PDF near the 2 MiB limit, verify that the uploader cannot decide on it, and check that a reader can download it only after approval.
- BOM UAT should activate a second revision and confirm the previous revision becomes superseded. Repeat for the other BOM type and verify its active revision is independent. Check that inactive materials and stale drafts are rejected.
- Costing UAT should revise a material rate and verify that future BOM estimates use the new revision while an existing batch snapshot retains its original amounts and rates. Test missing rates, missing usage, and fully rejected output.
- Warehouse movement UAT should verify both ledgers and unchanged combined stock after a transfer, rejection of insufficient stock, and one ledger entry for a retried adjustment.
## Phase 4 implementation status
- Staff can create, edit, submit and review B2B business accounts. Verification uses submitted profile snapshots, separate permissions for submission and review, and an immutable event history.
- B2B UAT should use distinct submitting and reviewing accounts. Verify self-review is blocked, rejection allows correction and resubmission, and a verified profile is read-only.
- B2B price lists support draft variant prices and minimum quantities, activation, archiving, and active-list merchandise previews.
- Price-list UAT should verify that unverified accounts and competing active lists cannot activate a draft, archived terms stay read-only, and price checks reject quantities below the variant minimum.
- Staff can issue B2B quotations from account-specific price lists, review saved profile and pricing snapshots, and record acceptance, decline, or withdrawal before expiry.
- Quotation UAT should verify minimum quantities, expiry, immutable snapshots after archiving a price list, and exact retries for issuance and responses.
- B2B credit policies support immutable proposals, independent approval or rejection, and suspension with decision history.
- Credit policy UAT should verify that unverified accounts and self-review are rejected, a second active policy in the same currency cannot be approved, and suspension permits a replacement.
- B2B samples support requests for published variants, independent approval or rejection, and manual dispatch records with staff and reference history.
- Sample UAT should verify ineligible accounts and variants, self-review, dispatch only after approval, and replay with the original payload and key.
- B2B artwork supports private PDF, PNG, and JPEG version uploads, independent review, and permission-based downloads.
- Artwork UAT should use separate uploader, reviewer, and reader accounts. Exercise the 2 MiB upload limit through ingress, approval and rejection, download permissions, and preservation of prior approved versions.
- Partner orders support conversion from accepted, unexpired quotations, immutable merchandise snapshots, and reasoned cancellation.
- Partner order UAT should verify expired quotes, duplicate references and quote conversion, exact retries, and cancellation blocked by an active payment receipt.
- Partner payments support manual external receipts, exact paid and outstanding merchandise balances, receipt details, and confirmed reasoned reversals. Read and manage permissions are separate, and payment readers can open an order's payment history without order-read permission.
- Partner payment UAT should exercise partial and full receipts, duplicate references, overpayments, cancelled orders, exact retries for recording and reversal, restored balances, and cancellation after reversing all active receipts. References normalize to uppercase and remain reserved after reversal.
- Custom requests and reporting remain open.

View File

@ -1,41 +0,0 @@
# Phase 2 release checklist
Production release is blocked until the environment checks below pass. Local implementation verification does not replace authenticated UAT or deployment acceptance.
## Code gates
- [x] Purpose-built customer and administration routes, with session/permission guards.
- [x] Exact decimal display, strict write inputs, validated response shapes.
- [x] Private caches and requests cleared on logout, expiry, organization change and permission downgrade.
- [x] Stale responses cannot invalidate a newer session or remove its pending command.
- [x] Cart writes serialize locally; stale versions require review.
- [x] Checkout confirmation uses the reviewed version; unknown results retain the same payload/key across navigation.
- [x] Adjustment/reservation intents stay in session memory for exact retries; session termination discards them.
- [x] Order charges use authoritative server totals; null means unfinalized, not zero; payment collection stays unavailable.
- [x] Recovery tokens captured once in memory and removed from browser history; never persisted or logged.
- [x] Destructive lifecycle actions have confirmation; system/owner/self restrictions remain enforced by the backend.
- [x] Strict TypeScript, lint without warnings, all tests passing, build below the 500 kB per-chunk budget.
- [x] Dependency audit has no reported vulnerabilities.
- [x] CI runs dependency audit and npm run check on pushes/PRs; Docker validates Nginx syntax during build.
- [x] No new type/lint suppressions, skipped tests, debug logging or source credentials.
## Environment and acceptance gates — pending
- [ ] Provision the installation owner on the intended UAT backend host/database; record organizationId. Never run local bootstrap against an unknown database.
- [ ] Provision least-privilege UAT staff and customer accounts, including denied/suspended accounts and independent reviewer roles.
- [ ] Exercise actual catalog/group/variant creation and publication, warehouse opening stock, private address/cart, coupon and checkout/order journeys against the deployed backend.
- [ ] Verify cross-account privacy, revoked sessions, changed permissions, concurrent carts, stock contention, duplicate retries and order expiry in live UAT.
- [ ] Configure approved pricing policies and SMTP; verify recovery delivery and one-time token expiry/reset.
- [ ] Build/run the container and test /workspace, /cart, /admin/catalog deep links; inspect CSP, certificate verification and /api health responses.
- [ ] Verify HTTPS ingress, HSTS, trusted proxy/rate-limit policy and deployment secrets. Nginx forwards /api over verified HTTPS; frontend does not change backend trust-proxy policy.
- [ ] Test complete populated screens in browsers at 320/768/1024/1440 widths; full keyboard/dialog/screen-reader/contrast checks and deployed axe/Lighthouse runs.
- [ ] Verify production Core Web Vitals, expected traffic, infrastructure logs/alerts and privacy-safe client error collection. APPLICATION_RENDER_FAILED is the safe local render diagnostic; API requestId correlates service errors.
- [ ] Confirm remote CI passes, observe deployment health/error/latency metrics, rehearse rollback, and obtain owner sign-off.
## Rollback
Record the active and previous build/commit release IDs before rollout. The SSH deployment restores the previous release automatically when its HTTPS checks fail. Follow the [static deployment runbook](STATIC-DEPLOYMENT.md) for manual rollback, then verify health, SPA deep links and /api connectivity. Retain orders, stock ledgers and accounts. Confirm the actual host procedure and measured rollback time in UAT before production. A feature-branch push does not deploy the main-branch pipeline.
## Operational limits
Pending intents exist only within the active browser session; reloading signs out and discards them. After interruption, inspect orders or the stock ledger before beginning a new intent. The backend currently has no live gateway/carrier or contact delivery; customer self-registration is available. Staff catalog/role writes follow the backend's existing concurrency policy; coordinate overlapping administration edits. Never reinterpret finalized merchandise as proof of payment or fulfillment.

View File

@ -1,7 +0,0 @@
# Phase 2 — commerce and administration
Preserve the existing brand/theme; add purpose-built MUI customer and administration screens. Modules: session boundary → addresses/cart/orders; session/permissions → users/roles/audit, catalog, stock, coupons/pricing; recovery is public and clears fragment secrets from history. Backend remains authoritative. Production payment collection and public registration are unavailable.
Build in slices: (1) schemas/exact decimal and session privacy; (2) addresses/cart/idempotent checkout/order lifecycle; (3) user/role/audit and catalog/variant/group management; (4) inventory, coupons/pricing and recovery; (5) lint/tests/accessibility/security, chunk budgets, CI/container/release runbook.
Acceptance: valid decimal output including integers; two-decimal write inputs; cache cancellation/removal and request generation isolation on logout/expiry/revocation; serialized cart writes with conflict refetch; checkout timeout retries retain identical intent/key; nullable charges remain unfinalized; permission-gated UI plus backend checks; independent account/role safeguards; no fake successes; all CONSTRAINTS.md gates have recorded outcomes. Existing accounts are provisioned by backend CLI/staff APIs; live UAT cannot pass until account setup.

View File

@ -1,90 +0,0 @@
# SSH deployment to server1
Drone validates the application and Nginx snippet, uploads `dist` and the release
script, and activates the release through SSH. The sole deployment secret is
`manicandles_deploy_key`. SSH uses `mihir@server1.midastix.com:22`.
## One-time server setup
Server inspection on 19 November 2026 found an HTTP-only site at
`/etc/nginx/sites-enabled/ManiCandles.midastix.com.conf`, with its old root at
`/var/www/ManiCandles.midastix.com`. Certbot is installed. The setup script is
specific to that configuration and refuses to overwrite a site with TLS settings.
Obtain this branch's files on server1 using your existing repository access.
From the repository directory, run the following as `mihir`.
```sh
sudo sh scripts/setup-static-host.sh
sudo certbot --nginx -d manicandles.midastix.com --redirect
sudo nginx -t
curl --fail --show-error https://manicandles.midastix.com/
```
Alternatively, copy `scripts/setup-static-host.sh` and
`deploy/nginx-locations.conf` together to `/tmp/` on server1, and run
`sudo sh /tmp/setup-static-host.sh`, followed by the Certbot and verification
commands above. The snippet must be beside the setup script for this layout.
Setup backs up the original site under `/var/backups`, prepares writable release
directories, installs the snippet, validates Nginx, and reloads it. Validation or
reload failure restores the saved site file. If the old root contains an index,
setup retains it as the initial `current` release and a rollback target. If no
old index exists, the frontend awaits its first deployment. DNS must point to
server1 and public port 80 must be reachable for certificate issuance. Complete
Certbot's email and agreement prompts yourself. Verify HTTPS before merging.
Save the complete matching private key in Drone's `manicandles_deploy_key`
secret. Its public key must be authorized for `mihir` on server1. Keep the
private key outside the repository and logs.
## Release and acceptance
After server setup, merge the change into main. Main-branch push builds perform
an SSH access check before the quality gates. Feature branches validate the
configuration, test rollback, and build the frontend without publishing a release.
Uploads first enter `incoming/BUILD-COMMIT`. A completed build moves to
`releases/BUILD-COMMIT/dist` under the deployment lock. Retried uploads cannot
overwrite a published release. A file lock
serializes activation. An older build cannot replace a newer active build.
The `current` symlink changes atomically. HTTPS checks use the real hostname
resolved to loopback and verify the certificate, release marker, homepage,
`/workspace`, `/cart`, and `/api/v1/health/ready`. Readiness must return the backend's
`{"status":"ok"}` response. An HTML fallback fails verification. Failure restores the previous
current symlink, or removes the first activation if no release existed before it.
The last successful release is also retained at `previous`. Its assets can serve
requests from browser tabs opened before the update. Failed first deployments
leave the site awaiting a successful release.
After the main build succeeds, test externally from a trusted terminal.
```sh
curl --fail --show-error https://manicandles.midastix.com/release.txt
curl --fail --show-error https://manicandles.midastix.com/api/v1/health/ready
```
Then exercise authenticated UAT journeys. The frontend release does not provision
an organization or user accounts.
## Manual rollback
As `mihir` on server1, restore the preceding successful release under the same
lock used by CI. Verify the marker and API after switching. Coordinate this with
active pipelines because a later successful deployment can activate a new release.
```sh
(
set -eu
cd /var/www/manicandles
flock -x 9
test -s previous/index.html
ln -s "$(readlink previous)" .rollback-current
mv -Tf .rollback-current current
) 9>/var/www/manicandles/.deploy.lock
curl --fail --show-error https://manicandles.midastix.com/release.txt
curl --fail --show-error https://manicandles.midastix.com/api/v1/health/ready
```
Retain release directories until rollback has been verified. Disk retention is
manual in this initial deployment flow.

View File

@ -1,19 +0,0 @@
# Phase 2 implementation verification — 13 October 2026
Final local gate: 30 tests passed, strict TypeScript and lint passed, production build passed with all 27 JavaScript chunks below 500 kB (largest approximately 494 kB). The dependency audit reported zero vulnerabilities.
| Area | Evidence / outcome |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Contract | Deployed Swagger exposes cart, checkout, addresses, users, roles, admin orders, pricing and coupon routes; backend stores/schemas determine response and mutation contracts. |
| Automated tests | Contract tests cover exact decimal strings, persisted metadata, strict inputs, coupon limits/windows, recovery fragment cleanup and error diagnostics. Component/workflow tests cover session privacy, expiry, permission downgrade, stale responses, navigation-safe checkout retry, changed-cart review and nullable order charges. |
| Accessibility | Axe on the permission-denied workspace reports no serious/critical findings. JSDOM color-contrast execution is unavailable; color contrast and populated-route browser axe remain a deployed acceptance gate. |
| Browser routes | Addresses/orders/access/roles/catalog/inventory/coupons/pricing/audit all show the sign-in gate with no private input forms when unauthenticated. No captured errors on those route checks. |
| Responsive | Cart shell checked at 320, 768, 1024, 1440; document width did not exceed viewport. Populated authenticated screens still require live UAT. |
| Recovery | Invalid organization input showed a field-associated local validation error; no recovery email was sent. |
| Build/performance | Routes load lazily; JavaScript chunks are measured by scripts/check-build.mjs and must remain below 500,000 bytes. No oversized-chunk warnings are accepted. |
| Dependency audit | No reported vulnerabilities with the finalized npm lockfile. |
| Independent review | Three bounded adversarial cycles. Decimal handling, session cleanup/revocation, intent persistence, reviewed-version concurrency, permissions cache erasure and cancellation/session races were reconciled and guarded by tests. User chose independent review plus tests without external cross-model execution. |
| Deployment | Nginx CSP/frame/referrer/type headers and verified HTTPS API proxy added; CI quality gates and image-build nginx -t added. No local Docker runtime was available; container/ingress execution and remote CI remain unverified. |
| Live authenticated UAT | Pending: user confirmed no organization/account setup. No account was created, data seeded, mail sent, payment collected or deployment performed. |
See RELEASE-CHECKLIST.md for production acceptance gates. Previous Phase 1 results remain historical in UAT-RESULTS.md.

View File

@ -1,21 +0,0 @@
# Existing-site Phase 1 verification — 11 October 2026
| Check | Result | Evidence |
| --- | --- | --- |
| API contract/client | Passed | 8 automated tests for organization validation, query encoding/list shape, decimal variants, login/me, 204/logout/errors, network/cancel, malformed responses/diagnostics |
| TypeScript | Passed | npm run typecheck |
| Production compilation | Passed | npm run build; retained MUI/Framer Motion bundle triggers Vite's 500 kB advisory |
| Dependency audit | Passed | 0 vulnerabilities after patched Vite and unused typography plugin removal |
| Browser service checks | Passed | Service liveness and database readiness both showed Passed through /api proxy |
| Malformed organization | Passed | Invalid UUID produced a local validation error |
| Unconfigured catalog/staff | Passed | Setup guidance visible; staff sign-in disabled without UUID |
| Mobile navigation | Passed | Expanded menu exposes Workspace/Connection; navigation closes menu |
| Keyboard skip link | Passed | Enter moved document focus to main-content |
| Catalog responsive shell | Passed | Tested 320, 768, 1024, 1440 widths; document width did not exceed viewport |
| Browser console | Passed for observed setup/health flow | No captured error messages |
| Published catalog/search/pagination/detail with live fixtures | Pending | Requires provisioned organization and published products |
| Login/me/logout/expiry across navigation with a real account | Pending | Requires approved account |
| Nginx container/ingress/deep-link deployment | Pending | Docker runtime unavailable locally; config/source reviewed only |
| Full-platform acceptance | Pending | Remaining frontend phases and UAT fixture/role matrix required |
No account was created, no production data was seeded, and no deployment was performed. The existing Drone pipeline deploys main on push, so the upgrade remains on a feature branch. API fixture tests validate client behavior and do not prove authenticated live acceptance.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

View File

@ -1,23 +0,0 @@
import tseslint from "typescript-eslint";
import reactHooks from "eslint-plugin-react-hooks";
export default tseslint.config(
{ ignores: ["dist/**", "node_modules/**", ".yarn/**"] },
...tseslint.configs.recommended,
{
files: ["**/*.ts", "**/*.tsx"],
plugins: { "react-hooks": reactHooks },
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
},
},
);

View File

@ -1,21 +1,15 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1" />
<title>Mani Candles Co.</title>
<meta name="description" content="Handmade luxury candles from Mani Candles Co., poured in small batches." />
<meta name="robots" content="index, follow" />
<meta property="og:title" content="Mani Candles Co." />
<meta property="og:description" content="Handmade luxury candles from Mani Candles Co., poured in small batches." />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Mani Candles Co." />
<meta name="twitter:description" content="Handmade luxury candles from Mani Candles Co., poured in small batches." />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Mani Candles - Premium hand-poured soy and coconut candles crafted in India. Explore luxury scents, custom candle customizers, B2B wholesale, and wedding gifts." />
<!-- Google Fonts: Inter and Cormorant Garamond -->
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Great+Vibes&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<title>Mani Candles | Luxury Handmade Soy Candles India</title>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>

View File

@ -1,35 +0,0 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
add_header X-Content-Type-Options nosniff always;
add_header Referrer-Policy strict-origin-when-cross-origin always;
add_header X-Frame-Options DENY always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https://www.transparenttextures.com; connect-src 'self'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
location /api/ {
proxy_pass https://manicandles-backend.midastix.com;
proxy_ssl_server_name on;
proxy_ssl_verify on;
proxy_ssl_verify_depth 3;
proxy_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
proxy_set_header Host manicandles-backend.midastix.com;
proxy_set_header Authorization $http_authorization;
# The backend rate-limits per client IP; it trusts this hop via TRUST_PROXY.
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 10s;
proxy_read_timeout 20s;
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Credentials;
location ~ "^/api/v1/(?:(?:supplier-documents|b2b/artworks)/[0-9a-fA-F-]{36}/versions|products/[0-9a-fA-F-]{36}/images)$" {
client_max_body_size 3m;
proxy_pass https://manicandles-backend.midastix.com;
}
}
location / {
try_files $uri $uri/ /index.html;
}
}

7680
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,93 +1,37 @@
{ {
"name": "mani-candles", "name": "frontend",
"version": "0.0.0",
"private": true, "private": true,
"version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --config vite.config.ts", "dev": "vite",
"build": "vite build --config vite.config.ts && node scripts/check-build.mjs", "build": "tsc -b && vite build",
"serve": "vite preview --config vite.config.ts", "lint": "oxlint",
"typecheck": "tsc -p tsconfig.json --noEmit", "preview": "vite preview"
"test": "node --test test/*.test.ts && vitest run --config vitest.config.ts",
"lint": "eslint src test --max-warnings=0",
"check": "npm run lint && npm run typecheck && npm test && npm run build"
}, },
"engines": { "dependencies": {
"node": ">=24 <25" "@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@mui/icons-material": "^9.2.0",
"@mui/material": "^9.2.0",
"@tanstack/react-query": "^5.101.2",
"axios": "^1.18.1",
"framer-motion": "^12.42.2",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"react-helmet-async": "^3.0.0",
"react-hook-form": "^7.81.0",
"react-icons": "^5.7.0",
"react-router-dom": "^7.18.1",
"swiper": "^14.0.1"
}, },
"packageManager": "npm@11.17.0",
"devDependencies": { "devDependencies": {
"@emotion/react": "^11.11.4", "@types/node": "^24.13.2",
"@emotion/styled": "^11.11.5", "@types/react": "^19.2.17",
"@eslint/js": "^10.0.1", "@types/react-dom": "^19.2.3",
"@hookform/resolvers": "^3.10.0", "@vitejs/plugin-react": "^6.0.3",
"@mui/icons-material": "^5.15.15", "oxlint": "^1.71.0",
"@mui/material": "^5.15.15", "typescript": "~6.0.2",
"@radix-ui/react-accordion": "^1.2.4", "vite": "^8.1.1"
"@radix-ui/react-alert-dialog": "^1.1.7",
"@radix-ui/react-aspect-ratio": "^1.1.3",
"@radix-ui/react-avatar": "^1.1.4",
"@radix-ui/react-checkbox": "^1.1.5",
"@radix-ui/react-collapsible": "^1.1.4",
"@radix-ui/react-context-menu": "^2.2.7",
"@radix-ui/react-dialog": "^1.1.7",
"@radix-ui/react-dropdown-menu": "^2.1.7",
"@radix-ui/react-hover-card": "^1.1.7",
"@radix-ui/react-label": "^2.1.3",
"@radix-ui/react-menubar": "^1.1.7",
"@radix-ui/react-navigation-menu": "^1.2.6",
"@radix-ui/react-popover": "^1.1.7",
"@radix-ui/react-progress": "^1.1.3",
"@radix-ui/react-radio-group": "^1.2.4",
"@radix-ui/react-scroll-area": "^1.2.4",
"@radix-ui/react-select": "^2.1.7",
"@radix-ui/react-separator": "^1.1.3",
"@radix-ui/react-slider": "^1.2.4",
"@radix-ui/react-slot": "^1.2.0",
"@radix-ui/react-switch": "^1.1.4",
"@radix-ui/react-tabs": "^1.1.4",
"@radix-ui/react-toast": "^1.2.7",
"@radix-ui/react-toggle": "^1.1.3",
"@radix-ui/react-toggle-group": "^1.1.3",
"@radix-ui/react-tooltip": "^1.2.0",
"@tailwindcss/vite": "^4.1.6",
"@tanstack/react-query": "^5.56.2",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.7",
"@types/node": "^22.5.5",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.7.0",
"axe-core": "^4.14.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"date-fns": "^3.6.0",
"embla-carousel-react": "^8.6.0",
"eslint": "^10.12.0",
"eslint-plugin-react-hooks": "^7.1.1",
"framer-motion": "^11.9.0",
"input-otp": "^1.4.2",
"jsdom": "^30.1.2",
"lucide-react": "^0.469.0",
"next-themes": "^0.4.6",
"react": "^18.3.1",
"react-day-picker": "^9.11.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.55.0",
"react-icons": "^5.4.0",
"react-resizable-panels": "^2.1.7",
"recharts": "^2.15.2",
"sonner": "^2.0.7",
"tailwind-merge": "^2.5.2",
"tailwindcss": "^4.1.6",
"tw-animate-css": "^1.4.0",
"typescript": "^6.0.3",
"typescript-eslint": "^8.71.1",
"vaul": "^1.1.2",
"vite": "^6.4.4",
"vitest": "^5.0.3",
"wouter": "^3.3.5",
"zod": "^4.6.7"
} }
} }

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 9.3 KiB

24
public/icons.svg Normal file
View File

@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg">
<symbol id="bluesky-icon" viewBox="0 0 16 17">
<g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
<defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
</symbol>
<symbol id="discord-icon" viewBox="0 0 20 19">
<path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
</symbol>
<symbol id="documentation-icon" viewBox="0 0 21 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
</symbol>
<symbol id="github-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
</symbol>
<symbol id="social-icon" viewBox="0 0 20 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
</symbol>
<symbol id="x-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
public/logo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

View File

@ -1,2 +0,0 @@
User-agent: *
Allow: /

View File

@ -1,17 +0,0 @@
import { readdir, stat } from "node:fs/promises";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import assert from "node:assert/strict";
const assets = new URL("../dist/assets/", import.meta.url);
const files = (await readdir(assets)).filter((file) => file.endsWith(".js"));
assert(files.length > 0, "No built JavaScript assets were found.");
for (const file of files) {
const size = (await stat(join(fileURLToPath(assets), file))).size;
assert(
size < 500000,
`${file} exceeds the 500 kB chunk budget (${size} bytes).`,
);
}
console.log(
`Build budget passed: ${files.length} JavaScript chunks below 500 kB.`,
);

View File

@ -1,90 +0,0 @@
#!/bin/sh
set -eu
root=${1:?Deployment directory required}
release_id=${2:?Build number and commit required}
host=${3:?Frontend hostname required}
case "$release_id" in *[!0-9a-f-]*|'') echo 'Invalid release ID' >&2; exit 1 ;; esac
build=${release_id%%-*}
case "$build" in *[!0-9]*|'') echo 'Invalid build number' >&2; exit 1 ;; esac
case "$host" in *[!a-zA-Z0-9.-]*|'') echo 'Invalid hostname' >&2; exit 1 ;; esac
cd "$root"
root=$(pwd -P)
exec 9> .deploy.lock
flock -x 9
release="$root/releases/$release_id/dist"
if [ ! -d "$release" ]; then
candidate="$root/incoming/$release_id/dist"
test -s "$candidate/index.html"
test "$(cat "$candidate/release.txt")" = "$release_id"
mkdir -p "$root/releases/$release_id"
mv "$candidate" "$release"
fi
test -s "$release/index.html"
test "$(cat "$release/release.txt")" = "$release_id"
# A slow older pipeline must not replace a newer successful release.
last_build=0
if [ -L current ] && [ -f current/release.txt ]; then
last_release=$(cat current/release.txt)
last_build=${last_release%%-*}
fi
if [ "$build" -lt "$last_build" ]; then
echo "Skipping superseded build $build (active build $last_build)"
exit 0
fi
if [ -e current ] && [ ! -L current ]; then
echo 'The current release must be a symlink' >&2
exit 1
fi
old=$(readlink current || true)
old_previous=$(readlink previous || true)
temporary="$root/.current-$release_id"
previous_temporary="$root/.previous-$release_id"
switched=false
restore() {
result=$?
trap - EXIT HUP INT TERM
if [ "$switched" = true ] && [ "$result" -ne 0 ]; then
if [ -n "$old" ]; then
ln -sfn "$old" "$temporary"
mv -Tf "$temporary" current
else
rm -f current
fi
if [ -n "$old_previous" ]; then
ln -sfn "$old_previous" "$previous_temporary"
mv -Tf "$previous_temporary" previous
else
rm -f previous
fi
echo 'Release verification failed. Restored the previous release.' >&2
fi
rm -f "$temporary" "$previous_temporary"
exit "$result"
}
trap restore EXIT
trap 'exit 1' HUP INT TERM
chmod a+rx "$root/releases/$release_id"
chmod -R a+rX "$release"
switched=true
if [ -n "$old" ] && [ "$old" != "$release" ]; then
ln -sfn "$old" "$previous_temporary"
mv -Tf "$previous_temporary" previous
fi
ln -sfn "$release" "$temporary"
mv -Tf "$temporary" current
# Verify this server through the existing HTTPS virtual host and certificate.
served=$(curl --fail --silent --show-error --max-time 20 \
--resolve "$host:443:127.0.0.1" "https://$host/release.txt")
test "$served" = "$release_id"
for path in / /workspace /cart; do
curl --fail --silent --show-error --output /dev/null --max-time 20 \
--resolve "$host:443:127.0.0.1" "https://$host$path"
done
ready=$(curl --fail --silent --show-error --max-time 20 \
--resolve "$host:443:127.0.0.1" "https://$host/api/v1/health/ready")
test "$(printf '%s' "$ready" | tr -d '[:space:]')" = '{"status":"ok"}'
echo "Activated $release_id on $host"

View File

@ -1,46 +0,0 @@
#!/bin/sh
set -eu
test "$(id -u)" = 0 || { echo 'Run this setup script with sudo.' >&2; exit 1; }
script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd)
snippet="$script_dir/../deploy/nginx-locations.conf"
if [ ! -f "$snippet" ]; then snippet="$script_dir/nginx-locations.conf"; fi
test -s "$snippet"
site=$(readlink -f /etc/nginx/sites-enabled/ManiCandles.midastix.com.conf)
test -f "$site"
if grep -Eq 'listen[[:space:]].*443|ssl_certificate' "$site"; then
echo 'This site already contains TLS settings. Review its configuration before running setup.' >&2
exit 1
fi
nginx -t
command -v curl
command -v flock
command -v certbot
root=/var/www/manicandles
install -d -o mihir -g "$(id -gn mihir)" -m 0755 "$root" "$root/releases" "$root/incoming"
if [ ! -e "$root/current" ] && [ ! -L "$root/current" ] && [ -s /var/www/ManiCandles.midastix.com/index.html ]; then
ln -s /var/www/ManiCandles.midastix.com "$root/current"
chown -h mihir:"$(id -gn mihir)" "$root/current"
fi
install -d -m 0755 /etc/nginx/snippets /var/backups
backup="/var/backups/manicandles-nginx-$(date +%Y%m%d%H%M%S)-$$.conf"
cp -p "$site" "$backup"
if [ -e /etc/nginx/snippets/manicandles.conf ] && ! cmp -s "$snippet" /etc/nginx/snippets/manicandles.conf; then
echo 'A different deployment snippet exists. Review the existing setup before continuing.' >&2
exit 1
fi
install -m 0644 "$snippet" /etc/nginx/snippets/manicandles.conf
cat > "$site" <<'NGINX'
server {
listen 80;
server_name manicandles.midastix.com;
include /etc/nginx/snippets/manicandles.conf;
}
NGINX
if ! nginx -t || ! systemctl reload nginx; then
cp -p "$backup" "$site"
nginx -t && systemctl reload nginx
echo "Setup failed. Restored $backup" >&2
exit 1
fi
echo "Site prepared. Original configuration saved at $backup"
echo 'Next run: sudo certbot --nginx -d manicandles.midastix.com --redirect'

4
src/App.css Normal file
View File

@ -0,0 +1,4 @@
/*
Deprecated template file.
Global styles have been migrated to src/index.css, and Material UI is utilized for theme design variables.
*/

View File

@ -1,223 +1,5 @@
import { lazy, Suspense } from "react"; // Deprecated template file.
import { Switch, Route, Router as WouterRouter } from "wouter"; // The main application wrapper and routing configuration has been relocated to src/app/App.tsx
import { Layout } from "@/components/Layout"; // in accordance with feature-based architecture guidelines.
import { PlatformProvider } from "@/lib/platform"; export default {};
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import LinearProgress from "@mui/material/LinearProgress";
import { ErrorBoundary } from "@/components/ErrorBoundary";
const Home = lazy(() => import("@/pages/home"));
const ProductsPage = lazy(() => import("@/pages/ProductsPage"));
const ProductPage = lazy(() => import("@/pages/ProductPage"));
const AboutPage = lazy(() => import("@/pages/AboutPage"));
const ContactPage = lazy(() => import("@/pages/ContactPage"));
const WorkspacePage = lazy(() => import("@/pages/WorkspacePage"));
const ConnectionPage = lazy(() => import("@/pages/ConnectionPage"));
const AddressesPage = lazy(() => import("@/pages/AddressesPage"));
const CartPage = lazy(() => import("@/pages/CartPage"));
const OrdersPage = lazy(() => import("@/pages/OrdersPage"));
const AccessPage = lazy(() => import("@/pages/AccessPage"));
const RolesPage = lazy(() =>
import("@/pages/AccessPage").then((module) => ({
default: module.RolesPage,
})),
);
const AuditPage = lazy(() =>
import("@/pages/AccessPage").then((module) => ({
default: module.AuditPage,
})),
);
const CatalogAdminPage = lazy(() => import("@/pages/CatalogAdminPage"));
const InventoryPage = lazy(() => import("@/pages/InventoryPage"));
const MaterialStockPage = lazy(() => import("@/pages/MaterialStockPage"));
const BusinessAccountsPage = lazy(() => import("@/pages/BusinessAccountsPage"));
const PriceListsPage = lazy(() => import("@/pages/PriceListsPage"));
const QuotesPage = lazy(() => import("@/pages/QuotesPage"));
const CreditPoliciesPage = lazy(() => import("@/pages/CreditPoliciesPage"));
const SamplesPage = lazy(() => import("@/pages/SamplesPage"));
const ArtworkPage = lazy(() => import("@/pages/ArtworkPage"));
const PartnerOrdersPage = lazy(() => import("@/pages/PartnerOrdersPage"));
const PartnerPaymentsPage = lazy(() => import("@/pages/PartnerPaymentsPage"));
const MaterialCostRatesPage = lazy(() => import("@/pages/MaterialCostRatesPage"));
const ProcurementPage = lazy(() => import("@/pages/ProcurementPage"));
const BomPage = lazy(() => import("@/pages/BomPage"));
const ProductionBatchesPage = lazy(() => import("@/pages/ProductionBatchesPage"));
const SupplierDocumentsPage = lazy(() => import("@/pages/SupplierDocumentsPage"));
const PurchaseOrdersPage = lazy(() =>
import("@/pages/ProcurementPage").then((module) => ({ default: module.PurchaseOrdersPage })),
);
const OffersPage = lazy(() => import("@/pages/OffersPage"));
const RecoveryPage = lazy(() => import("@/pages/RecoveryPage"));
const NotFound = lazy(() => import("@/pages/not-found"));
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false } },
});
function Router() {
return (
<Suspense fallback={<LinearProgress aria-label="Loading page" />}>
<Switch>
<Route path="/" component={Home} />
<Route path="/products" component={ProductsPage} />
<Route path="/products/:id">
{(params) => <ProductPage id={params.id} />}
</Route>
<Route path="/workspace" component={WorkspacePage} />
<Route path="/connection" component={ConnectionPage} />
<Route path="/addresses" component={AddressesPage} />
<Route path="/cart" component={CartPage} />
<Route path="/orders">{() => <OrdersPage />}</Route>
<Route path="/orders/:id">
{(params) => <OrdersPage id={params.id} />}
</Route>
<Route path="/admin/orders">{() => <OrdersPage admin />}</Route>
<Route path="/admin/orders/:id">
{(params) => <OrdersPage admin id={params.id} />}
</Route>
<Route path="/admin/access" component={AccessPage} />
<Route path="/admin/roles" component={RolesPage} />
<Route path="/admin/audit" component={AuditPage} />
<Route path="/admin/business-accounts">{() => <BusinessAccountsPage />}</Route>
<Route path="/admin/business-accounts/new">{() => <BusinessAccountsPage create />}</Route>
<Route path="/admin/business-accounts/:id">
{(params) => <BusinessAccountsPage id={params.id} />}
</Route>
<Route path="/admin/b2b-price-lists">{() => <PriceListsPage />}</Route>
<Route path="/admin/b2b-price-lists/account/:id">
{(params) => <PriceListsPage account id={params.id} />}
</Route>
<Route path="/admin/b2b-price-lists/:id">
{(params) => <PriceListsPage id={params.id} />}
</Route>
<Route path="/admin/b2b-quotes">{() => <QuotesPage />}</Route>
<Route path="/admin/b2b-quotes/new">{() => <QuotesPage issue />}</Route>
<Route path="/admin/b2b-quotes/new/:accountId/:priceListId">
{(params) => <QuotesPage issue accountId={params.accountId} priceListId={params.priceListId} />}
</Route>
<Route path="/admin/b2b-quotes/account/:accountId">
{(params) => <QuotesPage accountId={params.accountId} />}
</Route>
<Route path="/admin/b2b-quotes/:id">
{(params) => <QuotesPage id={params.id} />}
</Route>
<Route path="/admin/b2b-credit-policies">{() => <CreditPoliciesPage />}</Route>
<Route path="/admin/b2b-credit-policies/new">{() => <CreditPoliciesPage propose />}</Route>
<Route path="/admin/b2b-credit-policies/new/:accountId">
{(params) => <CreditPoliciesPage propose accountId={params.accountId} />}
</Route>
<Route path="/admin/b2b-credit-policies/account/:accountId">
{(params) => <CreditPoliciesPage accountId={params.accountId} />}
</Route>
<Route path="/admin/b2b-credit-policies/:id">
{(params) => <CreditPoliciesPage id={params.id} />}
</Route>
<Route path="/admin/b2b-samples">{() => <SamplesPage />}</Route>
<Route path="/admin/b2b-samples/new">{() => <SamplesPage create />}</Route>
<Route path="/admin/b2b-samples/new/:accountId">
{(params) => <SamplesPage create accountId={params.accountId} />}
</Route>
<Route path="/admin/b2b-samples/account/:accountId">
{(params) => <SamplesPage accountId={params.accountId} />}
</Route>
<Route path="/admin/b2b-samples/:id">
{(params) => <SamplesPage id={params.id} />}
</Route>
<Route path="/admin/b2b-artwork">{() => <ArtworkPage />}</Route>
<Route path="/admin/b2b-artwork/new">{() => <ArtworkPage create />}</Route>
<Route path="/admin/b2b-artwork/new/:accountId">
{(params) => <ArtworkPage create accountId={params.accountId} />}
</Route>
<Route path="/admin/b2b-artwork/account/:accountId">
{(params) => <ArtworkPage accountId={params.accountId} />}
</Route>
<Route path="/admin/b2b-artwork/:id">
{(params) => <ArtworkPage id={params.id} />}
</Route>
<Route path="/admin/b2b-payments">{() => <PartnerPaymentsPage />}</Route>
<Route path="/admin/b2b-partner-orders/:orderId/payments">
{(params) => <PartnerPaymentsPage orderId={params.orderId} />}
</Route>
<Route path="/admin/b2b-partner-orders">{() => <PartnerOrdersPage />}</Route>
<Route path="/admin/b2b-partner-orders/new">{() => <PartnerOrdersPage create />}</Route>
<Route path="/admin/b2b-partner-orders/new/:quoteId">
{(params) => <PartnerOrdersPage create quoteId={params.quoteId} />}
</Route>
<Route path="/admin/b2b-partner-orders/account/:accountId">
{(params) => <PartnerOrdersPage accountId={params.accountId} />}
</Route>
<Route path="/admin/b2b-partner-orders/:id">
{(params) => <PartnerOrdersPage id={params.id} />}
</Route>
<Route path="/admin/catalog">{() => <CatalogAdminPage />}</Route>
<Route path="/admin/catalog/:id">
{(params) => <CatalogAdminPage id={params.id} />}
</Route>
<Route path="/admin/inventory">{() => <InventoryPage />}</Route>
<Route path="/admin/material-stock">{() => <MaterialStockPage />}</Route>
<Route path="/admin/material-stock/adjust">{() => <MaterialStockPage adjust />}</Route>
<Route path="/admin/material-stock/adjust/:id">
{(params) => <MaterialStockPage adjust id={params.id} />}
</Route>
<Route path="/admin/material-stock/:id">
{(params) => <MaterialStockPage id={params.id} />}
</Route>
<Route path="/admin/material-cost-rates">{() => <MaterialCostRatesPage />}</Route>
<Route path="/admin/material-cost-rates/:id">
{(params) => <MaterialCostRatesPage materialId={params.id} />}
</Route>
<Route path="/admin/inventory/:id">
{(params) => <InventoryPage id={params.id} />}
</Route>
<Route path="/admin/coupons">{() => <OffersPage />}</Route>
<Route path="/admin/procurement">{() => <ProcurementPage />}</Route>
<Route path="/admin/procurement/materials">{() => <ProcurementPage materials />}</Route>
<Route path="/admin/procurement/suppliers/:id">
{(params) => <ProcurementPage supplierId={params.id} />}
</Route>
<Route path="/admin/supplier-documents">{() => <SupplierDocumentsPage />}</Route>
<Route path="/admin/supplier-documents/:id">
{(params) => <SupplierDocumentsPage supplierId={params.id} />}
</Route>
<Route path="/admin/boms">{() => <BomPage />}</Route>
<Route path="/admin/boms/:id">
{(params) => <BomPage variantId={params.id} />}
</Route>
<Route path="/admin/packaging-boms">{() => <BomPage packaging />}</Route>
<Route path="/admin/packaging-boms/:id">
{(params) => <BomPage packaging variantId={params.id} />}
</Route>
<Route path="/admin/production-batches">{() => <ProductionBatchesPage />}</Route>
<Route path="/admin/production-batches/new">{() => <ProductionBatchesPage create />}</Route>
<Route path="/admin/production-batches/new/:bomId">
{(params) => <ProductionBatchesPage create bomId={params.bomId} />}
</Route>
<Route path="/admin/production-batches/:id">
{(params) => <ProductionBatchesPage batchId={params.id} />}
</Route>
<Route path="/admin/purchase-orders">{() => <PurchaseOrdersPage />}</Route>
<Route path="/admin/purchase-orders/:id">
{(params) => <PurchaseOrdersPage orderId={params.id} />}
</Route>
<Route path="/admin/pricing">{() => <OffersPage pricing />}</Route>
<Route path="/recovery">{() => <RecoveryPage />}</Route>
<Route path="/reset-password">{() => <RecoveryPage reset />}</Route>
<Route path="/about" component={AboutPage} />
<Route path="/contact" component={ContactPage} />
<Route component={NotFound} />
</Switch>
</Suspense>
);
}
export default function App() {
return (
<ErrorBoundary>
<QueryClientProvider client={queryClient}>
<PlatformProvider>
<WouterRouter base={import.meta.env.BASE_URL.replace(/\/$/, "")}>
<Layout>
<Router />
</Layout>
</WouterRouter>
</PlatformProvider>
</QueryClientProvider>
</ErrorBoundary>
);
}

51
src/app/App.tsx Normal file
View File

@ -0,0 +1,51 @@
import React, { useState } from 'react';
import { BrowserRouter } from 'react-router-dom';
import { ThemeProvider } from '@mui/material/styles';
import { CssBaseline } from '@mui/material';
import { HelmetProvider } from 'react-helmet-async';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import theme from '../theme/theme';
import { CartProvider } from '../contexts/CartContext';
import { WishlistProvider } from '../contexts/WishlistContext';
import AppRoutes from '../routes/AppRoutes';
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: 1,
},
},
});
export const App: React.FC = () => {
// Global wholesale vs retail context state
const [isB2BMode, setIsB2BMode] = useState<boolean>(() => {
const saved = localStorage.getItem('mani_candles_b2b_mode');
return saved === 'true';
});
const handleSetB2BMode = (val: boolean) => {
localStorage.setItem('mani_candles_b2b_mode', val ? 'true' : 'false');
setIsB2BMode(val);
};
return (
<HelmetProvider>
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<CssBaseline />
<CartProvider>
<WishlistProvider>
<BrowserRouter>
<AppRoutes isB2BMode={isB2BMode} setIsB2BMode={handleSetB2BMode} />
</BrowserRouter>
</WishlistProvider>
</CartProvider>
</ThemeProvider>
</QueryClientProvider>
</HelmetProvider>
);
};
export default App;

BIN
src/assets/hero.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 977 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

BIN
src/assets/logo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

1
src/assets/react.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

1
src/assets/vite.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@ -1,84 +0,0 @@
import { useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { z } from "zod";
import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField";
import Alert from "@mui/material/Alert";
import { Link } from "wouter";
import { cart } from "@/lib/commerce";
import { usePlatform } from "@/lib/platform";
import { ApiNotice } from "./ApiNotice";
export function AddToCart({ variantId }: { variantId: string }) {
const { principal, request, scope } = usePlatform(),
client = useQueryClient();
const [busy, setBusy] = useState(false),
[error, setError] = useState<unknown>(null),
[saved, setSaved] = useState(false),
[quantity, setQuantity] = useState(1);
if (!principal)
return (
<Link href="/workspace">
<u>Sign in to add to cart</u>
</Link>
);
return (
<div>
<form
className="cart-add"
onSubmit={async (event) => {
event.preventDefault();
if (busy) return;
setBusy(true);
setError(null);
setSaved(false);
try {
z.number().int().min(1).max(100).parse(quantity);
const current = await request("/cart", cart);
const total =
(current.lines.find((l) => l.variantId === variantId)?.quantity ||
0) + quantity;
z.number().int().max(100).parse(total);
await request(
`/cart/lines/${variantId}`,
z.object({ version: z.number() }),
{
method: "PUT",
body: { quantity: total, version: current.version },
},
);
await client.invalidateQueries({
queryKey: ["private", scope, "/cart"],
});
setSaved(true);
} catch (error) {
setError(error);
} finally {
setBusy(false);
}
}}
>
<TextField
label="Quantity"
type="number"
size="small"
value={quantity}
onChange={(e) => setQuantity(Number(e.target.value))}
inputProps={{ min: 1, max: 100, step: 1 }}
disabled={busy}
/>
<Button type="submit" variant="contained" disabled={busy}>
{busy ? "Adding…" : "Add to cart"}
</Button>
</form>
<ApiNotice error={error} />
{saved && (
<Alert severity="success">
Added.{" "}
<Link href="/cart">
<u>Review cart</u>
</Link>
</Alert>
)}
</div>
);
}

View File

@ -1,18 +0,0 @@
import Alert from "@mui/material/Alert";
import { ApiError } from "@/lib/api";
export function ApiNotice({ error }: { error: unknown }) {
if (!error) return null;
return (
<Alert severity="error" sx={{ my: 2, overflowWrap: "anywhere" }}>
{error instanceof Error ? error.message : "An unexpected error occurred."}
{error instanceof ApiError && (
<div>
<small>
{error.code}
{error.requestId && ` · Reference: ${error.requestId}`}
</small>
</div>
)}
</Alert>
);
}

View File

@ -1,12 +0,0 @@
import type { z } from "zod";
import type { profileSnapshot } from "@/lib/business";
export function BusinessSnapshot({ account }: { account: z.infer<typeof profileSnapshot> }) {
return <section className="workspace-id">
<h3>Business at quotation issuance</h3>
<p>{account.legalName}{account.tradingName && ` · ${account.tradingName}`} · Profile version {account.profileVersion}</p>
<p>Registration {account.registrationNumber}{account.taxIdentifier && ` · Tax ID ${account.taxIdentifier}`}</p>
<p>{account.contactEmail}{account.contactPhone && ` · ${account.contactPhone}`}</p>
<p>{[account.billingLine1, account.billingCity, account.billingRegion, account.billingPostalCode, account.countryCode].join(", ")}</p>
</section>;
}

View File

@ -1,133 +0,0 @@
import { Link } from "wouter";
import { useQuery } from "@tanstack/react-query";
import Alert from "@mui/material/Alert";
import Button from "@mui/material/Button";
import Skeleton from "@mui/material/Skeleton";
import { Flame } from "lucide-react";
import { listProducts, productImageUrl } from "@/lib/api";
import { usePlatform } from "@/lib/platform";
import { ApiNotice } from "./ApiNotice";
import "@/pages/products.css";
export function Catalog({
search = "",
offset = 0,
limit = 12,
onNext,
onPrevious,
}: {
search?: string;
offset?: number;
limit?: number;
onNext?: () => void;
onPrevious?: () => void;
}) {
const { organization } = usePlatform();
const query = useQuery({
queryKey: ["catalog", organization, search, offset, limit],
queryFn: ({ signal }) =>
listProducts(organization, search, offset, limit, signal),
enabled: Boolean(organization),
retry: false,
});
if (!organization)
return (
<Alert severity="info">
Configure your organization on the{" "}
<Link href="/connection">
<u>Connection page</u>
</Link>{" "}
to view the published collection.
</Alert>
);
if (query.isPending)
return (
<div
className="products-grid"
aria-busy="true"
aria-label="Loading collection"
>
{Array.from({ length: Math.min(limit, 4) }, (_, i) => (
<Skeleton key={i} variant="rectangular" height={280} />
))}
</div>
);
if (query.isError)
return (
<>
<ApiNotice error={query.error} />
<Button variant="outlined" onClick={() => query.refetch()}>
Try again
</Button>
</>
);
return (
<>
{!query.data.length ? (
<Alert severity="info">
{search
? "No candles match your search. Try another name."
: "No published candles are available yet."}
</Alert>
) : (
<div className="products-grid">
{query.data.map((product) => (
<article className="prod-card" key={product.id}>
<Link
href={`/products/${product.id}`}
className={`prod-img-wrap${product.images[0] ? "" : " catalog-placeholder"}`}
aria-label={`View ${product.name}`}
>
{product.images[0] ? (
<img
src={productImageUrl(organization, product.id, product.images[0].id)}
alt=""
loading="lazy"
/>
) : (
<>
<Flame size={48} aria-hidden="true" />
<span>Mani Candles</span>
</>
)}
</Link>
<div className="prod-info">
<h3 className="prod-name">
<Link href={`/products/${product.id}`}>{product.name}</Link>
</h3>
<p className="prod-scent">
View available variants and pricing.
</p>
<Link
className="catalog-details"
href={`/products/${product.id}`}
>
View candle →
</Link>
</div>
</article>
))}
</div>
)}
{onNext && onPrevious && (
<div className="catalog-pagination">
<Button
variant="outlined"
disabled={offset === 0}
onClick={onPrevious}
>
Previous
</Button>
<span>Page {offset / limit + 1}</span>
<Button
variant="outlined"
disabled={query.data.length < limit || offset + limit > 10000}
onClick={onNext}
>
Next
</Button>
</div>
)}
</>
);
}

View File

@ -1,70 +0,0 @@
import { useState } from "react";
import Button from "@mui/material/Button";
import Dialog from "@mui/material/Dialog";
import DialogTitle from "@mui/material/DialogTitle";
import DialogContent from "@mui/material/DialogContent";
import DialogActions from "@mui/material/DialogActions";
import { ApiNotice } from "./ApiNotice";
export function ConfirmAction({
label,
message,
onConfirm,
disabled = false,
}: {
label: string;
message: string;
onConfirm: () => Promise<unknown>;
disabled?: boolean;
}) {
const [open, setOpen] = useState(false),
[busy, setBusy] = useState(false),
[error, setError] = useState<unknown>(null);
return (
<>
<Button
disabled={disabled}
onClick={() => {
setError(null);
setOpen(true);
}}
>
{label}
</Button>
<Dialog
open={open}
onClose={() => {
if (!busy) setOpen(false);
}}
aria-labelledby="confirm-title"
>
<DialogTitle id="confirm-title">{label}</DialogTitle>
<DialogContent>
<p>{message}</p>
<ApiNotice error={error} />
</DialogContent>
<DialogActions>
<Button disabled={busy} onClick={() => setOpen(false)}>
Keep current state
</Button>
<Button
disabled={busy}
variant="contained"
onClick={async () => {
setBusy(true);
try {
await onConfirm();
setOpen(false);
} catch (error) {
setError(error);
} finally {
setBusy(false);
}
}}
>
{busy ? "Working…" : "Confirm"}
</Button>
</DialogActions>
</Dialog>
</>
);
}

View File

@ -1,27 +0,0 @@
import { Component, type ReactNode } from "react";
import Alert from "@mui/material/Alert";
import Button from "@mui/material/Button";
export class ErrorBoundary extends Component<
{ children: ReactNode },
{ failed: boolean }
> {
state = { failed: false };
static getDerivedStateFromError() {
return { failed: true };
}
componentDidCatch() {
console.error("APPLICATION_RENDER_FAILED");
}
render() {
return this.state.failed ? (
<main className="workspace-page">
<Alert severity="error">
This page could not be displayed. Reload to start a fresh session.
</Alert>
<Button onClick={() => location.reload()}>Reload application</Button>
</main>
) : (
this.props.children
);
}
}

View File

@ -1,373 +0,0 @@
/* ─── Layout.css — Header & Footer ──────────────────────── */
/* ══════════════════════════════════════════════════════════
MARQUEE / TICKER BAR
══════════════════════════════════════════════════════════ */
.ticker-bar {
background: var(--brand-purple-dark);
border-bottom: 1px solid rgba(212,162,76,0.25);
height: 36px;
overflow: hidden;
display: flex;
align-items: center;
}
.ticker-track {
display: flex;
align-items: center;
gap: 0;
animation: ticker-scroll 28s linear infinite;
white-space: nowrap;
will-change: transform;
}
.ticker-track:hover {
animation-play-state: paused;
}
@keyframes ticker-scroll {
0% { transform: translateX(0); }
100% { transform: translateX(-50%); }
}
.ticker-item {
display: inline-flex;
align-items: center;
gap: 0.6rem;
font-family: var(--font-display);
font-size: 0.62rem;
letter-spacing: 0.2em;
text-transform: uppercase;
color: rgba(255,255,255,0.85);
padding: 0 2.5rem;
}
.ticker-dot {
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--brand-gold);
flex-shrink: 0;
display: inline-block;
}
/* ══════════════════════════════════════════════════════════
LOGO
══════════════════════════════════════════════════════════ */
.logo-text {
font-family: var(--font-script);
font-size: 2rem;
color: #ffffff;
transition: color 0.3s ease;
line-height: 1;
}
.logo-text:hover { color: var(--brand-gold-light); }
.logo-img-wrap {
width: 44px;
height: 44px;
border-radius: 50%;
overflow: hidden;
border: 2px solid transparent;
transition: border-color 0.3s ease;
}
.logo-img-wrap:hover { border-color: var(--brand-gold); }
/* ══════════════════════════════════════════════════════════
NAV ITEM WITH DROPDOWN
══════════════════════════════════════════════════════════ */
.nav-item {
position: relative;
}
.nav-link {
font-family: var(--font-display);
font-size: 0.72rem;
letter-spacing: 0.2em;
text-transform: uppercase;
color: #ffffff;
text-decoration: none;
padding-bottom: 2px;
border-bottom: 2px solid transparent;
transition: border-color 0.3s ease, color 0.3s ease;
display: inline-flex;
align-items: center;
gap: 5px;
cursor: pointer;
background: none;
border-left: none;
border-right: none;
border-top: none;
}
.nav-link:hover {
color: var(--brand-gold-light);
border-bottom-color: rgba(212,162,76,0.6);
}
.nav-link.active {
color: var(--brand-gold-light);
border-bottom-color: var(--brand-gold);
border-bottom-width: 2.5px;
text-shadow:
0 0 12px rgba(255,211,107,0.9),
0 0 24px rgba(212,162,76,0.5);
font-weight: 600;
background: rgba(212,162,76,0.12);
border-radius: 4px;
padding: 3px 10px 5px;
}
.nav-chevron {
transition: transform 0.25s ease;
opacity: 0.75;
}
.nav-item:hover .nav-chevron {
transform: rotate(180deg);
opacity: 1;
}
/* DROPDOWN PANEL */
.nav-dropdown {
position: absolute;
top: calc(100% + 18px);
left: 50%;
transform: translateX(-50%) translateY(-8px);
min-width: 200px;
background: rgba(45, 13, 82, 0.96);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(212,162,76,0.2);
border-radius: 8px;
padding: 0.6rem 0;
opacity: 0;
pointer-events: none;
transition: opacity 0.2s ease, transform 0.25s ease;
box-shadow: 0 16px 40px rgba(0,0,0,0.35);
z-index: 200;
}
/* Arrow notch */
.nav-dropdown::before {
content: '';
position: absolute;
top: -7px;
left: 50%;
transform: translateX(-50%);
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid rgba(212,162,76,0.25);
}
.nav-dropdown::after {
content: '';
position: absolute;
top: -6px;
left: 50%;
transform: translateX(-50%);
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid rgba(45,13,82,0.96);
}
.nav-item:hover .nav-dropdown {
opacity: 1;
pointer-events: auto;
transform: translateX(-50%) translateY(0);
}
.dropdown-item {
display: flex;
align-items: center;
gap: 0.6rem;
padding: 0.65rem 1.25rem;
font-family: var(--font-sans);
font-size: 0.83rem;
color: rgba(255,255,255,0.78);
text-decoration: none;
transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
white-space: nowrap;
}
.dropdown-item:hover {
background: rgba(212,162,76,0.12);
color: var(--brand-gold-light);
padding-left: 1.6rem;
}
.dropdown-divider {
height: 1px;
background: rgba(255,255,255,0.08);
margin: 0.4rem 0;
}
/* ══════════════════════════════════════════════════════════
MOBILE TOGGLE
══════════════════════════════════════════════════════════ */
.mobile-toggle {
background: none;
border: none;
color: #ffffff;
cursor: pointer;
display: flex;
align-items: center;
padding: 4px;
transition: color 0.3s ease;
}
.mobile-toggle:hover { color: var(--brand-gold-light); }
/* ══════════════════════════════════════════════════════════
MOBILE DRAWER
══════════════════════════════════════════════════════════ */
.mobile-menu {
background: rgba(45, 13, 82, 0.97);
backdrop-filter: blur(16px);
border-bottom: 1px solid rgba(212, 162, 76, 0.2);
padding: 1.5rem;
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.mobile-nav-section {
display: flex;
flex-direction: column;
}
.mobile-nav-link {
font-family: var(--font-display);
font-size: 0.85rem;
letter-spacing: 0.2em;
text-transform: uppercase;
color: #ffffff;
text-decoration: none;
padding: 0.8rem 0.5rem;
border-bottom: 1px solid rgba(255,255,255,0.07);
transition: color 0.3s ease, padding-left 0.2s ease;
display: block;
}
.mobile-nav-link:hover {
color: var(--brand-gold-light);
padding-left: 0.75rem;
}
.mobile-nav-link.active {
color: var(--brand-gold);
padding-left: 0.75rem;
text-shadow: 0 0 10px rgba(255,211,107,0.7);
font-weight: 600;
}
.mobile-dropdown-items {
display: flex;
flex-direction: column;
padding: 0.25rem 0 0.5rem 1rem;
gap: 0.1rem;
border-bottom: 1px solid rgba(255,255,255,0.07);
}
.mobile-dropdown-item {
font-family: var(--font-sans);
font-size: 0.82rem;
color: rgba(255,255,255,0.6);
text-decoration: none;
padding: 0.4rem 0.5rem;
transition: color 0.2s ease;
}
.mobile-dropdown-item:hover {
color: var(--brand-gold-light);
}
/* ══════════════════════════════════════════════════════════
FOOTER
══════════════════════════════════════════════════════════ */
.site-footer {
background: var(--brand-purple-dark);
color: #ffffff;
padding: 4rem 1.5rem;
margin-top: 5rem;
}
.footer-inner {
max-width: 1280px;
margin: 0 auto;
display: grid;
grid-template-columns: 1fr;
gap: 3rem;
text-align: center;
}
@media (min-width: 768px) {
.footer-inner {
grid-template-columns: 1fr 1fr 1fr;
text-align: left;
}
}
.footer-col {
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}
@media (min-width: 768px) {
.footer-col { align-items: flex-start; }
}
.footer-tagline {
font-family: var(--font-serif);
font-style: italic;
font-size: 1.1rem;
color: rgba(255,255,255,0.7);
}
.footer-heading {
font-family: var(--font-display);
font-size: 0.7rem;
letter-spacing: 0.25em;
text-transform: uppercase;
color: var(--brand-gold);
margin-bottom: 0.5rem;
}
.footer-link {
color: rgba(255,255,255,0.75);
font-size: 0.9rem;
text-decoration: none;
transition: color 0.3s ease;
}
.footer-link:hover { color: var(--brand-gold-light); }
.social-btn {
width: 40px;
height: 40px;
border-radius: 50%;
background: rgba(255,255,255,0.08);
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
text-decoration: none;
transition: background 0.3s ease, color 0.3s ease;
}
.social-btn:hover {
background: var(--brand-gold);
color: var(--brand-purple-dark);
}
.footer-copy {
font-size: 0.78rem;
color: rgba(255,255,255,0.4);
margin-top: 1rem;
}
.nav-item:focus-within .nav-dropdown { opacity:1; pointer-events:auto; transform:translateX(-50%) translateY(0); }
.skip-link { position:fixed; top:-100px; left:1rem; z-index:1500; background:white; color:var(--brand-purple); padding:1rem; }
.skip-link:focus { top:.5rem; }
a:focus-visible,button:focus-visible { outline:3px solid var(--brand-purple); outline-offset:4px; }
.nav-link:focus-visible,.mobile-nav-link:focus-visible { outline-color:var(--brand-gold-light); }
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; } }

View File

@ -1,312 +0,0 @@
import { Link, useLocation } from "wouter";
import { useState, useEffect } from "react";
import { motion, AnimatePresence } from "framer-motion";
import AppBar from "@mui/material/AppBar";
import Toolbar from "@mui/material/Toolbar";
import Box from "@mui/material/Box";
import Container from "@mui/material/Container";
import IconButton from "@mui/material/IconButton";
import { Menu, X, Instagram, Facebook, Twitter, ChevronDown, Flame, Sparkles, Star } from "lucide-react";
import { ScrollCandle } from "./ScrollCandle";
import "./Layout.css";
const logoPath = "/opengraph.jpg";
// ── Ticker messages ──────────────────────────────────────
const TICKER_ITEMS = [
{ icon: <Flame size={12} />, text: "UAT — commerce and administration" },
{ icon: <Sparkles size={12} />, text: "Explore the published collection" },
{ icon: <Star size={12} />, text: "Handpoured in small batches" },
{ icon: <Flame size={12} />, text: "100% Natural Soy Wax" },
{ icon: <Sparkles size={12} />, text: "Phthalate-free fragrance oils" },
{ icon: <Star size={12} />, text: "Payment collection is not enabled" },
];
// ── Nav structure with dropdowns ─────────────────────────
const NAV_LINKS = [
{ name: "Home", path: "/", dropdown: null },
{
name: "Products",
path: "/products",
dropdown: null,
},
{
name: "About",
path: "/about",
dropdown: [
{ label: "Our Story", path: "/about" },
{ label: "Our Process", path: "/about" },
{ label: "Meet the Maker", path: "/about" },
],
},
{
name: "Contact",
path: "/contact",
dropdown: [
{ label: "Send a Message", path: "/contact" },
{ label: "Wholesale Inquiries", path: "/contact" },
null,
{ label: "Follow on Instagram", path: "/contact" },
],
},
{ name: "Workspace", path: "/workspace", dropdown: null },
{ name: "Cart", path: "/cart", dropdown: null },
{ name: "Connection", path: "/connection", dropdown: null },
];
export function Layout({ children }: { children: React.ReactNode }) {
const [location] = useLocation();
const [scrolled, setScrolled] = useState(false);
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const [mobileOpenSection, setMobileOpenSection] = useState<string | null>(null);
useEffect(() => {
const handleScroll = () => setScrolled(window.scrollY > 20);
window.addEventListener("scroll", handleScroll);
return () => window.removeEventListener("scroll", handleScroll);
}, []);
useEffect(() => {
window.scrollTo(0, 0);
setMobileMenuOpen(false);
setMobileOpenSection(null);
}, [location]);
// Duplicate ticker items to create seamless loop
const allTickerItems = [...TICKER_ITEMS, ...TICKER_ITEMS];
return (
<Box sx={{ minHeight: "100vh", display: "flex", flexDirection: "column" }}>
<a className="skip-link" href="#main-content">Skip to content</a>
{/* ── Ticker Bar ── */}
<Box
className="ticker-bar"
sx={{ position: "fixed", top: 0, left: 0, right: 0, zIndex: 1200 }}
>
<div className="ticker-track">
{allTickerItems.map((item, i) => (
<span className="ticker-item" key={i}>
<span className="ticker-dot" />
{item.icon}
{item.text}
</span>
))}
</div>
</Box>
{/* ── Main AppBar ── */}
<AppBar
position="fixed"
sx={{
top: 36, // sits below the ticker bar
background: scrolled
? "rgba(91,30,140,0.78)"
: "rgba(91,30,140,0.58)",
backdropFilter: "blur(22px) saturate(1.6)",
WebkitBackdropFilter: "blur(22px) saturate(1.6)",
boxShadow: scrolled ? "0 1px 0 0 rgba(212,162,76,0.5), 0 4px 24px rgba(58,18,96,0.35)" : "none",
transition: "background 0.5s ease, box-shadow 0.5s ease",
overflow: "visible",
}}
>
<Container maxWidth="xl">
<Toolbar
disableGutters
sx={{ height: 76, justifyContent: "space-between", overflow: "visible" }}
>
{/* Logo */}
<Link
href="/"
style={{ display: "flex", alignItems: "center", gap: "0.9rem", textDecoration: "none" }}
>
<div className="logo-img-wrap">
<img
src={logoPath}
alt="Mani Candles Co. Logo"
style={{ width: "100%", height: "100%", objectFit: "cover" }}
/>
</div>
<span className="logo-text">Mani Candles</span>
</Link>
{/* Desktop Nav */}
<Box
component="nav"
sx={{
display: { xs: "none", md: "flex" },
gap: 2,
alignItems: "center",
overflow: "visible",
position: "relative",
}}
>
{NAV_LINKS.map((link) => (
<div className="nav-item" key={link.path + link.name}>
<Link
href={link.path}
className={`nav-link${location === link.path ? " active" : ""}`}
>
{link.name}
{link.dropdown && <ChevronDown size={13} className="nav-chevron" />}
</Link>
{/* Dropdown */}
{link.dropdown && (
<div className="nav-dropdown">
{link.dropdown.map((item, idx) =>
item === null ? (
<div key={`div-${idx}`} className="dropdown-divider" />
) : (
<Link key={item.label} href={item.path} className="dropdown-item">
{item.label}
</Link>
)
)}
</div>
)}
</div>
))}
</Box>
{/* Mobile Toggle */}
<IconButton
aria-label={mobileMenuOpen ? "Close navigation" : "Open navigation"}
aria-expanded={mobileMenuOpen}
aria-controls="mobile-navigation"
sx={{ display: { md: "none" }, color: "#ffffff" }}
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
>
{mobileMenuOpen ? <X size={26} /> : <Menu size={26} />}
</IconButton>
</Toolbar>
</Container>
{/* Mobile Drawer */}
<AnimatePresence>
{mobileMenuOpen && (
<motion.div
initial={{ opacity: 0, height: 0 }}
animate={{ opacity: 1, height: "auto" }}
exit={{ opacity: 0, height: 0 }}
className="mobile-menu"
id="mobile-navigation"
>
{NAV_LINKS.map((link) => (
<div className="mobile-nav-section" key={link.name}>
{link.dropdown ? (
<>
<button
className={`mobile-nav-link${location === link.path ? " active" : ""}`}
style={{ background: "none", border: "none", textAlign: "left", cursor: "pointer", width: "100%", display: "flex", justifyContent: "space-between", alignItems: "center" }}
onClick={() => setMobileOpenSection(mobileOpenSection === link.name ? null : link.name)}
aria-expanded={mobileOpenSection === link.name}
>
{link.name}
<ChevronDown
size={14}
style={{
transition: "transform 0.25s ease",
transform: mobileOpenSection === link.name ? "rotate(180deg)" : "rotate(0deg)",
opacity: 0.7,
}}
/>
</button>
<AnimatePresence>
{mobileOpenSection === link.name && (
<motion.div
initial={{ opacity: 0, height: 0 }}
animate={{ opacity: 1, height: "auto" }}
exit={{ opacity: 0, height: 0 }}
className="mobile-dropdown-items"
>
{link.dropdown.map((item, i) =>
item === null ? (
<div key={i} style={{ height: 1, background: "rgba(255,255,255,0.07)", margin: "0.2rem 0" }} />
) : (
<Link key={item.label} href={item.path} className="mobile-dropdown-item">
{item.label}
</Link>
)
)}
</motion.div>
)}
</AnimatePresence>
</>
) : (
<Link
href={link.path}
className={`mobile-nav-link${location === link.path ? " active" : ""}`}
>
{link.name}
</Link>
)}
</div>
))}
</motion.div>
)}
</AnimatePresence>
</AppBar>
{/* ── Page Content — offset for ticker + appbar ── */}
<Box component="main" id="main-content" tabIndex={-1} sx={{ flexGrow: 1, pt: "112px" }}>
<AnimatePresence mode="wait">
<motion.div
key={location}
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -20 }}
transition={{ duration: 0.5, ease: "easeOut" }}
>
{children}
</motion.div>
</AnimatePresence>
</Box>
{/* ── Scroll Candle ── */}
<ScrollCandle />
{/* ── Footer ── */}
<footer className="site-footer">
<div className="footer-inner">
<div className="footer-col">
<div style={{ display: "flex", alignItems: "center", gap: "1rem" }}>
<div style={{ width: 56, height: 56, borderRadius: "50%", overflow: "hidden", background: "#fff", padding: 3 }}>
<img
src={logoPath}
alt="Mani Candles Co."
style={{ width: "100%", height: "100%", objectFit: "cover", borderRadius: "50%" }}
/>
</div>
<span className="font-script" style={{ fontSize: "2rem", color: "var(--brand-gold-light)" }}>
Mani Candles
</span>
</div>
<p className="footer-tagline">Handmade • Natural • Heartmade</p>
</div>
<div className="footer-col">
<h4 className="footer-heading">Explore</h4>
{NAV_LINKS.map((link) => (
<Link key={link.path + link.name} href={link.path} className="footer-link">
{link.name}
</Link>
))}
</div>
<div className="footer-col">
<h4 className="footer-heading">Connect</h4>
<div style={{ display: "flex", gap: "0.75rem" }}>
<span className="social-btn" aria-label="Instagram link pending"><Instagram size={18} /></span>
<span className="social-btn" aria-label="Facebook link pending"><Facebook size={18} /></span>
<span className="social-btn" aria-label="Twitter link pending"><Twitter size={18} /></span>
</div>
<p className="footer-copy">
© {new Date().getFullYear()} Mani Candles Co. All rights reserved.
</p>
</div>
</div>
</footer>
</Box>
);
}

View File

@ -1,73 +0,0 @@
import { useState } from "react";
import { z } from "zod";
import Checkbox from "@mui/material/Checkbox";
import { usePlatform } from "@/lib/platform";
import { Pager, QueryView, Table, usePrivateQuery } from "./WorkspaceTools";
const record = z.object({
id: z.string().uuid(),
name: z.string(),
isSystem: z.boolean().optional(),
permissions: z.array(z.string()).optional(),
});
export function RecordSelection({
name,
label,
path,
initial = [],
roles = false,
}: {
name: string;
label: string;
path: string;
initial?: string[];
roles?: boolean;
}) {
const { principal } = usePlatform();
const [selected, setSelected] = useState(initial),
[offset, setOffset] = useState(0);
const query = usePrivateQuery(
`${path}?limit=25&offset=${offset}`,
z.array(record),
);
return (
<fieldset className="record-picker">
<legend>{label}</legend>
<p>{selected.length} selected. Selections are retained across pages.</p>
{selected.map((id) => (
<input key={id} type="hidden" name={name} value={id} />
))}
<QueryView query={query}>
{(items) => (
<>
<Table
head={["Select", "Name"]}
rowKeys={items.map((item) => item.id)}
rows={items.map((item) => [
<Checkbox
inputProps={{ "aria-label": `Select ${item.name}` }}
checked={selected.includes(item.id)}
disabled={
roles &&
(item.isSystem ||
item.permissions?.some(
(p) => !principal?.permissions.includes(p),
))
}
onChange={(_, checked) =>
setSelected((ids) =>
checked
? [...ids, item.id]
: ids.filter((id) => id !== item.id),
)
}
/>,
item.name,
])}
/>
<Pager offset={offset} count={items.length} onPage={setOffset} />
</>
)}
</QueryView>
</fieldset>
);
}

View File

@ -1,291 +0,0 @@
/* ─── ScrollCandle.css ───────────────────────────────────── */
.scroll-candle-wrap {
position: fixed;
right: 28px;
bottom: 0px;
z-index: 999;
display: flex;
flex-direction: column;
align-items: center;
pointer-events: none;
filter: drop-shadow(0 0 18px rgba(255, 160, 40, 0.35));
}
/* */
/* ── FLAME SYSTEM ─────────────────────────────────── */
.candle-flame-wrap {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: -2px;
}
/* Outer glow halo */
.flame-glow {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 48px;
height: 48px;
border-radius: 50%;
background: radial-gradient(circle, rgba(255, 200, 50, 0.45) 0%, transparent 70%);
animation: glow-pulse 1.8s ease-in-out infinite alternate;
z-index: 0;
}
@keyframes glow-pulse {
0% {
transform: translateX(-50%) scale(1);
opacity: 0.7;
}
100% {
transform: translateX(-50%) scale(1.35);
opacity: 1;
}
}
/* Flame outer — large orange teardrop */
.flame-outer {
position: relative;
z-index: 2;
width: 18px;
height: 34px;
background: linear-gradient(to top, #ff6a00, #ffaa00, #ffe066);
border-radius: 50% 50% 30% 30% / 60% 60% 40% 40%;
transform-origin: bottom center;
animation: flicker-outer 0.9s ease-in-out infinite alternate;
box-shadow:
0 0 8px 3px rgba(255, 140, 0, 0.6),
0 0 18px 6px rgba(255, 100, 0, 0.4);
}
@keyframes flicker-outer {
0% {
transform: scaleX(1) scaleY(1) rotate(-2deg);
}
25% {
transform: scaleX(0.88) scaleY(1.05) rotate(2deg);
}
50% {
transform: scaleX(1.05) scaleY(0.95) rotate(-1deg);
}
75% {
transform: scaleX(0.92) scaleY(1.08) rotate(3deg);
}
100% {
transform: scaleX(1.02) scaleY(1.02) rotate(-2deg);
}
}
/* Flame inner — bright white-yellow core */
.flame-inner {
position: absolute;
bottom: 4px;
left: 50%;
transform: translateX(-50%);
z-index: 3;
width: 8px;
height: 18px;
background: linear-gradient(to top, #fff8c5, #fff, rgba(255, 255, 255, 0));
border-radius: 50% 50% 30% 30% / 60% 60% 40% 40%;
animation: flicker-inner 0.7s ease-in-out infinite alternate;
opacity: 0.9;
}
@keyframes flicker-inner {
0% {
transform: translateX(-50%) scaleX(1) scaleY(1);
}
50% {
transform: translateX(-50%) scaleX(0.85) scaleY(1.1);
}
100% {
transform: translateX(-50%) scaleX(1.1) scaleY(0.9);
}
}
/* ── SMOKE PARTICLES ─────────────────────────────── */
.smoke-wrap {
position: absolute;
top: -18px;
left: 50%;
transform: translateX(-50%);
width: 20px;
height: 20px;
pointer-events: none;
z-index: 4;
}
.smoke-particle {
position: absolute;
bottom: 0;
left: 50%;
width: 4px;
height: 4px;
border-radius: 50%;
background: rgba(200, 180, 220, 0.45);
transform: translateX(-50%);
animation: smoke-rise 2.4s ease-out infinite;
opacity: 0;
}
.smoke-particle:nth-child(2) {
animation-delay: 0.8s;
left: 40%;
}
.smoke-particle:nth-child(3) {
animation-delay: 1.6s;
left: 60%;
}
@keyframes smoke-rise {
0% {
transform: translateX(-50%) translateY(0) scale(0.6);
opacity: 0;
}
20% {
opacity: 0.5;
}
100% {
transform: translateX(-50%) translateY(-22px) scale(2);
opacity: 0;
}
}
/* ── WICK ──────────────────────────────────────────── */
.candle-wick {
width: 2px;
height: 8px;
background: linear-gradient(to bottom, #3a2000, #1a0f00);
border-radius: 1px;
position: relative;
z-index: 2;
margin-bottom: -1px;
}
/* ── CANDLE BODY ──────────────────────────────────── */
.candle-body {
position: relative;
width: 22px;
background: linear-gradient(to right,
#e8dcc8 0%,
#fdf6e3 25%,
#fff9f0 50%,
#fdf6e3 75%,
#d9cbb5 100%);
border-radius: 3px 3px 4px 4px;
transition: height 0.18s linear;
box-shadow:
inset -3px 0 6px rgba(0, 0, 0, 0.1),
inset 3px 0 4px rgba(255, 255, 255, 0.4);
overflow: visible;
}
/* Candle top melted rim */
.candle-body::before {
content: '';
position: absolute;
top: -3px;
left: -2px;
right: -2px;
height: 6px;
background: radial-gradient(ellipse at center, #ffe8b0 0%, #e8d5a0 100%);
border-radius: 50%;
z-index: 1;
}
/* ── WAX DRIPS ──────────────────────────────────────── */
.wax-drip {
position: absolute;
top: 2px;
width: 5px;
background: linear-gradient(to bottom, rgba(253, 246, 227, 0.95), rgba(232, 220, 200, 0.6));
border-radius: 0 0 4px 4px;
animation: drip-grow 4s ease-in-out infinite;
}
.wax-drip-1 {
left: -3px;
height: 14px;
animation-delay: 0s;
animation-duration: 4.5s;
}
.wax-drip-2 {
right: -3px;
height: 10px;
animation-delay: 1.2s;
animation-duration: 3.8s;
}
.wax-drip-3 {
left: 2px;
height: 18px;
animation-delay: 2.5s;
animation-duration: 5.2s;
}
@keyframes drip-grow {
0% {
height: 6px;
opacity: 0.7;
}
60% {
height: 20px;
opacity: 1;
}
100% {
height: 6px;
opacity: 0.7;
}
}
/* ── CANDLE BASE / HOLDER ────────────────────────── */
.candle-base {
width: 32px;
height: 10px;
background: linear-gradient(to bottom, #c8a96e, #a07840);
border-radius: 3px 3px 6px 6px;
box-shadow:
0 3px 8px rgba(0, 0, 0, 0.3),
inset 0 1px 2px rgba(255, 200, 100, 0.4);
position: relative;
}
/* Holder shine */
.candle-base::after {
content: '';
position: absolute;
top: 2px;
left: 5px;
width: 8px;
height: 3px;
background: rgba(255, 220, 140, 0.4);
border-radius: 50%;
}
/* ── SCROLL LABEL ───────────────────────────────── */
.candle-scroll-label {
margin-top: 6px;
font-family: var(--font-script);
font-size: 0.68rem;
color: rgba(212, 162, 76, 0.7);
letter-spacing: 0.05em;
white-space: nowrap;
text-align: center;
transition: opacity 0.3s ease;
}

View File

@ -1,99 +0,0 @@
import { useEffect, useState } from "react";
import "./ScrollCandle.css";
// Space taken by flame + wick + base + label + bottom offset + header (ticker 36 + AppBar 76) + safety gap
const NON_BODY_HEIGHT = 70 + 8 + 10 + 24 + 40 + 112 + 16;
const CANDLE_MIN_HEIGHT = 14; // px — almost fully melted
//
export function ScrollCandle() {
const [maxHeight, setMaxHeight] = useState(
() => Math.max(200, window.innerHeight - NON_BODY_HEIGHT)
);
const [candleHeight, setCandleHeight] = useState(
() => Math.max(200, window.innerHeight - NON_BODY_HEIGHT)
);
const [scrollPct, setScrollPct] = useState(0);
// Recalculate on resize
useEffect(() => {
const onResize = () => {
const newMax = Math.max(200, window.innerHeight - NON_BODY_HEIGHT);
setMaxHeight(newMax);
};
window.addEventListener("resize", onResize);
return () => window.removeEventListener("resize", onResize);
}, []);
useEffect(() => {
const handleScroll = () => {
const scrollTop = window.scrollY;
const docHeight = document.documentElement.scrollHeight - window.innerHeight;
const pct = docHeight > 0 ? Math.min(scrollTop / docHeight, 1) : 0;
setScrollPct(pct);
setCandleHeight(
Math.max(CANDLE_MIN_HEIGHT, maxHeight - pct * (maxHeight - CANDLE_MIN_HEIGHT))
);
};
window.addEventListener("scroll", handleScroll, { passive: true });
return () => window.removeEventListener("scroll", handleScroll);
}, [maxHeight]);
// Flame shrinks slightly as candle melts
const flameScale = 0.6 + (candleHeight / maxHeight) * 0.4;
// Label changes as candle melts
const label =
scrollPct < 0.15 ? "just lit" :
scrollPct < 0.45 ? "burning..." :
scrollPct < 0.75 ? "melting..." :
scrollPct < 0.92 ? "almost gone" :
"★ keep scrolling";
return (
<div className="scroll-candle-wrap" aria-hidden="true">
{/* ── Flame ── */}
<div
className="candle-flame-wrap"
style={{ transform: `scale(${flameScale})`, transformOrigin: "bottom center" }}
>
{/* Smoke */}
<div className="smoke-wrap">
<div className="smoke-particle" />
<div className="smoke-particle" />
<div className="smoke-particle" />
</div>
{/* Glow halo */}
<div className="flame-glow" />
{/* Outer flame */}
<div className="flame-outer">
{/* Inner core */}
<div className="flame-inner" />
</div>
</div>
{/* ── Wick ── */}
<div className="candle-wick" />
{/* ── Candle Body (shrinks on scroll) ── */}
<div className="candle-body" style={{ height: candleHeight }}>
<div className="wax-drip wax-drip-1" />
<div className="wax-drip wax-drip-2" />
<div className="wax-drip wax-drip-3" />
</div>
{/* ── Base / Holder ── */}
<div className="candle-base" />
{/* ── Label ── */}
<p
className="candle-scroll-label"
style={{ opacity: scrollPct > 0.02 ? 1 : 0 }}
>
{label}
</p>
</div>
);
}

View File

@ -1,30 +0,0 @@
import { useRef, useState } from "react";
import Button from "@mui/material/Button";
import { Field } from "./WorkspaceTools";
export function readVariantQuantities(form: FormData) {
const quantities = form.getAll("quantity");
return form.getAll("variantId").map((id, index) => ({
variantId: String(id).trim(),
quantity: Number(quantities[index]),
}));
}
export function VariantQuantityFields({ options }: { options?: { value: string; label: string }[] }) {
const next = useRef(1);
const [rows, setRows] = useState([0]);
const limit = Math.min(100, options?.length ?? 100);
return <>
{rows.map((key, index) => <fieldset className="record-picker" key={key}>
<legend>Line {index + 1}</legend>
<Field name="variantId" label={`Variant for line ${index + 1}`} maxLength={36}
options={options && [{ value: "", label: "Choose a variant" }, ...options]} />
<Field name="quantity" label={`Quantity for line ${index + 1}`} type="number" />
<Button type="button" disabled={rows.length === 1} onClick={() => setRows(rows.filter((row) => row !== key))}>Remove line {index + 1}</Button>
</fieldset>)}
<Button type="button" disabled={rows.length >= limit} onClick={() => {
const key = next.current++;
setRows([...rows, key]);
}}>Add line</Button>
</>;
}

View File

@ -1,37 +0,0 @@
import { useState, type ReactNode } from "react";
import Alert from "@mui/material/Alert";
import { z } from "zod";
import { ActionForm, Field, Pager, QueryView, readText, usePrivateQuery } from "@/components/WorkspaceTools";
import { warehouse } from "@/lib/commerce";
export function WarehousePostingForm({ label, instruction, warehouseLabel = "Warehouse", excludeWarehouseId, read, children, reset = false, submit }: {
label: string;
instruction: string;
warehouseLabel?: string;
excludeWarehouseId?: string;
read?: (data: FormData) => unknown;
children?: ReactNode;
reset?: boolean;
submit: (input: unknown) => Promise<void>;
}) {
const [offset, setOffset] = useState(0);
const query = usePrivateQuery(`/inventory/warehouses?limit=25&offset=${offset}`, z.array(warehouse));
return <QueryView query={query}>{(rows) => {
const options = rows.filter((row) => row.id !== excludeWarehouseId);
return <>
{options.length ? <ActionForm key={offset} label={label} reset={reset}
read={read ?? ((data) => ({ warehouseId: readText(data, "warehouseId") }))} submit={submit}>
<p>{instruction}</p>
<Field name="warehouseId" label={warehouseLabel} options={[
{ value: "", label: "Choose a warehouse" },
...options.map((row) => ({ value: row.id, label: row.name })),
]} />
{children}
<Pager offset={offset} count={rows.length} onPage={setOffset} />
</ActionForm> : <>
<Alert severity="info">No eligible warehouses on this page.</Alert>
{(offset > 0 || rows.length === 25) && <Pager offset={offset} count={rows.length} onPage={setOffset} />}
</>}
</>;
}}</QueryView>;
}

View File

@ -1,93 +0,0 @@
import type { ReactNode } from "react";
import { Link } from "wouter";
import Container from "@mui/material/Container";
import Alert from "@mui/material/Alert";
import Button from "@mui/material/Button";
import { usePlatform } from "@/lib/platform";
import "@/pages/workspace.css";
export function WorkspaceShell({
title,
permission,
children,
}: {
title: string;
permission?: string;
children: ReactNode;
}) {
const { principal, can, scope } = usePlatform();
return (
<section className="workspace-page">
<Container maxWidth="lg">
<h1>{title}</h1>
{!principal ? (
<Alert severity="info">
Sign in to continue.{" "}
<Link href="/workspace">
<u>Account sign-in</u>
</Link>
</Alert>
) : (
<>
<WorkspaceNavigation />
{permission && !can(permission) ? (
<Alert severity="warning">
Your account does not have permission to view this page.
</Alert>
) : (
<div key={scope}>{children}</div>
)}
</>
)}
</Container>
</section>
);
}
export function WorkspaceNavigation() {
const { can } = usePlatform();
const links = [
{ label: "My cart", path: "/cart" },
{ label: "Addresses", path: "/addresses" },
{ label: "My orders", path: "/orders" },
{ label: "Access", path: "/admin/access", permission: "users.read" },
{ label: "Roles", path: "/admin/roles", permission: "roles.read" },
{ label: "Catalog", path: "/admin/catalog", permission: "catalog.read" },
{
label: "Inventory",
path: "/admin/inventory",
permission: "inventory.read",
},
{ label: "Coupons", path: "/admin/coupons", permission: "coupons.manage" },
{ label: "Suppliers", path: "/admin/procurement", permission: "procurement.read" },
{ label: "Supplier documents", path: "/admin/supplier-documents", permission: "supplier_document.read" },
{ label: "Materials", path: "/admin/procurement/materials", permission: "procurement.read" },
{ label: "Purchase orders", path: "/admin/purchase-orders", permission: "procurement.read" },
{ label: "Material stock", path: "/admin/material-stock", permission: "inventory.read" },
{ label: "Material cost rates", path: "/admin/material-cost-rates", permission: "cost.read" },
{ label: "Production BOMs", path: "/admin/boms", permission: "bom.read" },
{ label: "Production batches", path: "/admin/production-batches", permission: "production.read" },
{ label: "Packaging BOMs", path: "/admin/packaging-boms", permission: "packaging.read" },
{ label: "Pricing", path: "/admin/pricing", permission: "pricing.manage" },
{ label: "All orders", path: "/admin/orders", permission: "orders.read" },
{ label: "Audit", path: "/admin/audit", permission: "audit.read" },
{ label: "Business accounts", path: "/admin/business-accounts", permission: "b2b.read" },
{ label: "B2B price lists", path: "/admin/b2b-price-lists", permission: "b2b.price.read" },
{ label: "B2B quotations", path: "/admin/b2b-quotes", permission: "b2b.quote.read" },
{ label: "B2B credit policies", path: "/admin/b2b-credit-policies", permission: "b2b.credit.read" },
{ label: "B2B samples", path: "/admin/b2b-samples", permission: "b2b.sample.read" },
{ label: "B2B artwork", path: "/admin/b2b-artwork", permission: "b2b.artwork.read" },
{ label: "B2B partner orders", path: "/admin/b2b-partner-orders", permission: "b2b.order.read" },
{ label: "B2B partner payments", path: "/admin/b2b-payments", permission: "b2b.payment.read" },
];
return (
<nav className="workspace-links" aria-label="Workspace navigation">
{links
.filter((l) => !l.permission || can(l.permission))
.map((l) => (
<Button key={l.path} component={Link} href={l.path}>
{l.label}
</Button>
))}
</nav>
);
}

View File

@ -1,286 +0,0 @@
import {
createContext,
useContext,
useId,
useRef,
useState,
type ReactNode,
} from "react";
import { Link } from "wouter";
import { useQuery, type UseQueryResult } from "@tanstack/react-query";
import { z } from "zod";
import Alert from "@mui/material/Alert";
import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField";
import Checkbox from "@mui/material/Checkbox";
import FormControlLabel from "@mui/material/FormControlLabel";
import LinearProgress from "@mui/material/LinearProgress";
import Paper from "@mui/material/Paper";
import { usePlatform } from "@/lib/platform";
import { ApiNotice } from "./ApiNotice";
export function usePrivateQuery<T>(path: string, schema: z.ZodType<T>) {
const { scope, request } = usePlatform();
return useQuery({
queryKey: ["private", scope, path],
queryFn: ({ signal }) => request(path, schema, { signal }),
enabled: Boolean(scope),
retry: false,
});
}
export function QueryView<T>({
query,
children,
}: {
query: UseQueryResult<T>;
children: (data: T) => ReactNode;
}) {
if (query.isPending) return <LinearProgress aria-label="Loading workspace" />;
if (query.isError)
return (
<>
<ApiNotice error={query.error} />
<Button onClick={() => query.refetch()}>Try again</Button>
</>
);
return <>{children(query.data)}</>;
}
export function Panel({
title,
children,
}: {
title: string;
children: ReactNode;
}) {
return (
<Paper variant="outlined" className="workspace-panel">
<h2>{title}</h2>
{children}
</Paper>
);
}
const Errors = createContext<Record<string, string>>({});
export function ActionForm({
label,
read,
submit,
children,
reset = true,
lockFields = false,
}: {
label: string;
read: (data: FormData) => unknown;
submit: (input: unknown) => Promise<unknown>;
children: ReactNode;
reset?: boolean;
lockFields?: boolean;
}) {
const [busy, setBusy] = useState(false),
[error, setError] = useState<unknown>(null),
[success, setSuccess] = useState(false),
[fields, setFields] = useState<Record<string, string>>({});
const submitting = useRef(false);
return (
<form
className="workspace-form"
aria-label={label}
onSubmit={async (event) => {
event.preventDefault();
if (submitting.current) return;
submitting.current = true;
const form = event.currentTarget;
setBusy(true);
setError(null);
setSuccess(false);
setFields({});
try {
await submit(read(new FormData(form)));
if (reset) form.reset();
setSuccess(true);
} catch (error) {
if (error instanceof z.ZodError) {
setFields(
Object.fromEntries(
error.issues.map((i) => [String(i.path[0]), i.message]),
),
);
setError(
new Error(
error.issues
.map((issue) => `${issue.path.join(".")}: ${issue.message}`)
.join("; "),
),
);
} else setError(error);
} finally {
submitting.current = false;
setBusy(false);
}
}}
>
<fieldset disabled={busy || lockFields}>
<Errors.Provider value={fields}>{children}</Errors.Provider>
</fieldset>
<ApiNotice error={error} />
{success && <Alert severity="success">Saved successfully.</Alert>}
<Button type="submit" variant="contained" disabled={busy}>
{busy ? "Saving…" : label}
</Button>
</form>
);
}
export function Field({
name,
label,
type = "text",
value,
required = true,
maxLength,
options,
multiple = false,
helper,
onChange,
}: {
name: string;
label: string;
type?: string;
value?: string | number | string[];
required?: boolean;
maxLength?: number;
options?: { value: string; label: string }[];
multiple?: boolean;
helper?: string;
onChange?: (value: string) => void;
}) {
const errors = useContext(Errors),
id = useId();
return (
<TextField
id={id}
name={name}
label={label}
type={type}
defaultValue={onChange ? undefined : (value ?? (multiple ? [] : ""))}
value={onChange ? value : undefined}
onChange={onChange ? (event) => onChange(event.target.value) : undefined}
autoComplete={type === "password" ? "new-password" : undefined}
required={required}
fullWidth
error={Boolean(errors[name])}
helperText={errors[name] || helper}
inputProps={{ maxLength }}
select={Boolean(options)}
InputLabelProps={multiple ? { shrink: true } : undefined}
SelectProps={options ? { native: true, multiple } : undefined}
>
{options && (
<>
{!required && !multiple && <option value="">None</option>}
{options.map((o) => (
<option key={o.value} value={o.value}>
{o.label}
</option>
))}
</>
)}
</TextField>
);
}
export function Check({
name,
label,
value = false,
}: {
name: string;
label: string;
value?: boolean;
}) {
return (
<FormControlLabel
control={<Checkbox name={name} defaultChecked={value} />}
label={label}
/>
);
}
export const readText = (data: FormData, name: string) =>
String(data.get(name) ?? "");
export const readNumber = (data: FormData, name: string) =>
Number(data.get(name));
export function Pager({
offset,
count,
onPage,
}: {
offset: number;
count: number;
onPage: (offset: number) => void;
}) {
return (
<div className="catalog-pagination">
<Button
disabled={!offset}
onClick={() => onPage(Math.max(0, offset - 25))}
>
Previous
</Button>
<span>Page {offset / 25 + 1}</span>
<Button
disabled={count < 25 || offset + 25 > 10000}
onClick={() => onPage(offset + 25)}
>
Next
</Button>
</div>
);
}
export function Empty({ label = "No records yet." }: { label?: string }) {
return <Alert severity="info">{label}</Alert>;
}
export function Table({
head,
rows,
rowKeys,
}: {
head: string[];
rows: ReactNode[][];
rowKeys: string[];
}) {
return rows.length ? (
<div className="workspace-table">
<table>
<thead>
<tr>
{head.map((h) => (
<th key={h} scope="col">
{h}
</th>
))}
</tr>
</thead>
<tbody>
{rows.map((row, index) => (
<tr key={rowKeys[index]}>
{row.map((cell, i) => (
<td key={i}>{cell}</td>
))}
</tr>
))}
</tbody>
</table>
</div>
) : (
<Empty />
);
}
export function WorkspaceLink({
href,
children,
}: {
href: string;
children: ReactNode;
}) {
return (
<Link href={href}>
<u>{children}</u>
</Link>
);
}

View File

@ -0,0 +1,58 @@
import React, { useState, useEffect } from 'react';
import { Box, Typography } from '@mui/material';
const messages = [
'Free complimentary shipping across India on B2C orders above ₹999',
'Corporate Gifting & Wedding return favors: Custom branding & wholesale prices available',
'Design your own olfactory signature with our Custom Candle Builder',
'Sustainable luxury: 100% natural hand-poured soy wax candles'
];
export const AnnouncementBar: React.FC = () => {
const [currentMessageIndex, setCurrentMessageIndex] = useState(0);
const [fade, setFade] = useState(true);
useEffect(() => {
const rotateInterval = setInterval(() => {
setFade(false);
setTimeout(() => {
setCurrentMessageIndex((prevIndex) => (prevIndex + 1) % messages.length);
setFade(true);
}, 500); // match transition duration
}, 5000);
return () => clearInterval(rotateInterval);
}, []);
return (
<Box
sx={{
backgroundColor: 'secondary.main',
color: '#F5EFEB',
py: 0.8,
px: 2,
textAlign: 'center',
position: 'relative',
zIndex: 1201,
borderBottom: '1px solid rgba(255, 255, 255, 0.05)'
}}
>
<Typography
variant="caption"
sx={{
display: 'block',
fontSize: '0.75rem',
letterSpacing: '0.08em',
fontWeight: 400,
textTransform: 'uppercase',
opacity: fade ? 1 : 0,
transition: 'opacity 0.5s ease-in-out',
}}
>
{messages[currentMessageIndex]}
</Typography>
</Box>
);
};
export default AnnouncementBar;

View File

@ -0,0 +1,63 @@
import React from 'react';
import { Breadcrumbs as MuiBreadcrumbs, Link, Typography, Container, Box } from '@mui/material';
import { Link as RouterLink, useLocation } from 'react-router-dom';
import { IoIosArrowForward } from 'react-icons/io';
export const Breadcrumbs: React.FC = () => {
const location = useLocation();
const pathnames = location.pathname.split('/').filter((x) => x);
// Don't show breadcrumbs on homepage
if (pathnames.length === 0) return null;
return (
<Box sx={{ py: 2, backgroundColor: 'background.default', borderBottom: '1px solid rgba(230, 223, 213, 0.4)' }}>
<Container maxWidth="lg">
<MuiBreadcrumbs
separator={<IoIosArrowForward size={10} style={{ color: '#8E7557' }} />}
aria-label="breadcrumb"
>
<Link
component={RouterLink}
to="/"
underline="hover"
color="text.secondary"
sx={{ fontSize: '0.8rem', letterSpacing: '0.05em', '&:hover': { color: 'primary.main' } }}
>
Home
</Link>
{pathnames.map((value, index) => {
const last = index === pathnames.length - 1;
const to = `/${pathnames.slice(0, index + 1).join('/')}`;
const displayName = value
.replace(/-/g, ' ')
.replace(/\b\w/g, (c) => c.toUpperCase()); // Capitalize first letters
return last ? (
<Typography
key={to}
color="text.primary"
sx={{ fontSize: '0.8rem', letterSpacing: '0.05em', fontWeight: 500 }}
>
{displayName}
</Typography>
) : (
<Link
key={to}
component={RouterLink}
to={to}
underline="hover"
color="text.secondary"
sx={{ fontSize: '0.8rem', letterSpacing: '0.05em', '&:hover': { color: 'primary.main' } }}
>
{displayName}
</Link>
);
})}
</MuiBreadcrumbs>
</Container>
</Box>
);
};
export default Breadcrumbs;

View File

@ -0,0 +1,256 @@
import React, { useState } from 'react';
import {
Drawer,
Box,
Typography,
IconButton,
List,
ListItem,
ListItemAvatar,
Avatar,
ListItemText,
ListItemSecondaryAction,
Button,
Divider,
Chip,
Dialog,
DialogTitle,
DialogContent,
DialogActions,
} from '@mui/material';
import { MdClose, MdOutlineDeleteOutline, MdAdd, MdRemove } from 'react-icons/md';
import { MdOutlineShoppingBag } from 'react-icons/md';
import { useCart } from '../../contexts/CartContext';
import { formatCurrency } from '../../utils/helpers';
import { useNavigate } from 'react-router-dom';
export const CartDrawer: React.FC = () => {
const navigate = useNavigate();
const { cartItems, isCartOpen, setIsCartOpen, removeFromCart, updateQuantity, cartTotal, clearCart } = useCart();
const [checkoutSuccess, setCheckoutSuccess] = useState(false);
const handleCheckout = () => {
// Simulate checkout action
setCheckoutSuccess(true);
};
const handleFinishCheckout = () => {
clearCart();
setCheckoutSuccess(false);
setIsCartOpen(false);
navigate('/');
};
return (
<>
<Drawer
anchor="right"
open={isCartOpen}
onClose={() => setIsCartOpen(false)}
disableScrollLock
slotProps={{ paper: { sx: {
width: { xs: '100%', sm: 440 },
backgroundColor: 'background.default',
} } }}
>
{/* Drawer Header */}
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', p: 3, borderBottom: '1px solid #E6DFD5' }}>
<Typography variant="h6" sx={{ fontFamily: 'Cormorant Garamond', fontWeight: 600, letterSpacing: '0.05em' }}>
Shopping Cart ({cartItems.length})
</Typography>
<IconButton onClick={() => setIsCartOpen(false)}>
<MdClose size={24} />
</IconButton>
</Box>
{/* Drawer Content */}
<Box sx={{ flex: 1, overflowY: 'auto', p: 3 }}>
{cartItems.length === 0 ? (
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', textAlign: 'center', py: 8 }}>
<MdOutlineShoppingBag size={48} style={{ color: '#C5A880', marginBottom: 16 }} />
<Typography variant="subtitle1" sx={{ fontWeight: 500, mb: 1 }}>
Your cart is empty
</Typography>
<Typography variant="body2" color="text.secondary" sx={{ mb: 4, px: 4, lineHeight: 1.6 }}>
Add items to your cart from our shop or design a personalized blend in the custom workspace.
</Typography>
<Button
variant="outlined"
color="primary"
onClick={() => {
setIsCartOpen(false);
navigate('/shop');
}}
sx={{ px: 4 }}
>
Go to Shop
</Button>
</Box>
) : (
<List disablePadding>
{cartItems.map((item, index) => {
const isB2B = item.mode === 'B2B';
const unitPrice = isB2B ? item.product.b2bPrice : item.product.price;
return (
<React.Fragment key={`${item.product.id}-${item.mode}-${index}`}>
<ListItem alignItems="flex-start" sx={{ px: 0, py: 2.5 }}>
<ListItemAvatar sx={{ mr: 2 }}>
<Avatar
src={item.product.images[0]}
variant="rounded"
sx={{ width: 80, height: 80, border: '1px solid #E6DFD5' }}
/>
</ListItemAvatar>
<ListItemText
primary={
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, alignItems: 'center', mb: 0.5 }}>
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}>
{item.product.name}
</Typography>
<Chip
label={isB2B ? 'Wholesale (B2B)' : 'Retail'}
size="small"
variant="outlined"
color={isB2B ? 'primary' : 'default'}
sx={{ height: 18, fontSize: '0.65rem', borderRadius: 1 }}
/>
</Box>
}
secondary={
<Box>
{/* Render customizations if custom candle */}
{item.customizations && (
<Box
sx={{
backgroundColor: 'rgba(142, 117, 87, 0.04)',
p: 1,
borderRadius: 1.5,
border: '1px dashed #C5A880',
my: 1,
fontSize: '0.75rem',
}}
>
<Typography variant="caption" color="text.secondary" sx={{ display: 'block' }}>
<strong>Jar:</strong> {item.customizations.jar} | <strong>Wax:</strong> {item.customizations.wax}
</Typography>
<Typography variant="caption" color="text.secondary" sx={{ display: 'block' }}>
<strong>Blend:</strong> {item.customizations.scentBlend}
</Typography>
{item.customizations.labelText && (
<Typography variant="caption" color="text.secondary" sx={{ display: 'block' }}>
<strong>Label Text:</strong> "{item.customizations.labelText}" ({item.customizations.labelFont})
</Typography>
)}
</Box>
)}
<Typography variant="body2" color="primary" sx={{ fontWeight: 500, mb: 1.5 }}>
{formatCurrency(unitPrice)} each
</Typography>
{/* Quantity Selector */}
<Box sx={{ display: 'flex', alignItems: 'center', border: '1px solid #E6DFD5', borderRadius: '50px', width: 90, px: 0.5 }}>
<IconButton
size="small"
onClick={() => updateQuantity(item.product.id, item.quantity - 1, item.mode)}
sx={{ p: 0.5 }}
>
<MdRemove size={14} />
</IconButton>
<Typography variant="body2" sx={{ flex: 1, textAlign: 'center', fontWeight: 600 }}>
{item.quantity}
</Typography>
<IconButton
size="small"
onClick={() => updateQuantity(item.product.id, item.quantity + 1, item.mode)}
sx={{ p: 0.5 }}
>
<MdAdd size={14} />
</IconButton>
</Box>
</Box>
}
/>
<ListItemSecondaryAction sx={{ top: 20 }}>
<IconButton
size="small"
onClick={() => removeFromCart(item.product.id, item.mode)}
sx={{ color: 'text.secondary', '&:hover': { color: 'error.main' } }}
>
<MdOutlineDeleteOutline size={20} />
</IconButton>
</ListItemSecondaryAction>
</ListItem>
<Divider sx={{ borderColor: 'rgba(230, 223, 213, 0.5)' }} />
</React.Fragment>
);
})}
</List>
)}
</Box>
{/* Drawer Footer Summary */}
{cartItems.length > 0 && (
<Box sx={{ p: 3, borderTop: '1px solid #E6DFD5', backgroundColor: '#FFFDFB' }}>
<Box sx={{ display: 'flex', justifyContent: 'space-between', mb: 2 }}>
<Typography variant="subtitle1" sx={{ fontWeight: 600 }}>
Subtotal
</Typography>
<Typography variant="subtitle1" color="primary" sx={{ fontWeight: 700 }}>
{formatCurrency(cartTotal)}
</Typography>
</Box>
<Typography variant="caption" color="text.secondary" sx={{ display: 'block', mb: 3 }}>
* Shipping & taxes calculated at checkout. GST invoice option available for B2B orders.
</Typography>
<Button
fullWidth
variant="contained"
color="primary"
onClick={handleCheckout}
sx={{ py: 1.5, mb: 1.5, fontSize: '0.85rem', letterSpacing: '0.1em' }}
>
Proceed to Checkout
</Button>
<Button
fullWidth
variant="text"
onClick={() => setIsCartOpen(false)}
sx={{ color: 'text.secondary', fontSize: '0.8rem' }}
>
Continue Shopping
</Button>
</Box>
)}
</Drawer>
{/* Checkout Simulation Dialog */}
<Dialog open={checkoutSuccess} onClose={handleFinishCheckout} maxWidth="xs" fullWidth>
<DialogTitle sx={{ fontFamily: 'Cormorant Garamond', fontWeight: 700, fontSize: '1.6rem', textAlign: 'center', pt: 4 }}>
Order Initiated
</DialogTitle>
<DialogContent sx={{ textAlign: 'center', px: 4 }}>
<Typography variant="body2" color="text.secondary" sx={{ lineHeight: 1.6, mb: 2 }}>
Thank you for shopping with Mani Candles!
</Typography>
<Typography variant="body2" sx={{ fontWeight: 500, color: 'primary.main', mb: 3 }}>
{cartItems.some(item => item.mode === 'B2B')
? 'Our corporate B2B sales desk is generating a custom GST invoice. We will reach out to you within 2 business hours.'
: 'Your secure B2C payment portal has been verified. A tracking link is dispatched to your registered email.'}
</Typography>
<Typography variant="caption" color="text.secondary" sx={{ display: 'block' }}>
Estimated Delivery: 3-5 Business Days across India.
</Typography>
</DialogContent>
<DialogActions sx={{ justifyContent: 'center', pb: 4 }}>
<Button variant="contained" color="primary" onClick={handleFinishCheckout} sx={{ px: 4 }}>
Return to Store
</Button>
</DialogActions>
</Dialog>
</>
);
};
export default CartDrawer;

View File

@ -0,0 +1,68 @@
import React, { useState, useEffect } from 'react';
import { Box, Typography, Button, Slide } from '@mui/material';
export const CookieConsent: React.FC = () => {
const [open, setOpen] = useState(false);
useEffect(() => {
const consent = localStorage.getItem('mani_candles_cookie_consent');
if (!consent) {
// Show consent after a short delay
const timer = setTimeout(() => setOpen(true), 2000);
return () => clearTimeout(timer);
}
}, []);
const handleAccept = () => {
localStorage.setItem('mani_candles_cookie_consent', 'accepted');
setOpen(false);
};
return (
<Slide direction="up" in={open} mountOnEnter unmountOnExit>
<Box
sx={{
position: 'fixed',
bottom: 24,
left: 24,
right: 24,
maxWidth: { xs: 'calc(100% - 48px)', sm: 480 },
backgroundColor: 'background.paper',
border: '1px solid #E6DFD5',
borderRadius: 3,
boxShadow: '0 8px 30px rgba(0,0,0,0.08)',
p: 3,
zIndex: 2000,
display: 'flex',
flexDirection: 'column',
gap: 2,
}}
>
<Typography variant="body2" sx={{ color: 'text.secondary', lineHeight: 1.5 }}>
We use cookies to elevate your sensory browsing experience, analyze site traffic, and optimize our B2B and B2C services. By accepting, you consent to our privacy terms.
</Typography>
<Box sx={{ display: 'flex', justifyContent: 'flex-end', gap: 1.5 }}>
<Button
size="small"
variant="text"
sx={{ color: 'text.secondary', fontSize: '0.75rem', letterSpacing: '0.05em' }}
onClick={() => setOpen(false)}
>
Decline
</Button>
<Button
size="small"
variant="contained"
color="primary"
sx={{ fontSize: '0.75rem', py: 0.8, px: 2 }}
onClick={handleAccept}
>
Accept & Burn
</Button>
</Box>
</Box>
</Slide>
);
};
export default CookieConsent;

View File

@ -0,0 +1,211 @@
import React, { useState } from 'react';
import { Box, Container, Grid, Typography, Link, TextField, Button, Divider, IconButton } from '@mui/material';
import { Link as RouterLink } from 'react-router-dom';
import { IoLogoInstagram, IoLogoFacebook, IoLogoPinterest, IoLogoTwitter } from 'react-icons/io';
export const Footer: React.FC = () => {
const [email, setEmail] = useState('');
const [subscribed, setSubscribed] = useState(false);
const handleSubscribe = (e: React.FormEvent) => {
e.preventDefault();
if (email) {
setSubscribed(true);
setEmail('');
}
};
return (
<Box
sx={{
backgroundColor: 'secondary.main',
color: '#F5EFEB',
pt: 8,
pb: 4,
mt: 'auto',
borderTop: '1px solid rgba(255, 255, 255, 0.05)',
}}
>
<Container maxWidth="lg">
<Grid container spacing={4} sx={{ mb: 6 }}>
{/* Brand Info */}
<Grid size={{ xs: 12, md: 4 }}>
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1.5, mb: 2.5 }}>
<Box
component="img"
src="/logo.jpg"
alt="Mani Candles Logo"
sx={{
height: 40,
width: 40,
borderRadius: '50%',
objectFit: 'cover',
border: '1px solid rgba(255, 255, 255, 0.2)',
}}
/>
<Typography
variant="h6"
sx={{
fontFamily: 'Cormorant Garamond',
fontWeight: 700,
letterSpacing: '0.1em',
color: '#FFFFFF',
}}
>
MANI CANDLES
</Typography>
</Box>
<Typography variant="body2" sx={{ opacity: 0.8, lineHeight: 1.7, mb: 3, pr: { md: 4 } }}>
Artisanal hand-poured luxury candles crafted in small batches in India. Utilizing 100% natural soy and coconut wax blends, therapeutic grade botanical extracts, and lead-free wicks to illuminate your sanctuary cleanly and beautifully.
</Typography>
<Box sx={{ display: 'flex', gap: 1 }}>
<IconButton color="inherit" sx={{ opacity: 0.8, '&:hover': { opacity: 1, color: 'primary.light' } }}>
<IoLogoInstagram size={20} />
</IconButton>
<IconButton color="inherit" sx={{ opacity: 0.8, '&:hover': { opacity: 1, color: 'primary.light' } }}>
<IoLogoFacebook size={20} />
</IconButton>
<IconButton color="inherit" sx={{ opacity: 0.8, '&:hover': { opacity: 1, color: 'primary.light' } }}>
<IoLogoPinterest size={20} />
</IconButton>
<IconButton color="inherit" sx={{ opacity: 0.8, '&:hover': { opacity: 1, color: 'primary.light' } }}>
<IoLogoTwitter size={20} />
</IconButton>
</Box>
</Grid>
{/* Quick Links (B2C) */}
<Grid size={{ xs: 6, sm: 3, md: 2 }}>
<Typography variant="subtitle2" sx={{ letterSpacing: '0.1em', fontWeight: 600, mb: 2.5, color: 'primary.light' }}>
SHOP
</Typography>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1.5 }}>
<Link component={RouterLink} to="/shop" color="inherit" underline="hover" sx={{ fontSize: '0.85rem', opacity: 0.8, '&:hover': { opacity: 1 } }}>
Shop All
</Link>
<Link component={RouterLink} to="/shop?category=classic" color="inherit" underline="hover" sx={{ fontSize: '0.85rem', opacity: 0.8, '&:hover': { opacity: 1 } }}>
Classic Line
</Link>
<Link component={RouterLink} to="/shop?category=luxury" color="inherit" underline="hover" sx={{ fontSize: '0.85rem', opacity: 0.8, '&:hover': { opacity: 1 } }}>
Luxury Collection
</Link>
<Link component={RouterLink} to="/shop?category=seasonal" color="inherit" underline="hover" sx={{ fontSize: '0.85rem', opacity: 0.8, '&:hover': { opacity: 1 } }}>
Seasonal Scents
</Link>
<Link component={RouterLink} to="/custom-candle" color="inherit" underline="hover" sx={{ fontSize: '0.85rem', opacity: 0.8, '&:hover': { opacity: 1 } }}>
Custom Builder
</Link>
</Box>
</Grid>
{/* Wholesaler & B2B Links */}
<Grid size={{ xs: 6, sm: 3, md: 2 }}>
<Typography variant="subtitle2" sx={{ letterSpacing: '0.1em', fontWeight: 600, mb: 2.5, color: 'primary.light' }}>
B2B SERVICES
</Typography>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1.5 }}>
<Link component={RouterLink} to="/b2b/corporate-gifting" color="inherit" underline="hover" sx={{ fontSize: '0.85rem', opacity: 0.8, '&:hover': { opacity: 1 } }}>
Corporate Gifting
</Link>
<Link component={RouterLink} to="/b2b/hotels-hospitality" color="inherit" underline="hover" sx={{ fontSize: '0.85rem', opacity: 0.8, '&:hover': { opacity: 1 } }}>
Hotels & Resorts
</Link>
<Link component={RouterLink} to="/b2b/private-label" color="inherit" underline="hover" sx={{ fontSize: '0.85rem', opacity: 0.8, '&:hover': { opacity: 1 } }}>
Private Label / OEM
</Link>
<Link component={RouterLink} to="/contact" color="inherit" underline="hover" sx={{ fontSize: '0.85rem', opacity: 0.8, '&:hover': { opacity: 1 } }}>
Custom Manufacture
</Link>
<Link component={RouterLink} to="/contact" color="inherit" underline="hover" sx={{ fontSize: '0.85rem', opacity: 0.8, '&:hover': { opacity: 1 } }}>
Bulk Inquiries
</Link>
</Box>
</Grid>
{/* Newsletter Input */}
<Grid size={{ xs: 12, sm: 6, md: 4 }}>
<Typography variant="subtitle2" sx={{ letterSpacing: '0.1em', fontWeight: 600, mb: 2.5, color: 'primary.light' }}>
THE CIRCLE JOURNAL
</Typography>
<Typography variant="body2" sx={{ opacity: 0.8, mb: 2.5, lineHeight: 1.6 }}>
Receive exclusive alerts on seasonal pourings, brand collaborations, slow-living guides, and special discount codes.
</Typography>
{subscribed ? (
<Typography variant="body2" sx={{ color: 'primary.light', fontWeight: 600 }}>
Thank you for subscribing. Welcome to the circle.
</Typography>
) : (
<form onSubmit={handleSubscribe}>
<Box sx={{ display: 'flex', gap: 1 }}>
<TextField
fullWidth
type="email"
placeholder="Enter email address"
value={email}
onChange={(e) => setEmail(e.target.value)}
required
variant="outlined"
size="small"
sx={{
'& .MuiOutlinedInput-root': {
backgroundColor: 'rgba(255, 255, 255, 0.08)',
borderRadius: 1,
color: '#F5EFEB',
'& fieldset': { borderColor: 'rgba(255, 255, 255, 0.15)' },
'&:hover fieldset': { borderColor: 'primary.light' },
'&.Mui-focused fieldset': { borderColor: 'primary.light' },
},
'& input::placeholder': { color: '#F5EFEB', opacity: 0.5 },
}}
/>
<Button
type="submit"
variant="contained"
color="primary"
sx={{
px: 3,
borderRadius: 1,
textTransform: 'none',
letterSpacing: '0.05em',
}}
>
Subscribe
</Button>
</Box>
</form>
)}
</Grid>
</Grid>
<Divider sx={{ borderColor: 'rgba(255, 255, 255, 0.1)', mb: 4 }} />
{/* Footer Bottom */}
<Grid container spacing={2} sx={{ alignItems: 'center' }}>
<Grid size={{ xs: 12, sm: 6 }}>
<Typography variant="caption" sx={{ opacity: 0.6, fontSize: '0.75rem' }}>
&copy; {new Date().getFullYear()} Mani Candles Private Limited. All rights reserved. Made in India.
</Typography>
</Grid>
<Grid size={{ xs: 12, sm: 6 }} sx={{ display: 'flex', gap: 2.5, justifyContent: { xs: 'flex-start', sm: 'flex-end' } }}>
<Link component={RouterLink} to="/privacy-policy" color="inherit" underline="hover" sx={{ fontSize: '0.75rem', opacity: 0.6, '&:hover': { opacity: 1 } }}>
Privacy
</Link>
<Link component={RouterLink} to="/terms-conditions" color="inherit" underline="hover" sx={{ fontSize: '0.75rem', opacity: 0.6, '&:hover': { opacity: 1 } }}>
Terms
</Link>
<Link component={RouterLink} to="/shipping-policy" color="inherit" underline="hover" sx={{ fontSize: '0.75rem', opacity: 0.6, '&:hover': { opacity: 1 } }}>
Shipping
</Link>
<Link component={RouterLink} to="/refund-policy" color="inherit" underline="hover" sx={{ fontSize: '0.75rem', opacity: 0.6, '&:hover': { opacity: 1 } }}>
Refunds
</Link>
</Grid>
</Grid>
</Container>
</Box>
);
};
export default Footer;

View File

@ -0,0 +1,442 @@
import React, { useState } from 'react';
import {
AppBar,
Toolbar,
Typography,
Box,
IconButton,
Badge,
Button,
Menu,
MenuItem,
Drawer,
List,
ListItem,
ListItemButton,
ListItemText,
Divider,
Container,
FormControlLabel,
Switch,
TextField,
InputAdornment,
} from '@mui/material';
import { Link as RouterLink, useNavigate } from 'react-router-dom';
import { IoIosHeartEmpty, IoIosSearch, IoIosMenu, IoIosClose } from 'react-icons/io';
import { MdOutlineShoppingBag } from 'react-icons/md';
import { useCart } from '../../contexts/CartContext';
import { useWishlist } from '../../contexts/WishlistContext';
export const Header: React.FC<{ isB2BMode: boolean; setIsB2BMode: (val: boolean) => void }> = ({
isB2BMode,
setIsB2BMode,
}) => {
const navigate = useNavigate();
const { cartCount, setIsCartOpen } = useCart();
const { wishlistItems, setIsWishlistOpen } = useWishlist();
// Mobile navigation state
const [mobileOpen, setMobileOpen] = useState(false);
// Search overlay state
const [searchOpen, setSearchOpen] = useState(false);
const [searchQuery, setSearchQuery] = useState('');
// Dropdown states
const [shopAnchor, setShopAnchor] = useState<null | HTMLElement>(null);
const [b2bAnchor, setB2BAnchor] = useState<null | HTMLElement>(null);
const handleSearchSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (searchQuery.trim()) {
navigate(`/shop?search=${encodeURIComponent(searchQuery)}`);
setSearchQuery('');
setSearchOpen(false);
}
};
return (
<>
<AppBar position="sticky" className="glass-header" sx={{ zIndex: 1200 }}>
<Container maxWidth="xl">
<Toolbar disableGutters sx={{ justifyContent: 'space-between', height: 80 }}>
{/* Mobile Burger Menu */}
<IconButton
color="inherit"
aria-label="open drawer"
edge="start"
onClick={() => setMobileOpen(true)}
sx={{ display: { xs: 'flex', md: 'none' }, mr: 1 }}
>
<IoIosMenu size={24} />
</IconButton>
{/* Brand Logo */}
<Box
component={RouterLink}
to="/"
sx={{
display: 'flex',
alignItems: 'center',
gap: 1.5,
textDecoration: 'none',
flexGrow: { xs: 1, md: 0 },
justifyContent: { xs: 'center', md: 'flex-start' },
}}
>
<Box
component="img"
src="/logo.jpg"
alt="Mani Candles Logo"
sx={{
height: { xs: 40, md: 50 },
width: { xs: 40, md: 50 },
borderRadius: '50%',
objectFit: 'cover',
border: '1.5px solid #EFE9F3',
}}
/>
<Typography
variant="h5"
sx={{
fontFamily: `'Cormorant Garamond', serif`,
fontWeight: 700,
letterSpacing: '0.1em',
color: 'secondary.main',
fontSize: { xs: '1.1rem', md: '1.4rem' },
display: { xs: 'none', sm: 'block' },
}}
>
MANI CANDLES
</Typography>
</Box>
{/* Desktop Navigation */}
<Box
sx={{
display: { xs: 'none', md: 'flex' },
alignItems: 'center',
gap: 4,
}}
>
{/* Shop Link with dropdown */}
<Button
color="inherit"
onClick={(e) => setShopAnchor(e.currentTarget)}
sx={{
fontFamily: 'Inter',
fontSize: '0.8rem',
letterSpacing: '0.1em',
fontWeight: 500,
'&:hover': { color: 'primary.main' },
}}
>
Shop
</Button>
<Menu
anchorEl={shopAnchor}
open={Boolean(shopAnchor)}
onClose={() => setShopAnchor(null)}
disableScrollLock
slotProps={{ paper: { sx: {
mt: 1,
boxShadow: '0 8px 30px rgba(0,0,0,0.06)',
border: '1px solid #E6DFD5',
borderRadius: 2,
p: 1,
} } }}
>
<MenuItem onClick={() => { setShopAnchor(null); navigate('/shop'); }}>Shop All</MenuItem>
<MenuItem onClick={() => { setShopAnchor(null); navigate('/shop?category=classic'); }}>Classic Collection</MenuItem>
<MenuItem onClick={() => { setShopAnchor(null); navigate('/shop?category=luxury'); }}>Luxury Collection</MenuItem>
<MenuItem onClick={() => { setShopAnchor(null); navigate('/shop?category=seasonal'); }}>Seasonal Line</MenuItem>
<MenuItem onClick={() => { setShopAnchor(null); navigate('/shop?category=giftbox'); }}>Heritage Gift Boxes</MenuItem>
<Divider sx={{ my: 0.5 }} />
<MenuItem onClick={() => { setShopAnchor(null); navigate('/custom-candle'); }} sx={{ color: 'primary.main', fontWeight: 600 }}>Custom Candle Builder</MenuItem>
</Menu>
{/* B2B Services with dropdown */}
<Button
color="inherit"
onClick={(e) => setB2BAnchor(e.currentTarget)}
sx={{
fontFamily: 'Inter',
fontSize: '0.8rem',
letterSpacing: '0.1em',
fontWeight: 500,
'&:hover': { color: 'primary.main' },
}}
>
B2B & Custom
</Button>
<Menu
anchorEl={b2bAnchor}
open={Boolean(b2bAnchor)}
onClose={() => setB2BAnchor(null)}
disableScrollLock
slotProps={{ paper: { sx: {
mt: 1,
boxShadow: '0 8px 30px rgba(0,0,0,0.06)',
border: '1px solid #E6DFD5',
borderRadius: 2,
p: 1,
} } }}
>
<MenuItem onClick={() => { setB2BAnchor(null); navigate('/b2b/corporate-gifting'); }}>Corporate Gifting</MenuItem>
<MenuItem onClick={() => { setB2BAnchor(null); navigate('/b2b/hotels-hospitality'); }}>Hotels & Resorts</MenuItem>
<MenuItem onClick={() => { setB2BAnchor(null); navigate('/b2b/private-label'); }}>Private Label & OEM</MenuItem>
<MenuItem onClick={() => { setB2BAnchor(null); navigate('/custom-candle'); }}>Custom Candle Orders</MenuItem>
</Menu>
<Button
component={RouterLink}
to="/journal"
color="inherit"
sx={{
fontFamily: 'Inter',
fontSize: '0.8rem',
letterSpacing: '0.1em',
fontWeight: 500,
'&:hover': { color: 'primary.main' },
}}
>
Journal
</Button>
<Button
component={RouterLink}
to="/about"
color="inherit"
sx={{
fontFamily: 'Inter',
fontSize: '0.8rem',
letterSpacing: '0.1em',
fontWeight: 500,
'&:hover': { color: 'primary.main' },
}}
>
Our Story
</Button>
<Button
component={RouterLink}
to="/contact"
color="inherit"
sx={{
fontFamily: 'Inter',
fontSize: '0.8rem',
letterSpacing: '0.1em',
fontWeight: 500,
'&:hover': { color: 'primary.main' },
}}
>
Contact
</Button>
</Box>
{/* Action Bar: B2C/B2B Switch, Search, Wishlist, Cart */}
<Box sx={{ display: 'flex', alignItems: 'center', gap: { xs: 1, md: 2.5 } }}>
{/* B2B Toggler */}
<FormControlLabel
control={
<Switch
checked={isB2BMode}
onChange={(e) => setIsB2BMode(e.target.checked)}
color="primary"
size="small"
/>
}
label={
<Typography
sx={{
fontSize: '0.7rem',
fontWeight: 600,
letterSpacing: '0.05em',
textTransform: 'uppercase',
color: isB2BMode ? 'primary.main' : 'text.secondary',
display: { xs: 'none', sm: 'inline-block' },
}}
>
{isB2BMode ? 'Wholesale (B2B)' : 'Retail (B2C)'}
</Typography>
}
sx={{ mr: 0 }}
/>
<IconButton onClick={() => setSearchOpen(!searchOpen)} color="inherit">
<IoIosSearch size={22} />
</IconButton>
<IconButton onClick={() => setIsWishlistOpen(true)} color="inherit">
<Badge badgeContent={wishlistItems.length} color="primary" sx={{ '& .MuiBadge-badge': { fontSize: '0.7rem' } }}>
<IoIosHeartEmpty size={22} />
</Badge>
</IconButton>
<IconButton onClick={() => setIsCartOpen(true)} color="inherit">
<Badge badgeContent={cartCount} color="primary" sx={{ '& .MuiBadge-badge': { fontSize: '0.7rem' } }}>
<MdOutlineShoppingBag size={22} />
</Badge>
</IconButton>
</Box>
</Toolbar>
</Container>
{/* Search Overlay Dropdown */}
{searchOpen && (
<Box
sx={{
backgroundColor: 'background.default',
borderBottom: '1px solid #E6DFD5',
py: 2.5,
animation: 'fadeIn 0.3s ease',
}}
>
<Container maxWidth="md">
<form onSubmit={handleSearchSubmit}>
<TextField
fullWidth
placeholder="Search our luxury candle catalog (e.g. Saffron, Sandalwood, Oud)..."
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
variant="outlined"
autoFocus
slotProps={{ input: {
startAdornment: (
<InputAdornment position="start">
<IoIosSearch size={20} />
</InputAdornment>
),
endAdornment: (
<InputAdornment position="end">
<IconButton size="small" onClick={() => setSearchOpen(false)}>
<IoIosClose size={24} />
</IconButton>
</InputAdornment>
),
sx: {
borderRadius: 6,
backgroundColor: '#FFFFFF',
'& fieldset': { borderColor: '#E6DFD5' },
'&:hover fieldset': { borderColor: '#C5A880' },
},
} }}
/>
</form>
</Container>
</Box>
)}
</AppBar>
{/* Mobile Menu Drawer */}
<Drawer
anchor="left"
open={mobileOpen}
onClose={() => setMobileOpen(false)}
disableScrollLock
slotProps={{ paper: { sx: { width: 280, backgroundColor: 'background.default', p: 2 } } }}
>
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 3 }}>
<Typography variant="h6" sx={{ fontFamily: 'Cormorant Garamond', fontWeight: 700, letterSpacing: '0.1em' }}>
NAVIGATION
</Typography>
<IconButton onClick={() => setMobileOpen(false)}>
<IoIosClose size={24} />
</IconButton>
</Box>
<Divider sx={{ mb: 2 }} />
<List disablePadding>
<ListItem disablePadding>
<ListItemButton
onClick={() => {
setMobileOpen(false);
navigate('/shop');
}}
>
<ListItemText primary={<Typography sx={{ fontSize: "0.9rem", letterSpacing: "0.05em" }}>Shop All Candles</Typography>} />
</ListItemButton>
</ListItem>
<ListItem disablePadding>
<ListItemButton
onClick={() => {
setMobileOpen(false);
navigate('/custom-candle');
}}
>
<ListItemText primary={<Typography sx={{ fontSize: "0.9rem", color: "#8E7557", fontWeight: 600, letterSpacing: "0.05em" }}>Custom Candle Builder</Typography>}
/>
</ListItemButton>
</ListItem>
<Divider sx={{ my: 1.5 }} />
<Typography variant="overline" color="text.secondary" sx={{ pl: 2, letterSpacing: '0.1em', fontWeight: 600 }}>
B2B Solutions
</Typography>
<ListItem disablePadding>
<ListItemButton
onClick={() => {
setMobileOpen(false);
navigate('/b2b/corporate-gifting');
}}
>
<ListItemText primary={<Typography sx={{ fontSize: "0.85rem" }}>Corporate Gifting</Typography>} />
</ListItemButton>
</ListItem>
<ListItem disablePadding>
<ListItemButton
onClick={() => {
setMobileOpen(false);
navigate('/b2b/hotels-hospitality');
}}
>
<ListItemText primary={<Typography sx={{ fontSize: "0.85rem" }}>Hotels & Hospitality</Typography>} />
</ListItemButton>
</ListItem>
<ListItem disablePadding>
<ListItemButton
onClick={() => {
setMobileOpen(false);
navigate('/b2b/private-label');
}}
>
<ListItemText primary={<Typography sx={{ fontSize: "0.85rem" }}>Private Label & OEM</Typography>} />
</ListItemButton>
</ListItem>
<Divider sx={{ my: 1.5 }} />
<ListItem disablePadding>
<ListItemButton
onClick={() => {
setMobileOpen(false);
navigate('/journal');
}}
>
<ListItemText primary={<Typography sx={{ fontSize: "0.9rem" }}>The Journal</Typography>} />
</ListItemButton>
</ListItem>
<ListItem disablePadding>
<ListItemButton
onClick={() => {
setMobileOpen(false);
navigate('/about');
}}
>
<ListItemText primary={<Typography sx={{ fontSize: "0.9rem" }}>Our Story</Typography>} />
</ListItemButton>
</ListItem>
<ListItem disablePadding>
<ListItemButton
onClick={() => {
setMobileOpen(false);
navigate('/contact');
}}
>
<ListItemText primary={<Typography sx={{ fontSize: "0.9rem" }}>Contact Us</Typography>} />
</ListItemButton>
</ListItem>
</List>
</Drawer>
</>
);
};
export default Header;

View File

@ -0,0 +1,157 @@
import React, { useState, useEffect } from 'react';
import { Dialog, DialogContent, Box, Typography, TextField, Button, IconButton } from '@mui/material';
import { MdClose } from 'react-icons/md';
export const NewsletterPopup: React.FC = () => {
const [open, setOpen] = useState(false);
const [email, setEmail] = useState('');
const [subscribed, setSubscribed] = useState(false);
useEffect(() => {
const dismissed = sessionStorage.getItem('mani_candles_newsletter_dismissed');
if (!dismissed) {
// Show popup after 8 seconds of page browsing
const timer = setTimeout(() => {
setOpen(true);
}, 8000);
return () => clearTimeout(timer);
}
}, []);
const handleClose = () => {
sessionStorage.setItem('mani_candles_newsletter_dismissed', 'true');
setOpen(false);
};
const handleSubscribe = (e: React.FormEvent) => {
e.preventDefault();
if (email) {
setSubscribed(true);
setTimeout(() => {
handleClose();
}, 3000);
}
};
return (
<Dialog
open={open}
onClose={handleClose}
maxWidth="sm"
fullWidth
slotProps={{ paper: { sx: {
borderRadius: 4,
overflow: 'hidden',
backgroundColor: 'background.default',
border: '1px solid #E6DFD5',
} } }}
>
<Box sx={{ position: 'relative' }}>
<IconButton
onClick={handleClose}
sx={{
position: 'absolute',
top: 12,
right: 12,
color: 'text.secondary',
zIndex: 1,
'&:hover': { color: 'text.primary' },
}}
>
<MdClose size={22} />
</IconButton>
</Box>
<DialogContent sx={{ p: 0 }}>
<Box
sx={{
display: 'flex',
flexDirection: { xs: 'column', md: 'row' },
minHeight: 380,
}}
>
{/* Image Side */}
<Box
sx={{
flex: 1,
backgroundImage: 'url("https://images.unsplash.com/photo-1603006905003-be475563bc59?auto=format&fit=crop&q=80&w=400")',
backgroundSize: 'cover',
backgroundPosition: 'center',
display: { xs: 'none', md: 'block' },
}}
/>
{/* Form Side */}
<Box
sx={{
flex: 1.2,
p: 4,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
textAlign: 'center',
}}
>
<Typography variant="overline" color="primary" sx={{ letterSpacing: '0.15em', fontWeight: 600 }}>
The Journal & Circle
</Typography>
<Typography variant="h4" sx={{ my: 1.5, color: 'secondary.main', fontWeight: 500 }}>
Join Mani Circle
</Typography>
<Typography variant="body2" color="text.secondary" sx={{ mb: 3, lineHeight: 1.6 }}>
Subscribe to unlock 10% off your first order, receive private collection previews, and download our corporate bulk catalogs.
</Typography>
{subscribed ? (
<Box sx={{ py: 3 }}>
<Typography variant="subtitle2" color="primary" sx={{ letterSpacing: '0.05em', fontWeight: 600 }}>
Welcome to the circle.
</Typography>
<Typography variant="body2" color="text.secondary" sx={{ mt: 1 }}>
Your invitation and discount code have been dispatched to your inbox.
</Typography>
</Box>
) : (
<form onSubmit={handleSubscribe}>
<TextField
fullWidth
type="email"
placeholder="Enter your email address"
value={email}
onChange={(e) => setEmail(e.target.value)}
required
variant="outlined"
size="small"
sx={{
mb: 2,
'& .MuiOutlinedInput-root': {
backgroundColor: '#FFFFFF',
borderRadius: 2,
'& fieldset': { borderColor: '#E6DFD5' },
'&:hover fieldset': { borderColor: '#C5A880' },
},
}}
/>
<Button
fullWidth
type="submit"
variant="contained"
color="primary"
sx={{ py: 1.2, letterSpacing: '0.1em' }}
>
Join the Circle
</Button>
</form>
)}
<Typography variant="caption" color="text.secondary" sx={{ mt: 2, display: 'block', fontSize: '0.7rem' }}>
We respect your inbox. Unsubscribe at any time.
</Typography>
</Box>
</Box>
</DialogContent>
</Dialog>
);
};
export default NewsletterPopup;

View File

@ -0,0 +1,48 @@
import React from 'react';
import { Helmet } from 'react-helmet-async';
interface SEOHelmetProps {
title: string;
description: string;
canonicalUrl?: string;
ogImage?: string;
schemaJson?: object;
}
export const SEOHelmet: React.FC<SEOHelmetProps> = ({
title,
description,
canonicalUrl = window.location.href,
ogImage = 'https://images.unsplash.com/photo-1603006905003-be475563bc59?auto=format&fit=crop&q=80&w=800',
schemaJson,
}) => {
const fullTitle = title.includes('Mani Candles') ? title : `${title} | Mani Candles`;
return (
<Helmet>
<title>{fullTitle}</title>
<meta name="description" content={description} />
<link rel="canonical" href={canonicalUrl} />
{/* Open Graph / Facebook */}
<meta property="og:type" content="website" />
<meta property="og:title" content={fullTitle} />
<meta property="og:description" content={description} />
<meta property="og:image" content={ogImage} />
<meta property="og:url" content={canonicalUrl} />
{/* Twitter */}
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={fullTitle} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={ogImage} />
{/* Schema.org Structured Data */}
{schemaJson && (
<script type="application/ld+json">
{JSON.stringify(schemaJson)}
</script>
)}
</Helmet>
);
};
export default SEOHelmet;

View File

@ -0,0 +1,90 @@
import React, { useState, useEffect } from 'react';
import { Box, Typography } from '@mui/material';
export const ScrollCandle: React.FC = () => {
const [candleHeight, setCandleHeight] = useState(65);
const [isExtinguished, setIsExtinguished] = useState(false);
const [visible, setVisible] = useState(true); // Always visible initially
useEffect(() => {
const handleScroll = () => {
const scrollTop = window.scrollY;
const docHeight = document.documentElement.scrollHeight - window.innerHeight;
const scrollPercent = docHeight > 0 ? scrollTop / docHeight : 0;
// Show scroll candle only if there is a scrollable area on the page
if (docHeight > 30) {
setVisible(true);
} else {
setVisible(false);
}
// Height decreases from 65vh to 6vh
const newHeight = Math.max(6, 65 - scrollPercent * 59);
setCandleHeight(newHeight);
if (scrollPercent >= 0.96) {
setIsExtinguished(true);
} else {
setIsExtinguished(false);
}
};
window.addEventListener('scroll', handleScroll, { passive: true });
// Trigger initially
handleScroll();
return () => window.removeEventListener('scroll', handleScroll);
}, []);
if (!visible) return null;
return (
<Box className="scroll-candle-wrap" sx={{ opacity: visible ? 1 : 0 }}>
{/* Flame wrapper */}
<Box
className="candle-flame-wrap"
sx={{
opacity: isExtinguished ? 0 : 1,
transform: isExtinguished ? 'scale(0)' : 'scale(1)',
transition: 'all 0.5s ease',
}}
>
<Box className="flame-glow" />
<Box className="flame-outer" />
<Box className="flame-inner" />
</Box>
{/* Smoke rises if extinguished */}
{isExtinguished && (
<Box className="smoke-wrap">
<Box className="smoke-particle" />
<Box className="smoke-particle" />
<Box className="smoke-particle" />
</Box>
)}
{/* Wick */}
<Box className="candle-wick" />
{/* Wick Collar */}
<Box className="candle-wick-holder" />
{/* Candle Body */}
<Box className="candle-body" style={{ height: `${candleHeight}vh` }}>
<Box className="wax-drip wax-drip-1" />
<Box className="wax-drip wax-drip-2" />
</Box>
{/* Base */}
<Box className="candle-base" />
{/* Label */}
<Typography className="candle-scroll-label" sx={{ fontSize: '0.62rem', mt: 0.5 }}>
{isExtinguished ? 'Burnt out' : 'Scroll to Burn'}
</Typography>
</Box>
);
};
export default ScrollCandle;

View File

@ -0,0 +1,55 @@
import React, { useState, useEffect } from 'react';
import { Fab, Zoom } from '@mui/material';
import { IoIosArrowUp } from 'react-icons/io';
export const ScrollToTop: React.FC = () => {
const [visible, setVisible] = useState(false);
useEffect(() => {
const handleScroll = () => {
if (window.scrollY > 300) {
setVisible(true);
} else {
setVisible(false);
}
};
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);
}, []);
const scrollToTop = () => {
window.scrollTo({
top: 0,
behavior: 'smooth',
});
};
return (
<Zoom in={visible}>
<Fab
size="small"
color="secondary"
onClick={scrollToTop}
sx={{
position: 'fixed',
bottom: 96, // Sits above the WhatsApp button
right: { xs: 32, md: 88 }, // Shifted on desktop to align with WhatsApp button
zIndex: 1000,
backgroundColor: 'background.paper',
color: 'secondary.main',
border: '1px solid #E6DFD5',
boxShadow: '0 4px 15px rgba(0,0,0,0.05)',
'&:hover': {
backgroundColor: 'secondary.main',
color: 'background.paper',
},
}}
>
<IoIosArrowUp size={20} />
</Fab>
</Zoom>
);
};
export default ScrollToTop;

View File

@ -0,0 +1,64 @@
import React from 'react';
import { Card, Box, Skeleton, Grid } from '@mui/material';
export const ProductCardSkeleton: React.FC = () => {
return (
<Card sx={{ border: '1px solid #E6DFD5', boxShadow: 'none' }}>
<Skeleton variant="rectangular" height={260} animation="wave" />
<Box sx={{ p: 2 }}>
<Skeleton variant="text" width="60%" height={20} animation="wave" />
<Skeleton variant="text" width="90%" height={28} sx={{ my: 1 }} animation="wave" />
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mt: 2 }}>
<Skeleton variant="text" width="30%" height={24} animation="wave" />
<Skeleton variant="circular" width={32} height={32} animation="wave" />
</Box>
</Box>
</Card>
);
};
export const BlogCardSkeleton: React.FC = () => {
return (
<Card sx={{ border: '1px solid #E6DFD5', boxShadow: 'none' }}>
<Skeleton variant="rectangular" height={200} animation="wave" />
<Box sx={{ p: 3 }}>
<Skeleton variant="text" width="40%" height={16} animation="wave" />
<Skeleton variant="text" width="95%" height={32} sx={{ my: 1 }} animation="wave" />
<Skeleton variant="text" width="80%" height={20} animation="wave" />
<Box sx={{ display: 'flex', alignItems: 'center', mt: 3, gap: 1.5 }}>
<Skeleton variant="circular" width={36} height={36} animation="wave" />
<Box sx={{ flex: 1 }}>
<Skeleton variant="text" width="50%" height={16} animation="wave" />
<Skeleton variant="text" width="30%" height={14} animation="wave" />
</Box>
</Box>
</Box>
</Card>
);
};
export const ProductDetailSkeleton: React.FC = () => {
return (
<Grid container spacing={4} sx={{ py: 4 }}>
<Grid size={{ xs: 12, md: 6 }}>
<Skeleton variant="rectangular" height={450} sx={{ borderRadius: 2 }} animation="wave" />
<Box sx={{ display: 'flex', gap: 2, mt: 2 }}>
<Skeleton variant="rectangular" width={80} height={80} sx={{ borderRadius: 1 }} animation="wave" />
<Skeleton variant="rectangular" width={80} height={80} sx={{ borderRadius: 1 }} animation="wave" />
<Skeleton variant="rectangular" width={80} height={80} sx={{ borderRadius: 1 }} animation="wave" />
</Box>
</Grid>
<Grid size={{ xs: 12, md: 6 }}>
<Skeleton variant="text" width="30%" height={20} animation="wave" />
<Skeleton variant="text" width="85%" height={48} sx={{ my: 1 }} animation="wave" />
<Skeleton variant="text" width="95%" height={24} animation="wave" />
<Skeleton variant="text" width="90%" height={24} animation="wave" />
<Skeleton variant="rectangular" height={60} sx={{ my: 3, borderRadius: 1 }} animation="wave" />
<Box sx={{ display: 'flex', gap: 2, mt: 3 }}>
<Skeleton variant="rectangular" width="60%" height={48} sx={{ borderRadius: 6 }} animation="wave" />
<Skeleton variant="rectangular" width="35%" height={48} sx={{ borderRadius: 6 }} animation="wave" />
</Box>
</Grid>
</Grid>
);
};

View File

@ -0,0 +1,67 @@
import React, { useState } from 'react';
import { Fab, Tooltip, Box, Typography } from '@mui/material';
import { IoLogoWhatsapp } from 'react-icons/io';
export const WhatsAppButton: React.FC = () => {
const [hovered, setHovered] = useState(false);
const phoneNumber = '919999999999'; // Simulated brand WhatsApp contact
const message = encodeURIComponent(
'Hi Mani Candles! I am browsing your digital store and would like to inquire about B2C candle delivery or B2B corporate catalogs.'
);
const whatsappUrl = `https://wa.me/${phoneNumber}?text=${message}`;
return (
<Box
onMouseEnter={() => setHovered(true)}
onMouseLeave={() => setHovered(false)}
sx={{
position: 'fixed',
bottom: 24,
right: { xs: 24, md: 80 }, // Shifted on desktop to make room for the scroll candle
zIndex: 1000,
display: 'flex',
alignItems: 'center',
gap: 1.5,
}}
>
{hovered && (
<Box
sx={{
backgroundColor: 'background.paper',
py: 1,
px: 2,
borderRadius: 4,
boxShadow: '0 4px 15px rgba(0,0,0,0.06)',
border: '1px solid #E6DFD5',
transition: 'all 0.3s ease',
}}
>
<Typography variant="caption" sx={{ fontWeight: 500, color: 'secondary.main', letterSpacing: '0.05em' }}>
Inquire on WhatsApp
</Typography>
</Box>
)}
<Tooltip title="" placement="left">
<Fab
color="success"
href={whatsappUrl}
target="_blank"
rel="noopener noreferrer"
sx={{
backgroundColor: '#25D366',
color: '#FFFFFF',
boxShadow: '0 4px 20px rgba(37, 211, 102, 0.4)',
'&:hover': {
backgroundColor: '#128C7E',
boxShadow: '0 8px 30px rgba(18, 140, 126, 0.6)',
},
}}
>
<IoLogoWhatsapp size={26} />
</Fab>
</Tooltip>
</Box>
);
};
export default WhatsAppButton;

View File

@ -0,0 +1,128 @@
import React from 'react';
import {
Drawer,
Box,
Typography,
IconButton,
List,
ListItem,
ListItemAvatar,
Avatar,
ListItemText,
ListItemSecondaryAction,
Button,
Divider,
} from '@mui/material';
import { MdClose, MdOutlineDeleteOutline } from 'react-icons/md';
import { IoIosHeartEmpty } from 'react-icons/io';
import { useWishlist } from '../../contexts/WishlistContext';
import { useCart } from '../../contexts/CartContext';
import { formatCurrency } from '../../utils/helpers';
import { useNavigate } from 'react-router-dom';
export const WishlistDrawer: React.FC = () => {
const navigate = useNavigate();
const { wishlistItems, isWishlistOpen, setIsWishlistOpen, removeFromWishlist } = useWishlist();
const { addToCart } = useCart();
const handleMoveToCart = (product: any) => {
addToCart(product, 1, 'B2C'); // Moves as single item B2C
removeFromWishlist(product.id);
};
return (
<Drawer
anchor="right"
open={isWishlistOpen}
onClose={() => setIsWishlistOpen(false)}
disableScrollLock
slotProps={{ paper: { sx: {
width: { xs: '100%', sm: 400 },
backgroundColor: 'background.default',
} } }}
>
{/* Drawer Header */}
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', p: 3, borderBottom: '1px solid #E6DFD5' }}>
<Typography variant="h6" sx={{ fontFamily: 'Cormorant Garamond', fontWeight: 600, letterSpacing: '0.05em' }}>
Your Wishlist ({wishlistItems.length})
</Typography>
<IconButton onClick={() => setIsWishlistOpen(false)}>
<MdClose size={24} />
</IconButton>
</Box>
{/* Drawer Content */}
<Box sx={{ flex: 1, overflowY: 'auto', p: 3 }}>
{wishlistItems.length === 0 ? (
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', textAlign: 'center', py: 8 }}>
<IoIosHeartEmpty size={48} style={{ color: '#C5A880', marginBottom: 16 }} />
<Typography variant="subtitle1" sx={{ fontWeight: 500, mb: 1 }}>
Your wishlist is empty
</Typography>
<Typography variant="body2" color="text.secondary" sx={{ mb: 4, px: 4, lineHeight: 1.6 }}>
Save your favorite luxury pouring scents here to review and purchase them later.
</Typography>
<Button
variant="outlined"
color="primary"
onClick={() => {
setIsWishlistOpen(false);
navigate('/shop');
}}
sx={{ px: 4 }}
>
Explore Products
</Button>
</Box>
) : (
<List disablePadding>
{wishlistItems.map((item) => (
<React.Fragment key={item.id}>
<ListItem alignItems="flex-start" sx={{ px: 0, py: 2 }}>
<ListItemAvatar sx={{ mr: 2 }}>
<Avatar
src={item.images[0]}
variant="rounded"
sx={{ width: 70, height: 70, border: '1px solid #E6DFD5' }}
/>
</ListItemAvatar>
<ListItemText
primary={
<Typography variant="subtitle2" sx={{ fontWeight: 600, mb: 0.5, pr: 4 }}>
{item.name}
</Typography>
}
secondary={
<Box>
<Typography variant="body2" color="primary" sx={{ fontWeight: 500, mb: 1 }}>
{formatCurrency(item.price)}
</Typography>
<Button
size="small"
variant="contained"
color="primary"
onClick={() => handleMoveToCart(item)}
sx={{ fontSize: '0.7rem', py: 0.5, px: 1.5 }}
>
Move To Cart
</Button>
</Box>
}
/>
<ListItemSecondaryAction sx={{ top: 20 }}>
<IconButton size="small" onClick={() => removeFromWishlist(item.id)} sx={{ color: 'text.secondary', '&:hover': { color: 'error.main' } }}>
<MdOutlineDeleteOutline size={20} />
</IconButton>
</ListItemSecondaryAction>
</ListItem>
<Divider sx={{ borderColor: 'rgba(230, 223, 213, 0.5)' }} />
</React.Fragment>
))}
</List>
)}
</Box>
</Drawer>
);
};
export default WishlistDrawer;

View File

@ -1,55 +0,0 @@
import * as React from "react"
import * as AccordionPrimitive from "@radix-ui/react-accordion"
import { ChevronDown } from "lucide-react"
import { cn } from "@/lib/utils"
const Accordion = AccordionPrimitive.Root
const AccordionItem = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
>(({ className, ...props }, ref) => (
<AccordionPrimitive.Item
ref={ref}
className={cn("border-b", className)}
{...props}
/>
))
AccordionItem.displayName = "AccordionItem"
const AccordionTrigger = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<AccordionPrimitive.Header className="flex">
<AccordionPrimitive.Trigger
ref={ref}
className={cn(
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",
className
)}
{...props}
>
{children}
<ChevronDown className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" />
</AccordionPrimitive.Trigger>
</AccordionPrimitive.Header>
))
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
const AccordionContent = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<AccordionPrimitive.Content
ref={ref}
className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
{...props}
>
<div className={cn("pb-4 pt-0", className)}>{children}</div>
</AccordionPrimitive.Content>
))
AccordionContent.displayName = AccordionPrimitive.Content.displayName
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }

View File

@ -1,139 +0,0 @@
import * as React from "react"
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
import { cn } from "@/lib/utils"
import { buttonVariants } from "@/components/ui/button"
const AlertDialog = AlertDialogPrimitive.Root
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
const AlertDialogPortal = AlertDialogPrimitive.Portal
const AlertDialogOverlay = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Overlay
className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
)}
{...props}
ref={ref}
/>
))
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
const AlertDialogContent = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
>(({ className, ...props }, ref) => (
<AlertDialogPortal>
<AlertDialogOverlay />
<AlertDialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
className
)}
{...props}
/>
</AlertDialogPortal>
))
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
const AlertDialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-2 text-center sm:text-left",
className
)}
{...props}
/>
)
AlertDialogHeader.displayName = "AlertDialogHeader"
const AlertDialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className
)}
{...props}
/>
)
AlertDialogFooter.displayName = "AlertDialogFooter"
const AlertDialogTitle = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Title
ref={ref}
className={cn("text-lg font-semibold", className)}
{...props}
/>
))
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
const AlertDialogDescription = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
AlertDialogDescription.displayName =
AlertDialogPrimitive.Description.displayName
const AlertDialogAction = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Action>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Action
ref={ref}
className={cn(buttonVariants(), className)}
{...props}
/>
))
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
const AlertDialogCancel = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
>(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Cancel
ref={ref}
className={cn(
buttonVariants({ variant: "outline" }),
"mt-2 sm:mt-0",
className
)}
{...props}
/>
))
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
export {
AlertDialog,
AlertDialogPortal,
AlertDialogOverlay,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
AlertDialogFooter,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogAction,
AlertDialogCancel,
}

View File

@ -1,59 +0,0 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const alertVariants = cva(
"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
{
variants: {
variant: {
default: "bg-background text-foreground",
destructive:
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
},
},
defaultVariants: {
variant: "default",
},
}
)
const Alert = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
>(({ className, variant, ...props }, ref) => (
<div
ref={ref}
role="alert"
className={cn(alertVariants({ variant }), className)}
{...props}
/>
))
Alert.displayName = "Alert"
const AlertTitle = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
<h5
ref={ref}
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
{...props}
/>
))
AlertTitle.displayName = "AlertTitle"
const AlertDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("text-sm [&_p]:leading-relaxed", className)}
{...props}
/>
))
AlertDescription.displayName = "AlertDescription"
export { Alert, AlertTitle, AlertDescription }

View File

@ -1,5 +0,0 @@
import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
const AspectRatio = AspectRatioPrimitive.Root
export { AspectRatio }

View File

@ -1,50 +0,0 @@
"use client"
import * as React from "react"
import * as AvatarPrimitive from "@radix-ui/react-avatar"
import { cn } from "@/lib/utils"
const Avatar = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Root
ref={ref}
className={cn(
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
className
)}
{...props}
/>
))
Avatar.displayName = AvatarPrimitive.Root.displayName
const AvatarImage = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Image>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square h-full w-full", className)}
{...props}
/>
))
AvatarImage.displayName = AvatarPrimitive.Image.displayName
const AvatarFallback = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Fallback>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Fallback
ref={ref}
className={cn(
"flex h-full w-full items-center justify-center rounded-full bg-muted",
className
)}
{...props}
/>
))
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
export { Avatar, AvatarImage, AvatarFallback }

View File

@ -1,43 +0,0 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const badgeVariants = cva(
// @replit
// Whitespace-nowrap: Badges should never wrap.
"whitespace-nowrap inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2" +
" hover-elevate ",
{
variants: {
variant: {
default:
// @replit shadow-xs instead of shadow, no hover because we use hover-elevate
"border-transparent bg-primary text-primary-foreground shadow-xs",
secondary:
// @replit no hover because we use hover-elevate
"border-transparent bg-secondary text-secondary-foreground",
destructive:
// @replit shadow-xs instead of shadow, no hover because we use hover-elevate
"border-transparent bg-destructive text-destructive-foreground shadow-xs",
// @replit shadow-xs" - use badge outline variable
outline: "text-foreground border [border-color:var(--badge-outline)]",
},
},
defaultVariants: {
variant: "default",
},
}
)
export interface BadgeProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}
function Badge({ className, variant, ...props }: BadgeProps) {
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
)
}
export { Badge, badgeVariants }

View File

@ -1,115 +0,0 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { ChevronRight, MoreHorizontal } from "lucide-react"
import { cn } from "@/lib/utils"
const Breadcrumb = React.forwardRef<
HTMLElement,
React.ComponentPropsWithoutRef<"nav"> & {
separator?: React.ReactNode
}
>(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />)
Breadcrumb.displayName = "Breadcrumb"
const BreadcrumbList = React.forwardRef<
HTMLOListElement,
React.ComponentPropsWithoutRef<"ol">
>(({ className, ...props }, ref) => (
<ol
ref={ref}
className={cn(
"flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
className
)}
{...props}
/>
))
BreadcrumbList.displayName = "BreadcrumbList"
const BreadcrumbItem = React.forwardRef<
HTMLLIElement,
React.ComponentPropsWithoutRef<"li">
>(({ className, ...props }, ref) => (
<li
ref={ref}
className={cn("inline-flex items-center gap-1.5", className)}
{...props}
/>
))
BreadcrumbItem.displayName = "BreadcrumbItem"
const BreadcrumbLink = React.forwardRef<
HTMLAnchorElement,
React.ComponentPropsWithoutRef<"a"> & {
asChild?: boolean
}
>(({ asChild, className, ...props }, ref) => {
const Comp = asChild ? Slot : "a"
return (
<Comp
ref={ref}
className={cn("transition-colors hover:text-foreground", className)}
{...props}
/>
)
})
BreadcrumbLink.displayName = "BreadcrumbLink"
const BreadcrumbPage = React.forwardRef<
HTMLSpanElement,
React.ComponentPropsWithoutRef<"span">
>(({ className, ...props }, ref) => (
<span
ref={ref}
role="link"
aria-disabled="true"
aria-current="page"
className={cn("font-normal text-foreground", className)}
{...props}
/>
))
BreadcrumbPage.displayName = "BreadcrumbPage"
const BreadcrumbSeparator = ({
children,
className,
...props
}: React.ComponentProps<"li">) => (
<li
role="presentation"
aria-hidden="true"
className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
{...props}
>
{children ?? <ChevronRight />}
</li>
)
BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
const BreadcrumbEllipsis = ({
className,
...props
}: React.ComponentProps<"span">) => (
<span
role="presentation"
aria-hidden="true"
className={cn("flex h-9 w-9 items-center justify-center", className)}
{...props}
>
<MoreHorizontal className="h-4 w-4" />
<span className="sr-only">More</span>
</span>
)
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis"
export {
Breadcrumb,
BreadcrumbList,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbPage,
BreadcrumbSeparator,
BreadcrumbEllipsis,
}

View File

@ -1,83 +0,0 @@
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { Separator } from "@/components/ui/separator"
const buttonGroupVariants = cva(
"flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
{
variants: {
orientation: {
horizontal:
"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
vertical:
"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
},
},
defaultVariants: {
orientation: "horizontal",
},
}
)
function ButtonGroup({
className,
orientation,
...props
}: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
return (
<div
role="group"
data-slot="button-group"
data-orientation={orientation}
className={cn(buttonGroupVariants({ orientation }), className)}
{...props}
/>
)
}
function ButtonGroupText({
className,
asChild = false,
...props
}: React.ComponentProps<"div"> & {
asChild?: boolean
}) {
const Comp = asChild ? Slot : "div"
return (
<Comp
className={cn(
"bg-muted shadow-xs flex items-center gap-2 rounded-md border px-4 text-sm font-medium [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none",
className
)}
{...props}
/>
)
}
function ButtonGroupSeparator({
className,
orientation = "vertical",
...props
}: React.ComponentProps<typeof Separator>) {
return (
<Separator
data-slot="button-group-separator"
orientation={orientation}
className={cn(
"bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto",
className
)}
{...props}
/>
)
}
export {
ButtonGroup,
ButtonGroupSeparator,
ButtonGroupText,
buttonGroupVariants,
}

View File

@ -1,65 +0,0 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0" +
" hover-elevate active-elevate-2",
{
variants: {
variant: {
default:
// @replit: no hover, and add primary border
"bg-primary text-primary-foreground border border-primary-border",
destructive:
"bg-destructive text-destructive-foreground shadow-sm border-destructive-border",
outline:
// @replit Shows the background color of whatever card / sidebar / accent background it is inside of.
// Inherits the current text color. Uses shadow-xs. no shadow on active
// No hover state
" border [border-color:var(--button-outline)] shadow-xs active:shadow-none ",
secondary:
// @replit border, no hover, no shadow, secondary border.
"border bg-secondary text-secondary-foreground border border-secondary-border ",
// @replit no hover, transparent border
ghost: "border border-transparent",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
// @replit changed sizes
default: "min-h-9 px-4 py-2",
sm: "min-h-8 rounded-md px-3 text-xs",
lg: "min-h-10 rounded-md px-8",
icon: "h-9 w-9",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
)
}
)
Button.displayName = "Button"
export { Button, buttonVariants }

View File

@ -1,213 +0,0 @@
"use client"
import * as React from "react"
import {
ChevronDownIcon,
ChevronLeftIcon,
ChevronRightIcon,
} from "lucide-react"
import { DayButton, DayPicker, getDefaultClassNames } from "react-day-picker"
import { cn } from "@/lib/utils"
import { Button, buttonVariants } from "@/components/ui/button"
function Calendar({
className,
classNames,
showOutsideDays = true,
captionLayout = "label",
buttonVariant = "ghost",
formatters,
components,
...props
}: React.ComponentProps<typeof DayPicker> & {
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
}) {
const defaultClassNames = getDefaultClassNames()
return (
<DayPicker
showOutsideDays={showOutsideDays}
className={cn(
"bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
className
)}
captionLayout={captionLayout}
formatters={{
formatMonthDropdown: (date) =>
date.toLocaleString("default", { month: "short" }),
...formatters,
}}
classNames={{
root: cn("w-fit", defaultClassNames.root),
months: cn(
"relative flex flex-col gap-4 md:flex-row",
defaultClassNames.months
),
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
nav: cn(
"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
defaultClassNames.nav
),
button_previous: cn(
buttonVariants({ variant: buttonVariant }),
"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
defaultClassNames.button_previous
),
button_next: cn(
buttonVariants({ variant: buttonVariant }),
"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
defaultClassNames.button_next
),
month_caption: cn(
"flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",
defaultClassNames.month_caption
),
dropdowns: cn(
"flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",
defaultClassNames.dropdowns
),
dropdown_root: cn(
"has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",
defaultClassNames.dropdown_root
),
dropdown: cn(
"bg-popover absolute inset-0 opacity-0",
defaultClassNames.dropdown
),
caption_label: cn(
"select-none font-medium",
captionLayout === "label"
? "text-sm"
: "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",
defaultClassNames.caption_label
),
table: "w-full border-collapse",
weekdays: cn("flex", defaultClassNames.weekdays),
weekday: cn(
"text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",
defaultClassNames.weekday
),
week: cn("mt-2 flex w-full", defaultClassNames.week),
week_number_header: cn(
"w-[--cell-size] select-none",
defaultClassNames.week_number_header
),
week_number: cn(
"text-muted-foreground select-none text-[0.8rem]",
defaultClassNames.week_number
),
day: cn(
"group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",
defaultClassNames.day
),
range_start: cn(
"bg-accent rounded-l-md",
defaultClassNames.range_start
),
range_middle: cn("rounded-none", defaultClassNames.range_middle),
range_end: cn("bg-accent rounded-r-md", defaultClassNames.range_end),
today: cn(
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
defaultClassNames.today
),
outside: cn(
"text-muted-foreground aria-selected:text-muted-foreground",
defaultClassNames.outside
),
disabled: cn(
"text-muted-foreground opacity-50",
defaultClassNames.disabled
),
hidden: cn("invisible", defaultClassNames.hidden),
...classNames,
}}
components={{
Root: ({ className, rootRef, ...props }) => {
return (
<div
data-slot="calendar"
ref={rootRef}
className={cn(className)}
{...props}
/>
)
},
Chevron: ({ className, orientation, ...props }) => {
if (orientation === "left") {
return (
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
)
}
if (orientation === "right") {
return (
<ChevronRightIcon
className={cn("size-4", className)}
{...props}
/>
)
}
return (
<ChevronDownIcon className={cn("size-4", className)} {...props} />
)
},
DayButton: CalendarDayButton,
WeekNumber: ({ children, ...props }) => {
return (
<td {...props}>
<div className="flex size-[--cell-size] items-center justify-center text-center">
{children}
</div>
</td>
)
},
...components,
}}
{...props}
/>
)
}
function CalendarDayButton({
className,
day,
modifiers,
...props
}: React.ComponentProps<typeof DayButton>) {
const defaultClassNames = getDefaultClassNames()
const ref = React.useRef<HTMLButtonElement>(null)
React.useEffect(() => {
if (modifiers.focused) ref.current?.focus()
}, [modifiers.focused])
return (
<Button
ref={ref}
variant="ghost"
size="icon"
data-day={day.date.toLocaleDateString()}
data-selected-single={
modifiers.selected &&
!modifiers.range_start &&
!modifiers.range_end &&
!modifiers.range_middle
}
data-range-start={modifiers.range_start}
data-range-end={modifiers.range_end}
data-range-middle={modifiers.range_middle}
className={cn(
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",
defaultClassNames.day,
className
)}
{...props}
/>
)
}
export { Calendar, CalendarDayButton }

View File

@ -1,76 +0,0 @@
import * as React from "react"
import { cn } from "@/lib/utils"
const Card = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"rounded-xl border bg-card text-card-foreground shadow",
className
)}
{...props}
/>
))
Card.displayName = "Card"
const CardHeader = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex flex-col space-y-1.5 p-6", className)}
{...props}
/>
))
CardHeader.displayName = "CardHeader"
const CardTitle = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("font-semibold leading-none tracking-tight", className)}
{...props}
/>
))
CardTitle.displayName = "CardTitle"
const CardDescription = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
CardDescription.displayName = "CardDescription"
const CardContent = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
))
CardContent.displayName = "CardContent"
const CardFooter = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex items-center p-6 pt-0", className)}
{...props}
/>
))
CardFooter.displayName = "CardFooter"
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }

View File

@ -1,260 +0,0 @@
import * as React from "react"
import useEmblaCarousel, {
type UseEmblaCarouselType,
} from "embla-carousel-react"
import { ArrowLeft, ArrowRight } from "lucide-react"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
type CarouselApi = UseEmblaCarouselType[1]
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
type CarouselOptions = UseCarouselParameters[0]
type CarouselPlugin = UseCarouselParameters[1]
type CarouselProps = {
opts?: CarouselOptions
plugins?: CarouselPlugin
orientation?: "horizontal" | "vertical"
setApi?: (api: CarouselApi) => void
}
type CarouselContextProps = {
carouselRef: ReturnType<typeof useEmblaCarousel>[0]
api: ReturnType<typeof useEmblaCarousel>[1]
scrollPrev: () => void
scrollNext: () => void
canScrollPrev: boolean
canScrollNext: boolean
} & CarouselProps
const CarouselContext = React.createContext<CarouselContextProps | null>(null)
function useCarousel() {
const context = React.useContext(CarouselContext)
if (!context) {
throw new Error("useCarousel must be used within a <Carousel />")
}
return context
}
const Carousel = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement> & CarouselProps
>(
(
{
orientation = "horizontal",
opts,
setApi,
plugins,
className,
children,
...props
},
ref
) => {
const [carouselRef, api] = useEmblaCarousel(
{
...opts,
axis: orientation === "horizontal" ? "x" : "y",
},
plugins
)
const [canScrollPrev, setCanScrollPrev] = React.useState(false)
const [canScrollNext, setCanScrollNext] = React.useState(false)
const onSelect = React.useCallback((api: CarouselApi) => {
if (!api) {
return
}
setCanScrollPrev(api.canScrollPrev())
setCanScrollNext(api.canScrollNext())
}, [])
const scrollPrev = React.useCallback(() => {
api?.scrollPrev()
}, [api])
const scrollNext = React.useCallback(() => {
api?.scrollNext()
}, [api])
const handleKeyDown = React.useCallback(
(event: React.KeyboardEvent<HTMLDivElement>) => {
if (event.key === "ArrowLeft") {
event.preventDefault()
scrollPrev()
} else if (event.key === "ArrowRight") {
event.preventDefault()
scrollNext()
}
},
[scrollPrev, scrollNext]
)
React.useEffect(() => {
if (!api || !setApi) {
return
}
setApi(api)
}, [api, setApi])
React.useEffect(() => {
if (!api) {
return
}
onSelect(api)
api.on("reInit", onSelect)
api.on("select", onSelect)
return () => {
api?.off("select", onSelect)
}
}, [api, onSelect])
return (
<CarouselContext.Provider
value={{
carouselRef,
api: api,
opts,
orientation:
orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
scrollPrev,
scrollNext,
canScrollPrev,
canScrollNext,
}}
>
<div
ref={ref}
onKeyDownCapture={handleKeyDown}
className={cn("relative", className)}
role="region"
aria-roledescription="carousel"
{...props}
>
{children}
</div>
</CarouselContext.Provider>
)
}
)
Carousel.displayName = "Carousel"
const CarouselContent = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => {
const { carouselRef, orientation } = useCarousel()
return (
<div ref={carouselRef} className="overflow-hidden">
<div
ref={ref}
className={cn(
"flex",
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
className
)}
{...props}
/>
</div>
)
})
CarouselContent.displayName = "CarouselContent"
const CarouselItem = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => {
const { orientation } = useCarousel()
return (
<div
ref={ref}
role="group"
aria-roledescription="slide"
className={cn(
"min-w-0 shrink-0 grow-0 basis-full",
orientation === "horizontal" ? "pl-4" : "pt-4",
className
)}
{...props}
/>
)
})
CarouselItem.displayName = "CarouselItem"
const CarouselPrevious = React.forwardRef<
HTMLButtonElement,
React.ComponentProps<typeof Button>
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
return (
<Button
ref={ref}
variant={variant}
size={size}
className={cn(
"absolute h-8 w-8 rounded-full",
orientation === "horizontal"
? "-left-12 top-1/2 -translate-y-1/2"
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
className
)}
disabled={!canScrollPrev}
onClick={scrollPrev}
{...props}
>
<ArrowLeft className="h-4 w-4" />
<span className="sr-only">Previous slide</span>
</Button>
)
})
CarouselPrevious.displayName = "CarouselPrevious"
const CarouselNext = React.forwardRef<
HTMLButtonElement,
React.ComponentProps<typeof Button>
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
const { orientation, scrollNext, canScrollNext } = useCarousel()
return (
<Button
ref={ref}
variant={variant}
size={size}
className={cn(
"absolute h-8 w-8 rounded-full",
orientation === "horizontal"
? "-right-12 top-1/2 -translate-y-1/2"
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
className
)}
disabled={!canScrollNext}
onClick={scrollNext}
{...props}
>
<ArrowRight className="h-4 w-4" />
<span className="sr-only">Next slide</span>
</Button>
)
})
CarouselNext.displayName = "CarouselNext"
export {
type CarouselApi,
Carousel,
CarouselContent,
CarouselItem,
CarouselPrevious,
CarouselNext,
}

View File

@ -1,367 +0,0 @@
import * as React from "react"
import * as RechartsPrimitive from "recharts"
import { cn } from "@/lib/utils"
// Format: { THEME_NAME: CSS_SELECTOR }
const THEMES = { light: "", dark: ".dark" } as const
export type ChartConfig = {
[k in string]: {
label?: React.ReactNode
icon?: React.ComponentType
} & (
| { color?: string; theme?: never }
| { color?: never; theme: Record<keyof typeof THEMES, string> }
)
}
type ChartContextProps = {
config: ChartConfig
}
const ChartContext = React.createContext<ChartContextProps | null>(null)
function useChart() {
const context = React.useContext(ChartContext)
if (!context) {
throw new Error("useChart must be used within a <ChartContainer />")
}
return context
}
const ChartContainer = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div"> & {
config: ChartConfig
children: React.ComponentProps<
typeof RechartsPrimitive.ResponsiveContainer
>["children"]
}
>(({ id, className, children, config, ...props }, ref) => {
const uniqueId = React.useId()
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
return (
<ChartContext.Provider value={{ config }}>
<div
data-chart={chartId}
ref={ref}
className={cn(
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
className
)}
{...props}
>
<ChartStyle id={chartId} config={config} />
<RechartsPrimitive.ResponsiveContainer>
{children}
</RechartsPrimitive.ResponsiveContainer>
</div>
</ChartContext.Provider>
)
})
ChartContainer.displayName = "Chart"
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
const colorConfig = Object.entries(config).filter(
([, config]) => config.theme || config.color
)
if (!colorConfig.length) {
return null
}
return (
<style
dangerouslySetInnerHTML={{
__html: Object.entries(THEMES)
.map(
([theme, prefix]) => `
${prefix} [data-chart=${id}] {
${colorConfig
.map(([key, itemConfig]) => {
const color =
itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
itemConfig.color
return color ? ` --color-${key}: ${color};` : null
})
.join("\n")}
}
`
)
.join("\n"),
}}
/>
)
}
const ChartTooltip = RechartsPrimitive.Tooltip
const ChartTooltipContent = React.forwardRef<
HTMLDivElement,
React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
React.ComponentProps<"div"> & {
hideLabel?: boolean
hideIndicator?: boolean
indicator?: "line" | "dot" | "dashed"
nameKey?: string
labelKey?: string
}
>(
(
{
active,
payload,
className,
indicator = "dot",
hideLabel = false,
hideIndicator = false,
label,
labelFormatter,
labelClassName,
formatter,
color,
nameKey,
labelKey,
},
ref
) => {
const { config } = useChart()
const tooltipLabel = React.useMemo(() => {
if (hideLabel || !payload?.length) {
return null
}
const [item] = payload
const key = `${labelKey || item?.dataKey || item?.name || "value"}`
const itemConfig = getPayloadConfigFromPayload(config, item, key)
const value =
!labelKey && typeof label === "string"
? config[label as keyof typeof config]?.label || label
: itemConfig?.label
if (labelFormatter) {
return (
<div className={cn("font-medium", labelClassName)}>
{labelFormatter(value, payload)}
</div>
)
}
if (!value) {
return null
}
return <div className={cn("font-medium", labelClassName)}>{value}</div>
}, [
label,
labelFormatter,
payload,
hideLabel,
labelClassName,
config,
labelKey,
])
if (!active || !payload?.length) {
return null
}
const nestLabel = payload.length === 1 && indicator !== "dot"
return (
<div
ref={ref}
className={cn(
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
className
)}
>
{!nestLabel ? tooltipLabel : null}
<div className="grid gap-1.5">
{payload
.filter((item) => item.type !== "none")
.map((item, index) => {
const key = `${nameKey || item.name || item.dataKey || "value"}`
const itemConfig = getPayloadConfigFromPayload(config, item, key)
const indicatorColor = color || item.payload.fill || item.color
return (
<div
key={item.dataKey}
className={cn(
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
indicator === "dot" && "items-center"
)}
>
{formatter && item?.value !== undefined && item.name ? (
formatter(item.value, item.name, item, index, item.payload)
) : (
<>
{itemConfig?.icon ? (
<itemConfig.icon />
) : (
!hideIndicator && (
<div
className={cn(
"shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
{
"h-2.5 w-2.5": indicator === "dot",
"w-1": indicator === "line",
"w-0 border-[1.5px] border-dashed bg-transparent":
indicator === "dashed",
"my-0.5": nestLabel && indicator === "dashed",
}
)}
style={
{
"--color-bg": indicatorColor,
"--color-border": indicatorColor,
} as React.CSSProperties
}
/>
)
)}
<div
className={cn(
"flex flex-1 justify-between leading-none",
nestLabel ? "items-end" : "items-center"
)}
>
<div className="grid gap-1.5">
{nestLabel ? tooltipLabel : null}
<span className="text-muted-foreground">
{itemConfig?.label || item.name}
</span>
</div>
{item.value && (
<span className="font-mono font-medium tabular-nums text-foreground">
{item.value.toLocaleString()}
</span>
)}
</div>
</>
)}
</div>
)
})}
</div>
</div>
)
}
)
ChartTooltipContent.displayName = "ChartTooltip"
const ChartLegend = RechartsPrimitive.Legend
const ChartLegendContent = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div"> &
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
hideIcon?: boolean
nameKey?: string
}
>(
(
{ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey },
ref
) => {
const { config } = useChart()
if (!payload?.length) {
return null
}
return (
<div
ref={ref}
className={cn(
"flex items-center justify-center gap-4",
verticalAlign === "top" ? "pb-3" : "pt-3",
className
)}
>
{payload
.filter((item) => item.type !== "none")
.map((item) => {
const key = `${nameKey || item.dataKey || "value"}`
const itemConfig = getPayloadConfigFromPayload(config, item, key)
return (
<div
key={item.value}
className={cn(
"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
)}
>
{itemConfig?.icon && !hideIcon ? (
<itemConfig.icon />
) : (
<div
className="h-2 w-2 shrink-0 rounded-[2px]"
style={{
backgroundColor: item.color,
}}
/>
)}
{itemConfig?.label}
</div>
)
})}
</div>
)
}
)
ChartLegendContent.displayName = "ChartLegend"
// Helper to extract item config from a payload.
function getPayloadConfigFromPayload(
config: ChartConfig,
payload: unknown,
key: string
) {
if (typeof payload !== "object" || payload === null) {
return undefined
}
const payloadPayload =
"payload" in payload &&
typeof payload.payload === "object" &&
payload.payload !== null
? payload.payload
: undefined
let configLabelKey: string = key
if (
key in payload &&
typeof payload[key as keyof typeof payload] === "string"
) {
configLabelKey = payload[key as keyof typeof payload] as string
} else if (
payloadPayload &&
key in payloadPayload &&
typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
) {
configLabelKey = payloadPayload[
key as keyof typeof payloadPayload
] as string
}
return configLabelKey in config
? config[configLabelKey]
: config[key as keyof typeof config]
}
export {
ChartContainer,
ChartTooltip,
ChartTooltipContent,
ChartLegend,
ChartLegendContent,
ChartStyle,
}

View File

@ -1,28 +0,0 @@
import * as React from "react"
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
import { Check } from "lucide-react"
import { cn } from "@/lib/utils"
const Checkbox = React.forwardRef<
React.ElementRef<typeof CheckboxPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
>(({ className, ...props }, ref) => (
<CheckboxPrimitive.Root
ref={ref}
className={cn(
"grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
className
)}
{...props}
>
<CheckboxPrimitive.Indicator
className={cn("grid place-content-center text-current")}
>
<Check className="h-4 w-4" />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
))
Checkbox.displayName = CheckboxPrimitive.Root.displayName
export { Checkbox }

View File

@ -1,11 +0,0 @@
"use client"
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
const Collapsible = CollapsiblePrimitive.Root
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
export { Collapsible, CollapsibleTrigger, CollapsibleContent }

View File

@ -1,153 +0,0 @@
"use client"
import * as React from "react"
import { type DialogProps } from "@radix-ui/react-dialog"
import { Command as CommandPrimitive } from "cmdk"
import { Search } from "lucide-react"
import { cn } from "@/lib/utils"
import { Dialog, DialogContent } from "@/components/ui/dialog"
const Command = React.forwardRef<
React.ElementRef<typeof CommandPrimitive>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
>(({ className, ...props }, ref) => (
<CommandPrimitive
ref={ref}
className={cn(
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
className
)}
{...props}
/>
))
Command.displayName = CommandPrimitive.displayName
const CommandDialog = ({ children, ...props }: DialogProps) => {
return (
<Dialog {...props}>
<DialogContent className="overflow-hidden p-0">
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
{children}
</Command>
</DialogContent>
</Dialog>
)
}
const CommandInput = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Input>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
>(({ className, ...props }, ref) => (
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
<CommandPrimitive.Input
ref={ref}
className={cn(
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
/>
</div>
))
CommandInput.displayName = CommandPrimitive.Input.displayName
const CommandList = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.List>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
>(({ className, ...props }, ref) => (
<CommandPrimitive.List
ref={ref}
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
{...props}
/>
))
CommandList.displayName = CommandPrimitive.List.displayName
const CommandEmpty = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Empty>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
>((props, ref) => (
<CommandPrimitive.Empty
ref={ref}
className="py-6 text-center text-sm"
{...props}
/>
))
CommandEmpty.displayName = CommandPrimitive.Empty.displayName
const CommandGroup = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Group>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
>(({ className, ...props }, ref) => (
<CommandPrimitive.Group
ref={ref}
className={cn(
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
className
)}
{...props}
/>
))
CommandGroup.displayName = CommandPrimitive.Group.displayName
const CommandSeparator = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
>(({ className, ...props }, ref) => (
<CommandPrimitive.Separator
ref={ref}
className={cn("-mx-1 h-px bg-border", className)}
{...props}
/>
))
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
const CommandItem = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
>(({ className, ...props }, ref) => (
<CommandPrimitive.Item
ref={ref}
className={cn(
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
className
)}
{...props}
/>
))
CommandItem.displayName = CommandPrimitive.Item.displayName
const CommandShortcut = ({
className,
...props
}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
className={cn(
"ml-auto text-xs tracking-widest text-muted-foreground",
className
)}
{...props}
/>
)
}
CommandShortcut.displayName = "CommandShortcut"
export {
Command,
CommandDialog,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandItem,
CommandShortcut,
CommandSeparator,
}

View File

@ -1,198 +0,0 @@
import * as React from "react"
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
import { Check, ChevronRight, Circle } from "lucide-react"
import { cn } from "@/lib/utils"
const ContextMenu = ContextMenuPrimitive.Root
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
const ContextMenuGroup = ContextMenuPrimitive.Group
const ContextMenuPortal = ContextMenuPrimitive.Portal
const ContextMenuSub = ContextMenuPrimitive.Sub
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
const ContextMenuSubTrigger = React.forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
inset?: boolean
}
>(({ className, inset, children, ...props }, ref) => (
<ContextMenuPrimitive.SubTrigger
ref={ref}
className={cn(
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
inset && "pl-8",
className
)}
{...props}
>
{children}
<ChevronRight className="ml-auto h-4 w-4" />
</ContextMenuPrimitive.SubTrigger>
))
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
const ContextMenuSubContent = React.forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
>(({ className, ...props }, ref) => (
<ContextMenuPrimitive.SubContent
ref={ref}
className={cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
className
)}
{...props}
/>
))
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
const ContextMenuContent = React.forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
>(({ className, ...props }, ref) => (
<ContextMenuPrimitive.Portal>
<ContextMenuPrimitive.Content
ref={ref}
className={cn(
"z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
className
)}
{...props}
/>
</ContextMenuPrimitive.Portal>
))
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
const ContextMenuItem = React.forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
inset?: boolean
}
>(({ className, inset, ...props }, ref) => (
<ContextMenuPrimitive.Item
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
inset && "pl-8",
className
)}
{...props}
/>
))
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
const ContextMenuCheckboxItem = React.forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
>(({ className, children, checked, ...props }, ref) => (
<ContextMenuPrimitive.CheckboxItem
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)}
checked={checked}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<ContextMenuPrimitive.ItemIndicator>
<Check className="h-4 w-4" />
</ContextMenuPrimitive.ItemIndicator>
</span>
{children}
</ContextMenuPrimitive.CheckboxItem>
))
ContextMenuCheckboxItem.displayName =
ContextMenuPrimitive.CheckboxItem.displayName
const ContextMenuRadioItem = React.forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
>(({ className, children, ...props }, ref) => (
<ContextMenuPrimitive.RadioItem
ref={ref}
className={cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<ContextMenuPrimitive.ItemIndicator>
<Circle className="h-4 w-4 fill-current" />
</ContextMenuPrimitive.ItemIndicator>
</span>
{children}
</ContextMenuPrimitive.RadioItem>
))
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
const ContextMenuLabel = React.forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.Label>,
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
inset?: boolean
}
>(({ className, inset, ...props }, ref) => (
<ContextMenuPrimitive.Label
ref={ref}
className={cn(
"px-2 py-1.5 text-sm font-semibold text-foreground",
inset && "pl-8",
className
)}
{...props}
/>
))
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
const ContextMenuSeparator = React.forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
>(({ className, ...props }, ref) => (
<ContextMenuPrimitive.Separator
ref={ref}
className={cn("-mx-1 my-1 h-px bg-border", className)}
{...props}
/>
))
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
const ContextMenuShortcut = ({
className,
...props
}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
className={cn(
"ml-auto text-xs tracking-widest text-muted-foreground",
className
)}
{...props}
/>
)
}
ContextMenuShortcut.displayName = "ContextMenuShortcut"
export {
ContextMenu,
ContextMenuTrigger,
ContextMenuContent,
ContextMenuItem,
ContextMenuCheckboxItem,
ContextMenuRadioItem,
ContextMenuLabel,
ContextMenuSeparator,
ContextMenuShortcut,
ContextMenuGroup,
ContextMenuPortal,
ContextMenuSub,
ContextMenuSubContent,
ContextMenuSubTrigger,
ContextMenuRadioGroup,
}

View File

@ -1,120 +0,0 @@
import * as React from "react"
import * as DialogPrimitive from "@radix-ui/react-dialog"
import { X } from "lucide-react"
import { cn } from "@/lib/utils"
const Dialog = DialogPrimitive.Root
const DialogTrigger = DialogPrimitive.Trigger
const DialogPortal = DialogPrimitive.Portal
const DialogClose = DialogPrimitive.Close
const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay
ref={ref}
className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
)}
{...props}
/>
))
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
className
)}
{...props}
>
{children}
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
))
DialogContent.displayName = DialogPrimitive.Content.displayName
const DialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-1.5 text-center sm:text-left",
className
)}
{...props}
/>
)
DialogHeader.displayName = "DialogHeader"
const DialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className
)}
{...props}
/>
)
DialogFooter.displayName = "DialogFooter"
const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className
)}
{...props}
/>
))
DialogTitle.displayName = DialogPrimitive.Title.displayName
const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
DialogDescription.displayName = DialogPrimitive.Description.displayName
export {
Dialog,
DialogPortal,
DialogOverlay,
DialogTrigger,
DialogClose,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
}

View File

@ -1,116 +0,0 @@
import * as React from "react"
import { Drawer as DrawerPrimitive } from "vaul"
import { cn } from "@/lib/utils"
const Drawer = ({
shouldScaleBackground = true,
...props
}: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
<DrawerPrimitive.Root
shouldScaleBackground={shouldScaleBackground}
{...props}
/>
)
Drawer.displayName = "Drawer"
const DrawerTrigger = DrawerPrimitive.Trigger
const DrawerPortal = DrawerPrimitive.Portal
const DrawerClose = DrawerPrimitive.Close
const DrawerOverlay = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DrawerPrimitive.Overlay
ref={ref}
className={cn("fixed inset-0 z-50 bg-black/80", className)}
{...props}
/>
))
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName
const DrawerContent = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DrawerPortal>
<DrawerOverlay />
<DrawerPrimitive.Content
ref={ref}
className={cn(
"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
className
)}
{...props}
>
<div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
{children}
</DrawerPrimitive.Content>
</DrawerPortal>
))
DrawerContent.displayName = "DrawerContent"
const DrawerHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
{...props}
/>
)
DrawerHeader.displayName = "DrawerHeader"
const DrawerFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
{...props}
/>
)
DrawerFooter.displayName = "DrawerFooter"
const DrawerTitle = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
>(({ className, ...props }, ref) => (
<DrawerPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className
)}
{...props}
/>
))
DrawerTitle.displayName = DrawerPrimitive.Title.displayName
const DrawerDescription = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
>(({ className, ...props }, ref) => (
<DrawerPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
DrawerDescription.displayName = DrawerPrimitive.Description.displayName
export {
Drawer,
DrawerPortal,
DrawerOverlay,
DrawerTrigger,
DrawerClose,
DrawerContent,
DrawerHeader,
DrawerFooter,
DrawerTitle,
DrawerDescription,
}

Some files were not shown because too many files have changed in this diff Show More