💄 UI
This commit is contained in:
parent
77f1c27981
commit
ffb52546ec
2 changed files with 52 additions and 29 deletions
22
Cargo.lock
generated
22
Cargo.lock
generated
|
@ -152,7 +152,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "based"
|
name = "based"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.hydrar.de/jmarya/based?branch=ui#cdaabccd9eb701c5f0050def9706fc167137a481"
|
source = "git+https://git.hydrar.de/jmarya/based?branch=ui#f2cfcf27bbe7668caf95a99e7b8f7698e023fdec"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bcrypt",
|
"bcrypt",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -257,9 +257,9 @@ checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.13"
|
version = "1.2.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c7777341816418c02e033934a09f20dc0ccaf65a5201ef8a450ae0105a573fda"
|
checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"shlex",
|
"shlex",
|
||||||
]
|
]
|
||||||
|
@ -421,9 +421,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "data-encoding"
|
name = "data-encoding"
|
||||||
version = "2.7.0"
|
version = "2.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0e60eed09d8c01d3cee5b7d30acb059b76614c918fa0f992e0dd6eeb10daad6f"
|
checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "der"
|
name = "der"
|
||||||
|
@ -1345,9 +1345,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
version = "0.8.3"
|
version = "0.8.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924"
|
checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler2",
|
"adler2",
|
||||||
]
|
]
|
||||||
|
@ -2760,9 +2760,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.22.23"
|
version = "0.22.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "02a8b472d1a3d7c18e2d61a489aee3453fd9031c33e4f55bd533f4a7adca1bee"
|
checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -3318,9 +3318,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.7.1"
|
version = "0.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "86e376c75f4f43f44db463cf729e0d3acbf954d13e22c51e26e4c264b4ab545f"
|
checksum = "59690dea168f2198d1a3b0cac23b8063efcd11012f10ae4698f284808c8ef603"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
59
src/main.rs
59
src/main.rs
|
@ -91,6 +91,20 @@ pub async fn main_page(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub fn DetailLink(text: &str, reference: &str) -> PreEscaped<String> {
|
||||||
|
Flex(
|
||||||
|
Div()
|
||||||
|
.vanish()
|
||||||
|
.push(text.render())
|
||||||
|
.push(Link(reference, Text(reference)))
|
||||||
|
.render(),
|
||||||
|
)
|
||||||
|
.gap_x(ScreenValue::_2)
|
||||||
|
.direction(Direction::Row)
|
||||||
|
.render()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn info_tab(prj: &Project, root: &str) -> PreEscaped<String> {
|
pub fn info_tab(prj: &Project, root: &str) -> PreEscaped<String> {
|
||||||
Flex(
|
Flex(
|
||||||
Div()
|
Div()
|
||||||
|
@ -98,11 +112,12 @@ pub fn info_tab(prj: &Project, root: &str) -> PreEscaped<String> {
|
||||||
.push(Rounded(
|
.push(Rounded(
|
||||||
Background(Padding(Code(&prj.description)).all(ScreenValue::_4)).color(Gray::_900),
|
Background(Padding(Code(&prj.description)).all(ScreenValue::_4)).color(Gray::_900),
|
||||||
))
|
))
|
||||||
|
.push(Margin(Text("Information").xl().semibold()).top(ScreenValue::_2))
|
||||||
.push(Optional(prj.website.as_deref(), |website| {
|
.push(Optional(prj.website.as_deref(), |website| {
|
||||||
Link(website, Text(&format!("Website: {website}")))
|
DetailLink("Website:", website)
|
||||||
}))
|
}))
|
||||||
.push(Optional(prj.documentation.as_deref(), |docs| {
|
.push(Optional(prj.documentation.as_deref(), |docs| {
|
||||||
Link(docs, Text(&format!("Documentation: {docs}")))
|
DetailLink("Documentation:", docs)
|
||||||
}))
|
}))
|
||||||
.push(Optional(prj.since.as_deref(), |since| {
|
.push(Optional(prj.since.as_deref(), |since| {
|
||||||
Text(&format!("Since: {since}"))
|
Text(&format!("Since: {since}"))
|
||||||
|
@ -110,7 +125,7 @@ pub fn info_tab(prj: &Project, root: &str) -> PreEscaped<String> {
|
||||||
.push(Optional(prj.contact.as_ref(), |contact| {
|
.push(Optional(prj.contact.as_ref(), |contact| {
|
||||||
Div()
|
Div()
|
||||||
.vanish()
|
.vanish()
|
||||||
.push(Text("Contact").large())
|
.push(Text("Contact").xl().semibold())
|
||||||
.push(Text(&format!(
|
.push(Text(&format!(
|
||||||
"eMail: {}",
|
"eMail: {}",
|
||||||
contact
|
contact
|
||||||
|
@ -129,16 +144,22 @@ pub fn info_tab(prj: &Project, root: &str) -> PreEscaped<String> {
|
||||||
|
|
||||||
Div()
|
Div()
|
||||||
.vanish()
|
.vanish()
|
||||||
.push(Text("Sub projects").large())
|
.push(Margin(Text("Sub projects").xl().semibold()).bottom(ScreenValue::_2))
|
||||||
.push_for_each(&prj_links, |link: &_| {
|
.push(Row(prj_links
|
||||||
Width(
|
.into_iter()
|
||||||
ScreenValue::fit,
|
.map(|link| {
|
||||||
Button(Link(
|
Width(
|
||||||
&format!("/prj/{root}{link}"),
|
ScreenValue::fit,
|
||||||
Text(&prj.sub.as_ref().unwrap().get(*link).unwrap().name),
|
Button(Link(
|
||||||
)),
|
&format!("/prj/{root}{link}"),
|
||||||
)
|
ProjectIcon(
|
||||||
})
|
&prj.sub.as_ref().unwrap().get(link).unwrap(),
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.collect()))
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
.gap(ScreenValue::_2)
|
.gap(ScreenValue::_2)
|
||||||
|
@ -152,10 +173,14 @@ fn up_to(keyword: &str, v: &[&str], separator: &str) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn ProjectIcon(prj: &Project) -> PreEscaped<String> {
|
pub fn ProjectIcon(prj: &Project, big: bool) -> PreEscaped<String> {
|
||||||
Row(vec![
|
Row(vec![
|
||||||
Optional(prj.icon.as_ref(), |icon| Image(icon).alt("Project Icon")),
|
Optional(prj.icon.as_ref(), |icon| Image(icon).alt("Project Icon")),
|
||||||
Text(&prj.name)._2xl().render(),
|
if big {
|
||||||
|
Text(&prj.name)._2xl().render()
|
||||||
|
} else {
|
||||||
|
Text(&prj.name).render()
|
||||||
|
},
|
||||||
])
|
])
|
||||||
.gap(ScreenValue::_4)
|
.gap(ScreenValue::_4)
|
||||||
.full_center()
|
.full_center()
|
||||||
|
@ -183,14 +208,12 @@ pub async fn render_project(
|
||||||
let prj_path = up_to(x, &root_paths, "/");
|
let prj_path = up_to(x, &root_paths, "/");
|
||||||
|
|
||||||
(
|
(
|
||||||
ProjectIcon(&get_prj(c, &prj_path).unwrap()).0,
|
ProjectIcon(&get_prj(c, &prj_path).unwrap(), true).0,
|
||||||
format!("/prj/{}", prj_path),
|
format!("/prj/{}", prj_path),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
println!("{bc:?}");
|
|
||||||
|
|
||||||
page!(
|
page!(
|
||||||
shell,
|
shell,
|
||||||
ctx,
|
ctx,
|
||||||
|
|
Loading…
Add table
Reference in a new issue