basically finished the profile page

This commit is contained in:
Artemis 2025-01-23 20:51:16 +01:00
parent ec79a05fe5
commit 13f208496f
4 changed files with 44 additions and 5 deletions

View file

@ -36,10 +36,19 @@
box-sizing: border-box;
}
.b {
font-weight: bold;
}
body {
margin-bottom: 2em;
}
ul,
ol {
padding-left: 2ch;
}
h1>a {
text-decoration: none;
color: var(--clr-txt-on-dark);
@ -211,11 +220,10 @@ input#ident {
color: var(--clr-primary-a50);
}
.ident>.id {
.id {
font-family: monospace, monospace;
font-size: 1.1em;
font-weight: bold;
letter-spacing: .2ch;
color: var(--clr-txt-on-dark);
}

View file

@ -31,11 +31,10 @@ pub struct DollProfile {
}
impl DollProfile {
pub fn has_identifying_info(&self) -> bool {
pub fn has_notable_traits(&self) -> bool {
self.kind.is_some()
|| self.breed.is_some()
|| self.behaviour.is_some()
|| self.description.is_some()
|| self.chassis_type.is_some()
|| self.chassis_id.is_some()
|| self.chassis_color.is_some()

View file

@ -115,12 +115,18 @@ async fn show_profile(db: DollTagsDb, ident: &str) -> Result<Template, Redirect>
.await
.expect("fuck")
.ok_or(Redirect::to(uri!("/")))?;
let has_notable_traits = profile.has_notable_traits();
let has_chassis_info = profile.chassis_id.is_some()
&& profile.chassis_type.is_some()
&& profile.chassis_color.is_some();
println!("{:?}", profile);
Ok(Template::render(
"show_profile",
context! {
profile,
has_notable_traits,
has_chassis_info,
},
))
}

View file

@ -31,7 +31,33 @@
</div>
</section>
{% if has_notable_traits or profile.description %}
<section>
<h2>Identifying information</h2>
<div class="dual-fields">
<div>
{% if has_notable_traits %}
<h2>Notable traits</h3>
<ul>
{% if profile.kind %}<li><span class="b">Kind:</span> {{profile.kind}}</li>{% endif %}
{% if profile.breed %}<li><span class="b">Breed:</span> {{profile.breed}}</li>{% endif %}
{% if profile.behaviour %}<li><span class="b">Behaviour:</span> {{profile.behaviour}}</li>{% endif
%}
</ul>
{% if has_chassis_info %}
<p>{{profile.chassis_type}}-type {{profile.chassis_color}} chassis, ID [<span
class="id">{{profile.chassis_id}}</span>]</p>
{% endif %}
{% endif %}
</div>
<div>
{% if profile.description %}
<h2>Description</h3>
<p>{{ profile.description | linebreaksbr }}</p>
{% endif %}
</div>
</div>
</section>
{% endif %}
{% endblock main %}