Merge pull request #431 from mikecao/dev

v1.11.0
pull/435/head v1.11.0
Mike Cao 2021-01-14 00:38:05 -08:00 committed by GitHub
commit 0b8336f103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 500 additions and 339 deletions

View File

@ -1,11 +1,13 @@
import React, { useRef } from 'react'; import React, { useRef } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { useRouter } from 'next/router';
import Button from 'components/common/Button'; import Button from 'components/common/Button';
import FormLayout, { FormButtons, FormRow } from 'components/layout/FormLayout'; import FormLayout, { FormButtons, FormRow } from 'components/layout/FormLayout';
import CopyButton from 'components/common/CopyButton'; import CopyButton from 'components/common/CopyButton';
export default function TrackingCodeForm({ values, onClose }) { export default function TrackingCodeForm({ values, onClose }) {
const ref = useRef(); const ref = useRef();
const { basePath } = useRouter();
const { name, share_id } = values; const { name, share_id } = values;
return ( return (
@ -23,7 +25,9 @@ export default function TrackingCodeForm({ values, onClose }) {
rows={3} rows={3}
cols={60} cols={60}
spellCheck={false} spellCheck={false}
defaultValue={`${document.location.origin}/share/${share_id}/${encodeURIComponent(name)}`} defaultValue={`${
document.location.origin
}${basePath}/share/${share_id}/${encodeURIComponent(name)}`}
readOnly readOnly
/> />
</FormRow> </FormRow>

View File

@ -1,11 +1,13 @@
import React, { useRef } from 'react'; import React, { useRef } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { useRouter } from 'next/router';
import Button from 'components/common/Button'; import Button from 'components/common/Button';
import FormLayout, { FormButtons, FormRow } from 'components/layout/FormLayout'; import FormLayout, { FormButtons, FormRow } from 'components/layout/FormLayout';
import CopyButton from 'components/common/CopyButton'; import CopyButton from 'components/common/CopyButton';
export default function TrackingCodeForm({ values, onClose }) { export default function TrackingCodeForm({ values, onClose }) {
const ref = useRef(); const ref = useRef();
const { basePath } = useRouter();
return ( return (
<FormLayout> <FormLayout>
@ -22,7 +24,7 @@ export default function TrackingCodeForm({ values, onClose }) {
rows={3} rows={3}
cols={60} cols={60}
spellCheck={false} spellCheck={false}
defaultValue={`<script async defer data-website-id="${values.website_uuid}" src="${document.location.origin}/umami.js"></script>`} defaultValue={`<script async defer data-website-id="${values.website_uuid}" src="${document.location.origin}${basePath}/umami.js"></script>`}
readOnly readOnly
/> />
</FormRow> </FormRow>

View File

@ -18,13 +18,13 @@ export default function Header() {
<header className="container"> <header className="container">
{user?.is_admin && <UpdateNotice />} {user?.is_admin && <UpdateNotice />}
<div className={classNames(styles.header, 'row align-items-center')}> <div className={classNames(styles.header, 'row align-items-center')}>
<div className="col-12 col-md-12 col-lg-3"> <div className="col-6 col-lg-3 order-1 order-lg-1">
<div className={styles.title}> <div className={styles.title}>
<Icon icon={<Logo />} size="large" className={styles.logo} /> <Icon icon={<Logo />} size="large" className={styles.logo} />
<Link href={user ? '/' : 'https://umami.is'}>umami</Link> <Link href={user ? '/' : 'https://umami.is'}>umami</Link>
</div> </div>
</div> </div>
<div className="col-12 col-md-12 col-lg-6"> <div className="col-12 col-lg-6 order-3 order-lg-2">
{user && ( {user && (
<div className={styles.nav}> <div className={styles.nav}>
<Link href="/dashboard"> <Link href="/dashboard">
@ -39,7 +39,7 @@ export default function Header() {
</div> </div>
)} )}
</div> </div>
<div className="col-12 col-md-12 col-lg-3"> <div className="col-6 col-lg-3 order-2 order-lg-3">
<div className={styles.buttons}> <div className={styles.buttons}>
<ThemeButton /> <ThemeButton />
<LanguageButton menuAlign="right" /> <LanguageButton menuAlign="right" />

View File

@ -33,17 +33,15 @@
} }
@media only screen and (max-width: 992px) { @media only screen and (max-width: 992px) {
.title {
justify-content: center;
}
.nav { .nav {
font-size: var(--font-size-large); font-size: var(--font-size-large);
justify-content: center; justify-content: center;
padding: 20px 0; padding: 20px 0;
} }
}
.buttons { @media only screen and (max-width: 576px) {
justify-content: center; .header {
padding: 0 15px;
} }
} }

View File

@ -8,7 +8,7 @@ export default function Layout({ title, children, header = true, footer = true }
<> <>
<Head> <Head>
<title>umami{title && ` - ${title}`}</title> <title>umami{title && ` - ${title}`}</title>
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="favicon.ico" />
<link <link
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap"
rel="stylesheet" rel="stylesheet"

View File

@ -1,14 +1,16 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { useRouter } from 'next/router';
import { get } from 'lib/web'; import { get } from 'lib/web';
import { setShareToken } from 'redux/actions/app'; import { setShareToken } from 'redux/actions/app';
export default function useShareToken(shareId) { export default function useShareToken(shareId) {
const { basePath } = useRouter();
const dispatch = useDispatch(); const dispatch = useDispatch();
const shareToken = useSelector(state => state.app.shareToken); const shareToken = useSelector(state => state.app.shareToken);
async function loadToken(id) { async function loadToken(id) {
const { data } = await get(`/api/share/${id}`); const { data } = await get(`${basePath}/api/share/${id}`);
if (data) { if (data) {
dispatch(setShareToken(data)); dispatch(setShareToken(data));

View File

@ -1,6 +1,6 @@
{ {
"name": "umami", "name": "umami",
"version": "1.10.0", "version": "1.11.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ", "description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <mike@mikecao.com>", "author": "Mike Cao <mike@mikecao.com>",
"license": "MIT", "license": "MIT",
@ -13,7 +13,7 @@
"dev": "next dev", "dev": "next dev",
"build": "npm-run-all build-tracker build-lang build-geo build-db build-app", "build": "npm-run-all build-tracker build-lang build-geo build-db build-app",
"start": "next start", "start": "next start",
"start-env": "node scripts/start-env.js", "start-env": "node -r dotenv/config scripts/start-env.js",
"build-app": "next build", "build-app": "next build",
"build-tracker": "rollup -c rollup.tracker.config.js", "build-tracker": "rollup -c rollup.tracker.config.js",
"build-db": "npm-run-all copy-db-schema build-db-client", "build-db": "npm-run-all copy-db-schema build-db-client",
@ -56,7 +56,7 @@
} }
}, },
"dependencies": { "dependencies": {
"@prisma/client": "2.12.1", "@prisma/client": "2.14.0",
"@reduxjs/toolkit": "^1.5.0", "@reduxjs/toolkit": "^1.5.0",
"bcrypt": "^5.0.0", "bcrypt": "^5.0.0",
"chalk": "^4.1.0", "chalk": "^4.1.0",
@ -68,18 +68,18 @@
"date-fns-tz": "^1.0.12", "date-fns-tz": "^1.0.12",
"detect-browser": "^5.2.0", "detect-browser": "^5.2.0",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"formik": "^2.2.5", "formik": "^2.2.6",
"immer": "^8.0.0", "immer": "^8.0.0",
"is-localhost-ip": "^1.4.0", "is-localhost-ip": "^1.4.0",
"isbot-fast": "^1.2.0", "isbot-fast": "^1.2.0",
"jose": "2.0.3", "jose": "2.0.3",
"maxmind": "^4.3.1", "maxmind": "^4.3.1",
"moment-timezone": "^0.5.32", "moment-timezone": "^0.5.32",
"next": "^10.0.3", "next": "^10.0.5",
"prompts": "2.4.0", "prompts": "2.4.0",
"react": "^17.0.1", "react": "^17.0.1",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
"react-intl": "^5.10.6", "react-intl": "^5.10.16",
"react-redux": "^7.2.2", "react-redux": "^7.2.2",
"react-simple-maps": "^2.3.0", "react-simple-maps": "^2.3.0",
"react-spring": "^8.0.27", "react-spring": "^8.0.27",
@ -93,34 +93,34 @@
"thenby": "^1.3.4", "thenby": "^1.3.4",
"timezone-support": "^2.0.2", "timezone-support": "^2.0.2",
"tinycolor2": "^1.4.2", "tinycolor2": "^1.4.2",
"uuid": "^8.3.1" "uuid": "^8.3.2"
}, },
"devDependencies": { "devDependencies": {
"@formatjs/cli": "^2.13.15", "@formatjs/cli": "^2.13.16",
"@prisma/cli": "2.12.1", "@prisma/cli": "2.14.0",
"@rollup/plugin-buble": "^0.21.3", "@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-node-resolve": "^11.0.0", "@rollup/plugin-node-resolve": "^11.0.1",
"@rollup/plugin-replace": "^2.3.4", "@rollup/plugin-replace": "^2.3.4",
"@svgr/webpack": "^5.5.0", "@svgr/webpack": "^5.5.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"del": "^6.0.0", "del": "^6.0.0",
"dotenv-cli": "^4.0.0", "dotenv-cli": "^4.0.0",
"eslint": "^7.14.0", "eslint": "^7.17.0",
"eslint-config-prettier": "^6.15.0", "eslint-config-prettier": "^7.1.0",
"eslint-plugin-prettier": "^3.1.3", "eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.21.5", "eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react-hooks": "^4.2.0",
"extract-react-intl-messages": "^4.1.1", "extract-react-intl-messages": "^4.1.1",
"husky": "^4.3.0", "husky": "^4.3.7",
"lint-staged": "^10.5.2", "lint-staged": "^10.5.3",
"loadtest": "5.1.0", "loadtest": "5.1.2",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"postcss-flexbugs-fixes": "^5.0.2", "postcss-flexbugs-fixes": "^5.0.2",
"postcss-import": "^13.0.0", "postcss-import": "^13.0.0",
"postcss-preset-env": "^6.7.0", "postcss-preset-env": "^6.7.0",
"prettier": "^2.2.1", "prettier": "^2.2.1",
"prettier-eslint": "^12.0.0", "prettier-eslint": "^12.0.0",
"rollup": "^2.34.0", "rollup": "^2.36.1",
"rollup-plugin-hashbang": "^2.2.2", "rollup-plugin-hashbang": "^2.2.2",
"rollup-plugin-terser": "^7.0.2", "rollup-plugin-terser": "^7.0.2",
"stylelint": "^13.8.0", "stylelint": "^13.8.0",

View File

@ -29,11 +29,11 @@ export default function App({ Component, pageProps }) {
return ( return (
<Provider store={store}> <Provider store={store}>
<Head> <Head>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> <link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" /> <link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" /> <link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest" /> <link rel="manifest" href="site.webmanifest" />
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" /> <link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5" />
<meta name="msapplication-TileColor" content="#da532c" /> <meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#ffffff" /> <meta name="theme-color" content="#ffffff" />
</Head> </Head>

761
yarn.lock

File diff suppressed because it is too large Load Diff