Skip to content

Commit

Permalink
chore: run biome, cleanup repo
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
  • Loading branch information
explodingcamera committed Nov 24, 2024
1 parent 2100bfe commit 8bdfc46
Show file tree
Hide file tree
Showing 36 changed files with 84 additions and 77 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion .github/workflows/container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: ./scripts/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ The format is roughly based on the output of `git-cliff` and this project adhere
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).
-->

## [Unreleased]
## v1.0.0 - 2024-11-24

### 🚀 Features

- **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))
- **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.
- **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))
- **UI Improvements**: A lot of small improvements to the UI for better polish and usability.
- **New Metrics**: Added new metrics: `Bounce Rate`, `Average Time on Page`
- **New Metrics**: Added new metrics: `Bounce Rate`, `Average Time on Page` ([97cdfce](https://github.com/explodingcamera/liwan/commit/97cdfce509ed2fd2fd74b23c73726a5e01b7b288))
- **Favicons can be disabled**: You can now disable fetching favicons from DuckDuckGo (`config.toml` setting: `disable_favicons`) ([2100bfe](2100bfe6ba868b59d2b383220f22b0dbf23a6712))

### 🐛 Bug Fixes

- Fixed a potential panic when entities are not found in the database ([`31405a72`](https://github.com/explodingcamera/liwan/commit/31405a721dc5c5493098e211927281cca7816fec))
- Fixed a potential panic when entities are not found in the database ([`31405a7`](https://github.com/explodingcamera/liwan/commit/31405a721dc5c5493098e211927281cca7816fec))
- Fixed issues with the `Yesterday` Date Range ([`76278b57`](https://github.com/explodingcamera/liwan/commit/76278b579c5fe1557bf1c184542ed6ed2aba57cd))

### Other

- Removed Sessions and Average Views per Session metrics. They were not accurate and were removed to avoid confusion.
- Added more tests & improved API performance
- Updated dependencies
- Added more tests & improved API performance ([`95d95d0`](https://github.com/explodingcamera/liwan/commit/95d95d0f4670d20a6fa4fc6a7f4b17e4b1854391))

## **Liwan v0.1.1** - 2024-09-24

### ⚡ Performance

- **Database indexes**: Removed all unnecessary indexes to improve performance and reduce disk usage ([`6191a72f`](https://github.com/explodingcamera/liwan/commit/6191a72f08e8659237bc6c22139bde94432f66bb))
- **Database indexes**: Removed unnecessary indexes to improve performance and reduce disk usage ([`6191a72`](https://github.com/explodingcamera/liwan/commit/6191a72f08e8659237bc6c22139bde94432f66bb))

## **Liwan v0.1.0** - 2024-09-18

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ For commercial licensing options, contact [hi@liwan.dev](mailto:hi@liwan.dev).
- `data/spammers.txt` is in the public domain (see [matomo-org/referrer-spam-list](https://github.com/matomo-org/referrer-spam-list))
- `data/socials.txt` is based on [matomo-org/searchengine-and-social-list](https://github.com/matomo-org/searchengine-and-social-list) (available under the CC0 1.0 Universal Public Domain Dedication)
- `data/geo.json` is based on data from [Natural Earth](https://naturalearthdata.com/) (which itself is in the public domain)
- See [CONTRIBUTING](CONTRIBUTING.md) for more information on licensing of contributions from external contributors.
- See [CONTRIBUTING](.github/CONTRIBUTING.md) for more information on licensing of contributions from external contributors.
17 changes: 15 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"formatter": {
"indentStyle": "tab",
"indentWidth": 2,
Expand All @@ -11,6 +11,12 @@
"clientKind": "git",
"defaultBranch": "main"
},
"css": {
"parser": { "cssModules": true },
"formatter": {
"indentStyle": "space"
}
},
"linter": {
"rules": {
"suspicious": {
Expand All @@ -22,6 +28,13 @@
}
},
"files": {
"ignore": ["**/node_modules/*", "**/api/dashboard.ts"]
"ignore": [
"**/node_modules/*",
"**/dist/*",
"**/target/*",
"**/api/dashboard.ts",
"tracker/script.min.js",
"tracker/script.d.ts"
]
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion data/licenses-cargo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/licenses-npm.json

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ where
}
}

pub static DEFAULT_CONFIG: &str = include_str!("../config.example.toml");
pub static DEFAULT_CONFIG: &str = include_str!("../data/config.example.toml");

impl Config {
pub fn load(path: Option<String>) -> Result<Self> {
Expand Down
4 changes: 2 additions & 2 deletions web/astro.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from "astro/config";
import path from "node:path";
import react from "@astrojs/react";
import { defineConfig } from "astro/config";
import license from "rollup-plugin-license";
import path from "node:path";
const dirname = path.dirname(new URL(import.meta.url).pathname);

const proxy = {
Expand Down
4 changes: 2 additions & 2 deletions web/src/api/ranges.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "bun:test";
import { addDays, endOfDay, startOfDay, subDays } from "date-fns";
import { DateRange } from "./ranges";
import { describe, it, expect } from "bun:test";
import { startOfDay, endOfDay, addDays, subDays } from "date-fns";

describe("DateRange", () => {
it("should initialize with a range name", () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/api/ranges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import {
subYears,
} from "date-fns";

import type { GraphRange } from "../components/graph/graph";
import { formatDateRange } from "little-date";
import type { GraphRange } from "../components/graph/graph";

type DateRangeValue = { start: Date; end: Date };

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styles from "./card.module.css";
import { cls } from "../utils";
import styles from "./card.module.css";

export const CardButton = ({
active,
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/daterange/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useRef, useState } from "react";
import styles from "./daterange.module.css";
import { endOfDay, startOfDay, subWeeks } from "date-fns";
import { useRef, useState } from "react";
import { DateRange } from "../../api/ranges";
import { Dialog } from "../dialog";
import styles from "./daterange.module.css";

export const DatePickerRange = ({
onSelect,
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/dimensions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import styles from "./dimensions.module.css";

import { type Dimension, type DimensionTableRow, dimensionNames, metricNames, useDimension } from "../../api";

import { BrowserIcon, MobileDeviceIcon, OSIcon, ReferrerIcon } from "../icons";
import { useState } from "react";
import { cls, countryCodeToFlag, formatHost, formatPath, getHref, tryParseUrl } from "../../utils";
import { DetailsModal } from "./modal";
import { formatMetricVal } from "../../utils";
import { BrowserIcon, MobileDeviceIcon, OSIcon, ReferrerIcon } from "../icons";
import type { ProjectQuery } from "../project";
import { useState } from "react";
import { DetailsModal } from "./modal";

export const cardStyles = styles.card;

Expand Down
8 changes: 4 additions & 4 deletions web/src/components/dimensions/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ZoomInIcon } from "lucide-react";
import fuzzysort from "fuzzysort";
import { ZoomInIcon } from "lucide-react";
import styles from "./dimensions.module.css";

import { useDeferredValue, useMemo, useState } from "react";
import { DimensionLabel, DimensionValueBar } from ".";
import { type Dimension, type DimensionTableRow, dimensionNames, metricNames, useDimension } from "../../api";
import { cls, formatMetricVal } from "../../utils";
import { Dialog } from "../dialog";
import { DimensionLabel, DimensionValueBar } from ".";
import { dimensionNames, metricNames, useDimension, type Dimension, type DimensionTableRow } from "../../api";
import { useDeferredValue, useMemo, useState } from "react";
import type { ProjectQuery } from "../project";

export const DetailsModal = ({
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/graph/graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { useMemo } from "react";
import styles from "./graph.module.css";

import { ResponsiveLine, type SliceTooltipProps } from "@nivo/line";
import { useWindowSize } from "@uidotdev/usehooks";
import { addMonths } from "date-fns";
import type { DataPoint } from ".";
import { formatMetricVal } from "../../utils";
import { useWindowSize } from "@uidotdev/usehooks";
import type { DateRange } from "../../api/ranges";
import type { Metric } from "../../api";
import type { DateRange } from "../../api/ranges";
import { formatMetricVal } from "../../utils";

export type GraphRange = "year" | "month" | "day" | "hour";

Expand Down
2 changes: 2 additions & 0 deletions web/src/components/project.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
@media (max-width: 40rem) {
grid-column: span 1;
flex-direction: column;

.geoTable,
.geoMap {
width: 100%;
Expand All @@ -116,6 +117,7 @@
.geoTable {
padding: 1rem;
padding-top: 0;

> div {
padding: 0;
}
Expand Down
14 changes: 7 additions & 7 deletions web/src/components/project.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import styles from "./project.module.css";
import _map from "./worldmap.module.css";

import { Suspense, lazy, useEffect, useMemo, useState } from "react";
import { useLocalStorage } from "@uidotdev/usehooks";
import { Suspense, lazy, useEffect, useMemo, useState } from "react";

import { DateRange } from "../api/ranges";
import { metricNames, useDimension, useProject, useProjectData } from "../api";
import type { DimensionFilter, Metric, ProjectResponse, DimensionTableRow, Dimension } from "../api";
import type { Dimension, DimensionFilter, DimensionTableRow, Metric, ProjectResponse } from "../api";
import { DateRange } from "../api/ranges";

import { cls } from "../utils";
import { DimensionCard, DimensionDropdownCard, DimensionTabs, DimensionTabsCard, cardStyles } from "./dimensions";
import { LineGraph } from "./graph";
import { SelectRange } from "./project/range";
import { ProjectHeader } from "./project/project";
import { SelectMetrics } from "./project/metric";
import { SelectFilters } from "./project/filter";
import { DimensionCard, DimensionDropdownCard, DimensionTabs, DimensionTabsCard, cardStyles } from "./dimensions";
import { SelectMetrics } from "./project/metric";
import { ProjectHeader } from "./project/project";
import { SelectRange } from "./project/range";

const WorldMap = lazy(() => import("./worldmap").then((module) => ({ default: module.WorldMap })));

Expand Down
8 changes: 4 additions & 4 deletions web/src/components/project/filter.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import styles from "./filter.module.css";
import { SearchIcon, XIcon } from "lucide-react";
import styles from "./filter.module.css";

import { dimensionNames, filterNames, filterNamesInverted, type DimensionFilter, type FilterType } from "../../api";
import { type DimensionFilter, type FilterType, dimensionNames, filterNames, filterNamesInverted } from "../../api";

import { Dialog } from "../dialog";
import { capitalizeAll, cls } from "../../utils";
import { useRef, useState } from "react";
import { capitalizeAll, cls } from "../../utils";
import { Dialog } from "../dialog";

export const SelectFilters = ({
value,
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/project/metric.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styles from "./metric.module.css";
import { TrendingDownIcon, TrendingUpIcon } from "lucide-react";
import styles from "./metric.module.css";

import type { Metric, StatsResponse } from "../../api";
import { cls, formatMetricVal, formatPercent } from "../../utils";
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/project/project.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import styles from "./project.module.css";
import { CircleIcon, LockIcon } from "lucide-react";
import styles from "./project.module.css";

import { formatMetricVal } from "../../utils";
import type { ProjectResponse, StatsResponse } from "../../api";
import { formatMetricVal } from "../../utils";
import { CardLink } from "../card";

export const ProjectHeader = ({
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/project/range.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import styles from "./range.module.css";

import { useRef } from "react";
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
import { useRef } from "react";

import { endOfDay, startOfDay } from "date-fns";
import { api, useQuery } from "../../api";
import { DateRange, type RangeName, wellKnownRanges } from "../../api/ranges";
import { cls } from "../../utils";
import { Dialog } from "../dialog";
import { DatePickerRange } from "../daterange";
import { DateRange, wellKnownRanges, type RangeName } from "../../api/ranges";
import { api, useQuery } from "../../api";
import { endOfDay, startOfDay } from "date-fns";
import { Dialog } from "../dialog";

export const SelectRange = ({
onSelect,
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import styles from "./projects.module.css";
import { useLocalStorage } from "@uidotdev/usehooks";
import { ChevronDownIcon } from "lucide-react";

import * as Accordion from "@radix-ui/react-accordion";
import { type Metric, type ProjectResponse, api, metricNames, useMe, useProjectData, useQuery } from "../api";
import { DateRange } from "../api/ranges";
import { getUsername } from "../utils";
import { LineGraph } from "./graph";
import { SelectRange } from "./project/range";
import { SelectMetrics } from "./project/metric";
import { ProjectHeader } from "./project/project";
import * as Accordion from "@radix-ui/react-accordion";
import { SelectRange } from "./project/range";

const signedIn = getUsername();

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/settings/dialogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import {
useMutation,
useProjects,
} from "../../api";
import { createToast } from "../toast";
import { cls } from "../../utils";
import { createToast } from "../toast";

const toTitleCase = (str: string) => str[0].toUpperCase() + str.slice(1);

Expand Down
4 changes: 2 additions & 2 deletions web/src/components/settings/me.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import styles from "./me.module.css";
import { api, useMe, useMutation } from "../../api";
import { User2Icon } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { api, useMe, useMutation } from "../../api";
import { createToast } from "../toast";
import styles from "./me.module.css";

export const MyAccount = () => {
const formRef = useRef<HTMLFormElement>(null);
Expand Down
3 changes: 1 addition & 2 deletions web/src/components/settings/tables.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ details.edit summary + ul {
cursor: pointer;
margin: calc(var(--pico-form-element-spacing-vertical) * -0.5)
calc(var(--pico-form-element-spacing-horizontal) * -1);
padding: calc(var(--pico-form-element-spacing-vertical) * 0.5)
var(--pico-form-element-spacing-horizontal);
padding: calc(var(--pico-form-element-spacing-vertical) * 0.5) var(--pico-form-element-spacing-horizontal);
width: 100%;

align-items: center;
Expand Down
9 changes: 3 additions & 6 deletions web/src/components/tags.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
background-color: var(--pico-form-element-background-color);
color: var(--pico-color);
font-weight: var(--pico-font-weight);
transition: background-color var(--pico-transition),
color var(--pico-transition), box-shadow var(--pico-transition);
transition: background-color var(--pico-transition), color var(--pico-transition), box-shadow var(--pico-transition);
outline: 0;

margin-bottom: calc(var(--pico-spacing) + 1rem);
Expand All @@ -21,8 +20,7 @@
.react-tags.is-active {
--pico-border-color: var(--pico-form-element-focus-color);
--pico-outline-width: 0.0625rem;
--pico-box-shadow: 0 0 0 var(--pico-outline-width)
var(--pico-form-element-focus-color);
--pico-box-shadow: 0 0 0 var(--pico-outline-width) var(--pico-form-element-focus-color);
}

.react-tags.is-disabled {
Expand Down Expand Up @@ -163,8 +161,7 @@
}

.react-tags__listbox-option {
padding: calc(var(--pico-form-element-spacing-vertical) * 0.5)
var(--pico-form-element-spacing-horizontal);
padding: calc(var(--pico-form-element-spacing-vertical) * 0.5) var(--pico-form-element-spacing-horizontal);
}

.react-tags__listbox-option:hover {
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/userInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import styles from "./userInfo.module.css";

import { HelpCircle, LogOutIcon, SettingsIcon, SquareArrowOutUpRightIcon, UserIcon } from "lucide-react";
import { cls, getUsername } from "../utils";
import { api } from "../api";
import { cls, getUsername } from "../utils";

export const LoginButton = () => {
const username = getUsername();
Expand Down
6 changes: 1 addition & 5 deletions web/src/components/worldmap.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
transition: fill 0.3s, opacity 0.3s;
outline: none;

fill: hsl(
94,
calc(0% + 80% * var(--percent) * var(--percent)),
calc(40% + 4% * var(--percent))
);
fill: hsl(94, calc(0% + 80% * var(--percent) * var(--percent)), calc(40% + 4% * var(--percent)));

&:hover {
opacity: 0.8;
Expand Down
Loading

0 comments on commit 8bdfc46

Please sign in to comment.