this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: reset all schedules button in Settings

Preserves rect geometry; clears blank schedules and resets rect
schedules to due-today. Requires confirm dialog before executing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

+47 -1
+47 -1
crates/tala/src/main.rs
··· 169 169 170 170 #[component] 171 171 fn Settings() -> Element { 172 + let mut status = use_signal(|| Option::<String>::None); 172 173 rsx! { 173 174 div { id: "settings", 174 175 h2 { "Settings" } 175 - p { "Nothing here yet." } 176 + h3 { "Review" } 177 + p { "Reset all card schedules to due-today. Rect geometry is preserved." } 178 + button { 179 + class: "btn", 180 + onclick: move |_| { 181 + let typ_path = cards_path(); 182 + spawn(async move { 183 + let confirmed = document::eval( 184 + "dioxus.send(window.confirm('Reset all schedules? This cannot be undone.'))" 185 + ).recv::<bool>().await.unwrap_or(false); 186 + if !confirmed { return; } 187 + match Sidecar::load_or_empty_for(&typ_path) { 188 + Ok(mut sc) => { 189 + let today = tala_srs::today_str(); 190 + for sched in sc.cards.values_mut() { 191 + match sched { 192 + CardSchedule::FrontBack { forward_schedule, reverse_schedule } => { 193 + *forward_schedule = None; 194 + *reverse_schedule = None; 195 + } 196 + CardSchedule::Cloze { blanks, rects } => { 197 + blanks.clear(); 198 + for r in rects.iter_mut() { 199 + r.schedule = tala_srs::Schedule { 200 + due: today.clone(), 201 + stability: 0.0, 202 + difficulty: 0.0, 203 + }; 204 + } 205 + } 206 + } 207 + } 208 + match sc.save_for(&typ_path) { 209 + Ok(_) => status.set(Some("Schedules reset.".into())), 210 + Err(e) => status.set(Some(format!("Error: {e}"))), 211 + } 212 + } 213 + Err(e) => status.set(Some(format!("Error: {e}"))), 214 + } 215 + }); 216 + }, 217 + "Reset all schedules" 218 + } 219 + if let Some(msg) = status.read().as_deref() { 220 + p { class: "status", "{msg}" } 221 + } 176 222 } 177 223 } 178 224 }