This commit is contained in:
parent
56711e4ee7
commit
cc451bd5b4
11 changed files with 104 additions and 52 deletions
|
@ -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<Config>) -> impl Responder
|
|||
|
||||
#[derive(Content, Debug)]
|
||||
struct PortfolioTemplate {
|
||||
navbar: NavBar,
|
||||
error: bool,
|
||||
projects: Option<Vec<Project>>,
|
||||
waiting: Option<Vec<Project>>,
|
||||
|
@ -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,
|
||||
|
|
|
@ -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<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)]
|
||||
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())),
|
||||
|
|
|
@ -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<Config>) -> 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(),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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<Config>) -> impl Responder
|
|||
|
||||
#[derive(Content, Debug)]
|
||||
struct PortfolioTemplate<'a> {
|
||||
navbar: NavBar,
|
||||
bots_app: Option<Vec<File>>,
|
||||
bots_loc: Option<String>,
|
||||
persos_app: Option<Vec<File>>,
|
||||
|
@ -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,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Parameters light */
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
--background: #ffffff;
|
||||
--background: #f1f1f1;
|
||||
--font-color: #18181b;
|
||||
--link-hover-color: #df5a9c;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
{{>head.html}}
|
||||
</head>
|
||||
<body class="index">
|
||||
<p style="color: aliceblue">404 :/</p>
|
||||
<header>{{>navbar.html}}</header>
|
||||
<main>
|
||||
<p style="color: aliceblue">404 :/</p>
|
||||
</main>
|
||||
{{>footer.html}}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
{{>head.html}}
|
||||
</head>
|
||||
<body>
|
||||
<header>{{>navbar.html}}</header>
|
||||
{{#data}} {{#error}}
|
||||
<div id="content">
|
||||
<main>
|
||||
<p>Github ne veut pas que tu vois ces informations...</p>
|
||||
</div>
|
||||
{{/error}} {{^error}}
|
||||
|
@ -36,7 +37,7 @@
|
|||
>
|
||||
{{/pulls_closed}} {{/closed}}
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
{{/error}} {{/data}} {{>footer.html}}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
loading="lazy"
|
||||
/>
|
||||
</div>
|
||||
<p class="subname">Etudiant qui va rater son master</p>
|
||||
<p class="subname">Étudiant qui va rater son master</p>
|
||||
|
||||
<article>
|
||||
<h1>Bienvenue !</h1>
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
{{>head.html}}
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<header>{{>navbar.html}}</header>
|
||||
<main>
|
||||
<h1 class="subtitle">Contacts et <em>réseaux sociaux</em></h1>
|
||||
<p>
|
||||
<a
|
||||
|
@ -101,7 +102,7 @@
|
|||
>Keyoxide</a
|
||||
>
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
{{>footer.html}}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -4,47 +4,50 @@
|
|||
{{>head.html}}
|
||||
</head>
|
||||
<body>
|
||||
<header>{{>navbar.html}}</header>
|
||||
{{#data}}
|
||||
<h1 id="title">Projets qui me tiennent à coeur</h1>
|
||||
<div id="content">
|
||||
<h2 class="subtitle">Bots</h2>
|
||||
<div class="subcontent">
|
||||
{{#bots_app}} {{#metadata}} {{#info}}
|
||||
<h3 class="subsubtitle">
|
||||
<a target="_blank" href="{{link}} ">{{title}}</a>
|
||||
</h3>
|
||||
{{/info}} {{/metadata}}
|
||||
<div class="subcontent">{{&content}}</div>
|
||||
{{/bots_app}} {{^bots_app}}
|
||||
<p>{{bots_loc}} {{err_msg}}</p>
|
||||
{{/bots_app}}
|
||||
<br />
|
||||
</div>
|
||||
<h2 class="subtitle">
|
||||
<a target="_blank" href="https://git.mylloon.fr/Paris8"
|
||||
>Projet de l'université</a
|
||||
>
|
||||
</h2>
|
||||
<div class="subcontent">
|
||||
{{&univ_content}} {{^univ_content}}
|
||||
<p>{{univ_loc}} {{err_msg}}</p>
|
||||
{{/univ_content}}
|
||||
</div>
|
||||
<main>
|
||||
<h1 id="title">Projets qui me tiennent à coeur</h1>
|
||||
<div id="content">
|
||||
<h2 class="subtitle">Bots</h2>
|
||||
<div class="subcontent">
|
||||
{{#bots_app}} {{#metadata}} {{#info}}
|
||||
<h3 class="subsubtitle">
|
||||
<a target="_blank" href="{{link}} ">{{title}}</a>
|
||||
</h3>
|
||||
{{/info}} {{/metadata}}
|
||||
<div class="subcontent">{{&content}}</div>
|
||||
{{/bots_app}} {{^bots_app}}
|
||||
<p>{{bots_loc}} {{err_msg}}</p>
|
||||
{{/bots_app}}
|
||||
<br />
|
||||
</div>
|
||||
<h2 class="subtitle">
|
||||
<a target="_blank" href="https://git.mylloon.fr/Paris8"
|
||||
>Projet de l'université</a
|
||||
>
|
||||
</h2>
|
||||
<div class="subcontent">
|
||||
{{&univ_content}} {{^univ_content}}
|
||||
<p>{{univ_loc}} {{err_msg}}</p>
|
||||
{{/univ_content}}
|
||||
</div>
|
||||
|
||||
<h2 class="subtitle">Projets perso</h2>
|
||||
<div class="subcontent">
|
||||
{{#persos_app}} {{#metadata}} {{#info}}
|
||||
<h3 class="subsubtitle">
|
||||
<a target="_blank" href="{{link}} ">{{title}}</a>
|
||||
</h3>
|
||||
{{/info}} {{/metadata}}
|
||||
<div class="subcontent">{{&content}}</div>
|
||||
{{/persos_app}} {{^persos_app}}
|
||||
<p>{{persos_loc}} {{err_msg}}</p>
|
||||
{{/persos_app}}
|
||||
<br />
|
||||
<h2 class="subtitle">Projets perso</h2>
|
||||
<div class="subcontent">
|
||||
{{#persos_app}} {{#metadata}} {{#info}}
|
||||
<h3 class="subsubtitle">
|
||||
<a target="_blank" href="{{link}} ">{{title}}</a>
|
||||
</h3>
|
||||
{{/info}} {{/metadata}}
|
||||
<div class="subcontent">{{&content}}</div>
|
||||
{{/persos_app}} {{^persos_app}}
|
||||
<p>{{persos_loc}} {{err_msg}}</p>
|
||||
{{/persos_app}}
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
{{/data}} {{>footer.html}}
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue