format logos in scores

This commit is contained in:
death916 2026-03-17 03:29:37 -07:00
parent c2bb7f4bdc
commit be4ef703b2
2 changed files with 4 additions and 10 deletions

View file

@ -104,7 +104,7 @@ impl State {
PaneType::News => text("News").into(), PaneType::News => text("News").into(),
PaneType::MlbPane => { PaneType::MlbPane => {
let games = &state.mlb_scores; let games = &state.mlb_scores;
let logos = sports::get_mlb_logos(); let logos = sports::get_mlb_logos(); // TODO: MOVE TO INITIALIZATION AND CACHE
scrollable(column(games.iter().map(|game| { scrollable(column(games.iter().map(|game| {
let Some(team1_logo) = logos.get(&game.team1) else { let Some(team1_logo) = logos.get(&game.team1) else {
return text("Error: Team 1 logo not found").into(); return text("Error: Team 1 logo not found").into();
@ -117,13 +117,13 @@ impl State {
container( container(
column![ column![
row![ row![
image(team1_handle.clone()).width(15).height(15),
text(&game.team1).size(20).width(Fill), text(&game.team1).size(20).width(Fill),
image(team1_handle.clone()).width(50).height(50), image(team2_handle.clone()).width(15).height(15),
text(&game.team2).size(20).width(Fill), text(&game.team2).size(20).width(Fill),
], ],
row![ row![
text(&game.score1).size(20).width(Fill), text(&game.score1).size(20).width(Fill),
image(team2_handle.clone()).width(50).height(50),
text(&game.score2).size(20).width(Fill), text(&game.score2).size(20).width(Fill),
], ],
text(format!("Period: {}", game.period)).size(14), text(format!("Period: {}", game.period)).size(14),

View file

@ -147,8 +147,6 @@ pub fn get_mlb_logos() -> HashMap<String, Vec<u8>> {
for team in teams { for team in teams {
let team_name = team["name"].as_str().unwrap(); let team_name = team["name"].as_str().unwrap();
let logo_url = team["logo"].as_str().unwrap(); let logo_url = team["logo"].as_str().unwrap();
println!("Team Name: {}", team_name);
println!("Logo URL: {}", logo_url);
logos_map.insert(team_name.to_string(), logo_url.to_string()); logos_map.insert(team_name.to_string(), logo_url.to_string());
} }
let mut logos_svg_map = std::collections::HashMap::new(); let mut logos_svg_map = std::collections::HashMap::new();
@ -159,11 +157,7 @@ pub fn get_mlb_logos() -> HashMap<String, Vec<u8>> {
.unwrap(); .unwrap();
let image_data = response.into_body().read_to_vec().unwrap(); let image_data = response.into_body().read_to_vec().unwrap();
println!("Logo Data Length: {}", image_data.clone().len());
logos_svg_map.insert(team_name.to_string(), image_data); logos_svg_map.insert(team_name.to_string(), image_data);
println!("Team Name: {}", team_name);
} }
logos_svg_map logos_svg_map
} }