Infinity-1995 commited on
Commit
2b2494d
·
verified ·
1 Parent(s): 2ba92dc

Update confirmation.html

Browse files
Files changed (1) hide show
  1. confirmation.html +29 -132
confirmation.html CHANGED
@@ -5,7 +5,7 @@
5
  <title>Donation confirmed</title>
6
 
7
  <script src="https://cdn.tailwindcss.com"></script>
8
- <script src="supabase.js"></script>
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap" rel="stylesheet">
10
 
11
  <style>
@@ -14,172 +14,69 @@ body {
14
  background-color: #F7F5F0;
15
  }
16
 
17
- /* TIMELINE */
18
- .timeline {
19
- position: relative;
20
- padding-left: 32px;
21
- }
22
-
23
- .timeline::before {
24
- content: "";
25
- position: absolute;
26
- left: 10px;
27
- top: 0;
28
- bottom: 0;
29
- width: 2px;
30
- background: #e5e7eb;
31
- }
32
-
33
- /* STEP */
34
- .step {
35
- position: relative;
36
- margin-bottom: 26px;
37
- opacity: 0.35;
38
- transition: 0.4s ease;
39
- }
40
-
41
- .step.active {
42
- opacity: 1;
43
- }
44
 
45
- /* DOTS */
46
- .step::before {
47
- content: "";
48
- position: absolute;
49
- left: -26px;
50
- top: 4px;
51
- width: 14px;
52
- height: 14px;
53
- border-radius: 50%;
54
- background: #d1d5db;
55
- border: 2px solid white;
56
- }
57
-
58
- .step.active::before {
59
- background: #10b981;
60
- box-shadow: 0 0 0 4px rgba(16,185,129,0.2);
61
- }
62
  </style>
63
  </head>
64
 
65
  <body>
66
 
67
- <!-- HEADER -->
68
- <nav class="flex justify-between items-center px-10 py-5 bg-emerald-600 text-white sticky top-0">
69
- <a href="index.html" class="text-2xl font-extrabold">NourishNet</a>
70
-
71
- <div class="hidden md:flex gap-10 font-medium">
72
- <a href="dashboard.html">Dashboard</a>
73
- <a href="#">Impact</a>
74
- <a href="#">Leaderboard</a>
75
- </div>
76
-
77
- <a href="index.html" class="bg-white text-emerald-600 px-5 py-2 rounded-full font-semibold">
78
- Logout
79
- </a>
80
  </nav>
81
 
82
- <!-- TITLE -->
83
- <div class="text-center mt-12">
84
 
85
- <h1 class="text-3xl font-bold">Donation confirmed!</h1>
86
 
87
- <p id="summaryText" class="text-gray-600 mt-2">
88
- Loading donation details...
89
- </p>
90
 
91
  </div>
92
 
93
- <!-- TRACKING -->
94
- <div class="max-w-2xl mx-auto bg-white p-8 rounded-xl mt-10 shadow-sm">
95
-
96
- <h2 class="font-bold text-xl mb-6">Live Tracking</h2>
97
-
98
- <div class="timeline">
99
 
100
- <div id="s1" class="step">Surplus logged</div>
101
 
102
- <div id="s2" class="step">AI matched</div>
103
 
104
- <div id="s3" class="step">
105
- Volunteer en route
106
- <p id="volunteerText" class="text-sm text-gray-500 mt-1"></p>
107
- </div>
108
-
109
- <div id="s4" class="step">
110
- Out for delivery
111
- </div>
112
-
113
- </div>
114
- </div>
115
-
116
- <!-- POINTS (RESTORED EXACTLY) -->
117
- <div class="max-w-2xl mx-auto mt-6 bg-emerald-600 text-white p-6 rounded-2xl flex justify-between items-center">
118
-
119
- <div>
120
- <p class="text-sm opacity-90">Points earned</p>
121
- <p class="text-3xl font-bold">+45</p>
122
- <p class="text-sm opacity-90">1 point per portion</p>
123
- </div>
124
-
125
- <div class="bg-emerald-500 px-4 py-3 rounded-xl text-sm">
126
- <p class="font-semibold">13 day streak!</p>
127
- <p>1 more for "Fortnight Hero"</p>
128
- </div>
129
 
130
  </div>
131
-
132
- <!-- BACK BUTTON -->
133
- <div class="text-center mt-8">
134
- <button onclick="window.location.href='dashboard.html'"
135
- class="bg-white border px-6 py-3 rounded-full font-semibold hover:scale-105 transition">
136
- ← Back to dashboard
137
- </button>
138
  </div>
139
 
140
- <div id="footer"></div>
141
-
142
  <script>
143
- fetch("footer.html")
144
- .then(res => res.text())
145
- .then(data => {
146
- document.getElementById("footer").innerHTML = data;
147
- });
148
- </script>
149
 
150
- <!-- SCRIPT -->
151
- <script>
152
  const data = JSON.parse(localStorage.getItem("donationData"));
153
 
154
  const summaryText = document.getElementById("summaryText");
155
- const volunteerText = document.getElementById("volunteerText");
156
 
157
  const s1 = document.getElementById("s1");
158
  const s2 = document.getElementById("s2");
159
  const s3 = document.getElementById("s3");
160
 
161
- if (data) {
162
-
163
- // 🔥 CLEAR SUMMARY (as requested)
164
- summaryText.innerText =
165
- `${data.portions} portions of ${data.foodType} successfully routed`;
166
 
167
- // 🚚 ETA
168
- let eta = "15–25 min";
169
 
170
- if (data.portions <= 50) eta = "10–15 min";
171
- else if (data.portions <= 120) eta = "15–25 min";
172
- else eta = "25–40 min";
173
-
174
- volunteerText.innerText =
175
- `Volunteer Ahmed assigned • ETA ${eta}`;
176
 
177
- // 🔥 ONLY FIRST 3 STEPS ACTIVE
178
- setTimeout(() => s1.classList.add("active"), 400);
179
- setTimeout(() => s2.classList.add("active"), 1200);
180
- setTimeout(() => s3.classList.add("active"), 2000);
181
 
 
 
182
  }
 
183
  </script>
184
 
185
  </body>
 
5
  <title>Donation confirmed</title>
6
 
7
  <script src="https://cdn.tailwindcss.com"></script>
8
+
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap" rel="stylesheet">
10
 
11
  <style>
 
14
  background-color: #F7F5F0;
15
  }
16
 
17
+ .timeline {position:relative;padding-left:32px;}
18
+ .timeline::before{content:"";position:absolute;left:10px;top:0;bottom:0;width:2px;background:#e5e7eb;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ .step{margin-bottom:26px;opacity:0.35;}
21
+ .step.active{opacity:1;}
22
+ .step::before{content:"";position:absolute;left:-26px;width:14px;height:14px;border-radius:50%;background:#d1d5db;}
23
+ .step.active::before{background:#10b981;}
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  </style>
25
  </head>
26
 
27
  <body>
28
 
29
+ <nav class="flex justify-between items-center px-10 py-5 bg-emerald-600 text-white">
30
+ <a href="#" class="text-2xl font-bold">NourishNet</a>
 
 
 
 
 
 
 
 
 
 
 
31
  </nav>
32
 
33
+ <div class="text-center mt-10">
 
34
 
35
+ <h1 class="text-3xl font-bold">Donation Confirmed 🎉</h1>
36
 
37
+ <p id="summaryText" class="text-gray-600 mt-2"></p>
 
 
38
 
39
  </div>
40
 
41
+ <div class="max-w-2xl mx-auto bg-white p-8 rounded-xl mt-10">
 
 
 
 
 
42
 
43
+ <h2 class="font-bold text-xl mb-6">Live Tracking</h2>
44
 
45
+ <div class="timeline">
46
 
47
+ <div id="s1" class="step">Surplus logged</div>
48
+ <div id="s2" class="step">AI matched</div>
49
+ <div id="s3" class="step">Volunteer en route</div>
50
+ <div id="s4" class="step">Out for delivery</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  </div>
 
 
 
 
 
 
 
53
  </div>
54
 
 
 
55
  <script>
 
 
 
 
 
 
56
 
 
 
57
  const data = JSON.parse(localStorage.getItem("donationData"));
58
 
59
  const summaryText = document.getElementById("summaryText");
 
60
 
61
  const s1 = document.getElementById("s1");
62
  const s2 = document.getElementById("s2");
63
  const s3 = document.getElementById("s3");
64
 
65
+ if(data && data.accepted){
 
 
 
 
66
 
67
+ const ngos = data.accepted.map(x=>x.recipient).join(", ");
 
68
 
69
+ summaryText.innerText =
70
+ `${data.portions} portions of ${data.foodType} sent to ${ngos}`;
 
 
 
 
71
 
72
+ setTimeout(()=>s1.classList.add("active"),500);
73
+ setTimeout(()=>s2.classList.add("active"),1200);
74
+ setTimeout(()=>s3.classList.add("active"),2000);
 
75
 
76
+ }else{
77
+ summaryText.innerText = "No donation data found.";
78
  }
79
+
80
  </script>
81
 
82
  </body>