haste_server/auth_n/oidc/routes/
style.rs1use axum::Json;
2use axum_extra::routing::TypedPath;
3use serde_json::{Value, json};
4
5#[derive(TypedPath)]
6#[typed_path("/smart-style.json")]
7pub struct SmartStylePath;
8
9pub async fn smart_style_get(_: SmartStylePath) -> Json<Value> {
11 Json(json!({
12 "color_background": "#ffffff",
13 "color_error": "#c62828",
14 "color_highlight": "#1565c0",
15 "color_modal_backdrop": "rgba(0, 0, 0, 0.5)",
16 "color_success": "#2e7d32",
17 "color_text": "#212121",
18 "dim_border_radius": "4px",
19 "dim_font_size": "16px",
20 "dim_spacing_size": "8px",
21 "font_family_body": "system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif",
22 "font_family_heading": "system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif"
23 }))
24}
25
26#[cfg(test)]
27mod tests {
28 use super::*;
29
30 #[tokio::test]
31 async fn serves_every_smart_style_property() {
32 let Json(style) = smart_style_get(SmartStylePath).await;
33 for key in [
34 "color_background",
35 "color_error",
36 "color_highlight",
37 "color_modal_backdrop",
38 "color_success",
39 "color_text",
40 "dim_border_radius",
41 "dim_font_size",
42 "dim_spacing_size",
43 "font_family_body",
44 "font_family_heading",
45 ] {
46 assert!(style[key].is_string(), "missing {key}");
47 }
48 }
49}