show banlist status next to card name
This commit is contained in:
parent
56cf06e7d5
commit
11ad72a33f
15
src/data.rs
15
src/data.rs
@ -2,7 +2,7 @@ use serde::Deserialize;
|
|||||||
use std::fmt::{self, Display, Write};
|
use std::fmt::{self, Display, Write};
|
||||||
use time::Date;
|
use time::Date;
|
||||||
|
|
||||||
use crate::SETS_BY_NAME;
|
use crate::{IMG_HOST, SETS_BY_NAME};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, PartialEq, Eq, Clone)]
|
#[derive(Debug, Deserialize, PartialEq, Eq, Clone)]
|
||||||
pub struct CardInfo {
|
pub struct CardInfo {
|
||||||
@ -80,7 +80,18 @@ impl Card {
|
|||||||
|
|
||||||
impl Display for Card {
|
impl Display for Card {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, r#"<h2 class="cardname">{}</h2><br/><em>"#, &self.name)?;
|
write!(
|
||||||
|
f,
|
||||||
|
r#"<h2 class="cardname">{} {}</h2><em>"#,
|
||||||
|
&self.name,
|
||||||
|
match self.banlist_info.map(|bi| bi.ban_tcg) {
|
||||||
|
Some(BanlistStatus::Banned) => format!(r#"<img class="banlist-icon" src="{}/static/forbidden.svg"/>"#, IMG_HOST.as_str()),
|
||||||
|
Some(BanlistStatus::Limited) => format!(r#"<img class="banlist-icon" src="{}/static/limited.svg"/>"#, IMG_HOST.as_str()),
|
||||||
|
Some(BanlistStatus::SemiLimited) =>
|
||||||
|
format!(r#"<img class="banlist-icon" src="{}/static/semi_limited.svg"/>"#, IMG_HOST.as_str()),
|
||||||
|
_ => String::new(),
|
||||||
|
}
|
||||||
|
)?;
|
||||||
if let Some(level) = self.level {
|
if let Some(level) = self.level {
|
||||||
if self.card_type.contains("XYZ") {
|
if self.card_type.contains("XYZ") {
|
||||||
f.write_str("Rank ")?;
|
f.write_str("Rank ")?;
|
||||||
|
1
static/forbidden.svg
Normal file
1
static/forbidden.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 243.97 244"><defs><style>.cls-1{fill:red;}.cls-2{fill:none;stroke:red;stroke-linecap:round;stroke-linejoin:round;stroke-width:15px;}</style></defs><title>forbidden</title><g id="banned_mc" data-name="banned mc"><g id="banned_mc_0_Layer1_0_FILL" data-name="banned mc 0 Layer1 0 FILL"><path d="M208.25,35.75Q172.49,0,122,0T35.8,35.75Q0,71.53,0,122T35.8,208.22Q71.56,244,122,244t86.22-35.76Q244,172.45,244,122T208.25,35.75Z" transform="translate(-0.04 0.01)"/></g><g id="banned_mc_0_Layer1_1_FILL" data-name="banned mc 0 Layer1 1 FILL"><path class="cls-1" d="M200.24,43.75q-32.52-32.52-78.39-32.52T43.46,43.75Q11,76.26,11,122.14t32.51,78.39Q76,233.05,121.85,233.05t78.39-32.52q32.5-32.5,32.51-78.39T200.24,43.75Z" transform="translate(-0.04 0.01)"/></g><g id="banned_mc_0_Layer1_2_FILL" data-name="banned mc 0 Layer1 2 FILL"><path d="M183,60.9q-25.29-25.3-61-25.3t-61,25.3q-25.29,25.29-25.29,61t25.29,61q25.29,25.29,61,25.29t61-25.29q25.29-25.31,25.29-61T183,60.9Z" transform="translate(-0.04 0.01)"/></g><path id="banned_cross_0_Layer0_0_1_STROKES" data-name="banned cross 0 Layer0 0 1 STROKES" class="cls-2" d="M53.88,53.88,190.1,190.12" transform="translate(-0.04 0.01)"/></g></svg>
|
After Width: | Height: | Size: 1.2 KiB |
1
static/limited.svg
Normal file
1
static/limited.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 243.97 244"><defs><style>.cls-1{fill:red;}.cls-2{fill:#fff;}</style></defs><title>limited</title><g id="limited_mc" data-name="limited mc"><g id="banned_circle2_0_Layer0_0_FILL" data-name="banned circle2 0 Layer0 0 FILL"><path d="M208.25,35.75Q172.49,0,122,0T35.8,35.75Q0,71.53,0,122T35.8,208.22Q71.56,244,122,244t86.22-35.76Q244,172.45,244,122T208.25,35.75Z" transform="translate(-0.04 0.01)"/></g><g id="banned_circle2_0_Layer0_1_FILL" data-name="banned circle2 0 Layer0 1 FILL"><path class="cls-1" d="M200.24,43.75q-32.52-32.52-78.39-32.52T43.46,43.75Q11,76.26,11,122.14t32.51,78.39Q76,233.05,121.85,233.05t78.39-32.52q32.5-32.5,32.51-78.39T200.24,43.75Z" transform="translate(-0.04 0.01)"/></g><g id="banned_circle2_0_Layer0_2_FILL" data-name="banned circle2 0 Layer0 2 FILL"><path d="M183,60.9q-25.29-25.3-61-25.3t-61,25.3q-25.29,25.29-25.29,61t25.29,61q25.29,25.29,61,25.29t61-25.29q25.29-25.31,25.29-61T183,60.9Z" transform="translate(-0.04 0.01)"/></g><g id="FL_1_mc_0_Layer0_0_FILL" data-name="FL 1 mc 0 Layer0 0 FILL"><path class="cls-2" d="M79.9,77.16l8.85-2.44,5.89-1.32,4.88-.4q8,0,8,7.42v73.71l-.4,11.28-1.22,4.47-1.73,1.73a6,6,0,0,1-3,1l-6,.71L85,174.05v7h81.23v-7l-9.46-.61-5.59-.61-3.25-.91a5.17,5.17,0,0,1-1.73-1.12l-1.42-1.73a8.28,8.28,0,0,1-.71-2.74l-.41-4.68-.1-7.52V50.83L77.87,68.73Z" transform="translate(-0.04 0.01)"/></g></g></svg>
|
After Width: | Height: | Size: 1.4 KiB |
1
static/semi_limited.svg
Normal file
1
static/semi_limited.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120"><defs><style>.cls-1{fill:red;}.cls-2{fill:#fff;}</style></defs><title>semi2</title><g id="banned_circle3_0_Layer2_0_FILL" data-name="banned circle3 0 Layer2 0 FILL"><path d="M102.43,17.58A57.83,57.83,0,0,0,60,0,57.83,57.83,0,0,0,17.61,17.58,57.8,57.8,0,0,0,0,60,57.77,57.77,0,0,0,17.61,102.4,57.79,57.79,0,0,0,60,120a57.79,57.79,0,0,0,42.41-17.59A57.77,57.77,0,0,0,120,60,57.8,57.8,0,0,0,102.43,17.58Z" transform="translate(-0.02 0.01)"/></g><g id="banned_circle3_0_Layer1_0_FILL" data-name="banned circle3 0 Layer1 0 FILL"><path class="cls-1" d="M98.49,21.52a52.53,52.53,0,0,0-38.56-16,52.51,52.51,0,0,0-38.55,16,52.54,52.54,0,0,0-16,38.55,52.54,52.54,0,0,0,16,38.55,52.54,52.54,0,0,0,38.55,16,52.56,52.56,0,0,0,38.56-16,52.54,52.54,0,0,0,16-38.55A52.54,52.54,0,0,0,98.49,21.52Z" transform="translate(-0.02 0.01)"/></g><g id="banned_circle3_0_Layer0_0_FILL" data-name="banned circle3 0 Layer0 0 FILL"><path d="M90,30A40.88,40.88,0,0,0,60,17.51,40.88,40.88,0,0,0,30,30a40.88,40.88,0,0,0-12.44,30A40.88,40.88,0,0,0,30,89.93a40.88,40.88,0,0,0,30,12.44A40.88,40.88,0,0,0,90,89.93a40.88,40.88,0,0,0,12.44-30A40.88,40.88,0,0,0,90,30Z" transform="translate(-0.02 0.01)"/></g><g id="FL_2_mc_0_Layer0_0_FILL" data-name="FL 2 mc 0 Layer0 0 FILL"><path class="cls-2" d="M80.55,50.1a17.66,17.66,0,0,0,2.5-9.3,13.6,13.6,0,0,0-1.55-6.4,15.12,15.12,0,0,0-4.5-5,21.24,21.24,0,0,0-7-3.25A33.83,33.83,0,0,0,61.2,25a30.78,30.78,0,0,0-13,2.5,24.81,24.81,0,0,0-9.4,7.85V44.8h5.5a28.91,28.91,0,0,1,1.4-4.15,14.24,14.24,0,0,1,2.15-3.5,9.58,9.58,0,0,1,3.15-2.45,9.08,9.08,0,0,1,4.4-1,9.35,9.35,0,0,1,7.1,2.9,10.63,10.63,0,0,1,2.7,7.55A19.23,19.23,0,0,1,64,51a29.36,29.36,0,0,1-4,7.1,66.27,66.27,0,0,1-7,7.9q-4.3,4.16-10.3,9l-2.55,2-1.65,1.3-1.25,1.1-1,1v8.65h42L83.75,72.9h-4.1l-1,1.45-1.15,1.3-2,.9-3.15.6-3.65.3-3.45.1H47.2l6.9-4.5,7.15-4.85,6.9-5.1,6.15-5.25A36.35,36.35,0,0,0,80.55,50.1Z" transform="translate(-0.02 0.01)"/></g></svg>
|
After Width: | Height: | Size: 2.0 KiB |
@ -72,20 +72,23 @@ h2 {
|
|||||||
font-size: 120%;
|
font-size: 120%;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
|
||||||
box-shadow: 10px 10px var(--bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.thumb {
|
.thumb {
|
||||||
max-height: 250px;
|
max-height: 250px;
|
||||||
max-width: 30%;
|
max-width: 30%;
|
||||||
float: right;
|
float: right;
|
||||||
margin: 0 0 0.8em 1.2em;
|
margin: 0 0 0.8em 1.2em;
|
||||||
|
box-shadow: 10px 10px var(--bg);
|
||||||
}
|
}
|
||||||
.fullimage {
|
.fullimage {
|
||||||
width: 30%;
|
width: 30%;
|
||||||
float: right;
|
float: right;
|
||||||
margin: 0 0 1em 1.5em;
|
margin: 0 0 1em 1.5em;
|
||||||
|
box-shadow: 15px 15px var(--bg);
|
||||||
|
}
|
||||||
|
.banlist-icon {
|
||||||
|
height: 15pt;
|
||||||
|
width: 15pt;
|
||||||
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* This is a big <a> element that looks and behaves more like a div
|
* This is a big <a> element that looks and behaves more like a div
|
||||||
|
Loading…
Reference in New Issue
Block a user