Skip to content
use actix_web::HttpRequest;
use actix_web::Result as AwResult;
use actix_web::get;

use crate::view::layout::{is_hx_request, render_layout};

#[get("/about")]
pub async fn about(req: HttpRequest) -> AwResult<maud::Markup> {
    let content = maud::html! {
        section class="page-section w-100 pa4 pa5-ns" {
            div class="center mw7" {
                header class="page-intro mb5" data-motion-group {
                    p class="eyebrow ma0 mb3" data-motion-item { "01 / About" }
                    h1 class="page-title fw6 white ma0 mb4" data-motion-item { "About" }
                    p class="page-lede f4 white-70 lh-copy ma0" data-motion-item {
                        "I am Silen Locatelli, a software engineer with experience across languages and systems. This page covers some of my interests outside work."
                    }
                }
                div class="surface-panel ba b--white-20 bg-black-20 pa4 pa5-ns" {
                    div data-motion-group {
                        h2 class="f4 fw6 white mb3 mt5" data-motion-item { "Interests" }
                        div class="interest-list" {
                            div class="interest-row mb4" data-motion-item {
                                span class="interest-number" { "01" }
                                h3 class="f5 fw6 white ma0 mb2" { "Handball" }
                                p class="f6 white-70 lh-copy" {
                                    "I played handball professionally as a goalkeeper and now play on the field for recreation."
                                }
                            }
                            div class="interest-row mb4" data-motion-item {
                                span class="interest-number" { "02" }
                                h3 class="f5 fw6 white ma0 mb2" { "Books" }
                                p class="f6 white-70 lh-copy" {
                                    "I read non-fiction and fantasy."
                                }
                            }
                            div class="interest-row mb4" data-motion-item {
                                span class="interest-number" { "03" }
                                h3 class="f5 fw6 white ma0 mb2" { "Games" }
                                p class="f6 white-70 lh-copy" {
                                    "I enjoy games that reward strategy and careful problem-solving."
                                }
                            }
                            div class="interest-row mb4" data-motion-item {
                                span class="interest-number" { "04" }
                                h3 class="f5 fw6 white ma0 mb2" { "Cooking" }
                                p class="f6 white-70 lh-copy" {
                                    "I cook Italian dishes and traditional Indian curries."
                                }
                            }
                        }
                    }
                    div class="mt5" data-motion-group {
                        h2 class="f4 fw6 white mb3" data-motion-item { "Site details" }
                        div data-motion-item {
                            p class="f6 white-70 ma0 mb2" {
                                "Built with Rust, Actix Web, Maud and Tachyons CSS. Hosted on an Infomaniak VPS with one vCPU and 2 GB of RAM."
                            }
                        }
                    }
                }
            }
        }
    };

    if is_hx_request(&req) {
        Ok(content)
    } else {
        Ok(render_layout(&content, "/about"))
    }
}