forked from
pds.dad/at-advent
this repo has no description
1{% extends "layout.askama.html" %} {% block content %}
2<div class="mb-6">
3 <div class="breadcrumbs text-sm">
4 <ul>
5 <li><a href="/">Home</a></li>
6 <li>Day {{ day }}</li>
7 </ul>
8 </div>
9 <h2 class="text-4xl font-bold">Day {{ day }}</h2>
10</div>
11
12<!-- Part 1 -->
13<div class="card bg-base-100 shadow-xl mb-6">
14 <div class="card-body">
15 <h3 class="card-title text-2xl">
16 Part 1 {% if challenge_one_completed %}
17 <div class="badge badge-success gap-2">
18 <svg
19 xmlns="http://www.w3.org/2000/svg"
20 fill="none"
21 viewBox="0 0 24 24"
22 class="inline-block w-4 h-4 stroke-current"
23 >
24 <path
25 stroke-linecap="round"
26 stroke-linejoin="round"
27 stroke-width="2"
28 d="M5 13l4 4L19 7"
29 ></path>
30 </svg>
31 Completed
32 </div>
33 {% endif %}
34 </h3>
35
36 <article class="prose prose-lg max-w-none">
37 {{ challenge_one_text | safe }}
38 </article>
39
40 {% if let Some(msg) = part_one_submit_message %}
41 <div class="mt-4">
42 {% match msg %} {% when FlashMessage::Success with (success) %}
43 <div class="alert alert-success shadow-lg">
44 <svg
45 xmlns="http://www.w3.org/2000/svg"
46 class="stroke-current shrink-0 h-6 w-6"
47 fill="none"
48 viewBox="0 0 24 24"
49 >
50 <path
51 stroke-linecap="round"
52 stroke-linejoin="round"
53 stroke-width="2"
54 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
55 />
56 </svg>
57 <span>{{success}}</span>
58 </div>
59 {% when FlashMessage::Error with (error) %}
60 <div class="alert alert-error shadow-lg">
61 <svg
62 xmlns="http://www.w3.org/2000/svg"
63 class="stroke-current shrink-0 h-6 w-6"
64 fill="none"
65 viewBox="0 0 24 24"
66 >
67 <path
68 stroke-linecap="round"
69 stroke-linejoin="round"
70 stroke-width="2"
71 d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
72 />
73 </svg>
74 <span>{{error}}</span>
75 </div>
76 {% endmatch %}
77 </div>
78 {% endif %}
79
80 <div class="card-actions justify-start mt-4">
81 {% if !is_logged_in %}
82 <a href="/login" class="btn btn-primary">Login to complete challenges</a>
83 {% else if !challenge_one_completed %}
84 <form method="post" action="/day/{{ day }}">
85 {% if requires_code_input_part_one %}
86 <div class="join">
87 <div>
88 <label class="input validator join-item">
89 <input
90 type="text"
91 name="verification_code_one"
92 placeholder="Enter Part one's solution"
93 required
94 />
95 </label>
96 <div class="validator-hint">Enter your solution</div>
97 </div>
98 <button type="submit" class="btn btn-primary join-item">
99 Check answer
100 </button>
101 </div>
102 {% else %}
103 <button class="btn btn-primary" type="submit">Check answer</button>
104 {% endif %}
105 </form>
106 {% else %}
107 <div class="badge badge-success badge-lg gap-2">
108 <svg
109 xmlns="http://www.w3.org/2000/svg"
110 fill="none"
111 viewBox="0 0 24 24"
112 class="inline-block w-4 h-4 stroke-current"
113 >
114 <path
115 stroke-linecap="round"
116 stroke-linejoin="round"
117 stroke-width="2"
118 d="M5 13l4 4L19 7"
119 ></path>
120 </svg>
121 Great work, you've completed Part 1!
122 </div>
123 {% endif %}
124 </div>
125 </div>
126</div>
127
128<!-- Part 2 -->
129{% if let Some(challenge_two_text) = challenge_two_text %}
130<div id="part_two" class="card bg-base-100 shadow-xl mb-6">
131 <div class="card-body">
132 <h3 class="card-title text-2xl">
133 Part 2 (challenge!) {% if challenge_two_completed %}
134 <div class="badge badge-success gap-2">
135 <svg
136 xmlns="http://www.w3.org/2000/svg"
137 fill="none"
138 viewBox="0 0 24 24"
139 class="inline-block w-4 h-4 stroke-current"
140 >
141 <path
142 stroke-linecap="round"
143 stroke-linejoin="round"
144 stroke-width="2"
145 d="M5 13l4 4L19 7"
146 ></path>
147 </svg>
148 Completed
149 </div>
150 {% endif %}
151 </h3>
152
153 <article class="prose prose-lg max-w-none">
154 {{ challenge_two_text | safe }}
155 </article>
156
157 {% if let Some(msg) = part_two_submit_message %}
158 <div class="mt-4">
159 {% match msg %} {% when FlashMessage::Success with (success) %}
160 <div class="alert alert-success shadow-lg">
161 <svg
162 xmlns="http://www.w3.org/2000/svg"
163 class="stroke-current shrink-0 h-6 w-6"
164 fill="none"
165 viewBox="0 0 24 24"
166 >
167 <path
168 stroke-linecap="round"
169 stroke-linejoin="round"
170 stroke-width="2"
171 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
172 />
173 </svg>
174 <span>{{success}}</span>
175 </div>
176 {% when FlashMessage::Error with (error) %}
177 <div class="alert alert-error shadow-lg">
178 <svg
179 xmlns="http://www.w3.org/2000/svg"
180 class="stroke-current shrink-0 h-6 w-6"
181 fill="none"
182 viewBox="0 0 24 24"
183 >
184 <path
185 stroke-linecap="round"
186 stroke-linejoin="round"
187 stroke-width="2"
188 d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
189 />
190 </svg>
191 <span>{{error}}</span>
192 </div>
193 {% endmatch %}
194 </div>
195 {% endif %}
196
197 <div class="card-actions justify-start mt-4">
198 {% if !is_logged_in %}
199 <a href="/login" class="btn btn-primary">Login to complete challenges</a>
200 {% else if !challenge_two_completed && !custom_submit_part_two %}
201 <form method="post" action="/day/{{ day }}">
202 {% if requires_code_input_part_two %}
203 <div class="join">
204 <div>
205 <label class="input validator join-item">
206 <input
207 type="text"
208 name="verification_code_two"
209 placeholder="Enter Part two's solution"
210 required
211 />
212 </label>
213 <div class="validator-hint">Enter your solution</div>
214 </div>
215 <button type="submit" class="btn btn-primary join-item">
216 Check answer
217 </button>
218 </div>
219 {% else %}
220 <button class="btn btn-primary" type="submit">Check answer</button>
221 {% endif %}
222 </form>
223 {% else if !challenge_two_completed %} {% else %}
224 <div class="badge badge-success badge-lg gap-2">
225 <svg
226 xmlns="http://www.w3.org/2000/svg"
227 fill="none"
228 viewBox="0 0 24 24"
229 class="inline-block w-4 h-4 stroke-current"
230 >
231 <path
232 stroke-linecap="round"
233 stroke-linejoin="round"
234 stroke-width="2"
235 d="M5 13l4 4L19 7"
236 ></path>
237 </svg>
238 Great work, you've completed Part 2!
239 </div>
240 {% endif %}
241 </div>
242 </div>
243</div>
244{% endif %}
245
246<!-- All Complete Message -->
247{% if challenge_one_completed && challenge_two_completed %}
248<div class="alert alert-success shadow-lg">
249 <svg
250 xmlns="http://www.w3.org/2000/svg"
251 class="stroke-current shrink-0 h-6 w-6"
252 fill="none"
253 viewBox="0 0 24 24"
254 >
255 <path
256 stroke-linecap="round"
257 stroke-linejoin="round"
258 stroke-width="2"
259 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
260 />
261 </svg>
262 <div>
263 <h3 class="font-bold">Amazing work! 🎉</h3>
264 <div class="text-sm">
265 You've completed all the challenges for today! Come back tomorrow at 00:00
266 UTC for more.
267 </div>
268 </div>
269</div>
270{% if let Some(next) = next_day %}
271<div class="flex justify-end mt-4">
272 <a href="/day/{{ next }}" class="btn btn-primary">Next Day →</a>
273</div>
274{% endif %} {% endif %} {% if challenge_one_completed %}
275<script>
276 if (window.location.hash === "#part_two") {
277 document.getElementById("part_two")?.scrollIntoView({ behavior: "smooth" });
278 }
279</script>
280{% endif %} {% endblock %}