aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/Summary.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/components/Summary.tsx')
-rw-r--r--frontend/src/components/Summary.tsx10
1 files changed, 5 insertions, 5 deletions
diff --git a/frontend/src/components/Summary.tsx b/frontend/src/components/Summary.tsx
index 922960b..ee50ce8 100644
--- a/frontend/src/components/Summary.tsx
+++ b/frontend/src/components/Summary.tsx
@@ -2,7 +2,7 @@ import React from "react";
2import ReactMarkdown from "react-markdown"; 2import ReactMarkdown from "react-markdown";
3 3
4import { MapSummary } from "@customTypes/Map"; 4import { MapSummary } from "@customTypes/Map";
5import "@css/Maps.css" 5import "@css/Maps.css";
6 6
7interface SummaryProps { 7interface SummaryProps {
8 selectedRun: number 8 selectedRun: number
@@ -18,11 +18,11 @@ const Summary: React.FC<SummaryProps> = ({ selectedRun, setSelectedRun, data })
18 function _select_run(idx: number, category_id: number) { 18 function _select_run(idx: number, category_id: number) {
19 const r = document.querySelectorAll("button.record"); 19 const r = document.querySelectorAll("button.record");
20 r.forEach(e => (e as HTMLElement).style.backgroundColor = "#2b2e46"); 20 r.forEach(e => (e as HTMLElement).style.backgroundColor = "#2b2e46");
21 (r[idx] as HTMLElement).style.backgroundColor = "#161723" 21 (r[idx] as HTMLElement).style.backgroundColor = "#161723";
22 22
23 23
24 if (data && data.summary.routes.length !== 0) { 24 if (data && data.summary.routes.length !== 0) {
25 idx += data.summary.routes.filter(e => e.category.id < category_id).length // lethimcook 25 idx += data.summary.routes.filter(e => e.category.id < category_id).length; // lethimcook
26 setSelectedRun(idx); 26 setSelectedRun(idx);
27 } 27 }
28 }; 28 };
@@ -34,7 +34,7 @@ const Summary: React.FC<SummaryProps> = ({ selectedRun, setSelectedRun, data })
34 34
35 function _category_change() { 35 function _category_change() {
36 const btn = document.querySelectorAll("#section3 #category span button"); 36 const btn = document.querySelectorAll("#section3 #category span button");
37 btn.forEach((e) => { (e as HTMLElement).style.backgroundColor = "#2b2e46" }); 37 btn.forEach((e) => { (e as HTMLElement).style.backgroundColor = "#2b2e46"; });
38 // heavenly father forgive me for i have sinned. TODO: fix this bullshit with dynamic categories 38 // heavenly father forgive me for i have sinned. TODO: fix this bullshit with dynamic categories
39 const idx = selectedCategory === 1 ? 0 : data.map.is_coop ? selectedCategory - 3 : selectedCategory - 1; 39 const idx = selectedCategory === 1 ? 0 : data.map.is_coop ? selectedCategory - 3 : selectedCategory - 1;
40 (btn[idx] as HTMLElement).style.backgroundColor = "#202232"; 40 (btn[idx] as HTMLElement).style.backgroundColor = "#202232";
@@ -42,7 +42,7 @@ const Summary: React.FC<SummaryProps> = ({ selectedRun, setSelectedRun, data })
42 42
43 function _history_change() { 43 function _history_change() {
44 const btn = document.querySelectorAll("#section3 #history span button"); 44 const btn = document.querySelectorAll("#section3 #history span button");
45 btn.forEach((e) => { (e as HTMLElement).style.backgroundColor = "#2b2e46" }); 45 btn.forEach((e) => { (e as HTMLElement).style.backgroundColor = "#2b2e46"; });
46 (historySelected ? btn[1] as HTMLElement : btn[0] as HTMLElement).style.backgroundColor = "#202232"; 46 (historySelected ? btn[1] as HTMLElement : btn[0] as HTMLElement).style.backgroundColor = "#202232";
47 }; 47 };
48 48