navbar on all pages
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending

This commit is contained in:
Mylloon 2023-10-09 22:38:59 +02:00
parent 56711e4ee7
commit cc451bd5b4
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
11 changed files with 104 additions and 52 deletions

View file

@ -6,7 +6,7 @@ use crate::{
github::{fetch_pr, ProjectState}, github::{fetch_pr, ProjectState},
utils::get_url, utils::get_url,
}, },
template::Infos, template::{Infos, NavBar},
}; };
use actix_web::{get, web, HttpRequest, HttpResponse, Responder}; use actix_web::{get, web, HttpRequest, HttpResponse, Responder};
use cached::proc_macro::once; use cached::proc_macro::once;
@ -20,6 +20,7 @@ pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder
#[derive(Content, Debug)] #[derive(Content, Debug)]
struct PortfolioTemplate { struct PortfolioTemplate {
navbar: NavBar,
error: bool, error: bool,
projects: Option<Vec<Project>>, projects: Option<Vec<Project>>,
waiting: Option<Vec<Project>>, waiting: Option<Vec<Project>>,
@ -46,6 +47,11 @@ struct Pull {
#[once(time = 120)] #[once(time = 120)]
pub async fn build_page(config: Config, url: String) -> String { pub async fn build_page(config: Config, url: String) -> String {
let navbar = NavBar {
contrib: true,
..NavBar::default()
};
// Fetch latest data from github // Fetch latest data from github
let data = match fetch_pr().await { let data = match fetch_pr().await {
Ok(projects) => { Ok(projects) => {
@ -107,6 +113,7 @@ pub async fn build_page(config: Config, url: String) -> String {
}); });
PortfolioTemplate { PortfolioTemplate {
navbar,
error: false, error: false,
projects: Some( projects: Some(
data.iter() data.iter()
@ -132,6 +139,7 @@ pub async fn build_page(config: Config, url: String) -> String {
eprintln!("{}", e); eprintln!("{}", e);
PortfolioTemplate { PortfolioTemplate {
navbar,
error: true, error: true,
projects: None, projects: None,
waiting: None, waiting: None,

View file

@ -1,7 +1,12 @@
use actix_web::{get, web, HttpRequest, HttpResponse, Responder}; use actix_web::{get, web, HttpRequest, HttpResponse, Responder};
use cached::proc_macro::once; 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")] #[get("/networks")]
pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder { pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
@ -11,11 +16,21 @@ pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder
)) ))
} }
#[derive(Content, Debug)]
struct NetworksTemplate {
navbar: NavBar,
}
#[once(time = 60)] #[once(time = 60)]
pub fn build_page(config: Config, url: String) -> String { pub fn build_page(config: Config, url: String) -> String {
config.tmpl.render( config.tmpl.render(
"networks.html", "networks.html",
(), NetworksTemplate {
navbar: NavBar {
networks: true,
..NavBar::default()
},
},
Infos { Infos {
page_title: Some("Mes réseaux".into()), page_title: Some("Mes réseaux".into()),
page_desc: Some(format!("Réseaux d'{}", config.fc.name.unwrap_or_default())), page_desc: Some(format!("Réseaux d'{}", config.fc.name.unwrap_or_default())),

View file

@ -1,13 +1,28 @@
use actix_web::{web, HttpResponse, Responder}; use actix_web::{web, HttpResponse, Responder};
use cached::proc_macro::once; 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<Config>) -> impl Responder { pub async fn page(config: web::Data<Config>) -> impl Responder {
HttpResponse::NotFound().body(build_page(config.get_ref().to_owned())) HttpResponse::NotFound().body(build_page(config.get_ref().to_owned()))
} }
#[derive(Content, Debug)]
struct NotFoundTemplate {
navbar: NavBar,
}
#[once(time = 60)] #[once(time = 60)]
pub fn build_page(config: Config) -> String { 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(),
)
} }

View file

@ -9,7 +9,7 @@ use crate::{
markdown::{read_file, File}, markdown::{read_file, File},
utils::get_url, utils::get_url,
}, },
template::Infos, template::{Infos, NavBar},
}; };
#[get("/portfolio")] #[get("/portfolio")]
@ -22,6 +22,7 @@ pub async fn page(req: HttpRequest, config: web::Data<Config>) -> impl Responder
#[derive(Content, Debug)] #[derive(Content, Debug)]
struct PortfolioTemplate<'a> { struct PortfolioTemplate<'a> {
navbar: NavBar,
bots_app: Option<Vec<File>>, bots_app: Option<Vec<File>>,
bots_loc: Option<String>, bots_loc: Option<String>,
persos_app: Option<Vec<File>>, persos_app: Option<Vec<File>>,
@ -72,6 +73,10 @@ pub fn build_page(config: Config, url: String) -> String {
config.tmpl.render( config.tmpl.render(
"portfolio.html", "portfolio.html",
PortfolioTemplate { PortfolioTemplate {
navbar: NavBar {
portfolio: true,
..NavBar::default()
},
bots_app, bots_app,
bots_loc, bots_loc,
persos_app, persos_app,

View file

@ -1,7 +1,7 @@
/* Parameters light */ /* Parameters light */
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
:root { :root {
--background: #ffffff; --background: #f1f1f1;
--font-color: #18181b; --font-color: #18181b;
--link-hover-color: #df5a9c; --link-hover-color: #df5a9c;
} }

View file

@ -31,6 +31,7 @@ main {
.subname { .subname {
margin-top: 0; margin-top: 0;
font-size: large; font-size: large;
margin-bottom: 1.5em;
} }
.pronouns { .pronouns {
@ -45,7 +46,7 @@ main {
} }
/* Description */ /* Description */
h1 { h1 {
font-weight: 600; font-weight: 600;
margin-bottom: 0;
} }

View file

@ -4,7 +4,10 @@
{{>head.html}} {{>head.html}}
</head> </head>
<body class="index"> <body class="index">
<p style="color: aliceblue">404 :/</p> <header>{{>navbar.html}}</header>
<main>
<p style="color: aliceblue">404 :/</p>
</main>
{{>footer.html}} {{>footer.html}}
</body> </body>
</html> </html>

View file

@ -4,8 +4,9 @@
{{>head.html}} {{>head.html}}
</head> </head>
<body> <body>
<header>{{>navbar.html}}</header>
{{#data}} {{#error}} {{#data}} {{#error}}
<div id="content"> <main>
<p>Github ne veut pas que tu vois ces informations...</p> <p>Github ne veut pas que tu vois ces informations...</p>
</div> </div>
{{/error}} {{^error}} {{/error}} {{^error}}
@ -36,7 +37,7 @@
> >
{{/pulls_closed}} {{/closed}} {{/pulls_closed}} {{/closed}}
</p> </p>
</div> </main>
{{/error}} {{/data}} {{>footer.html}} {{/error}} {{/data}} {{>footer.html}}
</body> </body>
</html> </html>

View file

@ -19,7 +19,7 @@
loading="lazy" loading="lazy"
/> />
</div> </div>
<p class="subname">Etudiant qui va rater son master</p> <p class="subname">Étudiant qui va rater son master</p>
<article> <article>
<h1>Bienvenue !</h1> <h1>Bienvenue !</h1>

View file

@ -4,7 +4,8 @@
{{>head.html}} {{>head.html}}
</head> </head>
<body> <body>
<div id="content"> <header>{{>navbar.html}}</header>
<main>
<h1 class="subtitle">Contacts et <em>réseaux sociaux</em></h1> <h1 class="subtitle">Contacts et <em>réseaux sociaux</em></h1>
<p> <p>
<a <a
@ -101,7 +102,7 @@
>Keyoxide</a >Keyoxide</a
> >
</p> </p>
</div> </main>
{{>footer.html}} {{>footer.html}}
</body> </body>
</html> </html>

View file

@ -4,47 +4,50 @@
{{>head.html}} {{>head.html}}
</head> </head>
<body> <body>
<header>{{>navbar.html}}</header>
{{#data}} {{#data}}
<h1 id="title">Projets qui me tiennent à coeur</h1> <main>
<div id="content"> <h1 id="title">Projets qui me tiennent à coeur</h1>
<h2 class="subtitle">Bots</h2> <div id="content">
<div class="subcontent"> <h2 class="subtitle">Bots</h2>
{{#bots_app}} {{#metadata}} {{#info}} <div class="subcontent">
<h3 class="subsubtitle"> {{#bots_app}} {{#metadata}} {{#info}}
<a target="_blank" href="{{link}} ">{{title}}</a> <h3 class="subsubtitle">
</h3> <a target="_blank" href="{{link}} ">{{title}}</a>
{{/info}} {{/metadata}} </h3>
<div class="subcontent">{{&content}}</div> {{/info}} {{/metadata}}
{{/bots_app}} {{^bots_app}} <div class="subcontent">{{&content}}</div>
<p>{{bots_loc}} {{err_msg}}</p> {{/bots_app}} {{^bots_app}}
{{/bots_app}} <p>{{bots_loc}} {{err_msg}}</p>
<br /> {{/bots_app}}
</div> <br />
<h2 class="subtitle"> </div>
<a target="_blank" href="https://git.mylloon.fr/Paris8" <h2 class="subtitle">
>Projet de l'université</a <a target="_blank" href="https://git.mylloon.fr/Paris8"
> >Projet de l'université</a
</h2> >
<div class="subcontent"> </h2>
{{&univ_content}} {{^univ_content}} <div class="subcontent">
<p>{{univ_loc}} {{err_msg}}</p> {{&univ_content}} {{^univ_content}}
{{/univ_content}} <p>{{univ_loc}} {{err_msg}}</p>
</div> {{/univ_content}}
</div>
<h2 class="subtitle">Projets perso</h2> <h2 class="subtitle">Projets perso</h2>
<div class="subcontent"> <div class="subcontent">
{{#persos_app}} {{#metadata}} {{#info}} {{#persos_app}} {{#metadata}} {{#info}}
<h3 class="subsubtitle"> <h3 class="subsubtitle">
<a target="_blank" href="{{link}} ">{{title}}</a> <a target="_blank" href="{{link}} ">{{title}}</a>
</h3> </h3>
{{/info}} {{/metadata}} {{/info}} {{/metadata}}
<div class="subcontent">{{&content}}</div> <div class="subcontent">{{&content}}</div>
{{/persos_app}} {{^persos_app}} {{/persos_app}} {{^persos_app}}
<p>{{persos_loc}} {{err_msg}}</p> <p>{{persos_loc}} {{err_msg}}</p>
{{/persos_app}} {{/persos_app}}
<br /> <br />
</div>
</div> </div>
</div> </main>
{{/data}} {{>footer.html}} {{/data}} {{>footer.html}}
</body> </body>
</html> </html>