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::MlbPane => {
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| {
let Some(team1_logo) = logos.get(&game.team1) else {
return text("Error: Team 1 logo not found").into();
@ -117,13 +117,13 @@ impl State {
container(
column![
row![
image(team1_handle.clone()).width(15).height(15),
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),
],
row![
text(&game.score1).size(20).width(Fill),
image(team2_handle.clone()).width(50).height(50),
text(&game.score2).size(20).width(Fill),
],
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 {
let team_name = team["name"].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());
}
let mut logos_svg_map = std::collections::HashMap::new();
@ -157,13 +155,9 @@ pub fn get_mlb_logos() -> HashMap<String, Vec<u8>> {
.header("User-Agent", "deathclock-app/0.1")
.call()
.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);
println!("Team Name: {}", team_name);
}
logos_svg_map
}