diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2025-03-19 15:57:50 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-19 15:57:50 +0000 |
| commit | ae32e264b668a46e138a64a2d8a8d4c662e990ea (patch) | |
| tree | b634fdb8a9bf01ad94ae39c6b104c0a910b87f19 /frontend/src | |
| parent | feat/backend: send map difficulty in summary (#271) (diff) | |
| download | lphub-ae32e264b668a46e138a64a2d8a8d4c662e990ea.tar.gz lphub-ae32e264b668a46e138a64a2d8a8d4c662e990ea.tar.bz2 lphub-ae32e264b668a46e138a64a2d8a8d4c662e990ea.zip | |
fix/frontend: broken summary difficulty v2 (#272)
Diffstat (limited to 'frontend/src')
| -rw-r--r-- | frontend/src/components/Summary.tsx | 17 | ||||
| -rw-r--r-- | frontend/src/types/Map.ts | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/frontend/src/components/Summary.tsx b/frontend/src/components/Summary.tsx index 1df6a78..7da2f1e 100644 --- a/frontend/src/components/Summary.tsx +++ b/frontend/src/components/Summary.tsx | |||
| @@ -140,6 +140,21 @@ const Summary: React.FC<SummaryProps> = ({ selectedRun, setSelectedRun, data }) | |||
| 140 | <section id='section4' className='summary1'> | 140 | <section id='section4' className='summary1'> |
| 141 | <div id='difficulty'> | 141 | <div id='difficulty'> |
| 142 | <span>Difficulty</span> | 142 | <span>Difficulty</span> |
| 143 | {data.map.difficulty <= 2 && (<span style={{ color: "lime" }}>Very easy</span>)} | ||
| 144 | {data.map.difficulty > 2 && data.map.difficulty <= 4 && (<span style={{ color: "green" }}>Easy</span>)} | ||
| 145 | {data.map.difficulty > 4 && data.map.difficulty <= 6 && (<span style={{ color: "yellow" }}>Medium</span>)} | ||
| 146 | {data.map.difficulty > 6 && data.map.difficulty <= 8 && (<span style={{ color: "orange" }}>Hard</span>)} | ||
| 147 | {data.map.difficulty > 8 && data.map.difficulty <= 10 && (<span style={{ color: "red" }}>Very hard</span>)} | ||
| 148 | <div> | ||
| 149 | {data.map.difficulty <= 2 ? (<div className='difficulty-rating' style={{ backgroundColor: "lime" }}></div>) : (<div className='difficulty-rating'></div>)} | ||
| 150 | {data.map.difficulty > 2 && data.map.difficulty <= 4 ? (<div className='difficulty-rating' style={{ backgroundColor: "green" }}></div>) : (<div className='difficulty-rating'></div>)} | ||
| 151 | {data.map.difficulty > 4 && data.map.difficulty <= 6 ? (<div className='difficulty-rating' style={{ backgroundColor: "yellow" }}></div>) : (<div className='difficulty-rating'></div>)} | ||
| 152 | {data.map.difficulty > 6 && data.map.difficulty <= 8 ? (<div className='difficulty-rating' style={{ backgroundColor: "orange" }}></div>) : (<div className='difficulty-rating'></div>)} | ||
| 153 | {data.map.difficulty > 8 && data.map.difficulty <= 10 ? (<div className='difficulty-rating' style={{ backgroundColor: "red" }}></div>) : (<div className='difficulty-rating'></div>)} | ||
| 154 | </div> | ||
| 155 | </div> | ||
| 156 | {/* <div id='difficulty'> | ||
| 157 | <span>Difficulty</span> | ||
| 143 | {data.summary.routes[selectedRun].rating <= 2 && (<span style={{ color: "lime" }}>Very easy</span>)} | 158 | {data.summary.routes[selectedRun].rating <= 2 && (<span style={{ color: "lime" }}>Very easy</span>)} |
| 144 | {data.summary.routes[selectedRun].rating > 2 && data.summary.routes[selectedRun].rating <= 4 && (<span style={{ color: "green" }}>Easy</span>)} | 159 | {data.summary.routes[selectedRun].rating > 2 && data.summary.routes[selectedRun].rating <= 4 && (<span style={{ color: "green" }}>Easy</span>)} |
| 145 | {data.summary.routes[selectedRun].rating > 4 && data.summary.routes[selectedRun].rating <= 6 && (<span style={{ color: "yellow" }}>Medium</span>)} | 160 | {data.summary.routes[selectedRun].rating > 4 && data.summary.routes[selectedRun].rating <= 6 && (<span style={{ color: "yellow" }}>Medium</span>)} |
| @@ -152,7 +167,7 @@ const Summary: React.FC<SummaryProps> = ({ selectedRun, setSelectedRun, data }) | |||
| 152 | {data.summary.routes[selectedRun].rating > 6 && data.summary.routes[selectedRun].rating <= 8 ? (<div className='difficulty-rating' style={{ backgroundColor: "orange" }}></div>) : (<div className='difficulty-rating'></div>)} | 167 | {data.summary.routes[selectedRun].rating > 6 && data.summary.routes[selectedRun].rating <= 8 ? (<div className='difficulty-rating' style={{ backgroundColor: "orange" }}></div>) : (<div className='difficulty-rating'></div>)} |
| 153 | {data.summary.routes[selectedRun].rating > 8 && data.summary.routes[selectedRun].rating <= 10 ? (<div className='difficulty-rating' style={{ backgroundColor: "red" }}></div>) : (<div className='difficulty-rating'></div>)} | 168 | {data.summary.routes[selectedRun].rating > 8 && data.summary.routes[selectedRun].rating <= 10 ? (<div className='difficulty-rating' style={{ backgroundColor: "red" }}></div>) : (<div className='difficulty-rating'></div>)} |
| 154 | </div> | 169 | </div> |
| 155 | </div> | 170 | </div> */} |
| 156 | <div id='count'> | 171 | <div id='count'> |
| 157 | <span>Completion Count</span> | 172 | <span>Completion Count</span> |
| 158 | <div>{data.summary.routes[selectedRun].completion_count}</div> | 173 | <div>{data.summary.routes[selectedRun].completion_count}</div> |
diff --git a/frontend/src/types/Map.ts b/frontend/src/types/Map.ts index 89c66d5..4f8eabf 100644 --- a/frontend/src/types/Map.ts +++ b/frontend/src/types/Map.ts | |||
| @@ -79,6 +79,7 @@ interface MapSummaryMap { | |||
| 79 | map_name: string; | 79 | map_name: string; |
| 80 | is_coop: boolean; | 80 | is_coop: boolean; |
| 81 | is_disabled: boolean; | 81 | is_disabled: boolean; |
| 82 | difficulty: number; | ||
| 82 | }; | 83 | }; |
| 83 | 84 | ||
| 84 | interface MapSummaryDetails { | 85 | interface MapSummaryDetails { |