-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rating-based colored text for cells (#1126)
* feat: chunithm + maimaidx rating colored cells * fix: nest a div inside for better rainbow rendering * feat: maimai + ongeki * fix: maimai's "rating" value is called "rate". oops. * feat: vf6 color * chore: lint code * chore: um why is this here? * feat: wacca rating cell * fix: undefine white color so it doesn't blend in * chore: lint code
- Loading branch information
Showing
8 changed files
with
331 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from "react"; | ||
import { PBScoreDocument, ScoreDocument } from "tachi-common"; | ||
|
||
export default function CHUNITHMRatingCell({ score }: { score: ScoreDocument | PBScoreDocument }) { | ||
let color: undefined | string = undefined; | ||
|
||
const rating = score.calculatedData.rating; | ||
|
||
if (rating === null || rating === undefined) { | ||
color = undefined; | ||
} else if (rating >= 16.0) { | ||
color = | ||
"linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)"; | ||
return ( | ||
<td> | ||
<div | ||
style={{ | ||
background: color, | ||
backgroundClip: "text", | ||
outline: "white", | ||
WebkitTextFillColor: "transparent", | ||
}} | ||
> | ||
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong> | ||
</div> | ||
</td> | ||
); | ||
} else if (rating >= 15.25) { | ||
color = "silver"; | ||
} else if (rating >= 14.5) { | ||
color = "var(--bs-warning)"; | ||
} else if (rating >= 13.25) { | ||
color = "gray"; | ||
} else if (rating >= 12.0) { | ||
color = "sienna"; | ||
} else if (rating >= 10.0) { | ||
color = "purple"; | ||
} else if (rating >= 7.0) { | ||
color = "red"; | ||
} else if (rating >= 4.0) { | ||
color = "orange"; | ||
} else if (rating >= 0) { | ||
color = "green"; | ||
} | ||
|
||
return ( | ||
<td | ||
style={{ | ||
color, | ||
outline: "white", | ||
}} | ||
> | ||
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong> | ||
</td> | ||
); | ||
} |
35 changes: 0 additions & 35 deletions
35
client/src/components/tables/cells/GitadoraJudgementCell copy.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React from "react"; | ||
import { PBScoreDocument, ScoreDocument } from "tachi-common"; | ||
|
||
export default function MaimaiDXRatingCell({ score }: { score: ScoreDocument | PBScoreDocument }) { | ||
let color: undefined | string = undefined; | ||
|
||
const rating = score.calculatedData.rate; | ||
|
||
if (rating === null || rating === undefined) { | ||
color = undefined; | ||
} else if (rating >= 300) { | ||
color = | ||
"linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)"; | ||
return ( | ||
<td> | ||
<div | ||
style={{ | ||
background: color, | ||
backgroundClip: "text", | ||
outline: "white", | ||
WebkitTextFillColor: "transparent", | ||
}} | ||
> | ||
<strong>{score.calculatedData.rate ?? "N/A"}</strong> | ||
</div> | ||
</td> | ||
); | ||
} else if (rating >= 290) { | ||
color = "lightgoldenrodyellow"; | ||
} else if (rating >= 280) { | ||
color = "var(--bs-warning)"; | ||
} else if (rating >= 260) { | ||
color = "gray"; | ||
} else if (rating >= 240) { | ||
color = "brown"; | ||
} else if (rating >= 200) { | ||
color = "purple"; | ||
} else if (rating >= 140) { | ||
color = "red"; | ||
} else if (rating >= 80) { | ||
color = "yellow"; | ||
} else if (rating >= 40) { | ||
color = "green"; | ||
} else if (rating >= 20) { | ||
color = "blue"; | ||
} else if (rating >= 0) { | ||
color = undefined; | ||
} | ||
|
||
return ( | ||
<td | ||
style={{ | ||
color, | ||
outline: "white", | ||
}} | ||
> | ||
<strong>{score.calculatedData.rate ?? "N/A"}</strong> | ||
</td> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from "react"; | ||
import { PBScoreDocument, ScoreDocument } from "tachi-common"; | ||
|
||
export default function MaimaiRatingCell({ score }: { score: ScoreDocument | PBScoreDocument }) { | ||
let color: undefined | string = undefined; | ||
|
||
const rating = score.calculatedData.rate; | ||
|
||
if (rating === null || rating === undefined) { | ||
color = undefined; | ||
} else if (rating >= 15.0) { | ||
color = | ||
"linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)"; | ||
return ( | ||
<td> | ||
<div | ||
style={{ | ||
background: color, | ||
backgroundClip: "text", | ||
outline: "white", | ||
WebkitTextFillColor: "transparent", | ||
}} | ||
> | ||
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong> | ||
</div> | ||
</td> | ||
); | ||
} else if (rating >= 14.5) { | ||
color = "var(--bs-warning)"; | ||
} else if (rating >= 14.0) { | ||
color = "gray"; | ||
} else if (rating >= 13.0) { | ||
color = "brown"; | ||
} else if (rating >= 12.0) { | ||
color = "purple"; | ||
} else if (rating >= 10.0) { | ||
color = "red"; | ||
} else if (rating >= 7.0) { | ||
color = "yellow"; | ||
} else if (rating >= 4.0) { | ||
color = "green"; | ||
} else if (rating >= 2.0) { | ||
color = "cyan"; | ||
} else if (rating >= 0.0) { | ||
// undefining so the rating text isn't permanently white on light mode | ||
color = undefined; | ||
} | ||
|
||
return ( | ||
<td | ||
style={{ | ||
color, | ||
outline: "white", | ||
}} | ||
> | ||
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong> | ||
</td> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from "react"; | ||
import { PBScoreDocument, ScoreDocument } from "tachi-common"; | ||
|
||
export default function OngekiRatingCell({ score }: { score: ScoreDocument | PBScoreDocument }) { | ||
let color: undefined | string = undefined; | ||
|
||
const rating = score.calculatedData.rating; | ||
|
||
if (rating === null || rating === undefined) { | ||
color = undefined; | ||
} else if (rating >= 15.0) { | ||
color = | ||
"linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)"; | ||
return ( | ||
<td> | ||
<div | ||
style={{ | ||
background: color, | ||
backgroundClip: "text", | ||
outline: "white", | ||
WebkitTextFillColor: "transparent", | ||
}} | ||
> | ||
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong> | ||
</div> | ||
</td> | ||
); | ||
} else if (rating >= 14.5) { | ||
color = "silver"; | ||
} else if (rating >= 14.0) { | ||
color = "var(--bs-warning)"; | ||
} else if (rating >= 13.0) { | ||
color = "gray"; | ||
} else if (rating >= 12.0) { | ||
color = "sienna"; | ||
} else if (rating >= 10.0) { | ||
color = "purple"; | ||
} else if (rating >= 7.0) { | ||
color = "red"; | ||
} else if (rating >= 4.0) { | ||
color = "orange"; | ||
} else if (rating >= 2.0) { | ||
color = "green"; | ||
} else if (rating >= 0.0) { | ||
color = "var(--bs-info)"; | ||
} | ||
|
||
return ( | ||
<td | ||
style={{ | ||
color, | ||
outline: "white", | ||
}} | ||
> | ||
<strong>{score.calculatedData.rating?.toFixed(2) ?? "N/A"}</strong> | ||
</td> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from "react"; | ||
import { PBScoreDocument, ScoreDocument } from "tachi-common"; | ||
|
||
export default function WACCARatingCell({ score }: { score: ScoreDocument | PBScoreDocument }) { | ||
let color: undefined | string = undefined; | ||
|
||
const rating = score.calculatedData.rate; | ||
|
||
if (rating === null || rating === undefined) { | ||
color = undefined; | ||
} else if (rating >= 50) { | ||
color = | ||
"linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)"; | ||
return ( | ||
<td> | ||
<div | ||
style={{ | ||
background: color, | ||
backgroundClip: "text", | ||
outline: "white", | ||
WebkitTextFillColor: "transparent", | ||
}} | ||
> | ||
<strong>{score.calculatedData.rate ?? "N/A"}</strong> | ||
</div> | ||
</td> | ||
); | ||
} else if (rating >= 44) { | ||
color = "var(--bs-warning)"; | ||
} else if (rating >= 38) { | ||
color = "silver"; | ||
} else if (rating >= 32) { | ||
color = "var(--bs-info)"; | ||
} else if (rating >= 26) { | ||
color = "purple"; | ||
} else if (rating >= 20) { | ||
color = "red"; | ||
} else if (rating >= 12) { | ||
color = "orange"; | ||
} else if (rating >= 6) { | ||
color = "darkblue"; | ||
} else if (rating >= 0) { | ||
color = "var(--bs-secondary)"; | ||
} | ||
|
||
return ( | ||
<td | ||
style={{ | ||
color, | ||
outline: "white", | ||
}} | ||
> | ||
<strong>{score.calculatedData.rate ?? "N/A"}</strong> | ||
</td> | ||
); | ||
} |
Oops, something went wrong.