Spaces:
Running
Running
Upload 2 files
Browse files- README_1.md +15 -0
- index_1.html +1070 -0
README_1.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: TriSmart
|
| 3 |
+
emoji: 🔵
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: yellow
|
| 6 |
+
sdk: static
|
| 7 |
+
app_file: index.html
|
| 8 |
+
pinned: false
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# trismart: less waste, more impact
|
| 12 |
+
|
| 13 |
+
Take a photo of any item you want to get rid of: TriSmart tells you if it can be donated, how to give it a second life, and where it goes if not (French sorting rules).
|
| 14 |
+
|
| 15 |
+
AI waste scanner (OpenAI CLIP via Transformers.js, runs in the browser), dashboard, business analytics and an AI sorting assistant.
|
index_1.html
ADDED
|
@@ -0,0 +1,1070 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
| 6 |
+
<title>trismart: less waste, more impact</title>
|
| 7 |
+
<meta name="description" content="trismart is an AI-powered platform that helps people and businesses manage, reduce and optimize their waste.">
|
| 8 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 9 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 10 |
+
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
|
| 11 |
+
<style>
|
| 12 |
+
/* ============================================================
|
| 13 |
+
DESIGN TOKENS
|
| 14 |
+
============================================================ */
|
| 15 |
+
:root{
|
| 16 |
+
--cobalt:#3547FF; --cobalt-ink:#2433D6; --cobalt-soft:#E6E9FF;
|
| 17 |
+
--lime:#D7FF45; --lime-soft:#F1FFC2;
|
| 18 |
+
--orange:#FF7043; --orange-soft:#FFE6DD;
|
| 19 |
+
--paper:#F8F7F2; --white:#FFFFFF; --ink:#202020; --ink-2:#4A4A47; --muted:#6E6D68;
|
| 20 |
+
--line:#E7E5DC; --line-2:#D9D6CA;
|
| 21 |
+
/* chart categorical (validated: CVD + contrast pass on white) */
|
| 22 |
+
--c-pack:#3547FF; --c-org:#0F9B8E; --c-bulk:#A07A00; --c-res:#E5582F;
|
| 23 |
+
--r-sm:12px; --r-md:18px; --r-lg:28px; --r-xl:36px;
|
| 24 |
+
--s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px; --s7:48px; --s8:64px;
|
| 25 |
+
--shadow:0 1px 0 rgba(32,32,32,.04), 0 12px 32px -12px rgba(32,32,32,.12);
|
| 26 |
+
--ease:cubic-bezier(.2,.8,.2,1);
|
| 27 |
+
--display:"Space Grotesk",system-ui,sans-serif; --body:Inter,system-ui,sans-serif;
|
| 28 |
+
}
|
| 29 |
+
*{box-sizing:border-box}
|
| 30 |
+
[hidden]{display:none!important}
|
| 31 |
+
html,body{margin:0;background:var(--paper);color:var(--ink);font-family:var(--body);font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased}
|
| 32 |
+
button,input,select{font:inherit;color:inherit}
|
| 33 |
+
button{cursor:pointer}
|
| 34 |
+
a{color:var(--cobalt-ink)}
|
| 35 |
+
:focus-visible{outline:3px solid var(--cobalt);outline-offset:2px;border-radius:8px}
|
| 36 |
+
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
| 37 |
+
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
|
| 38 |
+
|
| 39 |
+
/* ============================================================
|
| 40 |
+
LAYOUT
|
| 41 |
+
============================================================ */
|
| 42 |
+
.app{display:grid;grid-template-columns:248px 1fr;min-height:100vh}
|
| 43 |
+
.sidebar{position:sticky;top:0;height:100vh;padding:28px 18px;display:flex;flex-direction:column;gap:28px;border-right:1px solid var(--line);background:var(--paper)}
|
| 44 |
+
.wordmark{font-family:var(--display);font-weight:700;font-size:26px;letter-spacing:-.04em;display:flex;align-items:center;gap:6px;padding:0 10px;text-decoration:none;color:var(--ink)}
|
| 45 |
+
.wordmark .dot{width:12px;height:12px;border-radius:50%;background:var(--lime);box-shadow:0 0 0 3px var(--ink);display:inline-block;transform:translateY(2px)}
|
| 46 |
+
.nav{display:flex;flex-direction:column;gap:4px}
|
| 47 |
+
.nav button{display:flex;align-items:center;gap:12px;border:0;background:none;padding:11px 12px;border-radius:14px;font-weight:500;color:var(--ink-2);text-align:left;transition:background .2s var(--ease),color .2s}
|
| 48 |
+
.nav button svg{width:20px;height:20px;flex:none}
|
| 49 |
+
.nav button:hover{background:#EFEDE5;color:var(--ink)}
|
| 50 |
+
.nav button[aria-current="page"]{background:var(--ink);color:var(--paper)}
|
| 51 |
+
.nav button[aria-current="page"] .kbd{color:#A9A8A2}
|
| 52 |
+
.nav .kbd{margin-left:auto;font-size:11px;color:var(--muted);font-family:var(--display)}
|
| 53 |
+
.side-bottom{margin-top:auto;display:flex;flex-direction:column;gap:14px}
|
| 54 |
+
.mode{display:grid;grid-template-columns:1fr 1fr;background:#EFEDE5;border-radius:14px;padding:4px}
|
| 55 |
+
.mode button{border:0;background:none;border-radius:10px;padding:8px 6px;font-size:13px;font-weight:600;color:var(--ink-2)}
|
| 56 |
+
.mode button[aria-pressed="true"]{background:var(--white);color:var(--ink);box-shadow:var(--shadow)}
|
| 57 |
+
.account{display:flex;align-items:center;gap:10px;padding:10px;border-radius:14px;border:1px solid var(--line)}
|
| 58 |
+
.avatar{width:34px;height:34px;border-radius:12px;background:var(--cobalt);color:#fff;display:grid;place-items:center;font-family:var(--display);font-weight:700;font-size:14px;flex:none}
|
| 59 |
+
.account small{display:block;color:var(--muted);font-size:12px}
|
| 60 |
+
.account b{font-size:13px}
|
| 61 |
+
|
| 62 |
+
main{min-width:0;padding:36px clamp(16px,4vw,56px) 80px}
|
| 63 |
+
.view{display:none;animation:viewIn .45s var(--ease)}
|
| 64 |
+
.view.active{display:block}
|
| 65 |
+
@keyframes viewIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
|
| 66 |
+
|
| 67 |
+
.topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:var(--s5)}
|
| 68 |
+
.eyebrow{font-family:var(--display);font-size:13px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
|
| 69 |
+
.mobile-head{display:none}
|
| 70 |
+
|
| 71 |
+
/* ============================================================
|
| 72 |
+
TYPE
|
| 73 |
+
============================================================ */
|
| 74 |
+
.mega{font-family:var(--display);font-weight:700;letter-spacing:-.045em;line-height:.9;font-size:clamp(48px,8.4vw,120px);margin:0}
|
| 75 |
+
.mega .hl{position:relative;white-space:nowrap}
|
| 76 |
+
.mega .hl::after{content:"";position:absolute;left:-2%;right:-2%;bottom:.06em;height:.26em;background:var(--lime);z-index:-1;border-radius:6px;transform-origin:left;animation:mark .9s .2s var(--ease) both}
|
| 77 |
+
@keyframes mark{from{transform:scaleX(0)}to{transform:scaleX(1)}}
|
| 78 |
+
.h2{font-family:var(--display);font-weight:700;letter-spacing:-.03em;font-size:clamp(26px,3vw,36px);line-height:1;margin:0}
|
| 79 |
+
.h3{font-family:var(--display);font-weight:600;letter-spacing:-.02em;font-size:20px;line-height:1.15;margin:0}
|
| 80 |
+
.muted{color:var(--muted)}
|
| 81 |
+
.big-num{font-family:var(--display);font-weight:700;letter-spacing:-.05em;line-height:.9;font-size:clamp(44px,5vw,64px)}
|
| 82 |
+
.big-num small{font-size:.38em;letter-spacing:-.02em;margin-left:4px;font-weight:600}
|
| 83 |
+
|
| 84 |
+
/* ============================================================
|
| 85 |
+
COMPONENTS
|
| 86 |
+
============================================================ */
|
| 87 |
+
.card{background:var(--white);border:1px solid var(--line);border-radius:var(--r-lg);padding:var(--s5);box-shadow:var(--shadow)}
|
| 88 |
+
.card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:var(--s4);flex-wrap:wrap}
|
| 89 |
+
.btn{display:inline-flex;align-items:center;justify-content:center;gap:10px;border:0;border-radius:999px;padding:14px 22px;font-weight:600;font-size:15px;transition:transform .15s var(--ease),box-shadow .2s,background .2s;text-decoration:none;white-space:nowrap}
|
| 90 |
+
.btn svg{width:18px;height:18px}
|
| 91 |
+
.btn:active{transform:scale(.97)}
|
| 92 |
+
.btn-primary{background:var(--cobalt);color:#fff;box-shadow:0 8px 20px -8px rgba(53,71,255,.7)}
|
| 93 |
+
.btn-primary:hover{background:var(--cobalt-ink)}
|
| 94 |
+
.btn-lime{background:var(--lime);color:var(--ink)}
|
| 95 |
+
.btn-lime:hover{box-shadow:0 0 0 4px rgba(215,255,69,.35)}
|
| 96 |
+
.btn-ghost{background:transparent;color:inherit;border:1.5px solid currentColor}
|
| 97 |
+
.btn-ghost:hover{background:rgba(255,255,255,.12)}
|
| 98 |
+
.btn-quiet{background:#EFEDE5;color:var(--ink)}
|
| 99 |
+
.btn-quiet:hover{background:#E6E3D8}
|
| 100 |
+
.btn-sm{padding:9px 14px;font-size:13px}
|
| 101 |
+
.icon-btn{width:40px;height:40px;border-radius:12px;border:1px solid var(--line);background:var(--white);display:grid;place-items:center}
|
| 102 |
+
.icon-btn svg{width:18px;height:18px}
|
| 103 |
+
|
| 104 |
+
.badge{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:600;padding:3px 9px;border-radius:999px;white-space:nowrap;letter-spacing:.01em}
|
| 105 |
+
.badge svg{width:12px;height:12px}
|
| 106 |
+
.b-measured{background:var(--ink);color:var(--paper)}
|
| 107 |
+
.b-ai{background:transparent;color:var(--cobalt-ink);border:1.5px dashed var(--cobalt)}
|
| 108 |
+
.b-good{background:var(--lime);color:var(--ink)}
|
| 109 |
+
.b-alert{background:var(--orange-soft);color:#9A2F0E}
|
| 110 |
+
.delta{font-size:13px;font-weight:600;display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px}
|
| 111 |
+
.delta.good{background:var(--lime-soft);color:#3E5200}
|
| 112 |
+
.delta.bad{background:var(--orange-soft);color:#9A2F0E}
|
| 113 |
+
|
| 114 |
+
.chips{display:flex;flex-wrap:wrap;gap:8px}
|
| 115 |
+
.chip{border:1.5px solid var(--line-2);background:var(--white);border-radius:999px;padding:8px 14px;font-size:13.5px;font-weight:500;transition:border-color .2s,background .2s}
|
| 116 |
+
.chip:hover{border-color:var(--ink)}
|
| 117 |
+
.chip[aria-pressed="true"]{background:var(--ink);color:var(--paper);border-color:var(--ink)}
|
| 118 |
+
.chip .sw{display:inline-block;width:9px;height:9px;border-radius:3px;margin-right:6px;vertical-align:0}
|
| 119 |
+
|
| 120 |
+
.seg{display:inline-flex;background:#EFEDE5;border-radius:999px;padding:4px}
|
| 121 |
+
.seg button{border:0;background:none;border-radius:999px;padding:8px 14px;font-size:13px;font-weight:600;color:var(--ink-2)}
|
| 122 |
+
.seg button[aria-pressed="true"]{background:var(--white);color:var(--ink);box-shadow:var(--shadow)}
|
| 123 |
+
select.select{appearance:none;border:1.5px solid var(--line-2);background:var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23202020' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 14px center;border-radius:999px;padding:9px 38px 9px 16px;font-size:13.5px;font-weight:500}
|
| 124 |
+
|
| 125 |
+
.toast-wrap{position:fixed;left:50%;bottom:28px;transform:translateX(-50%);z-index:60;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none}
|
| 126 |
+
.toast{background:var(--ink);color:var(--paper);padding:12px 18px;border-radius:16px;font-weight:500;font-size:14px;display:flex;gap:10px;align-items:center;box-shadow:0 16px 40px -12px rgba(0,0,0,.4);animation:toastIn .35s var(--ease)}
|
| 127 |
+
.toast .ok{width:22px;height:22px;border-radius:50%;background:var(--lime);color:var(--ink);display:grid;place-items:center;font-weight:700;font-size:13px}
|
| 128 |
+
@keyframes toastIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
|
| 129 |
+
|
| 130 |
+
/* success burst */
|
| 131 |
+
.burst{position:fixed;inset:0;pointer-events:none;z-index:70;display:grid;place-items:center}
|
| 132 |
+
.burst .ring{width:120px;height:120px;border-radius:50%;border:6px solid var(--lime);animation:ring .7s var(--ease) forwards}
|
| 133 |
+
.burst .check{position:absolute;width:76px;height:76px;border-radius:50%;background:var(--lime);display:grid;place-items:center;animation:pop .7s var(--ease) forwards}
|
| 134 |
+
.burst .check svg{width:38px;height:38px}
|
| 135 |
+
@keyframes ring{0%{transform:scale(.4);opacity:1}100%{transform:scale(1.9);opacity:0}}
|
| 136 |
+
@keyframes pop{0%{transform:scale(.3);opacity:0}35%{transform:scale(1.08);opacity:1}75%{transform:scale(1);opacity:1}100%{transform:scale(.9);opacity:0}}
|
| 137 |
+
|
| 138 |
+
/* ============================================================
|
| 139 |
+
DASHBOARD
|
| 140 |
+
============================================================ */
|
| 141 |
+
.hero{display:grid;grid-template-columns:1.25fr 1fr;gap:var(--s5);align-items:stretch;margin-bottom:var(--s5)}
|
| 142 |
+
.hero-copy{display:flex;flex-direction:column;justify-content:space-between;gap:var(--s5);padding:var(--s2) 0}
|
| 143 |
+
.hero-copy p{max-width:440px;font-size:17px;color:var(--ink-2);margin:0}
|
| 144 |
+
.ai-card{position:relative;overflow:hidden;background:var(--cobalt);color:#fff;border-radius:var(--r-xl);padding:28px;display:flex;flex-direction:column;justify-content:space-between;gap:28px;min-height:300px;isolation:isolate}
|
| 145 |
+
.ai-card .net{position:absolute;right:-40px;bottom:-60px;width:300px;height:300px;z-index:-1;opacity:.5}
|
| 146 |
+
.ai-card .net circle{fill:#fff}
|
| 147 |
+
.ai-card .net .n-lime{fill:var(--lime)}
|
| 148 |
+
.ai-card .net line{stroke:rgba(255,255,255,.28);stroke-width:1.2}
|
| 149 |
+
.ai-card .net .pulse{animation:pulse 2.8s ease-in-out infinite;transform-box:fill-box;transform-origin:center}
|
| 150 |
+
.ai-card .net .pulse:nth-child(2n){animation-delay:1.1s}
|
| 151 |
+
@keyframes pulse{0%,100%{transform:scale(1);opacity:.85}50%{transform:scale(1.6);opacity:1}}
|
| 152 |
+
.ai-tag{display:inline-flex;align-items:center;gap:8px;font-family:var(--display);font-weight:600;font-size:13px;letter-spacing:.06em;text-transform:uppercase;background:rgba(255,255,255,.14);padding:6px 12px;border-radius:999px;width:max-content}
|
| 153 |
+
.ai-tag .live{width:8px;height:8px;border-radius:50%;background:var(--lime);box-shadow:0 0 0 0 rgba(215,255,69,.7);animation:live 2s infinite}
|
| 154 |
+
@keyframes live{0%{box-shadow:0 0 0 0 rgba(215,255,69,.6)}70%{box-shadow:0 0 0 10px rgba(215,255,69,0)}100%{box-shadow:0 0 0 0 rgba(215,255,69,0)}}
|
| 155 |
+
.ai-card h2{font-family:var(--display);font-weight:700;font-size:clamp(28px,3vw,40px);line-height:1;letter-spacing:-.035em;margin:14px 0 0;max-width:380px}
|
| 156 |
+
.ai-actions{display:flex;gap:10px;flex-wrap:wrap}
|
| 157 |
+
|
| 158 |
+
.kpis{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--s4);margin-bottom:var(--s5)}
|
| 159 |
+
.kpi{position:relative;display:flex;flex-direction:column;gap:14px;min-height:190px}
|
| 160 |
+
.kpi .top{display:flex;justify-content:space-between;align-items:center;gap:8px}
|
| 161 |
+
.kpi .label{font-weight:600;font-size:14px;color:var(--ink-2)}
|
| 162 |
+
.kpi .foot{margin-top:auto;display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:13px;color:var(--muted)}
|
| 163 |
+
.kpi.lime{background:var(--lime);border-color:var(--lime)}
|
| 164 |
+
.kpi.lime .label,.kpi.lime .foot{color:#2B3600}
|
| 165 |
+
.meter{height:8px;border-radius:999px;background:rgba(32,32,32,.12);overflow:hidden}
|
| 166 |
+
.meter i{display:block;height:100%;background:var(--ink);border-radius:999px;width:0;transition:width 1.1s var(--ease)}
|
| 167 |
+
|
| 168 |
+
.grid-2{display:grid;grid-template-columns:1.6fr 1fr;gap:var(--s4);margin-bottom:var(--s5)}
|
| 169 |
+
.legend{display:flex;flex-wrap:wrap;gap:14px;font-size:13px;color:var(--ink-2)}
|
| 170 |
+
.legend span{display:inline-flex;align-items:center;gap:6px}
|
| 171 |
+
.legend i{width:10px;height:10px;border-radius:3px;display:inline-block}
|
| 172 |
+
.chart{position:relative;width:100%}
|
| 173 |
+
.chart svg{display:block;width:100%;height:auto;overflow:visible}
|
| 174 |
+
.chart .axis{fill:var(--muted);font-size:11px;font-family:var(--body)}
|
| 175 |
+
.chart .grid{stroke:var(--line);stroke-width:1}
|
| 176 |
+
.chart .col-hit{fill:transparent;cursor:pointer}
|
| 177 |
+
.chart .col-hit:hover,.chart .col-hit.on{fill:rgba(32,32,32,.04)}
|
| 178 |
+
.tip{position:absolute;pointer-events:none;background:var(--ink);color:var(--paper);border-radius:14px;padding:10px 12px;font-size:12.5px;min-width:170px;opacity:0;transform:translateY(4px);transition:opacity .15s,transform .15s;z-index:5}
|
| 179 |
+
.tip.show{opacity:1;transform:none}
|
| 180 |
+
.tip b{font-family:var(--display);font-size:14px;display:block;margin-bottom:4px}
|
| 181 |
+
.tip .r{display:flex;justify-content:space-between;gap:14px}
|
| 182 |
+
.tip .r span{display:inline-flex;align-items:center;gap:6px}
|
| 183 |
+
.tip .r i{width:8px;height:8px;border-radius:2px;display:inline-block}
|
| 184 |
+
.tip .t{border-top:1px solid #3a3a3a;margin-top:6px;padding-top:6px}
|
| 185 |
+
.table-view{width:100%;border-collapse:collapse;font-size:13px;margin-top:8px}
|
| 186 |
+
.table-view th,.table-view td{text-align:right;padding:7px 8px;border-bottom:1px solid var(--line)}
|
| 187 |
+
.table-view th:first-child,.table-view td:first-child{text-align:left}
|
| 188 |
+
.table-view th{font-weight:600;color:var(--muted)}
|
| 189 |
+
|
| 190 |
+
.moves{display:flex;flex-direction:column;gap:10px}
|
| 191 |
+
.move{display:grid;grid-template-columns:auto 1fr;gap:14px;padding:16px;border-radius:var(--r-md);border:1px solid var(--line);background:var(--paper);transition:transform .2s var(--ease),border-color .2s,opacity .3s}
|
| 192 |
+
.move:hover{transform:translateY(-2px);border-color:var(--line-2)}
|
| 193 |
+
.move .n{font-family:var(--display);font-weight:700;font-size:28px;line-height:1;letter-spacing:-.04em;color:var(--cobalt)}
|
| 194 |
+
.move h4{margin:0 0 4px;font-size:15px;line-height:1.3}
|
| 195 |
+
.move p{margin:0 0 10px;font-size:13.5px;color:var(--ink-2)}
|
| 196 |
+
.move .row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
| 197 |
+
.move.done{opacity:.55}
|
| 198 |
+
.move.done h4{text-decoration:line-through}
|
| 199 |
+
.move.alert .n{color:#C2410C}
|
| 200 |
+
|
| 201 |
+
.feed{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
|
| 202 |
+
.feed li{display:grid;grid-template-columns:auto 1fr auto;gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid var(--line)}
|
| 203 |
+
.feed li:last-child{border-bottom:0}
|
| 204 |
+
.feed .ic{width:38px;height:38px;border-radius:12px;display:grid;place-items:center;font-size:17px}
|
| 205 |
+
.feed .ic.scan{background:var(--cobalt-soft)}
|
| 206 |
+
.feed .ic.report{background:#EFEDE5}
|
| 207 |
+
.feed .ic.done{background:var(--lime)}
|
| 208 |
+
.feed .ic.alert{background:var(--orange-soft)}
|
| 209 |
+
.feed b{font-weight:600;font-size:14px}
|
| 210 |
+
.feed small{display:block;color:var(--muted);font-size:12.5px}
|
| 211 |
+
.feed time{font-size:12px;color:var(--muted);white-space:nowrap}
|
| 212 |
+
.feed li.new{animation:slideIn .5s var(--ease)}
|
| 213 |
+
@keyframes slideIn{from{opacity:0;transform:translateX(-10px);background:var(--lime-soft)}to{opacity:1;transform:none}}
|
| 214 |
+
|
| 215 |
+
.empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:10px;padding:28px 12px;color:var(--muted)}
|
| 216 |
+
.empty .shape{width:72px;height:72px;border-radius:24px;background:var(--lime-soft);display:grid;place-items:center;font-size:30px;transform:rotate(-8deg)}
|
| 217 |
+
.empty b{color:var(--ink);font-family:var(--display);font-size:18px}
|
| 218 |
+
|
| 219 |
+
/* ============================================================
|
| 220 |
+
SCAN
|
| 221 |
+
============================================================ */
|
| 222 |
+
.scan-grid{display:grid;grid-template-columns:1.05fr 1fr;gap:var(--s4);align-items:start}
|
| 223 |
+
.viewer{position:relative;border-radius:var(--r-xl);overflow:hidden;background:var(--ink);aspect-ratio:4/3.4;display:grid;place-items:center;color:var(--paper);isolation:isolate}
|
| 224 |
+
.viewer video,.viewer img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
|
| 225 |
+
.viewer .frame{position:absolute;inset:14%;border-radius:28px;pointer-events:none;z-index:2;
|
| 226 |
+
background:
|
| 227 |
+
linear-gradient(var(--lime),var(--lime)) top left/36px 4px no-repeat,linear-gradient(var(--lime),var(--lime)) top left/4px 36px no-repeat,
|
| 228 |
+
linear-gradient(var(--lime),var(--lime)) top right/36px 4px no-repeat,linear-gradient(var(--lime),var(--lime)) top right/4px 36px no-repeat,
|
| 229 |
+
linear-gradient(var(--lime),var(--lime)) bottom left/36px 4px no-repeat,linear-gradient(var(--lime),var(--lime)) bottom left/4px 36px no-repeat,
|
| 230 |
+
linear-gradient(var(--lime),var(--lime)) bottom right/36px 4px no-repeat,linear-gradient(var(--lime),var(--lime)) bottom right/4px 36px no-repeat}
|
| 231 |
+
.viewer .scanline{position:absolute;left:14%;right:14%;height:3px;background:var(--lime);box-shadow:0 0 18px 4px rgba(215,255,69,.6);z-index:3;display:none;top:14%}
|
| 232 |
+
.viewer.scanning .scanline{display:block;animation:scanY 1.4s ease-in-out infinite alternate}
|
| 233 |
+
@keyframes scanY{from{top:14%}to{top:86%}}
|
| 234 |
+
.viewer .placeholder{position:relative;z-index:1;text-align:center;padding:24px;display:flex;flex-direction:column;align-items:center;gap:14px}
|
| 235 |
+
.viewer .placeholder .h2{color:var(--paper)}
|
| 236 |
+
.viewer .placeholder p{margin:0;color:#BDBCB6;max-width:300px}
|
| 237 |
+
.viewer.drag{outline:4px dashed var(--lime);outline-offset:-12px}
|
| 238 |
+
.viewer-controls{display:flex;gap:10px;flex-wrap:wrap;margin-top:var(--s4)}
|
| 239 |
+
.demo-row{margin-top:var(--s4)}
|
| 240 |
+
.demo-row .eyebrow{margin-bottom:8px;display:block}
|
| 241 |
+
.model-state{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:16px;background:var(--white);border:1px solid var(--line);margin-top:var(--s4);font-size:13.5px}
|
| 242 |
+
.model-state .bar{flex:1;height:6px;background:#EFEDE5;border-radius:99px;overflow:hidden;min-width:60px}
|
| 243 |
+
.model-state .bar i{display:block;height:100%;width:0;background:var(--cobalt);transition:width .3s}
|
| 244 |
+
.model-state.ready .bar{display:none}
|
| 245 |
+
.dotc{width:10px;height:10px;border-radius:50%;background:var(--orange);flex:none}
|
| 246 |
+
.model-state.ready .dotc{background:#5C7A00;box-shadow:0 0 0 4px var(--lime)}
|
| 247 |
+
.model-state.loading .dotc{background:var(--cobalt);animation:live 1.4s infinite}
|
| 248 |
+
|
| 249 |
+
.result{min-height:420px}
|
| 250 |
+
.result .empty{min-height:380px;justify-content:center}
|
| 251 |
+
.res-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
|
| 252 |
+
.res-item{font-family:var(--display);font-weight:700;font-size:clamp(28px,3.2vw,40px);line-height:1;letter-spacing:-.035em;margin:8px 0 14px;text-transform:capitalize}
|
| 253 |
+
.conf{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--ink-2);margin-bottom:18px}
|
| 254 |
+
.conf .meter{flex:1;background:#EFEDE5}
|
| 255 |
+
.conf .meter i{background:var(--cobalt)}
|
| 256 |
+
.step{border-radius:var(--r-md);padding:16px 18px;margin-top:10px;border:1px solid var(--line);animation:viewIn .45s var(--ease) both}
|
| 257 |
+
.step:nth-of-type(2){animation-delay:.08s}.step:nth-of-type(3){animation-delay:.16s}
|
| 258 |
+
.step .st{display:flex;align-items:center;gap:10px;font-family:var(--display);font-weight:600;font-size:16px;margin-bottom:8px}
|
| 259 |
+
.step .st .n{width:26px;height:26px;border-radius:9px;background:var(--ink);color:var(--paper);display:grid;place-items:center;font-size:13px}
|
| 260 |
+
.step p{margin:0;font-size:14px;color:var(--ink-2)}
|
| 261 |
+
.links{display:flex;flex-wrap:wrap;gap:8px}
|
| 262 |
+
.links a{display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border-radius:12px;background:var(--cobalt-soft);color:var(--cobalt-ink);text-decoration:none;font-weight:600;font-size:13px;transition:background .2s}
|
| 263 |
+
.links a:hover{background:#D5DAFF}
|
| 264 |
+
.binbox{border:0;color:var(--ink)}
|
| 265 |
+
.binbox .bin-name{font-family:var(--display);font-weight:700;font-size:24px;letter-spacing:-.03em;line-height:1.05;margin:4px 0 6px}
|
| 266 |
+
.binbox p{color:inherit;opacity:.85}
|
| 267 |
+
.binbox .st .n{background:rgba(255,255,255,.35);color:inherit}
|
| 268 |
+
.res-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}
|
| 269 |
+
.not-sure{background:var(--orange-soft);border-color:#FFD3C4}
|
| 270 |
+
|
| 271 |
+
/* ============================================================
|
| 272 |
+
ANALYTICS
|
| 273 |
+
============================================================ */
|
| 274 |
+
.filters{display:flex;flex-wrap:wrap;gap:12px;align-items:center;margin-bottom:var(--s5);padding:14px;background:var(--white);border:1px solid var(--line);border-radius:var(--r-lg)}
|
| 275 |
+
.filters .sep{width:1px;height:28px;background:var(--line)}
|
| 276 |
+
.akpis{display:grid;grid-template-columns:repeat(4,1fr);gap:var(--s4);margin-bottom:var(--s4)}
|
| 277 |
+
.akpi .big-num{font-size:clamp(34px,3.6vw,48px)}
|
| 278 |
+
.akpi .label{font-size:13px;font-weight:600;color:var(--ink-2);margin-bottom:10px;display:flex;justify-content:space-between;gap:6px;flex-wrap:wrap}
|
| 279 |
+
.hbar{display:grid;grid-template-columns:140px 1fr 70px;align-items:center;gap:12px;margin:12px 0;font-size:13.5px}
|
| 280 |
+
.hbar .track{height:14px;background:#EFEDE5;border-radius:999px;overflow:hidden;display:flex;gap:2px}
|
| 281 |
+
.hbar .track i{display:block;height:100%;transition:width .8s var(--ease)}
|
| 282 |
+
.hbar .track i:first-child{border-radius:999px 0 0 999px}
|
| 283 |
+
.hbar .track i:last-child{border-radius:0 999px 999px 0}
|
| 284 |
+
.hbar b{text-align:right;font-family:var(--display)}
|
| 285 |
+
.cat-row{display:grid;grid-template-columns:auto 1fr auto auto;gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid var(--line);font-size:14px}
|
| 286 |
+
.cat-row:last-child{border-bottom:0}
|
| 287 |
+
.cat-row i{width:12px;height:12px;border-radius:4px}
|
| 288 |
+
.cat-row b{font-family:var(--display)}
|
| 289 |
+
.reco{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--s4)}
|
| 290 |
+
.reco .card{display:flex;flex-direction:column;gap:10px}
|
| 291 |
+
.reco .save{font-family:var(--display);font-weight:700;font-size:34px;letter-spacing:-.04em;line-height:1}
|
| 292 |
+
.reco .card.feature{background:var(--ink);color:var(--paper);border-color:var(--ink)}
|
| 293 |
+
.reco .card.feature .muted{color:#A9A8A2}
|
| 294 |
+
.reco .card.feature .b-ai{color:var(--lime);border-color:var(--lime)}
|
| 295 |
+
.note{display:flex;gap:16px;flex-wrap:wrap;align-items:center;font-size:13px;color:var(--muted);margin:var(--s4) 0}
|
| 296 |
+
|
| 297 |
+
/* ============================================================
|
| 298 |
+
ASSISTANT
|
| 299 |
+
============================================================ */
|
| 300 |
+
.chat-wrap{display:grid;grid-template-columns:1fr 300px;gap:var(--s4);align-items:start}
|
| 301 |
+
.chat{display:flex;flex-direction:column;height:min(72vh,720px);padding:0;overflow:hidden}
|
| 302 |
+
.chat-head{display:flex;align-items:center;gap:12px;padding:18px 22px;border-bottom:1px solid var(--line)}
|
| 303 |
+
.bot-av{width:40px;height:40px;border-radius:14px;background:var(--cobalt);display:grid;place-items:center;position:relative}
|
| 304 |
+
.bot-av::after{content:"";position:absolute;right:-3px;bottom:-3px;width:12px;height:12px;border-radius:50%;background:var(--lime);border:2.5px solid #fff}
|
| 305 |
+
.bot-av svg{width:22px;height:22px}
|
| 306 |
+
.msgs{flex:1;overflow-y:auto;padding:22px;display:flex;flex-direction:column;gap:14px;scroll-behavior:smooth}
|
| 307 |
+
.msg{max-width:min(84%,560px);padding:13px 16px;border-radius:20px;font-size:14.5px;line-height:1.55;animation:viewIn .35s var(--ease)}
|
| 308 |
+
.msg.bot{background:var(--paper);border:1px solid var(--line);border-bottom-left-radius:6px;align-self:flex-start}
|
| 309 |
+
.msg.user{background:var(--cobalt);color:#fff;border-bottom-right-radius:6px;align-self:flex-end}
|
| 310 |
+
.msg p{margin:0 0 8px}.msg p:last-child{margin:0}
|
| 311 |
+
.msg ul{margin:6px 0 8px;padding-left:18px}
|
| 312 |
+
.msg .msg-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
|
| 313 |
+
.msg .src{margin-top:8px;font-size:12px;color:var(--muted);display:flex;gap:6px;align-items:center}
|
| 314 |
+
.typing{display:inline-flex;gap:4px;padding:16px 18px}
|
| 315 |
+
.typing i{width:7px;height:7px;border-radius:50%;background:var(--muted);animation:bounce 1s infinite}
|
| 316 |
+
.typing i:nth-child(2){animation-delay:.15s}.typing i:nth-child(3){animation-delay:.3s}
|
| 317 |
+
@keyframes bounce{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-5px);opacity:1}}
|
| 318 |
+
.composer{display:flex;gap:10px;padding:14px;border-top:1px solid var(--line);background:var(--white)}
|
| 319 |
+
.composer input{flex:1;border:1.5px solid var(--line-2);border-radius:999px;padding:13px 18px;background:var(--paper)}
|
| 320 |
+
.composer input:focus{outline:none;border-color:var(--cobalt);background:#fff}
|
| 321 |
+
.composer .btn{padding:13px 18px}
|
| 322 |
+
.suggest{display:flex;flex-direction:column;gap:8px}
|
| 323 |
+
.suggest .chip{text-align:left;border-radius:16px}
|
| 324 |
+
|
| 325 |
+
/* ============================================================
|
| 326 |
+
MOBILE
|
| 327 |
+
============================================================ */
|
| 328 |
+
.bottom-nav{display:none}
|
| 329 |
+
@media (max-width:1100px){
|
| 330 |
+
.hero{grid-template-columns:1fr}
|
| 331 |
+
.grid-2{grid-template-columns:1fr}
|
| 332 |
+
.akpis{grid-template-columns:repeat(2,1fr)}
|
| 333 |
+
.reco{grid-template-columns:1fr}
|
| 334 |
+
.chat-wrap{grid-template-columns:1fr}
|
| 335 |
+
.chat-side{order:-1}
|
| 336 |
+
.suggest{flex-direction:row;flex-wrap:wrap}
|
| 337 |
+
}
|
| 338 |
+
@media (max-width:860px){
|
| 339 |
+
.app{grid-template-columns:1fr}
|
| 340 |
+
.sidebar{display:none}
|
| 341 |
+
main{padding:18px 16px 120px}
|
| 342 |
+
.mobile-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}
|
| 343 |
+
.mobile-head .mode{width:180px}
|
| 344 |
+
.kpis{grid-template-columns:1fr}
|
| 345 |
+
.kpi{min-height:auto}
|
| 346 |
+
.scan-grid{grid-template-columns:1fr}
|
| 347 |
+
.hbar{grid-template-columns:96px 1fr 56px}
|
| 348 |
+
.filters .sep{display:none}
|
| 349 |
+
.bottom-nav{display:grid;grid-template-columns:repeat(4,1fr);position:fixed;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));background:var(--ink);border-radius:24px;padding:8px;z-index:50;box-shadow:0 16px 40px -12px rgba(0,0,0,.45)}
|
| 350 |
+
.bottom-nav button{border:0;background:none;color:#A9A8A2;display:flex;flex-direction:column;align-items:center;gap:3px;font-size:11px;font-weight:600;padding:6px 0;border-radius:16px}
|
| 351 |
+
.bottom-nav button svg{width:22px;height:22px}
|
| 352 |
+
.bottom-nav button[aria-current="page"]{color:var(--lime)}
|
| 353 |
+
.bottom-nav .scan-fab{background:var(--lime);color:var(--ink)!important;margin:-22px 6px 0;border-radius:20px;box-shadow:0 8px 20px -6px rgba(215,255,69,.7)}
|
| 354 |
+
.chat{height:calc(100vh - 260px)}
|
| 355 |
+
.toast-wrap{bottom:calc(104px + env(safe-area-inset-bottom))}
|
| 356 |
+
.msg{max-width:92%}
|
| 357 |
+
}
|
| 358 |
+
@media (max-width:460px){.akpis{grid-template-columns:1fr}}
|
| 359 |
+
</style>
|
| 360 |
+
</head>
|
| 361 |
+
<body>
|
| 362 |
+
<div class="app">
|
| 363 |
+
<!-- ===================== SIDEBAR ===================== -->
|
| 364 |
+
<aside class="sidebar" aria-label="Main navigation">
|
| 365 |
+
<a class="wordmark" href="#dashboard" aria-label="trismart home">trismart<span class="dot" aria-hidden="true"></span></a>
|
| 366 |
+
<nav class="nav" id="sideNav"></nav>
|
| 367 |
+
<div class="side-bottom">
|
| 368 |
+
<div class="eyebrow" style="padding:0 6px">Workspace</div>
|
| 369 |
+
<div class="mode" role="group" aria-label="Workspace mode">
|
| 370 |
+
<button data-mode="business" aria-pressed="true">Business</button>
|
| 371 |
+
<button data-mode="personal" aria-pressed="false">Personal</button>
|
| 372 |
+
</div>
|
| 373 |
+
<div class="account"><div class="avatar" id="avatar">DC</div><div><b id="accName">Demo Café Group</b><small id="accSub">3 sites · Paris</small></div></div>
|
| 374 |
+
</div>
|
| 375 |
+
</aside>
|
| 376 |
+
|
| 377 |
+
<main id="main">
|
| 378 |
+
<div class="mobile-head">
|
| 379 |
+
<a class="wordmark" href="#dashboard" style="padding:0">trismart<span class="dot" aria-hidden="true"></span></a>
|
| 380 |
+
<div class="mode" role="group" aria-label="Workspace mode">
|
| 381 |
+
<button data-mode="business" aria-pressed="true">Business</button>
|
| 382 |
+
<button data-mode="personal" aria-pressed="false">Personal</button>
|
| 383 |
+
</div>
|
| 384 |
+
</div>
|
| 385 |
+
|
| 386 |
+
<!-- ===================== DASHBOARD ===================== -->
|
| 387 |
+
<section class="view" id="view-dashboard" aria-labelledby="dashTitle">
|
| 388 |
+
<div class="hero">
|
| 389 |
+
<div class="hero-copy">
|
| 390 |
+
<div>
|
| 391 |
+
<div class="eyebrow" id="dashDate"></div>
|
| 392 |
+
<h1 class="mega" id="dashTitle" style="margin-top:14px">Less waste.<br><span class="hl">More impact.</span></h1>
|
| 393 |
+
</div>
|
| 394 |
+
<p id="heroSub"></p>
|
| 395 |
+
</div>
|
| 396 |
+
<div class="ai-card">
|
| 397 |
+
<svg class="net" viewBox="0 0 300 300" aria-hidden="true">
|
| 398 |
+
<g><line x1="60" y1="70" x2="150" y2="40"/><line x1="150" y1="40" x2="240" y2="110"/><line x1="60" y1="70" x2="120" y2="150"/><line x1="120" y1="150" x2="240" y2="110"/><line x1="120" y1="150" x2="200" y2="210"/><line x1="240" y1="110" x2="200" y2="210"/><line x1="200" y1="210" x2="100" y2="250"/><line x1="120" y1="150" x2="100" y2="250"/></g>
|
| 399 |
+
<g><circle class="pulse" cx="60" cy="70" r="4"/><circle class="pulse n-lime" cx="150" cy="40" r="5"/><circle class="pulse" cx="240" cy="110" r="4"/><circle class="pulse n-lime" cx="120" cy="150" r="7"/><circle class="pulse" cx="200" cy="210" r="4"/><circle class="pulse" cx="100" cy="250" r="5"/></g>
|
| 400 |
+
</svg>
|
| 401 |
+
<div>
|
| 402 |
+
<span class="ai-tag"><span class="live"></span>trismart AI</span>
|
| 403 |
+
<h2>Ready to make smarter waste decisions?</h2>
|
| 404 |
+
</div>
|
| 405 |
+
<div class="ai-actions">
|
| 406 |
+
<button class="btn btn-lime" data-go="scan"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 7V5a2 2 0 0 1 2-2h2M17 3h2a2 2 0 0 1 2 2v2M21 17v2a2 2 0 0 1-2 2h-2M7 21H5a2 2 0 0 1-2-2v-2M7 12h10"/></svg>Scan a waste item</button>
|
| 407 |
+
<button class="btn btn-ghost" data-go="assistant">Ask the assistant</button>
|
| 408 |
+
</div>
|
| 409 |
+
</div>
|
| 410 |
+
</div>
|
| 411 |
+
|
| 412 |
+
<div class="kpis" id="kpis"></div>
|
| 413 |
+
|
| 414 |
+
<div class="grid-2">
|
| 415 |
+
<div class="card">
|
| 416 |
+
<div class="card-head">
|
| 417 |
+
<div><h3 class="h3">Waste trend</h3><div class="muted" style="font-size:13px">Monthly volume by stream, last 6 months · kg</div></div>
|
| 418 |
+
<div style="display:flex;gap:8px;align-items:center"><span class="badge b-measured">✓ Measured</span><button class="btn btn-quiet btn-sm" id="trendTableBtn" aria-pressed="false">Table view</button></div>
|
| 419 |
+
</div>
|
| 420 |
+
<div class="legend" id="trendLegend" style="margin-bottom:12px"></div>
|
| 421 |
+
<div class="chart" id="trendChart"></div>
|
| 422 |
+
</div>
|
| 423 |
+
<div class="card">
|
| 424 |
+
<div class="card-head">
|
| 425 |
+
<div><h3 class="h3">Your next smart moves</h3><div class="muted" style="font-size:13px">Ranked by impact for your activity</div></div>
|
| 426 |
+
<span class="badge b-ai">✦ AI</span>
|
| 427 |
+
</div>
|
| 428 |
+
<div class="moves" id="moves"></div>
|
| 429 |
+
</div>
|
| 430 |
+
</div>
|
| 431 |
+
|
| 432 |
+
<div class="card">
|
| 433 |
+
<div class="card-head">
|
| 434 |
+
<div><h3 class="h3">Recent activity</h3><div class="muted" style="font-size:13px">Scans, reports and completed actions</div></div>
|
| 435 |
+
<button class="btn btn-quiet btn-sm" id="clearFeed">Clear my scans</button>
|
| 436 |
+
</div>
|
| 437 |
+
<ul class="feed" id="feed" aria-live="polite"></ul>
|
| 438 |
+
</div>
|
| 439 |
+
</section>
|
| 440 |
+
|
| 441 |
+
<!-- ===================== SCAN ===================== -->
|
| 442 |
+
<section class="view" id="view-scan" aria-labelledby="scanTitle">
|
| 443 |
+
<div class="topbar">
|
| 444 |
+
<div><div class="eyebrow">AI waste scanner</div><h1 class="mega" id="scanTitle" style="font-size:clamp(44px,6vw,84px);margin-top:10px">Scan it.<br><span class="hl">Sort it.</span></h1></div>
|
| 445 |
+
</div>
|
| 446 |
+
<div class="scan-grid">
|
| 447 |
+
<div>
|
| 448 |
+
<div class="viewer" id="viewer">
|
| 449 |
+
<video id="video" playsinline muted hidden></video>
|
| 450 |
+
<img id="shot" alt="Photo of the scanned item" hidden>
|
| 451 |
+
<div class="frame" aria-hidden="true"></div>
|
| 452 |
+
<div class="scanline" aria-hidden="true"></div>
|
| 453 |
+
<div class="placeholder" id="viewerPh">
|
| 454 |
+
<div class="h2">Point. Shoot.<br>Done.</div>
|
| 455 |
+
<p>Use your camera or drop a photo. One item, close-up, plain background works best.</p>
|
| 456 |
+
</div>
|
| 457 |
+
</div>
|
| 458 |
+
<div class="viewer-controls">
|
| 459 |
+
<button class="btn btn-primary" id="camBtn"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 8h3l2-3h6l2 3h3v11H4z"/><circle cx="12" cy="13" r="3.5"/></svg><span>Open camera</span></button>
|
| 460 |
+
<button class="btn btn-lime" id="captureBtn" hidden><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4"><circle cx="12" cy="12" r="8"/></svg>Capture</button>
|
| 461 |
+
<label class="btn btn-quiet" tabindex="0" id="uploadLbl"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 16V4M7 9l5-5 5 5M4 20h16"/></svg>Upload a photo<input type="file" id="fileIn" accept="image/*" class="sr-only"></label>
|
| 462 |
+
</div>
|
| 463 |
+
<div class="model-state loading" id="modelState" role="status"><span class="dotc"></span><span id="modelTxt">Waking up the AI model…</span><span class="bar"><i id="modelBar"></i></span></div>
|
| 464 |
+
<div class="demo-row">
|
| 465 |
+
<span class="eyebrow">No item at hand? Try a demo</span>
|
| 466 |
+
<div class="chips" id="demoChips"></div>
|
| 467 |
+
</div>
|
| 468 |
+
</div>
|
| 469 |
+
<div class="card result" id="result" aria-live="polite"></div>
|
| 470 |
+
</div>
|
| 471 |
+
</section>
|
| 472 |
+
|
| 473 |
+
<!-- ===================== ANALYTICS ===================== -->
|
| 474 |
+
<section class="view" id="view-analytics" aria-labelledby="anTitle">
|
| 475 |
+
<div class="topbar">
|
| 476 |
+
<div><div class="eyebrow" id="anEyebrow">Business analytics</div><h1 class="h2" id="anTitle" style="font-size:clamp(40px,5vw,68px);margin-top:10px">Know every kilo.</h1></div>
|
| 477 |
+
<button class="btn btn-quiet btn-sm" id="exportBtn"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 4v12M7 11l5 5 5-5M4 20h16"/></svg>Export CSV</button>
|
| 478 |
+
</div>
|
| 479 |
+
<div class="filters" role="group" aria-label="Filters">
|
| 480 |
+
<div class="seg" id="periodSeg" role="group" aria-label="Time period">
|
| 481 |
+
<button data-p="30" aria-pressed="false">30 days</button><button data-p="90" aria-pressed="true">90 days</button><button data-p="365" aria-pressed="false">12 months</button>
|
| 482 |
+
</div>
|
| 483 |
+
<span class="sep"></span>
|
| 484 |
+
<label class="sr-only" for="siteSel">Location</label>
|
| 485 |
+
<select class="select" id="siteSel"></select>
|
| 486 |
+
<span class="sep"></span>
|
| 487 |
+
<div class="chips" id="catChips" role="group" aria-label="Waste categories"></div>
|
| 488 |
+
</div>
|
| 489 |
+
<div class="akpis" id="akpis"></div>
|
| 490 |
+
<div class="grid-2">
|
| 491 |
+
<div class="card">
|
| 492 |
+
<div class="card-head">
|
| 493 |
+
<div><h3 class="h3">Volume over time</h3><div class="muted" style="font-size:13px" id="anChartSub"></div></div>
|
| 494 |
+
<button class="btn btn-quiet btn-sm" id="anTableBtn" aria-pressed="false">Table view</button>
|
| 495 |
+
</div>
|
| 496 |
+
<div class="legend" id="anLegend" style="margin-bottom:12px"></div>
|
| 497 |
+
<div class="chart" id="anChart"></div>
|
| 498 |
+
</div>
|
| 499 |
+
<div class="card">
|
| 500 |
+
<div class="card-head"><div><h3 class="h3" id="byTitle">By location</h3><div class="muted" style="font-size:13px">Total kg, split by stream</div></div><span class="badge b-measured">✓ Measured</span></div>
|
| 501 |
+
<div id="byLocation"></div>
|
| 502 |
+
<h3 class="h3" style="margin-top:22px;font-size:17px">By category</h3>
|
| 503 |
+
<div id="byCat"></div>
|
| 504 |
+
</div>
|
| 505 |
+
</div>
|
| 506 |
+
<div class="card-head" style="margin:8px 0 14px"><div><h2 class="h2">Where to save next</h2></div><span class="badge b-ai">✦ AI estimates</span></div>
|
| 507 |
+
<div class="reco" id="reco"></div>
|
| 508 |
+
<div class="note"><span class="badge b-measured">✓ Measured</span> weighed at collection (hauler reports) <span class="badge b-ai">✦ AI estimate</span> modelled from scans, averages and local prices. Indicative only.</div>
|
| 509 |
+
</section>
|
| 510 |
+
|
| 511 |
+
<!-- ===================== ASSISTANT ===================== -->
|
| 512 |
+
<section class="view" id="view-assistant" aria-labelledby="asTitle">
|
| 513 |
+
<div class="topbar"><div><div class="eyebrow">AI assistant</div><h1 class="h2" id="asTitle" style="font-size:clamp(40px,5vw,68px);margin-top:10px">Ask anything.<br><span class="muted">Waste less.</span></h1></div></div>
|
| 514 |
+
<div class="chat-wrap">
|
| 515 |
+
<div class="card chat">
|
| 516 |
+
<div class="chat-head">
|
| 517 |
+
<div class="bot-av"><svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2"><circle cx="6" cy="7" r="2"/><circle cx="18" cy="7" r="2"/><circle cx="12" cy="17" r="2.5"/><path d="M7.5 8.5l3.5 6.5M16.5 8.5L13 15M8 7h8"/></svg></div>
|
| 518 |
+
<div><b>trismart AI</b><div class="muted" style="font-size:12.5px">Sorting rules · reduction tips · business savings</div></div>
|
| 519 |
+
<span class="badge b-ai" style="margin-left:auto">✦ AI answers</span>
|
| 520 |
+
</div>
|
| 521 |
+
<div class="msgs" id="msgs" aria-live="polite"></div>
|
| 522 |
+
<form class="composer" id="composer">
|
| 523 |
+
<label class="sr-only" for="ask">Your question</label>
|
| 524 |
+
<input id="ask" autocomplete="off" placeholder="e.g. Where does a pizza box go?">
|
| 525 |
+
<button class="btn btn-primary" type="submit" aria-label="Send"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button>
|
| 526 |
+
</form>
|
| 527 |
+
</div>
|
| 528 |
+
<div class="chat-side">
|
| 529 |
+
<div class="eyebrow" style="margin-bottom:10px">Try asking</div>
|
| 530 |
+
<div class="suggest" id="suggest"></div>
|
| 531 |
+
<div class="card" style="margin-top:16px;padding:18px">
|
| 532 |
+
<div class="h3" style="font-size:16px;margin-bottom:6px">How it answers</div>
|
| 533 |
+
<p class="muted" style="margin:0;font-size:13px">Answers come from trismart's sorting knowledge base (French rules) and your workspace data. They are AI guidance, so always check your local rules.</p>
|
| 534 |
+
</div>
|
| 535 |
+
</div>
|
| 536 |
+
</div>
|
| 537 |
+
</section>
|
| 538 |
+
</main>
|
| 539 |
+
</div>
|
| 540 |
+
|
| 541 |
+
<nav class="bottom-nav" id="bottomNav" aria-label="Main navigation"></nav>
|
| 542 |
+
<div class="toast-wrap" id="toasts" aria-live="polite"></div>
|
| 543 |
+
|
| 544 |
+
<script type="module">
|
| 545 |
+
/* =====================================================================
|
| 546 |
+
1. KNOWLEDGE BASE: sorting rules, links, categories
|
| 547 |
+
===================================================================== */
|
| 548 |
+
const BINS = {
|
| 549 |
+
yellow:{name:"Yellow bin",fr:"bac jaune",bg:"#FFE14D",fg:"#202020",tip:"All packaging: plastic, metal, paper and cardboard. Empty it, no need to rinse, and don't nest items."},
|
| 550 |
+
glass:{name:"Glass bin",fr:"verre",bg:"#18A36B",fg:"#FFFFFF",tip:"Bottles, jars and pots, without lids. No dishes, mirrors or light bulbs."},
|
| 551 |
+
compost:{name:"Food waste & compost",fr:"biodéchets",bg:"#8B5E3C",fg:"#FFFFFF",tip:"Food scraps, peels, coffee grounds and tea bags."},
|
| 552 |
+
general:{name:"General waste",fr:"ordures ménagères",bg:"#202020",fg:"#F8F7F2",tip:"Non-recyclable items: dirty tissues, nappies, broken dishes, used masks."},
|
| 553 |
+
textile:{name:"Textile collection point",fr:"borne textile",bg:"#7C5CFC",fg:"#FFFFFF",tip:"Clothes, shoes and linen, clean and dry, in a closed bag, even if worn or torn."},
|
| 554 |
+
bulky:{name:"Recycling centre / bulky pickup",fr:"déchèterie, encombrants",bg:"#FF7043",fg:"#202020",tip:"Furniture, mattresses and large items: take them to the recycling centre, or book the free bulky-item pickup with your town hall."},
|
| 555 |
+
electronic:{name:"Electronics collection",fr:"DEEE",bg:"#3547FF",fg:"#FFFFFF",tip:"Shops must take back your old appliance when you buy a new one; small devices go in in-store collection bins."},
|
| 556 |
+
hazardous:{name:"Hazardous waste",fr:"déchèterie",bg:"#D64545",fg:"#FFFFFF",tip:"Paint, solvents and chemicals: never in the bin or the sink. Take them to the recycling centre."},
|
| 557 |
+
battery:{name:"Battery collection box",fr:"borne à piles",bg:"#D7FF45",fg:"#202020",tip:"Drop batteries in the collection boxes found in supermarkets and shops."},
|
| 558 |
+
pharmacy:{name:"Pharmacy take-back",fr:"pharmacie",bg:"#14A39A",fg:"#FFFFFF",tip:"Bring unused or expired medicines (without the cardboard box) back to any pharmacy."},
|
| 559 |
+
};
|
| 560 |
+
const LINKS = {
|
| 561 |
+
ademe:["ADEME: what to do with my waste?","https://quefairedemesdechets.ademe.fr/"],
|
| 562 |
+
geev:["Geev: give it away","https://www.geev.com/"],
|
| 563 |
+
leboncoin:["Leboncoin: sell or give","https://www.leboncoin.fr/"],
|
| 564 |
+
emmaus:["Emmaüs: donate","https://www.emmaus-france.org/"],
|
| 565 |
+
refashion:["Refashion: textile points","https://refashion.fr/"],
|
| 566 |
+
ecomaison:["Ecomaison: furniture","https://ecomaison.com/"],
|
| 567 |
+
ecosystem:["ecosystem: electronics","https://www.ecosystem.eco/"],
|
| 568 |
+
corepile:["Corepile: batteries","https://www.corepile.fr/"],
|
| 569 |
+
cyclamed:["Cyclamed: medicines","https://www.cyclamed.org/"],
|
| 570 |
+
recyclivre:["Recyclivre: books","https://www.recyclivre.com/"],
|
| 571 |
+
};
|
| 572 |
+
// label (what CLIP compares with) : [bin, donate links, second-life idea, youtube query, short name, emoji, assistant keywords]
|
| 573 |
+
const CATS = {
|
| 574 |
+
"a plastic bottle":["yellow",[],"Turn it into a self-watering planter or a bird feeder.","DIY plastic bottle planter","plastic bottle","🧴",["plastic bottle","water bottle","soda bottle","bottle of water"]],
|
| 575 |
+
"a plastic food container or yogurt pot":["yellow",[],"Use it as a seedling pot or to store small items.","DIY yogurt pot seedling","plastic container","🥡",["yogurt","yoghurt","plastic container","tupperware","takeaway box","food container"]],
|
| 576 |
+
"a plastic bag or plastic packaging":["yellow",[],null,null,"plastic packaging","🛍️",["plastic bag","plastic film","wrapper","packaging film","bubble wrap"]],
|
| 577 |
+
"an aluminium soda can":["yellow",[],"Make a pencil holder or a small lantern.","DIY soda can crafts","aluminium can","🥫",["can","soda can","aluminium","aluminum","coke can","beer can"]],
|
| 578 |
+
"a metal food tin can":["yellow",[],"Make a herb planter or a desk organiser.","DIY tin can planter","tin can","🥫",["tin can","tin","food can","conserve"]],
|
| 579 |
+
"a cardboard box":["yellow",[],"Build storage boxes, a cat house or a kids' toy.","DIY cardboard box ideas","cardboard box","📦",["cardboard","carton box","box","pizza box","delivery box","amazon box"]],
|
| 580 |
+
"a newspaper, magazine or sheet of paper":["yellow",[],"Make gift wrap, paper bags or seedling pots.","DIY newspaper gift wrap","paper","📰",["paper","newspaper","magazine","flyer","envelope","receipt"]],
|
| 581 |
+
"a milk or juice carton":["yellow",[],"Cut it into seedling pots or a bird feeder.","DIY milk carton bird feeder","drink carton","🧃",["milk carton","juice carton","tetra pak","brick"]],
|
| 582 |
+
"a glass bottle":["glass",[],"Make a vase, a lamp or a water carafe.","DIY glass bottle vase","glass bottle","🍾",["glass bottle","wine bottle","beer bottle"]],
|
| 583 |
+
"a glass jar":["glass",[],"Reuse it for food storage, homemade jam or a candle holder.","DIY glass jar ideas","glass jar","🫙",["jar","glass jar","jam jar","pot de confiture"]],
|
| 584 |
+
"food leftovers or fruit and vegetable peels":["compost",[],"Make broth from veggie peels, or start a compost.","zero waste vegetable peel broth","food scraps","🥕",["leftovers","food waste","peel","peels","vegetable","food scraps","eggshell","egg shell"]],
|
| 585 |
+
"an apple core or banana peel":["compost",[],"Make a natural plant fertiliser.","banana peel fertilizer DIY","fruit waste","🍌",["banana","apple core","fruit"]],
|
| 586 |
+
"coffee grounds or a tea bag":["compost",[],"Use coffee grounds as fertiliser or a body scrub.","coffee grounds reuse ideas","coffee grounds","☕",["coffee","coffee grounds","tea bag","tea"]],
|
| 587 |
+
"a used paper tissue or napkin":["general",[],null,null,"used tissue","🤧",["tissue","napkin","kleenex","paper towel"]],
|
| 588 |
+
"a broken plate or ceramic mug":["general",[],null,null,"broken ceramic","🍽️",["broken plate","ceramic","mug","porcelain","dish"]],
|
| 589 |
+
"a used face mask":["general",[],null,null,"face mask","😷",["mask","face mask"]],
|
| 590 |
+
"a cigarette butt":["general",[],null,null,"cigarette butt","🚬",["cigarette","butt"]],
|
| 591 |
+
"old clothes, a t-shirt or a sweater":["textile",["emmaus","geev","leboncoin","refashion"],"Turn an old T-shirt into a tote bag or cleaning cloths.","DIY t-shirt tote bag no sew","clothes","👕",["clothes","t-shirt","tshirt","sweater","jeans","jacket","dress","clothing"]],
|
| 592 |
+
"a pair of shoes or sneakers":["textile",["emmaus","geev","refashion"],"Clean and repair them, or turn old boots into planters.","how to clean and restore sneakers","shoes","👟",["shoes","sneakers","boots","trainers"]],
|
| 593 |
+
"bed sheets, towels or curtains":["textile",["emmaus","refashion"],"Make reusable bags, cushion covers or rags.","DIY old bed sheets upcycling","linen","🛏️",["sheets","towel","curtain","linen","blanket"]],
|
| 594 |
+
"a wardrobe, cupboard or chest of drawers":["bulky",["emmaus","geev","leboncoin","ecomaison"],"Repaint it or change the handles to give it a new look.","DIY furniture makeover paint","wardrobe","🚪",["wardrobe","cupboard","drawers","dresser","furniture","shelf","bookcase"]],
|
| 595 |
+
"a chair or a table":["bulky",["emmaus","geev","leboncoin","ecomaison"],"Sand and repaint it, or reupholster the seat.","DIY chair makeover","chair or table","🪑",["chair","table","stool","desk"]],
|
| 596 |
+
"a sofa or an armchair":["bulky",["emmaus","geev","leboncoin","ecomaison"],"Change or clean the cover to refresh it.","DIY sofa cover makeover","sofa","🛋️",["sofa","couch","armchair"]],
|
| 597 |
+
"a mattress":["bulky",["ecomaison"],null,null,"mattress","🛏️",["mattress"]],
|
| 598 |
+
"a bicycle":["bulky",["geev","leboncoin","emmaus"],"Have it repaired in a self-repair bike workshop.","how to repair a bike","bicycle","🚲",["bike","bicycle"]],
|
| 599 |
+
"children's toys":["bulky",["emmaus","geev","leboncoin"],null,null,"toys","🧸",["toy","toys","lego","doll"]],
|
| 600 |
+
"books":["yellow",["recyclivre","emmaus","geev"],"Leave them in a book box (boîte à livres) for others to read.",null,"books","📚",["book","books","novel"]],
|
| 601 |
+
"a smartphone, laptop, cable or small electronic device":["electronic",["ecosystem","leboncoin"],"If it still works, donate or sell it, or have it repaired.","how to repair smartphone","small electronics","📱",["phone","smartphone","laptop","cable","charger","computer","electronic","headphones","tablet"]],
|
| 602 |
+
"a large appliance such as a fridge, washing machine or oven":["electronic",["ecosystem","leboncoin"],null,null,"large appliance","🧊",["fridge","washing machine","oven","dishwasher","microwave","freezer"]],
|
| 603 |
+
"a light bulb":["electronic",["ecosystem"],null,null,"light bulb","💡",["bulb","light bulb","lamp","neon"]],
|
| 604 |
+
"a battery":["battery",["corepile"],null,null,"battery","🔋",["battery","batteries","pile"]],
|
| 605 |
+
"a can of paint or a bottle of chemicals":["hazardous",[],null,null,"paint or chemicals","🎨",["paint","solvent","chemical","bleach","oil","white spirit"]],
|
| 606 |
+
"medicine boxes or pills":["pharmacy",["cyclamed"],null,null,"medicines","💊",["medicine","medication","pills","drugs","syringe"]],
|
| 607 |
+
};
|
| 608 |
+
const LABELS = Object.keys(CATS);
|
| 609 |
+
const THRESHOLD = 0.25;
|
| 610 |
+
|
| 611 |
+
/* =====================================================================
|
| 612 |
+
2. DEMO DATA: deterministic, realistic weekly weights
|
| 613 |
+
===================================================================== */
|
| 614 |
+
const STREAMS = [
|
| 615 |
+
{key:"pack",name:"Packaging",color:"#3547FF",verb:"recycled"},
|
| 616 |
+
{key:"org",name:"Organic",color:"#0F9B8E",verb:"composted"},
|
| 617 |
+
{key:"bulk",name:"Bulky & textiles",color:"#A07A00",verb:"reused"},
|
| 618 |
+
{key:"res",name:"Residual",color:"#E5582F",verb:"landfill / incineration"},
|
| 619 |
+
];
|
| 620 |
+
const WORKSPACES = {
|
| 621 |
+
business:{name:"Demo Café Group",sub:"3 sites · Paris",av:"DC",cost:{res:0.21,avoid:0.17},
|
| 622 |
+
sites:[{id:"opera",name:"Opéra café",base:{pack:38,org:46,bulk:6,res:31}},{id:"marais",name:"Marais café",base:{pack:29,org:35,bulk:4,res:24}},{id:"kitchen",name:"Central kitchen",base:{pack:52,org:88,bulk:9,res:41}}]},
|
| 623 |
+
personal:{name:"Romane's home",sub:"2 people · 1 dog",av:"RM",cost:{res:0.21,avoid:0.17},
|
| 624 |
+
sites:[{id:"home",name:"Home",base:{pack:2.4,org:3.1,bulk:.6,res:2.7}}]},
|
| 625 |
+
};
|
| 626 |
+
function rng(seed){return()=>{seed|=0;seed=seed+0x6D2B79F5|0;let t=Math.imul(seed^seed>>>15,1|seed);t=t+Math.imul(t^t>>>7,61|t)^t;return((t^t>>>14)>>>0)/4294967296}}
|
| 627 |
+
const WEEKS = 52;
|
| 628 |
+
const today = new Date(); today.setHours(0,0,0,0);
|
| 629 |
+
const weekStart = i => { const d=new Date(today); d.setDate(d.getDate()-7*(WEEKS-1-i)); return d; };
|
| 630 |
+
function buildData(ws){
|
| 631 |
+
const out={};
|
| 632 |
+
WORKSPACES[ws].sites.forEach((s,si)=>{
|
| 633 |
+
const r=rng(97+si*31+(ws==="personal"?500:0));
|
| 634 |
+
out[s.id]=Array.from({length:WEEKS},(_,w)=>{
|
| 635 |
+
const season=1+0.12*Math.sin((w/52)*Math.PI*2+1.2);
|
| 636 |
+
const progress=w/(WEEKS-1); // improvement over the year
|
| 637 |
+
const row={};
|
| 638 |
+
for(const st of STREAMS){
|
| 639 |
+
let v=s.base[st.key]*season*(0.88+r()*0.24);
|
| 640 |
+
if(st.key==="res") v*=1.18-0.30*progress; // residual falls
|
| 641 |
+
if(st.key==="org") v*=0.86+0.22*progress; // more composting
|
| 642 |
+
if(st.key==="bulk") v*=0.8+0.4*progress;
|
| 643 |
+
row[st.key]=Math.round(v*10)/10;
|
| 644 |
+
}
|
| 645 |
+
return row;
|
| 646 |
+
});
|
| 647 |
+
});
|
| 648 |
+
return out;
|
| 649 |
+
}
|
| 650 |
+
const DATA = {business:buildData("business"),personal:buildData("personal")};
|
| 651 |
+
|
| 652 |
+
/* =====================================================================
|
| 653 |
+
3. STATE + STORAGE (per-viewer conveniences only)
|
| 654 |
+
===================================================================== */
|
| 655 |
+
const store = {
|
| 656 |
+
get(k,d){try{const v=localStorage.getItem("trismart:"+k);return v?JSON.parse(v):d}catch{return d}},
|
| 657 |
+
set(k,v){try{localStorage.setItem("trismart:"+k,JSON.stringify(v))}catch{}}
|
| 658 |
+
};
|
| 659 |
+
const state = {
|
| 660 |
+
mode: store.get("mode","business"),
|
| 661 |
+
scans: store.get("scans",[]), // user scans (activity)
|
| 662 |
+
done: store.get("done",[]), // completed smart moves ids
|
| 663 |
+
period: 90, site:"all", cats:new Set(STREAMS.map(s=>s.key)),
|
| 664 |
+
};
|
| 665 |
+
|
| 666 |
+
/* =====================================================================
|
| 667 |
+
4. HELPERS
|
| 668 |
+
===================================================================== */
|
| 669 |
+
const $=s=>document.querySelector(s), $$=s=>[...document.querySelectorAll(s)];
|
| 670 |
+
const esc=s=>String(s).replace(/[&<>"']/g,c=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[c]));
|
| 671 |
+
const fmt=(n,d=0)=>n.toLocaleString("en-GB",{maximumFractionDigits:d,minimumFractionDigits:d});
|
| 672 |
+
const kg=n=>n>=1000?`${fmt(n/1000,1)}<small>t</small>`:`${fmt(n)}<small>kg</small>`;
|
| 673 |
+
const sum=a=>a.reduce((x,y)=>x+y,0);
|
| 674 |
+
const ago=t=>{const m=Math.round((Date.now()-t)/60000);if(m<1)return"just now";if(m<60)return m+" min ago";const h=Math.round(m/60);if(h<24)return h+" h ago";return Math.round(h/24)+" d ago"};
|
| 675 |
+
const MON=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
|
| 676 |
+
function toast(msg){const t=document.createElement("div");t.className="toast";t.innerHTML=`<span class="ok">✓</span>${esc(msg)}`;$("#toasts").append(t);setTimeout(()=>{t.style.transition="opacity .3s";t.style.opacity=0;setTimeout(()=>t.remove(),300)},2600)}
|
| 677 |
+
function burst(){const b=document.createElement("div");b.className="burst";b.innerHTML=`<div class="ring"></div><div class="check"><svg viewBox="0 0 24 24" fill="none" stroke="#202020" stroke-width="3"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></div>`;document.body.append(b);setTimeout(()=>b.remove(),800)}
|
| 678 |
+
const ws=()=>WORKSPACES[state.mode];
|
| 679 |
+
function weeksFor(siteId){const d=DATA[state.mode];return siteId==="all"?Array.from({length:WEEKS},(_,w)=>{const r={};for(const st of STREAMS)r[st.key]=sum(Object.values(d).map(s=>s[w][st.key]));return r}):d[siteId]}
|
| 680 |
+
function totals(rows,keys=STREAMS.map(s=>s.key)){const t={};for(const k of keys)t[k]=sum(rows.map(r=>r[k]));return t}
|
| 681 |
+
|
| 682 |
+
/* =====================================================================
|
| 683 |
+
5. NAVIGATION
|
| 684 |
+
===================================================================== */
|
| 685 |
+
const ICONS={
|
| 686 |
+
dashboard:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="8" height="10" rx="2"/><rect x="13" y="3" width="8" height="6" rx="2"/><rect x="13" y="11" width="8" height="10" rx="2"/><rect x="3" y="15" width="8" height="6" rx="2"/></svg>',
|
| 687 |
+
scan:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 7V5a2 2 0 0 1 2-2h2M17 3h2a2 2 0 0 1 2 2v2M21 17v2a2 2 0 0 1-2 2h-2M7 21H5a2 2 0 0 1-2-2v-2M7 12h10"/></svg>',
|
| 688 |
+
analytics:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 20V10M10 20V4M16 20v-7M22 20H2"/></svg>',
|
| 689 |
+
assistant:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 5h16v11H9l-5 4z"/><path d="M9 10h.01M12 10h.01M15 10h.01" stroke-width="3" stroke-linecap="round"/></svg>',
|
| 690 |
+
};
|
| 691 |
+
const ROUTES=[["dashboard","Dashboard","1"],["scan","Scan","2"],["analytics","Analytics","3"],["assistant","Assistant","4"]];
|
| 692 |
+
$("#sideNav").innerHTML=ROUTES.map(([id,l,k])=>`<button data-go="${id}">${ICONS[id]}${l}<span class="kbd">${k}</span></button>`).join("");
|
| 693 |
+
$("#bottomNav").innerHTML=[ROUTES[0],ROUTES[2],ROUTES[1],ROUTES[3]].map(([id,l])=>`<button data-go="${id}" class="${id==="scan"?"scan-fab":""}">${ICONS[id]}${l}</button>`).join("");
|
| 694 |
+
$("#bottomNav").style.gridTemplateColumns="repeat(4,1fr)";
|
| 695 |
+
|
| 696 |
+
function go(route,{push=true}={}){
|
| 697 |
+
if(!ROUTES.some(r=>r[0]===route)) route="dashboard";
|
| 698 |
+
$$(".view").forEach(v=>v.classList.toggle("active",v.id==="view-"+route));
|
| 699 |
+
$$("[data-go]").forEach(b=>{ if(b.closest(".nav,.bottom-nav")) b.setAttribute("aria-current",b.dataset.go===route?"page":"false") });
|
| 700 |
+
if(push && location.hash!=="#"+route) history.pushState(null,"","#"+route);
|
| 701 |
+
window.scrollTo({top:0,behavior:"smooth"});
|
| 702 |
+
if(route!=="scan") stopCam();
|
| 703 |
+
if(route==="scan") ensureModel();
|
| 704 |
+
if(route==="analytics") renderAnalytics();
|
| 705 |
+
requestAnimationFrame(()=>$$("#view-"+route+" .chart").forEach(c=>c._redraw&&c._redraw()));
|
| 706 |
+
if(route==="assistant") setTimeout(()=>$("#ask").focus({preventScroll:true}),300);
|
| 707 |
+
}
|
| 708 |
+
document.addEventListener("click",e=>{const b=e.target.closest("[data-go]");if(b){e.preventDefault();go(b.dataset.go)}});
|
| 709 |
+
addEventListener("popstate",()=>go(location.hash.slice(1),{push:false}));
|
| 710 |
+
addEventListener("keydown",e=>{if(e.target.matches("input,textarea,select"))return;const r=ROUTES.find(r=>r[2]===e.key);if(r)go(r[0])});
|
| 711 |
+
|
| 712 |
+
$$(".mode button").forEach(b=>b.addEventListener("click",()=>{state.mode=b.dataset.mode;store.set("mode",state.mode);state.site="all";applyMode();toast(`Switched to ${state.mode} workspace`)}));
|
| 713 |
+
function applyMode(){
|
| 714 |
+
$$(".mode button").forEach(b=>b.setAttribute("aria-pressed",String(b.dataset.mode===state.mode)));
|
| 715 |
+
$("#accName").textContent=ws().name;$("#accSub").textContent=ws().sub;$("#avatar").textContent=ws().av;
|
| 716 |
+
renderDashboard();
|
| 717 |
+
if($("#view-analytics").classList.contains("active")) renderAnalytics();
|
| 718 |
+
}
|
| 719 |
+
|
| 720 |
+
/* =====================================================================
|
| 721 |
+
6. CHART: stacked bars with hover tooltip + table view
|
| 722 |
+
===================================================================== */
|
| 723 |
+
function stackedChart(el,cols,streams,{height=260}={}){
|
| 724 |
+
const W=Math.max(300,Math.round(el.clientWidth||640)),H=W<480?220:height,P={l:40,r:6,t:10,b:28};
|
| 725 |
+
el._redraw=()=>stackedChart(el,cols,streams,{height});
|
| 726 |
+
const max=Math.max(1,...cols.map(c=>sum(streams.map(s=>c.v[s.key]))));
|
| 727 |
+
const step=niceStep(max/4), top=Math.ceil(max/step)*step;
|
| 728 |
+
const y=v=>P.t+(H-P.t-P.b)*(1-v/top);
|
| 729 |
+
const bw=Math.min(46,(W-P.l-P.r)/cols.length*0.56), gap=(W-P.l-P.r)/cols.length;
|
| 730 |
+
let svg=`<svg viewBox="0 0 ${W} ${H}" role="img" aria-label="Stacked bar chart of waste by stream"><g>`;
|
| 731 |
+
for(let t=0;t<=top+1e-9;t+=step){svg+=`<line class="grid" x1="${P.l}" x2="${W-P.r}" y1="${y(t)}" y2="${y(t)}"/><text class="axis" x="${P.l-8}" y="${y(t)+4}" text-anchor="end">${fmt(t)}</text>`}
|
| 732 |
+
svg+=`</g>`;
|
| 733 |
+
cols.forEach((c,i)=>{
|
| 734 |
+
const cx=P.l+gap*i+gap/2, x=cx-bw/2; let acc=0;
|
| 735 |
+
const vis=streams.filter(s=>c.v[s.key]>0);
|
| 736 |
+
vis.forEach((s,j)=>{
|
| 737 |
+
const v=c.v[s.key], y0=y(acc), y1=y(acc+v); acc+=v;
|
| 738 |
+
const h=Math.max(0,y0-y1);
|
| 739 |
+
const isTop=j===vis.length-1, r=isTop?Math.min(4,h):0;
|
| 740 |
+
svg+= r? `<path d="M${x},${y0} V${y1+r} Q${x},${y1} ${x+r},${y1} H${x+bw-r} Q${x+bw},${y1} ${x+bw},${y1+r} V${y0} Z" fill="${s.color}"><animate attributeName="opacity" from="0" to="1" dur=".5s"/></path>`
|
| 741 |
+
: `<rect x="${x}" y="${y1+2}" width="${bw}" height="${Math.max(0,y0-y1-2)}" fill="${s.color}"/>`;
|
| 742 |
+
});
|
| 743 |
+
if(cols.length<=12||i%2===0||W>520) svg+=`<text class="axis" x="${cx}" y="${H-8}" text-anchor="middle">${esc(c.label)}</text>`;
|
| 744 |
+
svg+=`<rect class="col-hit" data-i="${i}" x="${P.l+gap*i}" y="${P.t}" width="${gap}" height="${H-P.t-P.b}" rx="10" tabindex="0" aria-label="${esc(c.label)}: ${fmt(sum(streams.map(s=>c.v[s.key])))} kg"/>`;
|
| 745 |
+
});
|
| 746 |
+
svg+=`</svg><div class="tip" role="tooltip"></div>`;
|
| 747 |
+
el.innerHTML=svg;
|
| 748 |
+
const tip=el.querySelector(".tip");
|
| 749 |
+
const show=(hit)=>{
|
| 750 |
+
const i=+hit.dataset.i,c=cols[i],tot=sum(streams.map(s=>c.v[s.key]));
|
| 751 |
+
el.querySelectorAll(".col-hit").forEach(h=>h.classList.toggle("on",h===hit));
|
| 752 |
+
tip.innerHTML=`<b>${esc(c.full||c.label)}</b>`+[...streams].reverse().map(s=>`<div class="r"><span><i style="background:${s.color}"></i>${s.name}</span><span>${fmt(c.v[s.key])} kg</span></div>`).join("")+`<div class="r t"><span>Total</span><span>${fmt(tot)} kg</span></div>`;
|
| 753 |
+
const box=el.getBoundingClientRect(), hb=hit.getBoundingClientRect();
|
| 754 |
+
let left=hb.left-box.left+hb.width/2+12; if(left+190>box.width) left=hb.left-box.left+hb.width/2-200;
|
| 755 |
+
tip.style.left=Math.max(0,left)+"px"; tip.style.top="8px"; tip.classList.add("show");
|
| 756 |
+
};
|
| 757 |
+
el.querySelectorAll(".col-hit").forEach(h=>{h.addEventListener("mouseenter",()=>show(h));h.addEventListener("focus",()=>show(h));h.addEventListener("click",()=>show(h))});
|
| 758 |
+
el.addEventListener("mouseleave",()=>{tip.classList.remove("show");el.querySelectorAll(".col-hit").forEach(h=>h.classList.remove("on"))});
|
| 759 |
+
}
|
| 760 |
+
function niceStep(raw){const p=Math.pow(10,Math.floor(Math.log10(raw||1)));const n=raw/p;return (n<=1?1:n<=2?2:n<=2.5?2.5:n<=5?5:10)*p}
|
| 761 |
+
function tableView(cols,streams){return `<table class="table-view"><thead><tr><th>Period</th>${streams.map(s=>`<th>${s.name}</th>`).join("")}<th>Total</th></tr></thead><tbody>${cols.map(c=>`<tr><td>${esc(c.full||c.label)}</td>${streams.map(s=>`<td>${fmt(c.v[s.key])}</td>`).join("")}<td><b>${fmt(sum(streams.map(s=>c.v[s.key])))}</b></td></tr>`).join("")}</tbody></table>`}
|
| 762 |
+
const legendHTML=streams=>streams.map(s=>`<span><i style="background:${s.color}"></i>${s.name}</span>`).join("");
|
| 763 |
+
function monthly(rows,n){
|
| 764 |
+
const buckets=new Map();
|
| 765 |
+
rows.forEach((r,w)=>{const d=weekStart(w);const k=d.getFullYear()*12+d.getMonth();if(!buckets.has(k))buckets.set(k,{label:MON[d.getMonth()],full:MON[d.getMonth()]+" "+d.getFullYear(),v:Object.fromEntries(STREAMS.map(s=>[s.key,0]))});const b=buckets.get(k);for(const s of STREAMS)b.v[s.key]+=r[s.key]});
|
| 766 |
+
return [...buckets.values()].slice(-n).map(b=>({...b,v:Object.fromEntries(Object.entries(b.v).map(([k,v])=>[k,Math.round(v)]))}));
|
| 767 |
+
}
|
| 768 |
+
|
| 769 |
+
/* =====================================================================
|
| 770 |
+
7. DASHBOARD
|
| 771 |
+
===================================================================== */
|
| 772 |
+
const MOVES={
|
| 773 |
+
business:[
|
| 774 |
+
{id:"b1",title:"Start compost pickup at Marais café",body:"Organic waste is 37% of its bin. A weekly biowaste pickup could divert it from landfill.",impact:"−34 kg/week residual",tag:"good"},
|
| 775 |
+
{id:"b2",title:"Ask suppliers to take back cardboard",body:"Cardboard makes up 41% of your packaging. Two suppliers already offer reusable crates.",impact:"≈ €310/year saved",tag:"good"},
|
| 776 |
+
{id:"b3",title:"Residual waste up 12% at Opéra café",body:"Unusual spike in the last 2 weeks. Re-brief the team with the 5-minute sorting guide.",impact:"Needs attention",tag:"alert"},
|
| 777 |
+
],
|
| 778 |
+
personal:[
|
| 779 |
+
{id:"p1",title:"Switch to a countertop compost bin",body:"Food scraps are 35% of your household waste. Paris offers free biowaste collection points.",impact:"−3 kg/week residual",tag:"good"},
|
| 780 |
+
{id:"p2",title:"Donate the clothes you scanned",body:"3 items could go to Emmaüs or a textile point instead of the bin.",impact:"+ 2.4 kg reused",tag:"good"},
|
| 781 |
+
{id:"p3",title:"Batteries spotted in general waste",body:"They are hazardous in household bins. Drop them in a supermarket collection box.",impact:"Needs attention",tag:"alert"},
|
| 782 |
+
],
|
| 783 |
+
};
|
| 784 |
+
const BASE_FEED={
|
| 785 |
+
business:[
|
| 786 |
+
{ic:"report",e:"📄",t:"October hauler report imported",s:"1.8 t collected across 3 sites · verified",at:Date.now()-3.6e6*5},
|
| 787 |
+
{ic:"done",e:"✓",t:"Coffee grounds → compost partner",s:"Central kitchen · 62 kg diverted this month",at:Date.now()-3.6e6*26},
|
| 788 |
+
{ic:"alert",e:"!",t:"Overflowing bin reported",s:"Opéra café · residual container",at:Date.now()-3.6e6*31},
|
| 789 |
+
{ic:"scan",e:"🔍",t:"12 items scanned by staff",s:"Marais café · 92% sorted correctly",at:Date.now()-3.6e6*50},
|
| 790 |
+
],
|
| 791 |
+
personal:[
|
| 792 |
+
{ic:"report",e:"📄",t:"Weekly summary ready",s:"9.1 kg this week · 71% diverted",at:Date.now()-3.6e6*8},
|
| 793 |
+
{ic:"done",e:"✓",t:"Old chair given away on Geev",s:"Second life · 6 kg reused",at:Date.now()-3.6e6*40},
|
| 794 |
+
],
|
| 795 |
+
};
|
| 796 |
+
function renderDashboard(){
|
| 797 |
+
const d=new Date();
|
| 798 |
+
$("#dashDate").textContent=d.toLocaleDateString("en-GB",{weekday:"long",day:"numeric",month:"long"})+" · "+ws().name;
|
| 799 |
+
$("#heroSub").textContent= state.mode==="business"
|
| 800 |
+
? "Your 3 sites diverted more waste from landfill than last month. Here's what to do next."
|
| 801 |
+
: "Your household is sorting better every week. Keep the streak going.";
|
| 802 |
+
// KPIs: last 4 weeks vs previous 4
|
| 803 |
+
const rows=weeksFor("all"), cur=totals(rows.slice(-4)), prev=totals(rows.slice(-8,-4));
|
| 804 |
+
const tot=o=>sum(Object.values(o)), div=o=>o.pack+o.org+o.bulk;
|
| 805 |
+
const gen=tot(cur), genP=tot(prev), rate=div(cur)/gen, rateP=div(prev)/genP;
|
| 806 |
+
const save=div(cur)*ws().cost.avoid*(state.mode==="business"?1:1);
|
| 807 |
+
const savP=div(prev)*ws().cost.avoid;
|
| 808 |
+
const dGen=(gen-genP)/genP*100, dRate=(rate-rateP)*100, dSav=(save-savP)/savP*100;
|
| 809 |
+
const deltaHTML=(v,goodWhenDown,unit="%")=>{const good=goodWhenDown?v<=0:v>=0;return `<span class="delta ${good?"good":"bad"}">${v>=0?"▲":"▼"} ${fmt(Math.abs(v),1)}${unit}</span>`};
|
| 810 |
+
const scannedKg=sum(state.scans.map(s=>s.kg||0));
|
| 811 |
+
$("#kpis").innerHTML=`
|
| 812 |
+
<div class="card kpi"><div class="top"><span class="label">Waste generated</span><span class="badge b-measured">✓ Measured</span></div>
|
| 813 |
+
<div class="big-num">${kg(gen)}</div>
|
| 814 |
+
<div class="foot">${deltaHTML(dGen,true)} vs previous 4 weeks</div></div>
|
| 815 |
+
<div class="card kpi lime"><div class="top"><span class="label">Diverted from landfill</span><span class="badge b-measured">✓ Measured</span></div>
|
| 816 |
+
<div class="big-num">${fmt(rate*100)}<small>%</small></div>
|
| 817 |
+
<div class="meter" aria-hidden="true"><i data-w="${rate*100}"></i></div>
|
| 818 |
+
<div class="foot">${deltaHTML(dRate,false," pts")} · ${fmt(div(cur))} kg recycled, composted or reused</div></div>
|
| 819 |
+
<div class="card kpi"><div class="top"><span class="label">${state.mode==="business"?"Estimated cost savings":"Estimated savings"}</span><span class="badge b-ai">✦ AI estimate</span></div>
|
| 820 |
+
<div class="big-num">€${fmt(save)}</div>
|
| 821 |
+
<div class="foot">${deltaHTML(dSav,false)} · avoided disposal fees${scannedKg?` · ${state.scans.length} scans logged`:""}</div></div>`;
|
| 822 |
+
requestAnimationFrame(()=>$$(".kpi .meter i").forEach(i=>i.style.width=i.dataset.w+"%"));
|
| 823 |
+
// trend
|
| 824 |
+
const cols=monthly(rows,6);
|
| 825 |
+
$("#trendLegend").innerHTML=legendHTML(STREAMS);
|
| 826 |
+
const tb=$("#trendTableBtn");
|
| 827 |
+
const drawTrend=()=>{ if(tb.getAttribute("aria-pressed")==="true") $("#trendChart").innerHTML=tableView(cols,STREAMS); else stackedChart($("#trendChart"),cols,STREAMS,{height:300}) };
|
| 828 |
+
tb.onclick=()=>{tb.setAttribute("aria-pressed",String(tb.getAttribute("aria-pressed")!=="true"));tb.textContent=tb.getAttribute("aria-pressed")==="true"?"Chart view":"Table view";drawTrend()};
|
| 829 |
+
drawTrend();
|
| 830 |
+
renderMoves(); renderFeed();
|
| 831 |
+
}
|
| 832 |
+
function renderMoves(){
|
| 833 |
+
$("#moves").innerHTML=MOVES[state.mode].map((m,i)=>{const done=state.done.includes(m.id);return `
|
| 834 |
+
<article class="move ${m.tag==="alert"?"alert":""} ${done?"done":""}">
|
| 835 |
+
<div class="n">0${i+1}</div>
|
| 836 |
+
<div><h4>${esc(m.title)}</h4><p>${esc(m.body)}</p>
|
| 837 |
+
<div class="row"><span class="badge ${m.tag==="alert"?"b-alert":"b-good"}">${m.tag==="alert"?"⚠ ":""}${esc(m.impact)}</span>
|
| 838 |
+
<button class="btn ${done?"btn-quiet":"btn-primary"} btn-sm" data-move="${m.id}" ${done?'aria-pressed="true"':""}>${done?"Done ✓ · Undo":"Mark as done"}</button></div></div>
|
| 839 |
+
</article>`}).join("");
|
| 840 |
+
}
|
| 841 |
+
$("#moves").addEventListener("click",e=>{const b=e.target.closest("[data-move]");if(!b)return;const id=b.dataset.move;
|
| 842 |
+
if(state.done.includes(id)){state.done=state.done.filter(x=>x!==id)}else{state.done.push(id);burst();toast("Nice move! Added to your activity.")}
|
| 843 |
+
store.set("done",state.done);renderMoves();renderFeed(id)});
|
| 844 |
+
function renderFeed(highlight){
|
| 845 |
+
const doneItems=MOVES[state.mode].filter(m=>state.done.includes(m.id)).map(m=>({ic:"done",e:"✓",t:"Completed: "+m.title,s:m.impact,at:store.get("doneAt:"+m.id,Date.now()),id:m.id}));
|
| 846 |
+
doneItems.forEach(d=>{if(!store.get("doneAt:"+d.id,null))store.set("doneAt:"+d.id,d.at)});
|
| 847 |
+
const scans=state.scans.filter(s=>s.mode===state.mode).map(s=>({ic:"scan",e:s.emoji,t:`Scanned: ${s.item}`,s:`→ ${s.bin}${s.demo?" · demo":""}`,at:s.at,id:s.at}));
|
| 848 |
+
const items=[...scans,...doneItems,...BASE_FEED[state.mode]].sort((a,b)=>b.at-a.at).slice(0,7);
|
| 849 |
+
$("#clearFeed").hidden=!scans.length;
|
| 850 |
+
if(!items.length){$("#feed").innerHTML=`<li style="display:block"><div class="empty"><div class="shape">🫧</div><b>Nothing here yet</b><span>Scan your first item to start tracking your impact.</span><button class="btn btn-primary btn-sm" data-go="scan">Scan an item</button></div></li>`;return}
|
| 851 |
+
$("#feed").innerHTML=items.map(i=>`<li class="${(highlight&&i.id===highlight)||i.fresh?"new":""}"><span class="ic ${i.ic}" aria-hidden="true">${i.e}</span><div><b>${esc(i.t)}</b><small>${esc(i.s)}</small></div><time>${ago(i.at)}</time></li>`).join("");
|
| 852 |
+
}
|
| 853 |
+
$("#clearFeed").addEventListener("click",()=>{state.scans=state.scans.filter(s=>s.mode!==state.mode);store.set("scans",state.scans);renderDashboard();toast("Your scans were cleared")});
|
| 854 |
+
|
| 855 |
+
/* =====================================================================
|
| 856 |
+
8. SCANNER: CLIP zero-shot in the browser (Transformers.js)
|
| 857 |
+
===================================================================== */
|
| 858 |
+
let classifier=null, loading=null, stream=null;
|
| 859 |
+
const setModel=(cls,txt,p)=>{const m=$("#modelState");m.className="model-state "+cls;$("#modelTxt").textContent=txt;if(p!=null)$("#modelBar").style.width=p+"%"};
|
| 860 |
+
function ensureModel(){
|
| 861 |
+
if(classifier||loading) return loading;
|
| 862 |
+
setModel("loading","Downloading the AI model (first time only, ~1 min)…",2);
|
| 863 |
+
const files={};
|
| 864 |
+
loading=import("https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.0.2").then(({pipeline})=>
|
| 865 |
+
pipeline("zero-shot-image-classification","Xenova/clip-vit-base-patch32",{progress_callback:d=>{
|
| 866 |
+
if(d.status==="progress"&&d.total){files[d.file]=[d.loaded,d.total];const l=sum(Object.values(files).map(f=>f[0])),t=sum(Object.values(files).map(f=>f[1]));setModel("loading",`Downloading the AI model… ${Math.round(l/t*100)}%`,l/t*100)}
|
| 867 |
+
}})
|
| 868 |
+
).then(c=>{classifier=c;setModel("ready","AI model ready · runs on your device, photos never leave it");return c})
|
| 869 |
+
.catch(err=>{console.error(err);loading=null;setModel("error","AI model unavailable offline. Demo items still work. Tap to retry.");$("#modelState").onclick=()=>{$("#modelState").onclick=null;ensureModel()}});
|
| 870 |
+
return loading;
|
| 871 |
+
}
|
| 872 |
+
async function openCam(){
|
| 873 |
+
if(stream){stopCam();return}
|
| 874 |
+
try{
|
| 875 |
+
stream=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"},audio:false});
|
| 876 |
+
const v=$("#video");v.srcObject=stream;v.hidden=false;await v.play();
|
| 877 |
+
$("#shot").hidden=true;$("#viewerPh").hidden=true;$("#captureBtn").hidden=false;$("#camBtn span").textContent="Close camera";
|
| 878 |
+
}catch(e){toast("Camera unavailable. Upload a photo instead.");console.warn(e)}
|
| 879 |
+
}
|
| 880 |
+
function stopCam(){if(stream){stream.getTracks().forEach(t=>t.stop());stream=null}$("#video").hidden=true;$("#captureBtn").hidden=true;$("#camBtn span").textContent="Open camera";if($("#shot").hidden)$("#viewerPh").hidden=false}
|
| 881 |
+
$("#camBtn").addEventListener("click",openCam);
|
| 882 |
+
$("#captureBtn").addEventListener("click",()=>{const v=$("#video"),c=document.createElement("canvas");c.width=v.videoWidth;c.height=v.videoHeight;c.getContext("2d").drawImage(v,0,0);const url=c.toDataURL("image/jpeg",.9);stopCam();analyse(url)});
|
| 883 |
+
$("#fileIn").addEventListener("change",e=>readFile(e.target.files[0]));
|
| 884 |
+
$("#uploadLbl").addEventListener("keydown",e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();$("#fileIn").click()}});
|
| 885 |
+
const viewer=$("#viewer");
|
| 886 |
+
["dragenter","dragover"].forEach(ev=>viewer.addEventListener(ev,e=>{e.preventDefault();viewer.classList.add("drag")}));
|
| 887 |
+
["dragleave","drop"].forEach(ev=>viewer.addEventListener(ev,e=>{e.preventDefault();viewer.classList.remove("drag")}));
|
| 888 |
+
viewer.addEventListener("drop",e=>readFile(e.dataTransfer.files[0]));
|
| 889 |
+
function readFile(f){if(!f||!f.type.startsWith("image/")){toast("Please choose an image file");return}const r=new FileReader();r.onload=()=>analyse(r.result);r.readAsDataURL(f)}
|
| 890 |
+
|
| 891 |
+
function showShot(url){const s=$("#shot");s.src=url;s.hidden=false;$("#viewerPh").hidden=true}
|
| 892 |
+
async function analyse(url){
|
| 893 |
+
showShot(url); viewer.classList.add("scanning");
|
| 894 |
+
$("#result").innerHTML=`<div class="empty"><div class="shape" style="background:var(--cobalt-soft)">🔎</div><b>Analysing your item…</b><span>Comparing it with 33 types of waste</span></div>`;
|
| 895 |
+
const c=await ensureModel();
|
| 896 |
+
if(!c){viewer.classList.remove("scanning");renderResult(null);return}
|
| 897 |
+
const res=(await c(url,LABELS)).sort((a,b)=>b.score-a.score);
|
| 898 |
+
viewer.classList.remove("scanning");
|
| 899 |
+
const binScore={};res.forEach(r=>{const b=CATS[r.label][0];binScore[b]=(binScore[b]||0)+r.score});
|
| 900 |
+
renderResult({label:res[0].label,conf:binScore[CATS[res[0].label][0]],demo:false});
|
| 901 |
+
}
|
| 902 |
+
function demoScan(label){
|
| 903 |
+
const emoji=CATS[label][5];
|
| 904 |
+
const svg=`<svg xmlns='http://www.w3.org/2000/svg' width='800' height='680'><rect width='100%' height='100%' fill='#F8F7F2'/><text x='50%' y='54%' font-size='260' text-anchor='middle' dominant-baseline='middle'>${emoji}</text></svg>`;
|
| 905 |
+
showShot("data:image/svg+xml;utf8,"+encodeURIComponent(svg)); viewer.classList.add("scanning");
|
| 906 |
+
$("#result").innerHTML=`<div class="empty"><div class="shape" style="background:var(--cobalt-soft)">🔎</div><b>Analysing your item…</b></div>`;
|
| 907 |
+
setTimeout(()=>{viewer.classList.remove("scanning");renderResult({label,conf:.74+Math.random()*.18,demo:true})},1100);
|
| 908 |
+
}
|
| 909 |
+
const DEMOS=["a plastic bottle","an apple core or banana peel","old clothes, a t-shirt or a sweater","a chair or a table","a battery","a glass jar"];
|
| 910 |
+
$("#demoChips").innerHTML=DEMOS.map(l=>`<button class="chip" data-demo="${esc(l)}">${CATS[l][5]} ${esc(CATS[l][4])}</button>`).join("");
|
| 911 |
+
$("#demoChips").addEventListener("click",e=>{const b=e.target.closest("[data-demo]");if(b)demoScan(b.dataset.demo)});
|
| 912 |
+
|
| 913 |
+
let lastResult=null;
|
| 914 |
+
function renderResult(r){
|
| 915 |
+
const box=$("#result");
|
| 916 |
+
if(!r){box.innerHTML=`<div class="empty"><div class="shape" style="background:var(--orange-soft)">⚠️</div><b>The AI model isn't available</b><span>Check your connection and retry, or try a demo item.</span><button class="btn btn-primary btn-sm" id="retryBtn">Retry</button></div>`;$("#retryBtn").onclick=()=>ensureModel();return}
|
| 917 |
+
lastResult=r;
|
| 918 |
+
const [binKey,donate,idea,yt,short,emoji]=CATS[r.label], bin=BINS[binKey];
|
| 919 |
+
if(r.conf<THRESHOLD){
|
| 920 |
+
box.innerHTML=`<div class="res-head"><span class="eyebrow">Result</span><span class="badge b-ai">✦ AI estimate</span></div>
|
| 921 |
+
<div class="res-item">Hmm, not sure.</div>
|
| 922 |
+
<div class="step not-sure"><div class="st">🤔 Low confidence (${fmt(r.conf*100)}%)</div><p>Try another photo: one item, close-up, plain background. Or ask the assistant.</p></div>
|
| 923 |
+
<div class="res-actions"><button class="btn btn-primary" id="againBtn">Scan again</button><button class="btn btn-quiet" data-go="assistant">Ask the assistant</button></div>
|
| 924 |
+
<div class="links" style="margin-top:14px"><a href="${LINKS.ademe[1]}" target="_blank" rel="noopener">↗ ${LINKS.ademe[0]}</a></div>`;
|
| 925 |
+
}else{
|
| 926 |
+
let n=1, steps="";
|
| 927 |
+
if(donate.length) steps+=`<div class="step"><div class="st"><span class="n">${n++}</span>Someone could use it: donate or sell</div><div class="links">${donate.map(k=>`<a href="${LINKS[k][1]}" target="_blank" rel="noopener">↗ ${esc(LINKS[k][0])}</a>`).join("")}</div></div>`;
|
| 928 |
+
if(idea) steps+=`<div class="step"><div class="st"><span class="n">${n++}</span>Give it a second life</div><p>${esc(idea)}</p>${yt?`<div class="links" style="margin-top:10px"><a href="https://www.youtube.com/results?search_query=${encodeURIComponent(yt)}" target="_blank" rel="noopener" style="background:var(--orange-soft);color:#9A2F0E">▶ Watch tutorials</a></div>`:""}</div>`;
|
| 929 |
+
steps+=`<div class="step binbox" style="background:${bin.bg};color:${bin.fg}"><div class="st"><span class="n">${n}</span>${n>1?"Otherwise, it goes here":"It goes here"}</div><div class="bin-name">${esc(bin.name)}</div><p style="font-size:13px;margin-bottom:6px">${esc(bin.fr)}</p><p>${esc(bin.tip)}</p></div>`;
|
| 930 |
+
box.innerHTML=`<div class="res-head"><span class="eyebrow">${r.demo?"Demo result (simulated)":"Detected"}</span><span class="badge b-ai">✦ AI estimate</span></div>
|
| 931 |
+
<div class="res-item">${emoji} ${esc(short)}</div>
|
| 932 |
+
<div class="conf"><span>Confidence</span><div class="meter"><i data-w="${Math.min(99,r.conf*100)}"></i></div><b>${fmt(Math.min(99,r.conf*100))}%</b></div>
|
| 933 |
+
${steps}
|
| 934 |
+
<div class="res-actions"><button class="btn btn-primary" id="logBtn">Log this item</button><button class="btn btn-quiet" id="askBtn">Ask about it</button><button class="btn btn-quiet" id="againBtn">Scan another</button></div>`;
|
| 935 |
+
requestAnimationFrame(()=>box.querySelectorAll(".meter i").forEach(i=>i.style.width=i.dataset.w+"%"));
|
| 936 |
+
$("#logBtn").onclick=()=>{
|
| 937 |
+
const est={yellow:.05,glass:.3,compost:.2,general:.05,textile:.6,bulky:15,electronic:2,hazardous:1,battery:.05,pharmacy:.1}[binKey];
|
| 938 |
+
state.scans.push({item:short,emoji,bin:bin.name,at:Date.now(),demo:r.demo,kg:est,mode:state.mode});store.set("scans",state.scans);
|
| 939 |
+
burst();toast(`Logged: ${short} → ${bin.name}`);$("#logBtn").disabled=true;$("#logBtn").textContent="Logged ✓";renderDashboard();
|
| 940 |
+
};
|
| 941 |
+
$("#askBtn").onclick=()=>{go("assistant");ask(`What else can I do with a ${short}?`)};
|
| 942 |
+
}
|
| 943 |
+
const again=$("#againBtn"); if(again) again.onclick=()=>{$("#shot").hidden=true;$("#viewerPh").hidden=false;renderEmptyResult()};
|
| 944 |
+
}
|
| 945 |
+
function renderEmptyResult(){
|
| 946 |
+
$("#result").innerHTML=`<div class="empty"><div class="shape">📸</div><b>Your result appears here</b><span>trismart tells you if it can be donated, reused, and which bin it belongs in.</span>
|
| 947 |
+
<div class="chips" style="justify-content:center;margin-top:6px"><span class="chip">🤝 Donate</span><span class="chip">♻️ Reuse</span><span class="chip">🗑️ Sort</span></div></div>`;
|
| 948 |
+
}
|
| 949 |
+
|
| 950 |
+
/* =====================================================================
|
| 951 |
+
9. ANALYTICS
|
| 952 |
+
===================================================================== */
|
| 953 |
+
function renderAnalytics(){
|
| 954 |
+
const W=ws(), personal=state.mode==="personal";
|
| 955 |
+
$("#anEyebrow").textContent=personal?"Household analytics":"Business analytics";
|
| 956 |
+
$("#siteSel").innerHTML=(personal?"":`<option value="all">All locations</option>`)+W.sites.map(s=>`<option value="${s.id}">${esc(s.name)}</option>`).join("");
|
| 957 |
+
if(personal) state.site=W.sites[0].id; $("#siteSel").value=state.site; $("#siteSel").disabled=personal;
|
| 958 |
+
$("#catChips").innerHTML=STREAMS.map(s=>`<button class="chip" data-cat="${s.key}" aria-pressed="${state.cats.has(s.key)}"><span class="sw" style="background:${s.color}"></span>${s.name}</button>`).join("");
|
| 959 |
+
$$("#periodSeg button").forEach(b=>b.setAttribute("aria-pressed",String(+b.dataset.p===state.period)));
|
| 960 |
+
const streams=STREAMS.filter(s=>state.cats.has(s.key));
|
| 961 |
+
const nW=state.period===30?4:state.period===90?13:52;
|
| 962 |
+
const rows=weeksFor(state.site), cur=rows.slice(-nW), prev=rows.slice(-2*nW,-nW);
|
| 963 |
+
// KPIs
|
| 964 |
+
const t=totals(cur), tp=totals(prev.length?prev:cur);
|
| 965 |
+
const gen=sum(streams.map(s=>t[s.key])), genP=sum(streams.map(s=>tp[s.key]));
|
| 966 |
+
const allTot=sum(Object.values(t)), divT=t.pack+t.org+t.bulk, rate=divT/allTot, rateP=(tp.pack+tp.org+tp.bulk)/sum(Object.values(tp));
|
| 967 |
+
const cost=t.res*W.cost.res, save=divT*W.cost.avoid;
|
| 968 |
+
const d=(a,b)=>b?((a-b)/b*100):0;
|
| 969 |
+
const dl=(v,goodDown,u="%")=>{const g=goodDown?v<=0:v>=0;return `<span class="delta ${g?"good":"bad"}">${v>=0?"▲":"▼"} ${fmt(Math.abs(v),1)}${u}</span>`};
|
| 970 |
+
$("#akpis").innerHTML=`
|
| 971 |
+
<div class="card akpi"><div class="label">Total collected<span class="badge b-measured">✓</span></div><div class="big-num">${kg(gen)}</div><div style="margin-top:10px">${dl(d(gen,genP),true)}</div></div>
|
| 972 |
+
<div class="card akpi" style="background:var(--lime);border-color:var(--lime)"><div class="label">Diversion rate<span class="badge b-measured">✓</span></div><div class="big-num">${fmt(rate*100)}<small>%</small></div><div style="margin-top:10px">${dl((rate-rateP)*100,false," pts")}</div></div>
|
| 973 |
+
<div class="card akpi"><div class="label">Disposal cost<span class="badge b-ai">✦ est.</span></div><div class="big-num">€${fmt(cost)}</div><div class="muted" style="margin-top:10px;font-size:13px">residual at €${W.cost.res}/kg</div></div>
|
| 974 |
+
<div class="card akpi"><div class="label">Savings captured<span class="badge b-ai">✦ est.</span></div><div class="big-num">€${fmt(save)}</div><div class="muted" style="margin-top:10px;font-size:13px">vs. sending all to landfill</div></div>`;
|
| 975 |
+
// chart
|
| 976 |
+
let cols;
|
| 977 |
+
if(nW===52) cols=monthly(rows,12);
|
| 978 |
+
else cols=cur.map((r,i)=>{const ds=weekStart(WEEKS-nW+i);return{label:`${ds.getDate()} ${MON[ds.getMonth()]}`,full:`Week of ${ds.toLocaleDateString("en-GB",{day:"numeric",month:"long"})}`,v:Object.fromEntries(STREAMS.map(s=>[s.key,Math.round(r[s.key])]))}});
|
| 979 |
+
$("#anChartSub").textContent=`${nW===52?"Monthly":"Weekly"} · ${state.site==="all"?"all locations":W.sites.find(s=>s.id===state.site).name} · kg`;
|
| 980 |
+
$("#anLegend").innerHTML=legendHTML(streams);
|
| 981 |
+
const tb=$("#anTableBtn");
|
| 982 |
+
if(!streams.length){$("#anChart").innerHTML=`<div class="empty"><div class="shape">🎛️</div><b>No category selected</b><span>Pick at least one waste stream above.</span></div>`}
|
| 983 |
+
else if(tb.getAttribute("aria-pressed")==="true") $("#anChart").innerHTML=tableView(cols,streams);
|
| 984 |
+
else stackedChart($("#anChart"),cols,streams,{height:nW===13?280:260});
|
| 985 |
+
// by location
|
| 986 |
+
$("#byTitle").textContent=personal?"Your home":"By location";
|
| 987 |
+
const locs=W.sites.map(s=>({s,t:totals(DATA[state.mode][s.id].slice(-nW))}));
|
| 988 |
+
const maxL=Math.max(...locs.map(l=>sum(streams.map(x=>l.t[x.key]))),1);
|
| 989 |
+
$("#byLocation").innerHTML=locs.map(({s,t})=>{const tot=sum(streams.map(x=>t[x.key]));return `<div class="hbar"><span>${esc(s.name)}</span><div class="track" style="width:${Math.max(6,tot/maxL*100)}%">${streams.map(x=>`<i style="width:${t[x.key]/tot*100}%;background:${x.color}" title="${x.name}: ${fmt(t[x.key])} kg"></i>`).join("")}</div><b>${fmt(tot)}</b></div>`}).join("");
|
| 990 |
+
$("#byCat").innerHTML=STREAMS.map(s=>`<div class="cat-row" style="${state.cats.has(s.key)?"":"opacity:.4"}"><i style="background:${s.color}"></i><span>${s.name} <span class="muted">· ${s.verb}</span></span><b>${fmt(t[s.key])} kg</b><span class="muted">${fmt(t[s.key]/allTot*100)}%</span></div>`).join("");
|
| 991 |
+
// recommendations
|
| 992 |
+
const k=state.period/30;
|
| 993 |
+
const recos= personal? [
|
| 994 |
+
{save:`−${fmt(t.org/nW*0.6,1)} kg`,unit:"per week",title:"Compost your food scraps",body:"Most of your residual bin is organic. A free Paris collection point is 400 m away.",feature:true},
|
| 995 |
+
{save:"€"+fmt(12*k),unit:`over ${state.period} days`,title:"Buy loose and refill",body:"Swap 3 packaged staples for bulk refills to cut packaging by about a quarter."},
|
| 996 |
+
{save:"+6 kg",unit:"reused",title:"Declutter with donations",body:"Your last scans include clothes and a chair. Emmaüs picks up for free."},
|
| 997 |
+
]:[
|
| 998 |
+
{save:"€"+fmt(t.org*0.6*W.cost.res),unit:`over ${state.period} days`,title:"Divert organics at every site",body:"A biowaste contract for Marais and Opéra would move most organic waste out of residual bins.",feature:true},
|
| 999 |
+
{save:"€"+fmt(t.pack*0.35*0.12),unit:`over ${state.period} days`,title:"Reusable crates with suppliers",body:"Cardboard drives your packaging volume. Two of your suppliers offer take-back crates."},
|
| 1000 |
+
{save:"€"+fmt(cost*0.08),unit:`over ${state.period} days`,title:"Right-size your containers",body:"Opéra café's residual bin is collected half-empty 2 days a week. Fewer pickups, same service."},
|
| 1001 |
+
];
|
| 1002 |
+
$("#reco").innerHTML=recos.map(r=>`<article class="card ${r.feature?"feature":""}"><span class="badge b-ai" style="width:max-content">✦ AI estimate</span><div class="save">${r.save}</div><div class="muted" style="font-size:13px;margin-top:-6px">${r.unit}</div><h3 class="h3" style="font-size:18px">${esc(r.title)}</h3><p class="muted" style="margin:0;font-size:14px">${esc(r.body)}</p><button class="btn ${r.feature?"btn-lime":"btn-quiet"} btn-sm" style="margin-top:auto;width:max-content" data-plan="${esc(r.title)}">Add to my plan</button></article>`).join("");
|
| 1003 |
+
$("#anTableBtn").onclick=()=>{tb.setAttribute("aria-pressed",String(tb.getAttribute("aria-pressed")!=="true"));tb.textContent=tb.getAttribute("aria-pressed")==="true"?"Chart view":"Table view";renderAnalytics()};
|
| 1004 |
+
$("#exportBtn").onclick=()=>exportCSV(cols,streams);
|
| 1005 |
+
}
|
| 1006 |
+
$("#periodSeg").addEventListener("click",e=>{const b=e.target.closest("[data-p]");if(!b)return;state.period=+b.dataset.p;renderAnalytics()});
|
| 1007 |
+
$("#siteSel").addEventListener("change",e=>{state.site=e.target.value;renderAnalytics()});
|
| 1008 |
+
$("#catChips").addEventListener("click",e=>{const b=e.target.closest("[data-cat]");if(!b)return;const k=b.dataset.cat;state.cats.has(k)?state.cats.delete(k):state.cats.add(k);renderAnalytics()});
|
| 1009 |
+
$("#reco").addEventListener("click",e=>{const b=e.target.closest("[data-plan]");if(!b)return;b.textContent="In your plan ✓";b.disabled=true;burst();toast("Added to your plan: "+b.dataset.plan)});
|
| 1010 |
+
function exportCSV(cols,streams){
|
| 1011 |
+
const csv=["Period,"+streams.map(s=>s.name).join(",")+",Total",...cols.map(c=>`"${c.full||c.label}",`+streams.map(s=>c.v[s.key]).join(",")+","+sum(streams.map(s=>c.v[s.key])))].join("\n");
|
| 1012 |
+
const a=document.createElement("a");a.href=URL.createObjectURL(new Blob([csv],{type:"text/csv"}));a.download=`trismart-${state.mode}-${state.period}d.csv`;a.click();setTimeout(()=>URL.revokeObjectURL(a.href),1000);toast("CSV exported");
|
| 1013 |
+
}
|
| 1014 |
+
|
| 1015 |
+
/* =====================================================================
|
| 1016 |
+
10. ASSISTANT: knowledge-based answers
|
| 1017 |
+
===================================================================== */
|
| 1018 |
+
const SUGGEST=["Where does a pizza box go?","What can I do with an old sofa?","How can my café cut packaging waste?","Explain the yellow bin","Where do batteries go?","How do I reduce food waste at home?"];
|
| 1019 |
+
$("#suggest").innerHTML=SUGGEST.map(s=>`<button class="chip" data-q="${esc(s)}">${esc(s)}</button>`).join("");
|
| 1020 |
+
$("#suggest").addEventListener("click",e=>{const b=e.target.closest("[data-q]");if(b)ask(b.dataset.q)});
|
| 1021 |
+
$("#composer").addEventListener("submit",e=>{e.preventDefault();const v=$("#ask").value.trim();if(v){ask(v);$("#ask").value=""}});
|
| 1022 |
+
const msgs=$("#msgs");
|
| 1023 |
+
function addMsg(html,who="bot"){const m=document.createElement("div");m.className="msg "+who;m.innerHTML=html;msgs.append(m);msgs.scrollTop=msgs.scrollHeight;return m}
|
| 1024 |
+
function ask(q){
|
| 1025 |
+
addMsg(esc(q),"user");
|
| 1026 |
+
const t=addMsg(`<span class="typing" aria-label="trismart AI is typing"><i></i><i></i><i></i></span>`);t.style.padding="0";
|
| 1027 |
+
setTimeout(()=>{t.remove();addMsg(answer(q))},650+Math.random()*500);
|
| 1028 |
+
}
|
| 1029 |
+
function itemAnswer(label){
|
| 1030 |
+
const [binKey,donate,idea,yt,short,emoji]=CATS[label], bin=BINS[binKey];
|
| 1031 |
+
let h=`<p>${emoji} <b>${esc(short[0].toUpperCase()+short.slice(1))}</b></p>`;
|
| 1032 |
+
if(donate.length) h+=`<p><b>1. Can someone use it?</b> Donate or sell it: ${donate.map(k=>`<a href="${LINKS[k][1]}" target="_blank" rel="noopener">${esc(LINKS[k][0].split(":")[0])}</a>`).join(", ")}.</p>`;
|
| 1033 |
+
if(idea) h+=`<p><b>${donate.length?"2":"1"}. Second life:</b> ${esc(idea)}${yt?` <a href="https://www.youtube.com/results?search_query=${encodeURIComponent(yt)}" target="_blank" rel="noopener">Watch tutorials ↗</a>`:""}</p>`;
|
| 1034 |
+
h+=`<p><b>${donate.length||idea?"Otherwise":"It goes"} →</b> ${esc(bin.name)} <span class="muted">(${esc(bin.fr)})</span>. ${esc(bin.tip)}</p>`;
|
| 1035 |
+
if(label==="a cardboard box") h+=`<p>🍕 Pizza boxes go in the yellow bin too: just remove leftover food first.</p>`;
|
| 1036 |
+
return h+`<div class="msg-actions"><button class="btn btn-quiet btn-sm" data-go="scan">Scan it to confirm</button></div><div class="src">✦ Based on French sorting rules · check your local guidelines</div>`;
|
| 1037 |
+
}
|
| 1038 |
+
function answer(raw){
|
| 1039 |
+
const q=" "+raw.toLowerCase().replace(/[?!.,]/g," ")+" ";
|
| 1040 |
+
const has=(...w)=>w.some(x=>q.includes(x));
|
| 1041 |
+
if(/^\s*(hi|hello|hey|bonjour|salut)\b/.test(q)) return `<p>Hi! 👋 Ask me where something goes, how to give it a second life, or how to cut waste and costs.</p>`;
|
| 1042 |
+
if(has("yellow bin","bac jaune","recycling bin")) return `<p><b>The yellow bin (bac jaune)</b> takes <b>all packaging</b> in France since 2023:</p><ul><li>plastic bottles, pots, trays, films and bags</li><li>cans, tins and aerosols (empty)</li><li>paper, cardboard and drink cartons</li></ul><p>Tips: empty it, don't rinse, and don't nest items inside each other. Glass goes in the glass bin, not here.</p><div class="src">✦ French national sorting rules</div>`;
|
| 1043 |
+
if(has("compost","biowaste","biodéchet","food waste")&&has("home","reduce","less","cut","avoid","house"))
|
| 1044 |
+
return `<p>Five easy wins to <b>reduce food waste at home</b>:</p><ul><li>Plan meals and shop with a list.</li><li>Store the oldest food at the front of the fridge.</li><li>Learn the difference between "use by" and "best before".</li><li>Freeze bread and leftovers.</li><li>Compost what's left: Paris has free biowaste collection points.</li></ul><p>Households that do this typically cut their food waste noticeably within a month.</p><div class="src">✦ AI guidance</div>`;
|
| 1045 |
+
if(has("café","cafe","restaurant","business","company","shop","hotel","office")&&has("packaging","waste","cost","save","reduce","cut"))
|
| 1046 |
+
return `<p>For a <b>café or restaurant</b>, the biggest levers are:</p><ul><li><b>Reusable cups & containers</b>: offer a discount for customers' own cups.</li><li><b>Supplier take-back</b>: ask for reusable crates instead of cardboard.</li><li><b>Biowaste contract</b>: organics are often the heaviest part of your residual bin.</li><li><b>Right-size pickups</b>: half-empty containers cost the same as full ones.</li></ul><p>${state.mode==="business"?"In your workspace, organics at Marais café are the quickest win.":"Switch to the Business workspace to see this on real site data."}</p><div class="msg-actions"><button class="btn btn-primary btn-sm" data-go="analytics">Open analytics</button></div><div class="src">✦ AI estimate based on your workspace data</div>`;
|
| 1047 |
+
if(has("cost","save","saving","money","€"))
|
| 1048 |
+
return `<p>Your savings come from <b>avoided disposal fees</b>: every kilo recycled, composted or reused instead of going to residual waste costs less to treat.</p><p>On the dashboard, savings are labelled <b>✦ AI estimate</b> because they use average local prices, while weights are <b>✓ Measured</b> from hauler reports.</p><div class="msg-actions"><button class="btn btn-quiet btn-sm" data-go="analytics">See the breakdown</button></div>`;
|
| 1049 |
+
// item match: longest keyword wins
|
| 1050 |
+
let best=null,len=0;
|
| 1051 |
+
for(const [label,v] of Object.entries(CATS)) for(const kw of v[6]){ if(q.includes(" "+kw)&&kw.length>len){best=label;len=kw.length} }
|
| 1052 |
+
if(best) return itemAnswer(best);
|
| 1053 |
+
if(has("glass")) return itemAnswer("a glass bottle");
|
| 1054 |
+
return `<p>I'm not sure about that one yet. 🤔</p><p>Try naming a specific item (e.g. "coffee capsule", "old jeans", "paint can"), or scan it and I'll identify it.</p><div class="msg-actions"><button class="btn btn-primary btn-sm" data-go="scan">Scan an item</button><a class="btn btn-quiet btn-sm" href="${LINKS.ademe[1]}" target="_blank" rel="noopener">Search on ADEME ↗</a></div>`;
|
| 1055 |
+
}
|
| 1056 |
+
addMsg(`<p>Hi, I'm <b>trismart AI</b> ✦</p><p>I can tell you where anything goes, how to give it a second life, and how to cut waste and costs. What do you want to get rid of?</p>`);
|
| 1057 |
+
|
| 1058 |
+
let rT;addEventListener("resize",()=>{clearTimeout(rT);rT=setTimeout(()=>$$(".chart").forEach(c=>c._redraw&&c.closest(".view.active")&&c._redraw()),200)});
|
| 1059 |
+
|
| 1060 |
+
/* =====================================================================
|
| 1061 |
+
11. BOOT
|
| 1062 |
+
===================================================================== */
|
| 1063 |
+
renderEmptyResult();
|
| 1064 |
+
applyMode();
|
| 1065 |
+
go(location.hash.slice(1)||"dashboard",{push:false});
|
| 1066 |
+
// warm the model in the background once the page is idle (only on wide/desktop connections)
|
| 1067 |
+
if("requestIdleCallback" in window && !(navigator.connection&&navigator.connection.saveData)) requestIdleCallback(()=>ensureModel(),{timeout:6000});
|
| 1068 |
+
</script>
|
| 1069 |
+
</body>
|
| 1070 |
+
</html>
|