summaryrefslogtreecommitdiff
path: root/src/projects/mod.rs
blob: f3999845d9d382a0abfe5459838eef99b05de2bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
use self::data::PROJECTS;
use crate::layout::{DynScaffold, Scaffold};
use markup::Render;
use rocket::get;

pub mod data;

#[get("/projects")]
pub fn r_projects() -> DynScaffold<'static> {
    Scaffold {
        title: "projects".to_string(),
        content: markup::new! {
            p { "I am starting a lot of projects - this page lists some of them." }
            p {
                "Starting so many means, that most of then are not maintained or not even properly developed."
                "Here is a quick reference to what I define the status of a project to be:"
            }
            ol {
                li { @Status::Planned.render() ": No code has been written yet." }
                li { @Status::Developing.render() ": Project is under active development." }
                li { @Status::Maintained.render() ": Project is in a working state and receives regular updates." }
                li { @Status::Stale.render() ": Project has been discontinued for an unspecified amount of time, but might be resumed if i feel like it." }
                li { @Status::Abandoned.render() ": Project has been discontinued and will likely not be continued forever." }
                li { @Status::Unknown.render() ": I have not bothered to write down the status" }
            }
            ul {
                @for p in PROJECTS {
                    li { @p }
                }
            }
        },
    }
}

#[derive(Debug, Clone, Copy)]
pub enum Status {
    Unknown,
    Planned,
    Developing,
    Stale,
    Maintained,
    Abandoned,
}

markup::define! { Project(
    name: &'static str,
    status: Status,
    description: &'static str,
    link: Option<&'static str>,
    repo_link: Option<&'static str>
) {
    b { @name }
    @status.render()
    ": " @description
    " ("
    @if let Some(link) = link {
        a[href=link] "Project page"
        ", "
    }
    @let fallback = format!("https://codeberg.org/metamuffin/{name}");
    a[href=repo_link.unwrap_or(&fallback)] "Source code"
    ")"
}}

impl Status {
    pub fn render(self) -> impl Render {
        markup::new! {
           div[class=format!("status status-{self:?}")] { @format!("{self:?}") }
        }
    }
}