Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Update date filter buttons.

Mike Cao080eb34d579c
diff --git a/package.json b/package.json
index 1ff1730d1..64e09463b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "umami",
- "version": "2.5.0",
+ "version": "2.6.0",
"description": "A simple, fast, privacy-focused alternative to Google Analytics.",
"author": "Mike Cao <[email protected]>",
"license": "MIT",
diff --git a/src/components/input/WebsiteDateFilter.js b/src/components/input/WebsiteDateFilter.js
index 5ab19e605..a8403db6c 100644
--- a/src/components/input/WebsiteDateFilter.js
+++ b/src/components/input/WebsiteDateFilter.js
@@ -8,7 +8,6 @@ import styles from './WebsiteDateFilter.module.css';
export function WebsiteDateFilter({ websiteId }) {
const [dateRange, setDateRange] = useDateRange(websiteId);
const { value, startDate, endDate, selectedUnit } = dateRange;
-
const isFutureDate =
value !== 'all' && isAfter(incrementDateRange(dateRange, -1).startDate, new Date());
@@ -21,24 +20,14 @@ export function WebsiteDateFilter({ websiteId }) {
};
return (
- <>
- <DateFilter
- className={styles.dropdown}
- value={value}
- startDate={startDate}
- endDate={endDate}
- selectedUnit={selectedUnit}
- onChange={handleChange}
- showAllTime={true}
- />
+ <Flexbox justifyContent="center" gap={10}>
{value !== 'all' && (
- <Flexbox justifyContent="center" gap={10} className={styles.container}>
+ <Flexbox justifyContent="center" className={styles.buttons}>
<Button onClick={() => handleIncrement(1)}>
<Icon rotate={90}>
<Icons.ChevronDown />
</Icon>
</Button>
-
<Button onClick={() => handleIncrement(-1)} disabled={isFutureDate}>
<Icon rotate={270}>
<Icons.ChevronDown />
@@ -46,7 +35,16 @@ export function WebsiteDateFilter({ websiteId }) {
</Button>
</Flexbox>
)}
- </>
+ <DateFilter
+ className={styles.dropdown}
+ value={value}
+ startDate={startDate}
+ endDate={endDate}
+ selectedUnit={selectedUnit}
+ onChange={handleChange}
+ showAllTime={true}
+ />
+ </Flexbox>
);
}
diff --git a/src/components/input/WebsiteDateFilter.module.css b/src/components/input/WebsiteDateFilter.module.css
index 13234c55c..986f5c178 100644
--- a/src/components/input/WebsiteDateFilter.module.css
+++ b/src/components/input/WebsiteDateFilter.module.css
@@ -1,3 +1,14 @@
.dropdown {
min-width: 200px;
}
+
+.buttons button:first-child {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+}
+
+.buttons button:last-child {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ border-left: 1px solid var(--base400) !important;
+}
diff --git a/src/components/layout/AppLayout.module.css b/src/components/layout/AppLayout.module.css
index be51f83cf..bcce963f0 100644
--- a/src/components/layout/AppLayout.module.css
+++ b/src/components/layout/AppLayout.module.css
@@ -10,7 +10,7 @@
width: 100vw;
grid-column: 1;
grid-row: 1 / 2;
- z-index: 1;
+ z-index: var(--z-index-popup);
}
.body {
diff --git a/src/components/metrics/FilterTags.js b/src/components/metrics/FilterTags.js
index 30857a6b9..cb88a7dba 100644
--- a/src/components/metrics/FilterTags.js
+++ b/src/components/metrics/FilterTags.js
@@ -1,8 +1,8 @@
import { safeDecodeURI } from 'next-basics';
import { Button, Icon, Icons, Text } from 'react-basics';
import usePageQuery from 'components/hooks/usePageQuery';
-import styles from './FilterTags.module.css';
import useMessages from 'components/hooks/useMessages';
+import styles from './FilterTags.module.css';
export function FilterTags({ params }) {
const { formatMessage, labels } = useMessages();
@@ -26,6 +26,7 @@ export function FilterTags({ params }) {
return (
<div className={styles.filters}>
+ <div className={styles.label}>{formatMessage(labels.filters)}</div>
{Object.keys(params).map(key => {
if (!params[key]) {
return null;
diff --git a/src/components/metrics/FilterTags.module.css b/src/components/metrics/FilterTags.module.css
index 1c8458acd..c228dc4e4 100644
--- a/src/components/metrics/FilterTags.module.css
+++ b/src/components/metrics/FilterTags.module.css
@@ -4,19 +4,23 @@
gap: 10px;
}
+.label {
+ font-weight: 700;
+}
+
.tag {
display: flex;
flex-direction: row;
align-items: center;
gap: 10px;
font-size: var(--font-size-sm);
- border: 1px solid var(--base600);
+ border: 1px solid var(--blue400);
border-radius: var(--border-radius);
- line-height: 30px;
- padding: 0 8px;
+ padding: 8px 16px;
cursor: pointer;
+ background: var(--blue100);
}
.tag:hover {
- background: var(--base75);
+ background: var(--blue200);
}
diff --git a/src/components/pages/websites/WebsiteDetailsPage.js b/src/components/pages/websites/WebsiteDetailsPage.js
index c5ac47758..222d94d9e 100644
--- a/src/components/pages/websites/WebsiteDetailsPage.js
+++ b/src/components/pages/websites/WebsiteDetailsPage.js
@@ -22,12 +22,12 @@ export default function WebsiteDetailsPage({ websiteId }) {
return (
<Page loading={isLoading} error={error}>
<WebsiteHeader websiteId={websiteId} showLinks={showLinks} />
- <WebsiteMetricsBar websiteId={websiteId} sticky={true} />
- <WebsiteChart websiteId={websiteId} />
<FilterTags
websiteId={websiteId}
params={{ url, referrer, os, browser, device, country, region, city, title }}
/>
+ <WebsiteMetricsBar websiteId={websiteId} sticky={true} />
+ <WebsiteChart websiteId={websiteId} />
{!website && <Loading icon="dots" style={{ minHeight: 300 }} />}
{website && (
<>
diff --git a/src/components/pages/websites/WebsiteMetricsBar.js b/src/components/pages/websites/WebsiteMetricsBar.js
index 41ae859f5..0d1a20f0b 100644
--- a/src/components/pages/websites/WebsiteMetricsBar.js
+++ b/src/components/pages/websites/WebsiteMetricsBar.js
@@ -10,7 +10,7 @@ import { formatShortTime } from 'lib/format';
import { Button, Column, Icon, Icons, Popup, PopupTrigger, Row } from 'react-basics';
import styles from './WebsiteMetricsBar.module.css';
-export function WebsiteMetricsBar({ websiteId, showFilter = true, sticky }) {
+export function WebsiteMetricsBar({ websiteId, showFilter = true, showRefresh = true, sticky }) {
const { formatMessage, labels } = useMessages();
const { get, useQuery } = useApi();
@@ -161,8 +161,8 @@ export function WebsiteMetricsBar({ websiteId, showFilter = true, sticky }) {
<Column defaultSize={12} xl={4}>
<div className={styles.actions}>
{showFilter && <WebsiteFilterButton />}
+ {showRefresh && <RefreshButton websiteId={websiteId} />}
<WebsiteDateFilter websiteId={websiteId} />
- <RefreshButton websiteId={websiteId} />
</div>
</Column>
</Row>