use leptos::*; use crate::{prelude::*, DEFAULT_COLOR}; #[component] pub fn ConfigPage(setter: WriteSignal) -> impl IntoView { let config = use_context::>().expect("missing config context"); let (color, set_color) = leptos_use::use_css_var("--accent"); let (_color_rgb, set_color_rgb) = leptos_use::use_css_var("--accent-rgb"); // TODO should this be responsive? idk let previous_color = config.get_untracked().accent_color; set_color_rgb.set(parse_hex(&previous_color)); set_color.set(previous_color); macro_rules! get_cfg { (filter $field:ident) => { move || config.get().filters.$field }; ($field:ident) => { move || config.get().$field }; } macro_rules! set_cfg { ($field:ident) => { move |ev| { let mut mock = config.get(); mock.$field = event_target_checked(&ev); setter.set(mock); } }; (filter $field:ident) => { move |ev| { let mut mock = config.get(); mock.filters.$field = event_target_checked(&ev); setter.set(mock); } }; } view! {
config

config is saved in your browser local storage

loop videos

collapse content warnings

infinite scroll

accent color


filters

  • " likes"
  • " creates"
  • " announces"
  • " follows"
  • " orphans"

devtools

} } fn parse_hex(hex: &str) -> String { if hex.len() < 7 { return "0, 0, 0".into(); } let r = i64::from_str_radix(&hex[1..3], 16).unwrap_or_default(); let g = i64::from_str_radix(&hex[3..5], 16).unwrap_or_default(); let b = i64::from_str_radix(&hex[5..7], 16).unwrap_or_default(); format!("{r}, {g}, {b}") }