Merge pull request #871 from cywio/remove-realtime-metrics

Remove comparison metrics from realtime header
This commit is contained in:
Mike Cao 2021-12-03 20:03:04 -08:00 committed by GitHub
commit e572049cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 695 additions and 175 deletions

View File

@ -4,7 +4,7 @@
"es2020": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:react/recommended", "prettier"],
"extends": ["eslint:recommended", "plugin:react/recommended", "prettier", "next"],
"parserOptions": {
"ecmaFeatures": {
"jsx": true

2
.gitignore vendored
View File

@ -25,7 +25,7 @@
.idea
*.iml
*.log
.vscode/*
/.vscode/
# debug
npm-debug.log*

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged

View File

@ -24,7 +24,7 @@ RUN yarn next telemetry disable
RUN yarn build
# Production image
FROM node:12.18-alpine AS production
FROM node:12.22-alpine AS production
WORKDIR /app
# Copy cached dependencies

View File

@ -18,7 +18,7 @@ import Bars from 'assets/bars.svg';
export default function Header() {
const user = useSelector(state => state.user);
const [active, setActive] = useState(false);
const { locale, dir } = useLocale();
const { dir } = useLocale();
function handleClick() {
setActive(state => !state);

View File

@ -15,7 +15,7 @@ export default function FilterTags({ params, onClick }) {
return null;
}
return (
<div className={styles.tag}>
<div key={key} className={styles.tag}>
<Button icon={<Times />} onClick={() => onClick(key)} variant="action" iconRight>
{`${key}: ${params[key]}`}
</Button>

View File

@ -9,6 +9,7 @@ const MetricCard = ({
label,
reverseColors = false,
format = formatNumber,
hideComparison = false,
}) => {
const props = useSpring({ x: Number(value) || 0, from: { x: 0 } });
const changeProps = useSpring({ x: Number(change) || 0, from: { x: 0 } });
@ -18,8 +19,8 @@ const MetricCard = ({
<animated.div className={styles.value}>{props.x.interpolate(x => format(x))}</animated.div>
<div className={styles.label}>
{label}
{~~change === 0 && <span className={styles.change}>{format(0)}</span>}
{~~change !== 0 && (
{~~change === 0 && !hideComparison && <span className={styles.change}>{format(0)}</span>}
{~~change !== 0 && !hideComparison && (
<animated.span
className={`${styles.change} ${
change >= 0

View File

@ -30,18 +30,22 @@ export default function RealtimeHeader({ websites, data, websiteId, onSelect })
<MetricCard
label={<FormattedMessage id="metrics.views" defaultMessage="Views" />}
value={pageviews.length}
hideComparison
/>
<MetricCard
label={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />}
value={sessions.length}
hideComparison
/>
<MetricCard
label={<FormattedMessage id="metrics.events" defaultMessage="Events" />}
value={events.length}
hideComparison
/>
<MetricCard
label={<FormattedMessage id="metrics.countries" defaultMessage="Countries" />}
value={countries.length}
hideComparison
/>
</div>
</>

View File

@ -427,7 +427,7 @@ export function getSessionMetrics(website_id, start_at, end_at, field, filters =
export function getPageviewMetrics(website_id, start_at, end_at, field, table, filters = {}) {
const params = [website_id, start_at, end_at];
const { domain, url, ref } = filters;
const { domain, url } = filters;
let domainFilter = '';
let urlFilter = '';

View File

@ -7,6 +7,9 @@ module.exports = {
FORCE_SSL: !!process.env.FORCE_SSL,
},
basePath: process.env.BASE_PATH,
eslint: {
ignoreDuringBuilds: true,
},
webpack(config) {
config.module.rules.push({
test: /\.svg$/,

View File

@ -1,6 +1,6 @@
{
"name": "umami",
"version": "1.24.0",
"version": "1.24.1",
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <mike@mikecao.com>",
"license": "MIT",
@ -35,7 +35,9 @@
"download-country-names": "node scripts/download-country-names.js",
"loadtest": "node scripts/loadtest.js",
"loadtest:medium": "node scripts/loadtest.js --weight=medium",
"loadtest:heavy": "node scripts/loadtest.js --weight=heavy --verbose"
"loadtest:heavy": "node scripts/loadtest.js --weight=heavy --verbose",
"lint": "next lint --quiet",
"prepare": "husky install"
},
"lint-staged": {
"**/*.js": [
@ -50,11 +52,6 @@
"prettier --write"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"dependencies": {
"@fontsource/inter": "4.5.0",
"@prisma/client": "2.29.1",
@ -107,14 +104,14 @@
"cross-env": "^7.0.3",
"del": "^6.0.0",
"dotenv-cli": "^4.0.0",
"eslint": "^8.1.0",
"eslint": "^7.32.0",
"eslint-config-next": "^12.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"extract-react-intl-messages": "^4.1.1",
"husky": "^7.0.4",
"husky": "^7.0.0",
"lint-staged": "^11.0.0",
"loadtest": "5.1.2",
"npm-run-all": "^4.1.5",
@ -129,7 +126,7 @@
"rollup": "^2.48.0",
"rollup-plugin-hashbang": "^2.2.2",
"rollup-plugin-terser": "^7.0.2",
"stylelint": "^14.0.1",
"stylelint": "^13.13.0",
"stylelint-config-css-modules": "^2.2.0",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended": "^5.0.0",

825
yarn.lock

File diff suppressed because it is too large Load Diff