Skip to content

Commit 76f0dfe

Browse files
fix: mobile css/map hover
Signed-off-by: Henry Gressmann <[email protected]>
1 parent 7bcbfe3 commit 76f0dfe

File tree

10 files changed

+66
-16
lines changed

10 files changed

+66
-16
lines changed

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ async fn main() -> Result<()> {
1717
}
1818

1919
let app = Liwan::try_new(config)?;
20-
2120
app.run_background_tasks();
21+
2222
tokio::select! {
2323
res = web::start_webserver(app.clone(), s) => res,
2424
res = tokio::task::spawn_blocking(move || app.clone().events.process(r)) => res?

src/web/routes/event.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ impl EventApi {
7474
_ => (None, None),
7575
};
7676

77+
let path = url.path().to_string();
78+
let path = if path.len() > 1 && path.ends_with('/') { path.trim_end_matches('/').to_string() } else { path };
79+
let fqdn = url.host().unwrap_or_default().to_string();
80+
7781
let event = Event {
7882
visitor_id,
7983
referrer,
@@ -83,8 +87,8 @@ impl EventApi {
8387
created_at: chrono::Utc::now(),
8488
entity_id: event.entity_id,
8589
event: event.name,
86-
fqdn: url.host().unwrap_or_default().to_string().into(),
87-
path: url.path().to_string().into(),
90+
fqdn: fqdn.into(),
91+
path: path.into(),
8892
mobile: Some(useragent::is_mobile(&client)),
8993
platform: client.os.family.to_string().into(),
9094
};

src/web/webext.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ impl<T, E: Display> PoemErrExt<T> for Result<T, E> {
6363

6464
pub struct EmbeddedFilesEndpoint<E: RustEmbed + Send + Sync>(PhantomData<E>);
6565

66+
impl<E: RustEmbed + Send + Sync> Default for EmbeddedFilesEndpoint<E> {
67+
fn default() -> Self {
68+
Self::new()
69+
}
70+
}
71+
6672
impl<E: RustEmbed + Send + Sync> EmbeddedFilesEndpoint<E> {
6773
pub fn new() -> Self {
6874
EmbeddedFilesEndpoint(PhantomData)

tracker/script.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tracker/script.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,13 @@ const trackPageviews = () => {
110110
event("pageview");
111111
};
112112

113-
if (history.pushState) {
114-
const originalPushState = history.pushState;
115-
history.pushState = (...args: Parameters<typeof history.pushState>) => {
116-
originalPushState(...args);
117-
page();
118-
};
113+
if (window.history.pushState) {
114+
window.history.pushState = new Proxy(window.history.pushState, {
115+
apply: (target, thisArg, argArray) => {
116+
target.apply(thisArg, argArray);
117+
page();
118+
},
119+
});
119120
window.addEventListener("popstate", page);
120121
}
121122
page();

web/src/components/project.module.css

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818

1919
> h1 {
20-
font-size: 1.7rem;
20+
font-size: 1.4rem;
2121
margin: 0;
2222
align-items: first baseline;
2323
}
@@ -34,6 +34,10 @@ div.graph {
3434
gap: 1rem;
3535
row-gap: 1rem;
3636
margin: 0 -0.4rem;
37+
38+
@media (max-width: 40rem) {
39+
grid-template-columns: 1fr;
40+
}
3741
}
3842

3943
.geoCard.geoCard {
@@ -75,4 +79,35 @@ div.graph {
7579
padding-left: 0;
7680
}
7781
}
82+
83+
@media (max-width: 40rem) {
84+
grid-column: span 1;
85+
flex-direction: column;
86+
.geoTable,
87+
.geoMap {
88+
width: 100%;
89+
}
90+
91+
.geoMap {
92+
&::after {
93+
top: unset;
94+
width: 100%;
95+
left: 0;
96+
height: 2rem;
97+
background: linear-gradient(
98+
to bottom,
99+
transparent,
100+
var(--pico-card-background-color)
101+
);
102+
}
103+
}
104+
105+
.geoTable {
106+
padding: 1rem;
107+
padding-top: 0;
108+
> div {
109+
padding: 0;
110+
}
111+
}
112+
}
78113
}

web/src/components/project.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styles from "./project.module.css";
2-
import "./worldmap.module.css";
2+
import _map from "./worldmap.module.css";
33

44
import { useLocalStorage } from "@uidotdev/usehooks";
55
import { LockIcon } from "lucide-react";

web/src/components/projects.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
.header {
4040
display: flex;
4141
justify-content: space-between;
42+
margin-bottom: 1rem;
4243

4344
a {
4445
cursor: pointer;
@@ -160,7 +161,7 @@ button.stat {
160161
&[data-active="true"] {
161162
h2 {
162163
text-decoration: underline;
163-
font-weight: 500;
164+
font-weight: 600;
164165
}
165166
h2,
166167
h3 {

web/src/components/worldmap.module.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
.tooltipContainer {
2-
all: unset;
1+
.tooltipContainer.tooltipContainer {
2+
padding: 0;
3+
background: none;
34
}
45

56
.worldmap {

web/src/global.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
@import "react-tooltip/dist/react-tooltip.css" layer(tooltip);
44

55
@layer pico {
6-
:root {
6+
:root[data-theme="dark"] {
7+
--pico-background-color: #0a0c10;
8+
--pico-card-background-color: #141a1d;
79
}
810

911
@media only screen and (prefers-color-scheme: dark) {

0 commit comments

Comments
 (0)