logicaffeine_web/ui/pages/
privacy.rs1use crate::ui::components::footer::Footer;
12use crate::ui::components::main_nav::{ActivePage, MainNav};
13use crate::ui::fragment::scroll_to_section;
14use crate::ui::seo::{
15 breadcrumb_schema, organization_schema, pages as seo_pages, webpage_schema, BreadcrumbItem,
16 JsonLdMultiple, PageHead,
17};
18use dioxus::prelude::*;
19
20#[cfg(not(target_arch = "wasm32"))]
23const PRIVACY_HTML: &str = include_str!("../../../privacy.html");
24
25const LEGAL_STYLE: &str = r#"
26.legal-container {
27 min-height: 100vh;
28 display: flex;
29 flex-direction: column;
30 background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
31}
32
33.legal-content {
34 flex: 1;
35 max-width: 900px;
36 margin: 0 auto;
37 padding: 40px 20px 60px;
38 width: 100%;
39}
40
41.legal-content-inner {
42 background: rgba(255, 255, 255, 0.98);
43 border-radius: 16px;
44 padding: 40px;
45 box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
46}
47
48.legal-content-inner [id] {
49 scroll-margin-top: 104px;
50}
51
52.legal-footer {
53 border-top: 1px solid rgba(255,255,255,0.06);
54 padding: 24px 20px;
55 text-align: center;
56 color: rgba(229,231,235,0.56);
57 font-size: 13px;
58}
59
60.legal-footer a {
61 color: rgba(229,231,235,0.72);
62 text-decoration: none;
63 margin: 0 8px;
64}
65
66.legal-footer a:hover {
67 color: #a78bfa;
68}
69
70.github-link {
71 display: inline-flex;
72 align-items: center;
73 gap: 6px;
74}
75"#;
76
77#[component]
78pub fn Privacy(section: String) -> Element {
79 use_effect(use_reactive!(|section| {
80 if !section.is_empty() {
81 scroll_to_section(section);
82 }
83 }));
84
85 let breadcrumbs = vec![
86 BreadcrumbItem {
87 name: "Home",
88 path: "/",
89 },
90 BreadcrumbItem {
91 name: "Privacy Policy",
92 path: "/privacy",
93 },
94 ];
95 let schemas = vec![
96 organization_schema(),
97 webpage_schema(
98 "Privacy Policy",
99 "How LOGICAFFEINE collects, uses, and protects your personal information.",
100 "/privacy",
101 ),
102 breadcrumb_schema(&breadcrumbs),
103 ];
104
105 rsx! {
106 PageHead {
107 title: seo_pages::PRIVACY.title,
108 description: seo_pages::PRIVACY.description,
109 canonical_path: seo_pages::PRIVACY.canonical_path,
110 }
111 style { "{LEGAL_STYLE}" }
112 JsonLdMultiple { schemas }
113
114 div { class: "legal-container",
115 MainNav { active: ActivePage::Other, subtitle: Some("Privacy Policy") }
116
117 main { class: "legal-content",
118 PrivacyBody {}
119 }
120
121 Footer {}
122 }
123 }
124}
125
126#[cfg(not(target_arch = "wasm32"))]
127#[component]
128fn PrivacyBody() -> Element {
129 rsx! {
130 div { class: "legal-content-inner", dangerous_inner_html: "{PRIVACY_HTML}" }
131 }
132}
133
134#[cfg(target_arch = "wasm32")]
135#[component]
136fn PrivacyBody() -> Element {
137 let mut body = use_resource(|| crate::ui::data_fetch::fetch_static_text("/data/privacy.html"));
138 let state = body.read_unchecked();
139 match &*state {
140 Some(Ok(html)) => rsx! {
141 div { class: "legal-content-inner", dangerous_inner_html: "{html}" }
142 },
143 Some(Err(e)) => rsx! {
144 div { class: "legal-content-inner",
145 p { "The privacy policy failed to load: {e}" }
146 button { onclick: move |_| body.restart(), "Retry" }
147 }
148 },
149 None => rsx! {
150 div { class: "legal-content-inner", p { "Loading\u{2026}" } }
151 },
152 }
153}