Style rework #35

Merged
Anri merged 70 commits from rework into main 2023-10-15 20:58:23 +02:00
11 changed files with 104 additions and 52 deletions
Showing only changes of commit cc451bd5b4 - Show all commits

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">
<header>{{>navbar.html}}</header>
<main>
<p style="color: aliceblue">404 :/</p> <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,7 +4,9 @@
{{>head.html}} {{>head.html}}
</head> </head>
<body> <body>
<header>{{>navbar.html}}</header>
{{#data}} {{#data}}
<main>
<h1 id="title">Projets qui me tiennent à coeur</h1> <h1 id="title">Projets qui me tiennent à coeur</h1>
<div id="content"> <div id="content">
<h2 class="subtitle">Bots</h2> <h2 class="subtitle">Bots</h2>
@ -45,6 +47,7 @@
<br /> <br />
</div> </div>
</div> </div>
</main>
{{/data}} {{>footer.html}} {{/data}} {{>footer.html}}
</body> </body>
</html> </html>