Compare commits

...

2 Commits

Author SHA1 Message Date
Bauke eb48cc70c1
Add logo to header and favicon. 2022-10-09 13:37:37 +02:00
Bauke 0cf9dda4fd
Narrow img style to charts. 2022-10-09 13:34:46 +02:00
8 changed files with 32 additions and 6 deletions

14
source/assets/mod.rs Normal file
View File

@ -0,0 +1,14 @@
//! Miscellaneous assets.
use {
async_std::{fs::write, path::PathBuf},
color_eyre::Result,
};
/// Write all misellaneous asset files to where they belong.
pub async fn write_assets(parent: &PathBuf) -> Result<()> {
let logo = include_bytes!("tildes-statistics.png");
write(parent.join("tildes-statistics.png"), logo).await?;
Ok(())
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -6,6 +6,7 @@ use {
}; };
use crate::{ use crate::{
assets::write_assets,
charts::UserCountChart, charts::UserCountChart,
cli::{ cli::{
Cli, MainSubcommands, MigrateSubcommands, SnapshotSubcommands, Cli, MainSubcommands, MigrateSubcommands, SnapshotSubcommands,
@ -112,6 +113,7 @@ pub async fn run() -> Result<()> {
.render_to_file(&output) .render_to_file(&output)
.await?; .await?;
generate_css(&output).await?; generate_css(&output).await?;
write_assets(&output).await?;
if let Some(group) = user_count_group { if let Some(group) = user_count_group {
let groups = let groups =

View File

@ -11,6 +11,7 @@ use {
tracing_subscriber::filter::{EnvFilter, LevelFilter}, tracing_subscriber::filter::{EnvFilter, LevelFilter},
}; };
pub mod assets;
pub mod charts; pub mod charts;
pub mod cli; pub mod cli;
pub mod group_data; pub mod group_data;

View File

@ -26,11 +26,6 @@ a:visited {
} }
} }
img {
display: block;
width: 100%;
}
h1, h1,
h2, h2,
h3, h3,

View File

@ -17,8 +17,15 @@
} }
.page-header { .page-header {
align-items: center;
border-bottom: 4px solid var(--background-2); border-bottom: 4px solid var(--background-2);
display: flex;
padding: var(--large-spacing); padding: var(--large-spacing);
img {
height: 4rem;
margin-right: var(--large-spacing);
}
} }
.page-main { .page-main {
@ -59,6 +66,11 @@
background-color: var(--background-2); background-color: var(--background-2);
} }
} }
.chart {
display: block;
width: 100%;
}
} }
.page-footer { .page-footer {

View File

@ -6,6 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ page_title }}</title> <title>{{ page_title }}</title>
<link rel="shortcut icon" href="/tildes-statistics.png" type="image/png">
<link rel="stylesheet" href="/css/modern-normalize.css"> <link rel="stylesheet" href="/css/modern-normalize.css">
<link rel="stylesheet" href="/css/common.css"> <link rel="stylesheet" href="/css/common.css">
{% block head %}{% endblock %} {% block head %}{% endblock %}

View File

@ -6,6 +6,7 @@
{% block body %} {% block body %}
<header class="page-header"> <header class="page-header">
<img src="/tildes-statistics.png" alt="Tildes Statistics Logo">
<h1>Tildes Statistics</h1> <h1>Tildes Statistics</h1>
</header> </header>
@ -18,7 +19,7 @@
registered users on Tildes. registered users on Tildes.
</p> </p>
<img src="/charts/user-count.svg" alt="User Count Chart"> <img class="chart" src="/charts/user-count.svg" alt="User Count Chart">
<table> <table>
<thead> <thead>