MCPcopy Create free account
hub / github.com/PerroEngine/Perro / DocsIndexPage

Function DocsIndexPage

perro_website/src/pages/docs.rs:11–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9use crate::shared::{Seo, SeoInfo};
10
11#[component]
12pub fn DocsIndexPage() -> impl IntoView {
13 let groups = docs_by_nav_group();
14 let doc_count = groups.iter().map(|(_, count)| count).sum::<usize>();
15 let query_map = use_query_map();
16 let selected_group = move || query_map.with(|map| map.get("group"));
17 let query = RwSignal::new(String::new());
18 view! {
19 <Seo info=SeoInfo::new(
20 "Docs",
21 "Browse Perro documentation for scripting, runtime APIs, resource APIs, input APIs, scene nodes, assets, examples, and CLI workflows.",
22 "Perro docs, Perro API reference, Perro scripting docs, Perro nodes, Perro examples, Perro CLI docs, resource API, input API",
23 "/docs",
24 ) />
25 <PageFrame eyebrow="Docs" title="Perro Documentation">
26 <div class="doc-layout">
27 <aside class="doc-filter">
28 <h2>"Explore"</h2>
29 <a href="/docs"><span>"All"</span><small>{doc_count}</small></a>
30 {groups.into_iter().map(|(group, count)| {
31 let href = format!("/docs?group={group}");
32 view! {
33 <a href=href><span>{group}</span><small>{count}</small></a>
34 }}).collect_view()}
35 </aside>
36 <div class="doc-results">
37 <div class="doc-intro">
38 <div>
39 <p class="eyebrow">"Start Here"</p>
40 <h2>"Book first, docs when you need detail"</h2>
41 <p>"Use the book for the linear path. Use docs for focused API, runtime, asset, and tool reference."</p>
42 </div>
43 <a class="btn primary" href="/book">"Open Book"</a>
44 </div>
45 <input
46 class="search"
47 id="docs-search"
48 type="search"
49 placeholder="Search every guide, API, and system… /"
50 aria-label="Search documentation"
51 on:input=move |ev| query.set(event_target_value(&ev))
52 />
53 {move || grouped_docs_filtered_for_nav(&query.get(), selected_group().as_deref()).into_iter().map(|(group, docs)| view! {
54 <section class="docs-section" id=format!("group-{}", group.to_ascii_lowercase())>
55 <div class="docs-section-head">
56 <h2>{group}</h2>
57 <span>{docs.len()}" pages"</span>
58 </div>
59 <div class="doc-list">
60 {docs.into_iter().map(|doc| view! {
61 <a class="doc-row" href=doc.route_path.as_str()>
62 <span class="doc-row-main">
63 <strong>{doc.title.as_str()}</strong>
64 <span>{doc.summary.as_str()}</span>
65 </span>
66 <span class="doc-row-meta">{doc.nav_group.as_str()}</span>
67 </a>
68 }).collect_view()}

Callers

nothing calls this directly

Calls 4

docs_by_areaFunction · 0.85
withMethod · 0.80
iterMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected