aboutsummaryrefslogtreecommitdiff
path: root/ui/src/search.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/search.rs')
-rw-r--r--ui/src/search.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/ui/src/search.rs b/ui/src/search.rs
new file mode 100644
index 0000000..092ad57
--- /dev/null
+++ b/ui/src/search.rs
@@ -0,0 +1,31 @@
+/*
+ This file is part of jellything (https://codeberg.org/metamuffin/jellything)
+ which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
+ Copyright (C) 2025 metamuffin <metamuffin.org>
+*/
+
+markup::define! {
+ SearchPage {
+ h1 { @trs(&lang, "search.title") }
+ form[action="", method="GET"] {
+ input[type="text", name="query", placeholder=&*tr(lang, "search.placeholder"), value=&query];
+ input[type="submit", value="Search"];
+ }
+ @if let Some((count, results, search_dur)) = &results {
+ h2 { @trs(&lang, "search.results.title") }
+ p.stats { @tr(lang, "search.results.stats").replace("{count}", &count.to_string()).replace("{dur}", &format!("{search_dur:?}")) }
+ ul.children {@for (node, udata) in results.iter() {
+ li { @NodeCard { node, udata, lang: &lang } }
+ }}
+ // TODO pagination
+ }
+ }
+}
+
+pub fn search_page() {
+ LayoutPage {
+ title: tr(lang, "search.title").to_string(),
+ class: Some("search"),
+ content: SearchPage,
+ }
+} \ No newline at end of file