Skip to content

Commit

Permalink
Fix layout
Browse files Browse the repository at this point in the history
  • Loading branch information
enaut committed Nov 30, 2021
1 parent 1cfd0b1 commit 03e49aa
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 20 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ keywords = ["url", "link", "webpage", "actix", "web"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/enaut/pslink/"
version = "0.4.6"
version = "0.4.7"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
8 changes: 4 additions & 4 deletions app/src/pages/list_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,15 +837,15 @@ fn view_link<F: Fn(&str) -> String>(
Clicks::Extended(statistics) =>
if let Some(nodes) = l.cache.stats.clone() {
td![
nodes,
span!(
C!("stats_total"),
t("total_clicks"),
match &l.data.clicks {
Clicks::Count(c) => c.number,
Clicks::Extended(e) => e.total.number,
}
),
nodes
)
]
} else {
td!(statistics.total.number)
Expand Down Expand Up @@ -881,7 +881,7 @@ fn view_link<F: Fn(&str) -> String>(

/// Render stats is best performed in the update rather than in the view cycle to avoid needless recalculations. Since the database only sends a list of weeks that contain clicks this function has to add the weeks that do not contain clicks. This is more easily said than done since the first and last week index are not constant, the ordering has to be right, and not every year has 52 weeks. But we ignore the last issue.
fn render_stats(q: Statistics, maximum: &WeekCount) -> Node<Msg> {
let factor = 40.0 / f64::max(f64::from(maximum.total.number), 1.0);
let factor = 30.0 / f64::max(f64::from(maximum.total.number), 1.0);
let mut full: Vec<WeekCount> = Vec::new();
let mut week = chrono::Utc::now() - chrono::Duration::weeks(52);

Expand Down Expand Up @@ -922,7 +922,7 @@ fn render_stats(q: Statistics, maximum: &WeekCount) -> Node<Msg> {
#[allow(clippy::cast_possible_truncation)]
let normalized: Vec<i64> = full
.iter()
.map(|v| (40.0 - f64::from(v.total.number) * factor).round() as i64)
.map(|v| (30.0 - f64::from(v.total.number) * factor).round() as i64)
.collect();
let mut points = Vec::new();
points.push(format!("M 0 {}", &normalized[0]));
Expand Down
2 changes: 1 addition & 1 deletion locales/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ keywords = ["url", "link", "webpage", "actix", "web"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/enaut/pslink/"
version = "0.4.6"
version = "0.4.7"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion pslink/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
name = "pslink"
readme = "README.md"
repository = "https://github.com/enaut/pslink/"
version = "0.4.6"
version = "0.4.7"

[build-dependencies]
actix-web-static-files = { git = "https://github.com/enaut/actix-web-static-files.git", branch="master" }
Expand Down
11 changes: 3 additions & 8 deletions pslink/static/admin.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
body {
qbody {
margin: 0;
padding: 0;
}
Expand Down Expand Up @@ -64,22 +64,17 @@ td {
text-align: center;
border: 1px solid #ccc;
padding: 10px;
position: relative;
}

svg.statistics_graph {
width: 120px;
height: 50px;
height: 30px;
}

.stats_total {
display: block;
position: absolute;
font-size: 0.7em;
background-color: rgba(255, 255, 255, 0.75);
padding: 3px;
border-radius: 14px;
bottom: 0;
margin-top: -4px;
}

td.table_qr svg {
Expand Down
2 changes: 1 addition & 1 deletion shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
name = "pslink-shared"
readme = "../pslink/README.md"
repository = "https://github.com/enaut/pslink/"
version = "0.4.6"
version = "0.4.7"

[dependencies]
serde = {version="1.0", features = ["derive"]}
Expand Down

0 comments on commit 03e49aa

Please sign in to comment.