Skip to content

Commit b5d668d

Browse files
committed
fix: group all styling in syle.css
1 parent 727b7b4 commit b5d668d

3 files changed

Lines changed: 308 additions & 324 deletions

File tree

website/js/fair-distribution.js

Lines changed: 0 additions & 220 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
state.columns = detectColumns(rows);
4949

5050
ensureRequiredColumns();
51-
injectStyles();
5251
removeLoading(root);
5352
buildScaffold();
5453
initializeState();
@@ -92,225 +91,6 @@
9291
if (missing.length > 0) throw new Error(`Missing columns: ${missing.join(", ")}`);
9392
}
9493

95-
function injectStyles() {
96-
if (document.getElementById("fair-distribution-inline-styles")) return;
97-
98-
const style = document.createElement("style");
99-
style.id = "fair-distribution-inline-styles";
100-
101-
style.textContent = `
102-
#fair-viz {
103-
color: white;
104-
width: 100%;
105-
max-width: 1440px;
106-
margin: 0 auto;
107-
}
108-
109-
.fair-controls {
110-
display: flex;
111-
flex-wrap: wrap;
112-
gap: 14px 18px;
113-
align-items: center;
114-
justify-content: center;
115-
margin-bottom: 22px;
116-
}
117-
118-
.fair-control {
119-
display: flex;
120-
align-items: center;
121-
gap: 8px;
122-
color: white;
123-
font-size: 18px;
124-
font-weight: 700;
125-
white-space: nowrap;
126-
}
127-
128-
.fair-control select {
129-
background: #bfe2eb;
130-
border: 2px solid #2c2c2c;
131-
border-radius: 10px;
132-
padding: 7px 12px;
133-
font-size: 18px;
134-
font-weight: 700;
135-
color: #111;
136-
cursor: pointer;
137-
}
138-
139-
.fair-summary {
140-
display: flex;
141-
justify-content: center;
142-
gap: 14px;
143-
flex-wrap: wrap;
144-
margin-bottom: 22px;
145-
font-size: 14px;
146-
color: #dddddd;
147-
}
148-
149-
.fair-summary-box {
150-
border: 1px solid rgba(255,255,255,0.22);
151-
border-radius: 12px;
152-
padding: 9px 15px;
153-
background: rgba(255,255,255,0.03);
154-
}
155-
156-
.fair-grid {
157-
display: grid;
158-
grid-template-columns: 1fr 1fr;
159-
gap: 28px;
160-
align-items: stretch;
161-
}
162-
163-
.fair-country-card {
164-
border-radius: 16px;
165-
padding: 20px;
166-
background: rgba(255,255,255,0.03);
167-
}
168-
169-
.fair-country-title {
170-
text-align: center;
171-
font-size: 24px;
172-
font-weight: 800;
173-
margin-bottom: 6px;
174-
color: white;
175-
}
176-
177-
.fair-country-subtitle {
178-
text-align: center;
179-
font-size: 14px;
180-
color: #d0d0d0;
181-
margin-bottom: 18px;
182-
}
183-
184-
.fair-box {
185-
border: 1px solid rgba(255,255,255,0.24);
186-
border-radius: 12px;
187-
padding: 14px 16px;
188-
margin-bottom: 16px;
189-
background: rgba(255,255,255,0.02);
190-
}
191-
192-
.fair-box:last-child {
193-
margin-bottom: 0;
194-
}
195-
196-
.fair-box-title {
197-
font-size: 16px;
198-
font-weight: 800;
199-
color: white;
200-
margin-bottom: 12px;
201-
text-align: center;
202-
}
203-
204-
.fair-medal-row {
205-
display: grid;
206-
grid-template-columns: 72px 1fr 50px;
207-
align-items: start;
208-
gap: 12px;
209-
margin: 11px 0;
210-
}
211-
212-
.fair-medal-label {
213-
font-size: 14px;
214-
font-weight: 800;
215-
color: white;
216-
padding-top: 2px;
217-
}
218-
219-
.fair-medal-value {
220-
font-size: 14px;
221-
font-weight: 800;
222-
color: white;
223-
text-align: right;
224-
padding-top: 2px;
225-
}
226-
227-
.fair-medal-icons {
228-
display: flex;
229-
flex-wrap: wrap;
230-
gap: 3px;
231-
align-items: center;
232-
}
233-
234-
.fair-medal-icon {
235-
width: 16px;
236-
height: 16px;
237-
border-radius: 50%;
238-
flex-shrink: 0;
239-
}
240-
241-
.fair-medal-half-wrap {
242-
width: 8px;
243-
height: 16px;
244-
overflow: hidden;
245-
flex-shrink: 0;
246-
}
247-
248-
.fair-medal-overflow {
249-
font-size: 12px;
250-
font-weight: 800;
251-
color: rgba(255,255,255,0.7);
252-
align-self: flex-end;
253-
margin-left: 2px;
254-
}
255-
256-
.fair-note {
257-
text-align: center;
258-
margin-top: 22px;
259-
font-size: 18px;
260-
color: #d6d6d6;
261-
line-height: 1.5;
262-
}
263-
264-
.fair-warning {
265-
color: #ffd166;
266-
font-size: 12px;
267-
text-align: center;
268-
margin-top: 8px;
269-
}
270-
271-
.fair-warning--lg {
272-
font-size: 14px;
273-
margin-top: 12px;
274-
line-height: 1.5;
275-
}
276-
277-
.fair-error {
278-
color: white;
279-
text-align: center;
280-
padding: 24px;
281-
border: 1px solid rgba(255,255,255,0.25);
282-
border-radius: 12px;
283-
}
284-
285-
@media (max-width: 950px) {
286-
.fair-grid {
287-
grid-template-columns: 1fr;
288-
}
289-
}
290-
291-
.fair-prediction-wrapper {
292-
display: flex;
293-
justify-content: center;
294-
margin-bottom: 18px;
295-
}
296-
297-
.fair-prediction-banner {
298-
width: 80%;
299-
background: rgba(255, 209, 102, 0.12);
300-
border: 1px solid rgba(255, 209, 102, 0.55);
301-
color: #ffd166;
302-
padding: 14px 18px;
303-
border-radius: 12px;
304-
text-align: center;
305-
font-size: 14px;
306-
font-weight: 700;
307-
line-height: 1.45;
308-
}
309-
`;
310-
311-
document.head.appendChild(style);
312-
}
313-
31494
function buildScaffold() {
31595
const root = document.querySelector(selectors.root);
31696

website/js/never-medaled.js

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@
277277
state.worldGeo = worldGeo;
278278
state.columns = detectColumns(rows);
279279

280-
injectStyles();
281280
removeLoading(root);
282281
injectControls(root);
283282
setupControls();
@@ -306,109 +305,6 @@
306305
return candidates.find(candidate => columns.includes(candidate)) || null;
307306
}
308307

309-
function injectStyles() {
310-
if (document.getElementById("never-medaled-inline-styles")) return;
311-
312-
const style = document.createElement("style");
313-
style.id = "never-medaled-inline-styles";
314-
315-
style.textContent = `
316-
#never-medaled-viz {
317-
width: 100%;
318-
max-width: 1440px;
319-
margin: 0 auto;
320-
color: white;
321-
}
322-
323-
.never-controls {
324-
display: flex;
325-
justify-content: center;
326-
gap: 28px;
327-
align-items: center;
328-
margin: 0 auto;
329-
}
330-
331-
.never-controls label {
332-
color: white;
333-
font-size: 18px;
334-
font-weight: 700;
335-
font-family: "Elms Sans", sans-serif;
336-
margin-right: 8px;
337-
}
338-
339-
.never-controls select {
340-
background: #f4b400;
341-
color: #111;
342-
border: 3px solid #222;
343-
border-radius: 12px;
344-
padding: 8px 14px;
345-
font-size: 18px;
346-
font-weight: 700;
347-
font-family: "Elms Sans", sans-serif;
348-
cursor: pointer;
349-
}
350-
351-
.never-layout {
352-
display: grid;
353-
grid-template-columns: 1.2fr 0.8fr;
354-
gap: 34px;
355-
align-items: start;
356-
margin-top: 12px;
357-
}
358-
359-
.never-map-panel,
360-
.never-chart-panel {
361-
min-width: 0;
362-
}
363-
364-
.never-map-svg,
365-
.never-medaled-svg {
366-
width: 100%;
367-
height: auto;
368-
display: block;
369-
background: transparent;
370-
}
371-
372-
.never-medaled-tooltip {
373-
position: absolute;
374-
pointer-events: none;
375-
opacity: 0;
376-
background: rgba(20, 20, 20, 0.96);
377-
color: white;
378-
border: 1px solid rgba(255, 255, 255, 0.18);
379-
border-radius: 10px;
380-
padding: 10px 12px;
381-
font-family: "Elms Sans", sans-serif;
382-
font-size: 14px;
383-
line-height: 1.35;
384-
max-width: 330px;
385-
z-index: 9999;
386-
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
387-
}
388-
389-
.never-medaled-error {
390-
color: white;
391-
text-align: center;
392-
padding: 24px;
393-
border: 1px solid rgba(255, 255, 255, 0.25);
394-
border-radius: 12px;
395-
}
396-
397-
@media (max-width: 1000px) {
398-
.never-controls {
399-
flex-direction: column;
400-
gap: 10px;
401-
}
402-
403-
.never-layout {
404-
grid-template-columns: 1fr;
405-
}
406-
}
407-
`;
408-
409-
document.head.appendChild(style);
410-
}
411-
412308
function injectControls(root) {
413309
if (root.querySelector(".never-controls")) return;
414310

0 commit comments

Comments
 (0)