diff --git a/src/routes/contrib.rs b/src/routes/contrib.rs index 32b37f9..9bc7b1c 100644 --- a/src/routes/contrib.rs +++ b/src/routes/contrib.rs @@ -6,7 +6,7 @@ use crate::{ github::{fetch_pr, ProjectState}, utils::get_url, }, - template::Infos, + template::{Infos, NavBar}, }; use actix_web::{get, web, HttpRequest, HttpResponse, Responder}; use cached::proc_macro::once; @@ -20,6 +20,7 @@ pub async fn page(req: HttpRequest, config: web::Data) -> impl Responder #[derive(Content, Debug)] struct PortfolioTemplate { + navbar: NavBar, error: bool, projects: Option>, waiting: Option>, @@ -46,6 +47,11 @@ struct Pull { #[once(time = 120)] pub async fn build_page(config: Config, url: String) -> String { + let navbar = NavBar { + contrib: true, + ..NavBar::default() + }; + // Fetch latest data from github let data = match fetch_pr().await { Ok(projects) => { @@ -107,6 +113,7 @@ pub async fn build_page(config: Config, url: String) -> String { }); PortfolioTemplate { + navbar, error: false, projects: Some( data.iter() @@ -132,6 +139,7 @@ pub async fn build_page(config: Config, url: String) -> String { eprintln!("{}", e); PortfolioTemplate { + navbar, error: true, projects: None, waiting: None, diff --git a/src/routes/networks.rs b/src/routes/networks.rs index 7608a2b..35b184f 100644 --- a/src/routes/networks.rs +++ b/src/routes/networks.rs @@ -1,7 +1,12 @@ use actix_web::{get, web, HttpRequest, HttpResponse, Responder}; use cached::proc_macro::once; +use ramhorns::Content; -use crate::{config::Config, misc::utils::get_url, template::Infos}; +use crate::{ + config::Config, + misc::utils::get_url, + template::{Infos, NavBar}, +}; #[get("/networks")] pub async fn page(req: HttpRequest, config: web::Data) -> impl Responder { @@ -11,11 +16,21 @@ pub async fn page(req: HttpRequest, config: web::Data) -> impl Responder )) } +#[derive(Content, Debug)] +struct NetworksTemplate { + navbar: NavBar, +} + #[once(time = 60)] pub fn build_page(config: Config, url: String) -> String { config.tmpl.render( "networks.html", - (), + NetworksTemplate { + navbar: NavBar { + networks: true, + ..NavBar::default() + }, + }, Infos { page_title: Some("Mes réseaux".into()), page_desc: Some(format!("Réseaux d'{}", config.fc.name.unwrap_or_default())), diff --git a/src/routes/not_found.rs b/src/routes/not_found.rs index 7665ff3..21650e7 100644 --- a/src/routes/not_found.rs +++ b/src/routes/not_found.rs @@ -1,13 +1,28 @@ use actix_web::{web, HttpResponse, Responder}; use cached::proc_macro::once; +use ramhorns::Content; -use crate::{config::Config, template::Infos}; +use crate::{ + config::Config, + template::{Infos, NavBar}, +}; pub async fn page(config: web::Data) -> impl Responder { HttpResponse::NotFound().body(build_page(config.get_ref().to_owned())) } +#[derive(Content, Debug)] +struct NotFoundTemplate { + navbar: NavBar, +} + #[once(time = 60)] pub fn build_page(config: Config) -> String { - config.tmpl.render("404.html", (), Infos::default()) + config.tmpl.render( + "404.html", + NotFoundTemplate { + navbar: NavBar::default(), + }, + Infos::default(), + ) } diff --git a/src/routes/portfolio.rs b/src/routes/portfolio.rs index 23563e2..fb1f0f6 100644 --- a/src/routes/portfolio.rs +++ b/src/routes/portfolio.rs @@ -9,7 +9,7 @@ use crate::{ markdown::{read_file, File}, utils::get_url, }, - template::Infos, + template::{Infos, NavBar}, }; #[get("/portfolio")] @@ -22,6 +22,7 @@ pub async fn page(req: HttpRequest, config: web::Data) -> impl Responder #[derive(Content, Debug)] struct PortfolioTemplate<'a> { + navbar: NavBar, bots_app: Option>, bots_loc: Option, persos_app: Option>, @@ -72,6 +73,10 @@ pub fn build_page(config: Config, url: String) -> String { config.tmpl.render( "portfolio.html", PortfolioTemplate { + navbar: NavBar { + portfolio: true, + ..NavBar::default() + }, bots_app, bots_loc, persos_app, diff --git a/static/css/constants.css b/static/css/constants.css index 45c50e9..760d563 100644 --- a/static/css/constants.css +++ b/static/css/constants.css @@ -1,7 +1,7 @@ /* Parameters light */ @media (prefers-color-scheme: light) { :root { - --background: #ffffff; + --background: #f1f1f1; --font-color: #18181b; --link-hover-color: #df5a9c; } diff --git a/static/css/index.css b/static/css/index.css index 15698f3..3f7c9bc 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -31,6 +31,7 @@ main { .subname { margin-top: 0; font-size: large; + margin-bottom: 1.5em; } .pronouns { @@ -45,7 +46,7 @@ main { } /* Description */ - h1 { font-weight: 600; + margin-bottom: 0; } diff --git a/templates/404.html b/templates/404.html index 7e8b1df..14b0a5f 100644 --- a/templates/404.html +++ b/templates/404.html @@ -4,7 +4,10 @@ {{>head.html}} -

404 :/

+
{{>navbar.html}}
+
+

404 :/

+
{{>footer.html}} diff --git a/templates/contrib.html b/templates/contrib.html index 1c15051..460c89b 100644 --- a/templates/contrib.html +++ b/templates/contrib.html @@ -4,8 +4,9 @@ {{>head.html}} +
{{>navbar.html}}
{{#data}} {{#error}} -
+

Github ne veut pas que tu vois ces informations...

{{/error}} {{^error}} @@ -36,7 +37,7 @@ > {{/pulls_closed}} {{/closed}}

- + {{/error}} {{/data}} {{>footer.html}} diff --git a/templates/index.html b/templates/index.html index 135e0aa..af8009a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -19,7 +19,7 @@ loading="lazy" /> -

Etudiant qui va rater son master

+

Étudiant qui va rater son master

Bienvenue !

diff --git a/templates/networks.html b/templates/networks.html index 4565554..ddafc5d 100644 --- a/templates/networks.html +++ b/templates/networks.html @@ -4,7 +4,8 @@ {{>head.html}} -
+
{{>navbar.html}}
+

Contacts et réseaux sociaux

Keyoxide

-
+ {{>footer.html}} diff --git a/templates/portfolio.html b/templates/portfolio.html index 82f2017..d2df116 100644 --- a/templates/portfolio.html +++ b/templates/portfolio.html @@ -4,47 +4,50 @@ {{>head.html}} +
{{>navbar.html}}
{{#data}} -

Projets qui me tiennent à coeur

-
-

Bots

-
- {{#bots_app}} {{#metadata}} {{#info}} -

- {{title}} -

- {{/info}} {{/metadata}} -
{{&content}}
- {{/bots_app}} {{^bots_app}} -

{{bots_loc}} {{err_msg}}

- {{/bots_app}} -
-
-

- Projet de l'université -

-
- {{&univ_content}} {{^univ_content}} -

{{univ_loc}} {{err_msg}}

- {{/univ_content}} -
+
+

Projets qui me tiennent à coeur

+
+

Bots

+
+ {{#bots_app}} {{#metadata}} {{#info}} +

+ {{title}} +

+ {{/info}} {{/metadata}} +
{{&content}}
+ {{/bots_app}} {{^bots_app}} +

{{bots_loc}} {{err_msg}}

+ {{/bots_app}} +
+
+

+ Projet de l'université +

+
+ {{&univ_content}} {{^univ_content}} +

{{univ_loc}} {{err_msg}}

+ {{/univ_content}} +
-

Projets perso

-
- {{#persos_app}} {{#metadata}} {{#info}} -

- {{title}} -

- {{/info}} {{/metadata}} -
{{&content}}
- {{/persos_app}} {{^persos_app}} -

{{persos_loc}} {{err_msg}}

- {{/persos_app}} -
+

Projets perso

+
+ {{#persos_app}} {{#metadata}} {{#info}} +

+ {{title}} +

+ {{/info}} {{/metadata}} +
{{&content}}
+ {{/persos_app}} {{^persos_app}} +

{{persos_loc}} {{err_msg}}

+ {{/persos_app}} +
+
-
+
{{/data}} {{>footer.html}}