Skip to content

Commit c7e0c43

Browse files
chore: improve graph component, update changelog
Signed-off-by: Henry Gressmann <[email protected]>
1 parent 433455a commit c7e0c43

File tree

18 files changed

+117
-71
lines changed

18 files changed

+117
-71
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,22 @@ The format is roughly based on the output of `git-cliff` and this project adhere
1616
Since this is not a library, this changelog focuses on the changes that are relevant to the end-users. For a detailed list of changes, see the commit history, which adheres to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). New releases are created automatically when a new tag is pushed (Commit message: chore(release): vX.X.X).
1717
-->
1818

19-
## v1.0.0 - 2024-11-24
19+
## v1.0.0 - 2024-12-06
2020

2121
### 🚀 Features
2222

2323
- **UTM parameters**: Added support for UTM parameters. You can filter and search by UTM source, medium, campaign, content, and term. ([#13](https://github.com/explodingcamera/liwan/pull/13))
2424
- **New Date Ranges**: Fully reworked date ranges. Data is more accurate and consistent now, and you can move to the next or previous time range. Also includes some new time ranges like `Week to Date` and `All Time`. You can now also select a custom date range to view your data. ([97cdfce](https://github.com/explodingcamera/liwan/commit/97cdfce509ed2fd2fd74b23c73726a5e01b7b288), [391c580](https://github.com/explodingcamera/liwan/commit/391c580c926e2b4ca250e08bbe725210774d99b2))
2525
- **UI Improvements**: A lot of small improvements to the UI for better polish and usability.
2626
- **New Metrics**: Added new metrics: `Bounce Rate`, `Average Time on Page` ([97cdfce](https://github.com/explodingcamera/liwan/commit/97cdfce509ed2fd2fd74b23c73726a5e01b7b288))
27-
- **Favicons can be disabled**: You can now disable fetching favicons from DuckDuckGo (`config.toml` setting: `disable_favicons`) ([2100bfe](2100bfe6ba868b59d2b383220f22b0dbf23a6712))
27+
- **Favicons can be disabled**: You can now disable fetching favicons from DuckDuckGo (`config.toml` setting: `disable_favicons`) ([2100bfe](https://github.com/explodingcamera/liwan/commit/2100bfe6ba868b59d2b383220f22b0dbf23a6712))
28+
- **New Graphs**: Graphs are now custom-built using d3 directly to improve performance and flexibility. ([eb1415d](https://github.com/explodingcamera/liwan/commit/eb1415d6bdf6d3be9509b0b4fa743b6f112b2c0a))
2829

2930
### 🐛 Bug Fixes
3031

3132
- Fixed a potential panic when entities are not found in the database ([`31405a7`](https://github.com/explodingcamera/liwan/commit/31405a721dc5c5493098e211927281cca7816fec))
3233
- Fixed issues with the `Yesterday` Date Range ([`76278b57`](https://github.com/explodingcamera/liwan/commit/76278b579c5fe1557bf1c184542ed6ed2aba57cd))
34+
- Fixed issue with NaN values in the bounce rate metric ([eb1415d](https://github.com/explodingcamera/liwan/commit/eb1415d6bdf6d3be9509b0b4fa743b6f112b2c0a))
3335

3436
### Other
3537

Cargo.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

data/images/liwan-desktop-dark.png

-56.1 KB
Loading
-62.1 KB
Loading

data/images/liwan-desktop-full.png

-61.1 KB
Loading

data/images/liwan-desktop.png

-55.6 KB
Loading

data/licenses-npm.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

scripts/screenshot/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import captureWebsite from "capture-website";
22
import { join } from "node:path";
33

4+
const geoCardMargin = ".geocard { margin-bottom: 2rem !important; }";
5+
46
await captureWebsite.file(
57
"http://localhost:4321/p/public-project",
68
join(__dirname, "../../data/images/liwan-desktop.png"),
79
{
810
overwrite: true,
911
width: 1100,
10-
height: 1460,
12+
height: 1480,
1113
quality: 0.8,
14+
styles: [geoCardMargin],
1215
},
1316
);
1417

@@ -19,8 +22,9 @@ await captureWebsite.file(
1922
darkMode: true,
2023
overwrite: true,
2124
width: 1100,
22-
height: 1460,
25+
height: 1480,
2326
quality: 0.8,
27+
styles: [geoCardMargin],
2428
},
2529
);
2630

src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub fn handle_command(mut config: Config, cmd: Command) -> Result<()> {
133133
#[cfg(any(debug_assertions, test, feature = "_enable_seeding"))]
134134
Command::SeedDatabase(_) => {
135135
let app = Liwan::try_new(config)?;
136-
app.seed_database(1000000)?;
136+
app.seed_database(100000)?;
137137
println!("Database seeded with test data");
138138
}
139139
}

src/utils/seed.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ pub fn random_events(
4242
}
4343
generated += 1;
4444

45-
// let created_at = random_date(time_range.0, time_range.1, 0.5);
45+
let created_at = random_date(time_range.0, time_range.1, 0.5);
4646

47-
let time_slice = time_range.1 - time_range.0;
48-
let skew_factor = 2.0;
49-
let normalized = 1.0 - (1.0 - (generated as f64 / count as f64)).powf(skew_factor);
50-
let created_at = time_range.0 + time_slice * normalized;
47+
// let time_slice = time_range.1 - time_range.0;
48+
// let skew_factor = 2.0;
49+
// let normalized = 1.0 - (1.0 - (generated as f64 / count as f64)).powf(skew_factor);
50+
// let created_at = time_range.0 + time_slice * normalized;
5151

5252
let path = random_el(PATHS, 0.5);
5353
let referrer = random_el(REFERRERS, 0.5);
@@ -78,16 +78,16 @@ pub fn random_events(
7878
})
7979
}
8080

81-
// fn random_date(min: OffsetDateTime, max: OffsetDateTime, scale: f64) -> OffsetDateTime {
82-
// let mut rng = rand::thread_rng();
83-
// let uniform_random: f64 = rng.gen();
84-
// let weighted_random = (uniform_random.powf(1.0 - scale)).min(1.0);
85-
// let duration = max - min;
86-
// let duration_seconds = duration.as_seconds_f64();
87-
// let weighted_duration_seconds = duration_seconds * weighted_random;
88-
// let weighted_duration = time::Duration::seconds(weighted_duration_seconds as i64);
89-
// min + weighted_duration
90-
// }
81+
fn random_date(min: OffsetDateTime, max: OffsetDateTime, scale: f64) -> OffsetDateTime {
82+
let mut rng = rand::thread_rng();
83+
let uniform_random: f64 = rng.gen();
84+
let weighted_random = (uniform_random.powf(1.0 - scale)).min(1.0);
85+
let duration = max - min;
86+
let duration_seconds = duration.as_seconds_f64();
87+
let weighted_duration_seconds = duration_seconds * weighted_random;
88+
let weighted_duration = time::Duration::seconds(weighted_duration_seconds as i64);
89+
min + weighted_duration
90+
}
9191

9292
fn random_el<T>(slice: &[T], scale: f64) -> &T {
9393
let mut rng = rand::thread_rng();

0 commit comments

Comments
 (0)