gatherer: prettify

This commit is contained in:
Astro 2022-11-10 14:33:20 +01:00
parent aa715aa377
commit 9b6ecea459
4 changed files with 36 additions and 12 deletions

View File

@ -2,7 +2,7 @@ body {
margin: 0 auto;
padding: 0;
background-color: #484B90;
color: #F0F0E0;
color: #F0F0F0;
}
a {
@ -15,6 +15,7 @@ header {
}
header h1 {
margin: 0.5rem 0 0;
color: #FFF;
font-size: 400%;
font-variant: small-caps;
letter-spacing: 0.4rem;
@ -33,16 +34,16 @@ nav {
nav h2, nav ul {
display: inline-block;
list-style-type: none;
margin: 0 0.5rem;
margin: 0.5rem 0.5rem;
padding: 0.2rem;
}
nav h2 {
font-weight: normal;
font-size: 100%;
}
nav ul li {
display: inline-block;
list-style-type: none;
margin: 0 0.15rem;
}
main {
@ -65,22 +66,39 @@ article h2 {
}
section {
background-color: #5582E0;
border-radius: 1rem;
padding: 0.5rem;
margin: 1.5rem 0.5rem;
}
section .title {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
background-color: #484B90;
border-radius: 0.5rem;
padding: 0.5rem 1rem;
margin: 1.5rem 2rem;
}
section h3 {
float: left;
display: inline-block;
margin: 0;
padding: 1rem 0.5rem;
color: #FFF;
font-size: 250%;
font-weight: normal;
}
section h3::before {
color: #5582E0;
font-weight: bold;
content: '#';
}
section .score {
display: inline-block;
text-align: right;
margin: 0;
padding: 1rem 0.5rem;
}
section .hosts {
clear: both;
background-color: #5582E0;
list-style-type: none;
padding: 0;
margin: 0;

View File

@ -28,6 +28,7 @@ impl Muxable for RequestFactory {
.await.unwrap();
let mut languages = store.get_languages().await.unwrap();
languages.sort_by(|(_, count1), (_, count2)| count2.cmp(count1));
languages.truncate(23.min(languages.len()));
let mut languages = languages.into_iter()
.map(|(l, _)| l)
.collect::<Vec<_>>();

View File

@ -85,6 +85,9 @@ impl TrendAnalyzer {
pub fn process_tag(&mut self, name: &Arc<String>, tag: &Arc<TrendTag>) {
let score = tag.score(self.period, self.until);
if score <= 0. {
return;
}
if self.result.len() >= self.size &&
self.score_threshold.map_or(false, |score_threshold| score < score_threshold) {

View File

@ -2,13 +2,13 @@
<html lang="de">
<head>
<meta charset="utf-8"/>
<title>Caveman: {% if language.is_some() %}{{ language.as_ref().unwrap() }}{% else %}Trends in the Fediverse{% endif %}</title>
<title>Fedi.buzz: {% if language.is_some() %}{{ language.as_ref().unwrap() }}{% else %}Trends in the Fediverse{% endif %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" title="Default" type="text/css" href="/assets/style.css"/>
</head>
<body>
<header>
<h1>Fedi.Buzz</h1>
<h1>Fedi.buzz</h1>
<p>Trends in the Fediverse</p>
</header>
@ -28,10 +28,12 @@
<h2>{{ title }}</h2>
{% for (score, tag) in result %}
<section>
<h3>#{{ tag.spelling() }}</h3>
<p class="score">{{ format!("{}{:.0}%", if *score > 1. { "+" } else { "" }, 100. * score - 100.) }}</p>
<div class="title">
<h3>{{ tag.spelling() }}</h3>
<p class="score">{{ format!("{}{:.0}%", if *score > 1. { "+" } else { "" }, 100. * score - 100.) }}</p>
</div>
<ul class="hosts">
{% for (_count, host) in tag.hosts_set().into_iter().rev().take(4) %}
{% for (_count, host) in tag.hosts_set().into_iter().rev().take(5) %}
<li>
<a href="https://{{ host }}/tags/{{ tag.name }}">
{{ host }}