Merge branch 'dev' into bh/unregister

This commit is contained in:
Bartosz Hernas 2020-09-18 11:33:30 +02:00
commit 17b4f51ebe
78 changed files with 799 additions and 548 deletions

View File

@ -1,5 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { useRouter } from 'next/router';
import classNames from 'classnames'; import classNames from 'classnames';
import WebsiteChart from 'components/metrics/WebsiteChart'; import WebsiteChart from 'components/metrics/WebsiteChart';
import WorldMap from 'components/common/WorldMap'; import WorldMap from 'components/common/WorldMap';
@ -19,12 +20,29 @@ import EventsChart from './metrics/EventsChart';
import useFetch from 'hooks/useFetch'; import useFetch from 'hooks/useFetch';
import Loading from 'components/common/Loading'; import Loading from 'components/common/Loading';
export default function WebsiteDetails({ websiteId }) { const views = {
const { data } = useFetch(`/api/website/${websiteId}`); url: PagesTable,
referrer: ReferrersTable,
browser: BrowsersTable,
os: OSTable,
device: DevicesTable,
country: CountriesTable,
event: EventsTable,
};
export default function WebsiteDetails({ websiteId, token }) {
const router = useRouter();
const { data } = useFetch(`/api/website/${websiteId}`, { token });
const [chartLoaded, setChartLoaded] = useState(false); const [chartLoaded, setChartLoaded] = useState(false);
const [countryData, setCountryData] = useState(); const [countryData, setCountryData] = useState();
const [eventsData, setEventsData] = useState(); const [eventsData, setEventsData] = useState();
const [expand, setExpand] = useState(); const {
query: { id, view },
basePath,
asPath,
} = router;
const path = `${basePath}/${asPath.split('/')[1]}/${id.join('/')}`;
const BackButton = () => ( const BackButton = () => (
<Button <Button
@ -32,7 +50,7 @@ export default function WebsiteDetails({ websiteId }) {
className={styles.backButton} className={styles.backButton}
icon={<Arrow />} icon={<Arrow />}
size="xsmall" size="xsmall"
onClick={() => setExpand(null)} onClick={() => router.push(path)}
> >
<div> <div>
<FormattedMessage id="button.back" defaultMessage="Back" /> <FormattedMessage id="button.back" defaultMessage="Back" />
@ -46,53 +64,43 @@ export default function WebsiteDetails({ websiteId }) {
}, },
{ {
label: <FormattedMessage id="metrics.pages" defaultMessage="Pages" />, label: <FormattedMessage id="metrics.pages" defaultMessage="Pages" />,
value: 'url', value: `${path}?view=url`,
component: PagesTable,
}, },
{ {
label: <FormattedMessage id="metrics.referrers" defaultMessage="Referrers" />, label: <FormattedMessage id="metrics.referrers" defaultMessage="Referrers" />,
value: 'referrer', value: `${path}?view=referrer`,
component: ReferrersTable,
}, },
{ {
label: <FormattedMessage id="metrics.browsers" defaultMessage="Browsers" />, label: <FormattedMessage id="metrics.browsers" defaultMessage="Browsers" />,
value: 'browser', value: `${path}?view=browser`,
component: BrowsersTable,
}, },
{ {
label: <FormattedMessage id="metrics.operating-systems" defaultMessage="Operating system" />, label: <FormattedMessage id="metrics.operating-systems" defaultMessage="Operating system" />,
value: 'os', value: `${path}?view=os`,
component: OSTable,
}, },
{ {
label: <FormattedMessage id="metrics.devices" defaultMessage="Devices" />, label: <FormattedMessage id="metrics.devices" defaultMessage="Devices" />,
value: 'device', value: `${path}?view=device`,
component: DevicesTable,
}, },
{ {
label: <FormattedMessage id="metrics.countries" defaultMessage="Countries" />, label: <FormattedMessage id="metrics.countries" defaultMessage="Countries" />,
value: 'country', value: `${path}?view=country`,
component: CountriesTable,
}, },
{ {
label: <FormattedMessage id="metrics.events" defaultMessage="Events" />, label: <FormattedMessage id="metrics.events" defaultMessage="Events" />,
value: 'event', value: `${path}?view=event`,
component: EventsTable,
}, },
]; ];
const tableProps = { const tableProps = {
websiteId, websiteId,
token,
websiteDomain: data?.domain, websiteDomain: data?.domain,
limit: 10, limit: 10,
onExpand: handleExpand, onExpand: handleExpand,
}; };
const DetailsComponent = expand?.component; const DetailsComponent = views[view];
function getSelectedMenuOption(value) {
return menuOptions.find(e => e.value === value);
}
function handleDataLoad() { function handleDataLoad() {
if (!chartLoaded) { if (!chartLoaded) {
@ -101,11 +109,7 @@ export default function WebsiteDetails({ websiteId }) {
} }
function handleExpand(value) { function handleExpand(value) {
setExpand(getSelectedMenuOption(value)); router.push(`${path}?view=${value}`);
}
function handleMenuSelect(value) {
setExpand(getSelectedMenuOption(value));
} }
if (!data) { if (!data) {
@ -118,6 +122,7 @@ export default function WebsiteDetails({ websiteId }) {
<div className={classNames(styles.chart, 'col')}> <div className={classNames(styles.chart, 'col')}>
<WebsiteChart <WebsiteChart
websiteId={websiteId} websiteId={websiteId}
token={token}
title={data.name} title={data.name}
onDataLoad={handleDataLoad} onDataLoad={handleDataLoad}
showLink={false} showLink={false}
@ -126,7 +131,7 @@ export default function WebsiteDetails({ websiteId }) {
</div> </div>
</div> </div>
{!chartLoaded && <Loading />} {!chartLoaded && <Loading />}
{chartLoaded && !expand && ( {chartLoaded && !view && (
<> <>
<div className={classNames(styles.row, 'row')}> <div className={classNames(styles.row, 'row')}>
<div className="col-md-12 col-lg-6"> <div className="col-md-12 col-lg-6">
@ -162,19 +167,17 @@ export default function WebsiteDetails({ websiteId }) {
<EventsTable {...tableProps} onDataLoad={setEventsData} /> <EventsTable {...tableProps} onDataLoad={setEventsData} />
</div> </div>
<div className="col-12 col-md-12 col-lg-8 pt-5 pb-5"> <div className="col-12 col-md-12 col-lg-8 pt-5 pb-5">
<EventsChart websiteId={websiteId} /> <EventsChart websiteId={websiteId} token={token} />
</div> </div>
</div> </div>
</> </>
)} )}
{expand && ( {view && (
<MenuLayout <MenuLayout
className={styles.expand} className={styles.view}
menuClassName={styles.menu} menuClassName={styles.menu}
optionClassName={styles.option} contentClassName={styles.content}
menu={menuOptions} menu={menuOptions}
selectedOption={expand.value}
onMenuSelect={handleMenuSelect}
> >
<DetailsComponent {...tableProps} limit={false} /> <DetailsComponent {...tableProps} limit={false} />
</MenuLayout> </MenuLayout>

View File

@ -2,7 +2,7 @@
margin-bottom: 30px; margin-bottom: 30px;
} }
.expand { .view {
border-top: 1px solid var(--gray300); border-top: 1px solid var(--gray300);
} }
@ -10,8 +10,8 @@
font-size: var(--font-size-small); font-size: var(--font-size-small);
} }
.menu .option { .content {
font-size: var(--font-size-small); min-height: 600px;
} }
.backButton { .backButton {

View File

@ -11,7 +11,7 @@ import styles from './WebsiteList.module.css';
export default function WebsiteList({ userId }) { export default function WebsiteList({ userId }) {
const router = useRouter(); const router = useRouter();
const { data } = useFetch('/api/websites', { userId }); const { data } = useFetch('/api/websites', { user_id: userId });
if (!data) { if (!data) {
return null; return null;
@ -28,17 +28,14 @@ export default function WebsiteList({ userId }) {
<EmptyPlaceholder <EmptyPlaceholder
msg={ msg={
<FormattedMessage <FormattedMessage
id="placeholder.message.no-websites-configured" id="message.no-websites-configured"
defaultMessage="You don't have any websites configured." defaultMessage="You don't have any websites configured."
/> />
} }
> >
<Button icon={<Arrow />} size="medium" onClick={() => router.push('/settings')}> <Button icon={<Arrow />} size="medium" onClick={() => router.push('/settings')}>
<div> <div>
<FormattedMessage <FormattedMessage id="message.go-to-settings" defaultMessage="Go to settings" />
id="placeholder.message.go-to-settings"
defaultMessage="Go to settings"
/>
</div> </div>
</Button> </Button>
</EmptyPlaceholder> </EmptyPlaceholder>

View File

@ -70,34 +70,36 @@ export default function Calendar({ date, minDate, maxDate, onChange }) {
<Icon className={styles.icon} icon={selectYear ? <Cross /> : <Chevron />} size="small" /> <Icon className={styles.icon} icon={selectYear ? <Cross /> : <Chevron />} size="small" />
</div> </div>
</div> </div>
{!selectMonth && !selectYear && ( <div className={styles.body}>
<DaySelector {!selectMonth && !selectYear && (
date={date} <DaySelector
minDate={minDate} date={date}
maxDate={maxDate} minDate={minDate}
locale={locale} maxDate={maxDate}
onSelect={handleChange} locale={locale}
/> onSelect={handleChange}
)} />
{selectMonth && ( )}
<MonthSelector {selectMonth && (
date={date} <MonthSelector
minDate={minDate} date={date}
maxDate={maxDate} minDate={minDate}
locale={locale} maxDate={maxDate}
onSelect={handleChange} locale={locale}
onClose={toggleMonthSelect} onSelect={handleChange}
/> onClose={toggleMonthSelect}
)} />
{selectYear && ( )}
<YearSelector {selectYear && (
date={date} <YearSelector
minDate={minDate} date={date}
maxDate={maxDate} minDate={minDate}
onSelect={handleChange} maxDate={maxDate}
onClose={toggleYearSelect} onSelect={handleChange}
/> onClose={toggleYearSelect}
)} />
)}
</div>
</div> </div>
); );
} }
@ -220,42 +222,46 @@ const YearSelector = ({ date, minDate, maxDate, onSelect }) => {
return ( return (
<div className={styles.pager}> <div className={styles.pager}>
<Button <div className={styles.left}>
icon={<Chevron />} <Button
size="small" icon={<Chevron />}
className={styles.left} size="small"
onClick={handlePrevClick} onClick={handlePrevClick}
disabled={years[0] <= minYear} disabled={years[0] <= minYear}
variant="light" variant="light"
/> />
<table> </div>
<tbody> <div className={styles.middle}>
{chunk(years, 5).map((row, i) => ( <table>
<tr key={i}> <tbody>
{row.map((n, j) => ( {chunk(years, 5).map((row, i) => (
<td <tr key={i}>
key={j} {row.map((n, j) => (
className={classNames({ <td
[styles.selected]: n === year, key={j}
[styles.disabled]: n < minYear || n > maxYear, className={classNames({
})} [styles.selected]: n === year,
onClick={() => (n < minYear || n > maxYear ? null : handleSelect(n))} [styles.disabled]: n < minYear || n > maxYear,
> })}
{n} onClick={() => (n < minYear || n > maxYear ? null : handleSelect(n))}
</td> >
))} {n}
</tr> </td>
))} ))}
</tbody> </tr>
</table> ))}
<Button </tbody>
icon={<Chevron />} </table>
size="small" </div>
className={styles.right} <div className={styles.right}>
onClick={handleNextClick} <Button
disabled={years[years.length - 1] > maxYear} icon={<Chevron />}
variant="light" size="small"
/> onClick={handleNextClick}
disabled={years[years.length - 1] > maxYear}
variant="light"
/>
</div>
</div> </div>
); );
}; };

View File

@ -3,11 +3,11 @@
flex-direction: column; flex-direction: column;
font-size: var(--font-size-small); font-size: var(--font-size-small);
flex: 1; flex: 1;
min-height: 285px; min-height: 306px;
} }
.calendar table { .calendar table {
flex: 1; width: 100%;
border-spacing: 5px; border-spacing: 5px;
} }
@ -64,18 +64,34 @@
font-size: var(--font-size-normal); font-size: var(--font-size-normal);
} }
.body {
display: flex;
}
.selector { .selector {
cursor: pointer; cursor: pointer;
} }
.pager { .pager {
display: flex; display: flex;
flex: 1;
} }
.pager button { .pager button {
align-self: center; align-self: center;
} }
.middle {
flex: 1;
}
.left,
.right {
display: flex;
justify-content: center;
align-items: center;
}
.left svg { .left svg {
transform: rotate(90deg); transform: rotate(90deg);
} }

View File

@ -1,6 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { endOfYear } from 'date-fns'; import { endOfYear, isSameDay } from 'date-fns';
import Modal from './Modal'; import Modal from './Modal';
import DropDown from './DropDown'; import DropDown from './DropDown';
import DatePickerForm from 'components/forms/DatePickerForm'; import DatePickerForm from 'components/forms/DatePickerForm';
@ -112,7 +112,8 @@ const CustomRange = ({ startDate, endDate, onClick }) => {
return ( return (
<> <>
<Icon icon={<Calendar />} className="mr-2" onClick={handleClick} /> <Icon icon={<Calendar />} className="mr-2" onClick={handleClick} />
{`${dateFormat(startDate, 'd LLL y', locale)}${dateFormat(endDate, 'd LLL y', locale)}`} {dateFormat(startDate, 'd LLL y', locale)}
{!isSameDay(startDate, endDate) && `${dateFormat(endDate, 'd LLL y', locale)}`}
</> </>
); );
}; };

View File

@ -1,12 +1,13 @@
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
import Head from 'next/head'; import Head from 'next/head';
import Globe from 'assets/globe.svg';
import useDocumentClick from 'hooks/useDocumentClick';
import Menu from './Menu'; import Menu from './Menu';
import Button from './Button'; import Button from './Button';
import { menuOptions } from 'lib/lang'; import { menuOptions } from 'lib/lang';
import { setItem } from 'lib/web';
import useLocale from 'hooks/useLocale';
import useDocumentClick from 'hooks/useDocumentClick';
import Globe from 'assets/globe.svg';
import styles from './LanguageButton.module.css'; import styles from './LanguageButton.module.css';
import useLocale from '../../hooks/useLocale';
export default function LanguageButton({ menuPosition = 'bottom', menuAlign = 'left' }) { export default function LanguageButton({ menuPosition = 'bottom', menuAlign = 'left' }) {
const [showMenu, setShowMenu] = useState(false); const [showMenu, setShowMenu] = useState(false);
@ -16,7 +17,7 @@ export default function LanguageButton({ menuPosition = 'bottom', menuAlign = 'l
function handleSelect(value) { function handleSelect(value) {
setLocale(value); setLocale(value);
window.localStorage.setItem('locale', value); setItem('umami.locale', value);
setShowMenu(false); setShowMenu(false);
} }

View File

@ -0,0 +1,32 @@
import React from 'react';
import { useRouter } from 'next/router';
import classNames from 'classnames';
import styles from './NavMenu.module.css';
export default function NavMenu({ options = [], className, onSelect = () => {} }) {
const router = useRouter();
return (
<div className={classNames(styles.menu, className)}>
{options
.filter(({ hidden }) => !hidden)
.map(option => {
const { label, value, className: customClassName, render } = option;
return render ? (
render(option)
) : (
<div
key={value}
className={classNames(styles.option, customClassName, {
[styles.selected]: router.asPath === value,
})}
onClick={e => onSelect(value, e)}
>
{label}
</div>
);
})}
</div>
);
}

View File

@ -0,0 +1,20 @@
.menu {
border: 1px solid var(--gray500);
border-radius: 4px;
overflow: hidden;
z-index: 2;
}
.option {
padding: 8px 16px;
cursor: pointer;
border-radius: 4px;
}
.option:hover {
background: var(--gray75);
}
.selected {
font-weight: 600;
}

View File

@ -5,7 +5,7 @@ import { setDateRange } from 'redux/actions/websites';
import Button from './Button'; import Button from './Button';
import Refresh from 'assets/redo.svg'; import Refresh from 'assets/redo.svg';
import Dots from 'assets/ellipsis-h.svg'; import Dots from 'assets/ellipsis-h.svg';
import { useDateRange } from 'hooks/useDateRange'; import useDateRange from 'hooks/useDateRange';
import { getDateRange } from '../../lib/date'; import { getDateRange } from '../../lib/date';
export default function RefreshButton({ websiteId }) { export default function RefreshButton({ websiteId }) {

View File

@ -27,6 +27,7 @@ export default function UserButton() {
value: 'username', value: 'username',
className: styles.username, className: styles.username,
}, },
{ label: <FormattedMessage id="label.profile" defaultMessage="Profile" />, value: 'profile' },
{ label: <FormattedMessage id="label.logout" defaultMessage="Logout" />, value: 'logout' }, { label: <FormattedMessage id="label.logout" defaultMessage="Logout" />, value: 'logout' },
]; ];
@ -35,6 +36,8 @@ export default function UserButton() {
if (value === 'logout') { if (value === 'logout') {
router.push('/logout'); router.push('/logout');
} else if (value === 'profile') {
router.push('/settings/profile');
} }
} }

View File

@ -1,11 +1,15 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { isAfter } from 'date-fns'; import { isAfter, isBefore, isSameDay } from 'date-fns';
import Calendar from 'components/common/Calendar'; import Calendar from 'components/common/Calendar';
import Button from 'components/common/Button'; import Button from 'components/common/Button';
import { FormButtons } from 'components/layout/FormLayout'; import { FormButtons } from 'components/layout/FormLayout';
import { getDateRangeValues } from 'lib/date'; import { getDateRangeValues } from 'lib/date';
import styles from './DatePickerForm.module.css'; import styles from './DatePickerForm.module.css';
import ButtonGroup from '../common/ButtonGroup';
const FILTER_DAY = 0;
const FILTER_RANGE = 1;
export default function DatePickerForm({ export default function DatePickerForm({
startDate: defaultStartDate, startDate: defaultStartDate,
@ -15,21 +19,59 @@ export default function DatePickerForm({
onChange, onChange,
onClose, onClose,
}) { }) {
const [selected, setSelected] = useState(
isSameDay(defaultStartDate, defaultEndDate) ? FILTER_DAY : FILTER_RANGE,
);
const [date, setDate] = useState(defaultStartDate);
const [startDate, setStartDate] = useState(defaultStartDate); const [startDate, setStartDate] = useState(defaultStartDate);
const [endDate, setEndDate] = useState(defaultEndDate); const [endDate, setEndDate] = useState(defaultEndDate);
const disabled =
selected === FILTER_DAY
? isAfter(minDate, date) && isBefore(maxDate, date)
: isAfter(startDate, endDate);
const buttons = [
{
label: <FormattedMessage id="button.single-day" defaultMessage="Single day" />,
value: FILTER_DAY,
},
{
label: <FormattedMessage id="button.date-range" defaultMessage="Date range" />,
value: FILTER_RANGE,
},
];
function handleSave() { function handleSave() {
onChange({ ...getDateRangeValues(startDate, endDate), value: 'custom' }); if (selected === FILTER_DAY) {
onChange({ ...getDateRangeValues(date, date), value: 'custom' });
} else {
onChange({ ...getDateRangeValues(startDate, endDate), value: 'custom' });
}
} }
return ( return (
<div className={styles.container}> <div className={styles.container}>
<div className={styles.filter}>
<ButtonGroup size="small" items={buttons} selectedItem={selected} onClick={setSelected} />
</div>
<div className={styles.calendars}> <div className={styles.calendars}>
<Calendar date={startDate} minDate={minDate} maxDate={endDate} onChange={setStartDate} /> {selected === FILTER_DAY ? (
<Calendar date={endDate} minDate={startDate} maxDate={maxDate} onChange={setEndDate} /> <Calendar date={date} minDate={minDate} maxDate={maxDate} onChange={setDate} />
) : (
<>
<Calendar
date={startDate}
minDate={minDate}
maxDate={endDate}
onChange={setStartDate}
/>
<Calendar date={endDate} minDate={startDate} maxDate={maxDate} onChange={setEndDate} />
</>
)}
</div> </div>
<FormButtons> <FormButtons>
<Button variant="action" onClick={handleSave} disabled={isAfter(startDate, endDate)}> <Button variant="action" onClick={handleSave} disabled={disabled}>
<FormattedMessage id="button.save" defaultMessage="Save" /> <FormattedMessage id="button.save" defaultMessage="Save" />
</Button> </Button>
<Button onClick={onClose}> <Button onClick={onClose}>

View File

@ -1,25 +1,40 @@
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 800px;
max-width: 100vw; max-width: 100vw;
} }
.calendars { .calendars {
display: flex; display: flex;
justify-content: center;
} }
.calendars > div:first-child { .calendars > div {
padding-right: 20px; width: 380px;
border-right: 1px solid var(--gray300);
} }
.calendars > div:last-child { .calendars > div + div {
margin-left: 20px;
padding-left: 20px; padding-left: 20px;
border-left: 1px solid var(--gray300);
}
.filter {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 20px;
} }
@media only screen and (max-width: 768px) { @media only screen and (max-width: 768px) {
.calendars { .calendars {
flex-direction: column; flex-direction: column;
} }
.calendars > div + div {
padding: 0;
margin-left: 0;
margin-top: 20px;
border: 0;
}
} }

View File

@ -11,7 +11,7 @@ export default function Footer() {
<div /> <div />
<div> <div>
<FormattedMessage <FormattedMessage
id="footer.powered-by" id="message.powered-by"
defaultMessage="Powered by {name}" defaultMessage="Powered by {name}"
values={{ values={{
name: ( name: (

View File

@ -26,10 +26,10 @@ export default function Header() {
{user ? ( {user ? (
<> <>
<Link href="/dashboard"> <Link href="/dashboard">
<FormattedMessage id="header.nav.dashboard" defaultMessage="Dashboard" /> <FormattedMessage id="label.dashboard" defaultMessage="Dashboard" />
</Link> </Link>
<Link href="/settings"> <Link href="/settings">
<FormattedMessage id="header.nav.settings" defaultMessage="Settings" /> <FormattedMessage id="label.settings" defaultMessage="Settings" />
</Link> </Link>
<LanguageButton menuAlign="right" /> <LanguageButton menuAlign="right" />
<UserButton /> <UserButton />

View File

@ -1,29 +1,37 @@
import React from 'react'; import React from 'react';
import { useRouter } from 'next/router';
import classNames from 'classnames'; import classNames from 'classnames';
import Menu from 'components/common/Menu'; import NavMenu from 'components/common/NavMenu';
import styles from './MenuLayout.module.css'; import styles from './MenuLayout.module.css';
export default function MenuLayout({ export default function MenuLayout({
menu, menu,
selectedOption, selectedOption,
onMenuSelect,
className, className,
menuClassName, menuClassName,
contentClassName, contentClassName,
optionClassName,
children, children,
replace = false,
}) { }) {
const router = useRouter();
function handleSelect(url) {
if (replace) {
router.replace(url);
} else {
router.push(url);
}
}
return ( return (
<div className={classNames(styles.container, className, 'row')}> <div className={classNames(styles.container, className, 'row')}>
<Menu <NavMenu
options={menu} options={menu}
selectedOption={selectedOption} selectedOption={selectedOption}
className={classNames(styles.menu, menuClassName, 'col-12 col-lg-3')} className={classNames(styles.menu, menuClassName, 'col-12 col-lg-2')}
selectedClassName={styles.selected} onSelect={handleSelect}
optionClassName={classNames(styles.option, optionClassName)}
onSelect={onMenuSelect}
/> />
<div className={classNames(styles.content, contentClassName, 'col-12 col-lg-9')}> <div className={classNames(styles.content, contentClassName, 'col-12 col-lg-10')}>
{children} {children}
</div> </div>
</div> </div>

View File

@ -10,25 +10,11 @@
} }
.container .content { .container .content {
flex: 1;
position: relative; position: relative;
border-left: 1px solid var(--gray300); border-left: 1px solid var(--gray300);
padding-left: 30px; padding-left: 30px;
} margin-left: 30px;
.option {
font-size: var(--font-size-normal);
padding: 8px 16px;
cursor: pointer;
margin-right: 30px;
border-radius: 4px;
}
.option:hover {
background: var(--gray75);
}
.selected {
font-weight: 600;
} }
@media only screen and (max-width: 992px) { @media only screen and (max-width: 992px) {
@ -40,5 +26,6 @@
border-top: 1px solid var(--gray300); border-top: 1px solid var(--gray300);
border-left: 0; border-left: 0;
padding-left: 0; padding-left: 0;
margin-left: 0;
} }
} }

View File

@ -6,10 +6,10 @@ export const labels = defineMessages({
}); });
export const devices = defineMessages({ export const devices = defineMessages({
desktop: { id: 'device.desktop', defaultMessage: 'Desktop' }, desktop: { id: 'metrics.device.desktop', defaultMessage: 'Desktop' },
laptop: { id: 'device.laptop', defaultMessage: 'Laptop' }, laptop: { id: 'metrics.device.laptop', defaultMessage: 'Laptop' },
tablet: { id: 'device.tablet', defaultMessage: 'Tablet' }, tablet: { id: 'metrics.device.tablet', defaultMessage: 'Tablet' },
mobile: { id: 'device.mobile', defaultMessage: 'Mobile' }, mobile: { id: 'metrics.device.mobile', defaultMessage: 'Mobile' },
}); });
export function getDeviceMessage(device) { export function getDeviceMessage(device) {

View File

@ -4,8 +4,8 @@ import useFetch from 'hooks/useFetch';
import styles from './ActiveUsers.module.css'; import styles from './ActiveUsers.module.css';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
export default function ActiveUsers({ websiteId, className }) { export default function ActiveUsers({ websiteId, token, className }) {
const { data } = useFetch(`/api/website/${websiteId}/active`, {}, { interval: 60000 }); const { data } = useFetch(`/api/website/${websiteId}/active`, { token }, { interval: 60000 });
const count = useMemo(() => { const count = useMemo(() => {
return data?.[0]?.x || 0; return data?.[0]?.x || 0;
}, [data]); }, [data]);
@ -20,7 +20,7 @@ export default function ActiveUsers({ websiteId, className }) {
<div className={styles.text}> <div className={styles.text}>
<div> <div>
<FormattedMessage <FormattedMessage
id="active-users.message" id="message.active-users"
defaultMessage="{x} current {x, plural, one {visitor} other {visitors}}" defaultMessage="{x} current {x, plural, one {visitor} other {visitors}}"
values={{ x: count }} values={{ x: count }}
/> />

View File

@ -3,13 +3,14 @@ import { FormattedMessage } from 'react-intl';
import MetricsTable from './MetricsTable'; import MetricsTable from './MetricsTable';
import { browserFilter } from 'lib/filters'; import { browserFilter } from 'lib/filters';
export default function BrowsersTable({ websiteId, limit, onExpand }) { export default function BrowsersTable({ websiteId, token, limit, onExpand }) {
return ( return (
<MetricsTable <MetricsTable
title={<FormattedMessage id="metrics.browsers" defaultMessage="Browsers" />} title={<FormattedMessage id="metrics.browsers" defaultMessage="Browsers" />}
type="browser" type="browser"
metric={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />} metric={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />}
websiteId={websiteId} websiteId={websiteId}
token={token}
limit={limit} limit={limit}
dataFilter={browserFilter} dataFilter={browserFilter}
onExpand={onExpand} onExpand={onExpand}

View File

@ -3,13 +3,20 @@ import MetricsTable from './MetricsTable';
import { countryFilter, percentFilter } from 'lib/filters'; import { countryFilter, percentFilter } from 'lib/filters';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
export default function CountriesTable({ websiteId, limit, onDataLoad = () => {}, onExpand }) { export default function CountriesTable({
websiteId,
token,
limit,
onDataLoad = () => {},
onExpand,
}) {
return ( return (
<MetricsTable <MetricsTable
title={<FormattedMessage id="metrics.countries" defaultMessage="Countries" />} title={<FormattedMessage id="metrics.countries" defaultMessage="Countries" />}
type="country" type="country"
metric={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />} metric={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />}
websiteId={websiteId} websiteId={websiteId}
token={token}
limit={limit} limit={limit}
dataFilter={countryFilter} dataFilter={countryFilter}
onDataLoad={data => onDataLoad(percentFilter(data))} onDataLoad={data => onDataLoad(percentFilter(data))}

View File

@ -4,13 +4,14 @@ import { deviceFilter } from 'lib/filters';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { getDeviceMessage } from 'components/messages'; import { getDeviceMessage } from 'components/messages';
export default function DevicesTable({ websiteId, limit, onExpand }) { export default function DevicesTable({ websiteId, token, limit, onExpand }) {
return ( return (
<MetricsTable <MetricsTable
title={<FormattedMessage id="metrics.devices" defaultMessage="Devices" />} title={<FormattedMessage id="metrics.devices" defaultMessage="Devices" />}
type="device" type="device"
metric={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />} metric={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />}
websiteId={websiteId} websiteId={websiteId}
token={token}
limit={limit} limit={limit}
dataFilter={deviceFilter} dataFilter={deviceFilter}
renderLabel={({ x }) => getDeviceMessage(x)} renderLabel={({ x }) => getDeviceMessage(x)}

View File

@ -3,7 +3,7 @@ import tinycolor from 'tinycolor2';
import BarChart from './BarChart'; import BarChart from './BarChart';
import { getTimezone, getDateArray, getDateLength } from 'lib/date'; import { getTimezone, getDateArray, getDateLength } from 'lib/date';
import useFetch from 'hooks/useFetch'; import useFetch from 'hooks/useFetch';
import { useDateRange } from 'hooks/useDateRange'; import useDateRange from 'hooks/useDateRange';
const COLORS = [ const COLORS = [
'#2680eb', '#2680eb',
@ -16,7 +16,7 @@ const COLORS = [
'#85d044', '#85d044',
]; ];
export default function EventsChart({ websiteId }) { export default function EventsChart({ websiteId, token }) {
const dateRange = useDateRange(websiteId); const dateRange = useDateRange(websiteId);
const { startDate, endDate, unit, modified } = dateRange; const { startDate, endDate, unit, modified } = dateRange;
const { data } = useFetch( const { data } = useFetch(
@ -26,6 +26,7 @@ export default function EventsChart({ websiteId }) {
end_at: +endDate, end_at: +endDate,
unit, unit,
tz: getTimezone(), tz: getTimezone(),
token,
}, },
{ update: [modified] }, { update: [modified] },
); );

View File

@ -3,13 +3,14 @@ import { FormattedMessage } from 'react-intl';
import MetricsTable from './MetricsTable'; import MetricsTable from './MetricsTable';
import styles from './EventsTable.module.css'; import styles from './EventsTable.module.css';
export default function EventsTable({ websiteId, limit, onExpand, onDataLoad }) { export default function EventsTable({ websiteId, token, limit, onExpand, onDataLoad }) {
return ( return (
<MetricsTable <MetricsTable
title={<FormattedMessage id="metrics.events" defaultMessage="Events" />} title={<FormattedMessage id="metrics.events" defaultMessage="Events" />}
type="event" type="event"
metric={<FormattedMessage id="metrics.actions" defaultMessage="Actions" />} metric={<FormattedMessage id="metrics.actions" defaultMessage="Actions" />}
websiteId={websiteId} websiteId={websiteId}
token={token}
limit={limit} limit={limit}
renderLabel={({ x }) => <Label value={x} />} renderLabel={({ x }) => <Label value={x} />}
onExpand={onExpand} onExpand={onExpand}

View File

@ -3,12 +3,12 @@ import { FormattedMessage } from 'react-intl';
import classNames from 'classnames'; import classNames from 'classnames';
import Loading from 'components/common/Loading'; import Loading from 'components/common/Loading';
import useFetch from 'hooks/useFetch'; import useFetch from 'hooks/useFetch';
import { useDateRange } from 'hooks/useDateRange'; import useDateRange from 'hooks/useDateRange';
import { formatShortTime, formatNumber, formatLongNumber } from 'lib/format'; import { formatShortTime, formatNumber, formatLongNumber } from 'lib/format';
import MetricCard from './MetricCard'; import MetricCard from './MetricCard';
import styles from './MetricsBar.module.css'; import styles from './MetricsBar.module.css';
export default function MetricsBar({ websiteId, className }) { export default function MetricsBar({ websiteId, token, className }) {
const dateRange = useDateRange(websiteId); const dateRange = useDateRange(websiteId);
const { startDate, endDate, modified } = dateRange; const { startDate, endDate, modified } = dateRange;
const { data } = useFetch( const { data } = useFetch(
@ -16,6 +16,7 @@ export default function MetricsBar({ websiteId, className }) {
{ {
start_at: +startDate, start_at: +startDate,
end_at: +endDate, end_at: +endDate,
token,
}, },
{ {
update: [modified], update: [modified],

View File

@ -10,12 +10,13 @@ import useFetch from 'hooks/useFetch';
import Arrow from 'assets/arrow-right.svg'; import Arrow from 'assets/arrow-right.svg';
import { percentFilter } from 'lib/filters'; import { percentFilter } from 'lib/filters';
import { formatNumber, formatLongNumber } from 'lib/format'; import { formatNumber, formatLongNumber } from 'lib/format';
import { useDateRange } from 'hooks/useDateRange'; import useDateRange from 'hooks/useDateRange';
import styles from './MetricsTable.module.css'; import styles from './MetricsTable.module.css';
export default function MetricsTable({ export default function MetricsTable({
websiteId, websiteId,
websiteDomain, websiteDomain,
token,
title, title,
metric, metric,
type, type,
@ -37,6 +38,7 @@ export default function MetricsTable({
start_at: +startDate, start_at: +startDate,
end_at: +endDate, end_at: +endDate,
domain: websiteDomain, domain: websiteDomain,
token,
}, },
{ onDataLoad, delay: 300, update: [modified] }, { onDataLoad, delay: 300, update: [modified] },
); );

View File

@ -3,13 +3,14 @@ import MetricsTable from './MetricsTable';
import { osFilter } from 'lib/filters'; import { osFilter } from 'lib/filters';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
export default function OSTable({ websiteId, limit, onExpand }) { export default function OSTable({ websiteId, token, limit, onExpand }) {
return ( return (
<MetricsTable <MetricsTable
title={<FormattedMessage id="metrics.operating-systems" defaultMessage="Operating system" />} title={<FormattedMessage id="metrics.operating-systems" defaultMessage="Operating system" />}
type="os" type="os"
metric={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />} metric={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />}
websiteId={websiteId} websiteId={websiteId}
token={token}
limit={limit} limit={limit}
dataFilter={osFilter} dataFilter={osFilter}
onExpand={onExpand} onExpand={onExpand}

View File

@ -5,7 +5,7 @@ import { urlFilter } from 'lib/filters';
import { FILTER_COMBINED, FILTER_RAW } from 'lib/constants'; import { FILTER_COMBINED, FILTER_RAW } from 'lib/constants';
import MetricsTable from './MetricsTable'; import MetricsTable from './MetricsTable';
export default function PagesTable({ websiteId, websiteDomain, limit, onExpand }) { export default function PagesTable({ websiteId, token, websiteDomain, limit, onExpand }) {
const [filter, setFilter] = useState(FILTER_COMBINED); const [filter, setFilter] = useState(FILTER_COMBINED);
const buttons = [ const buttons = [
@ -25,6 +25,7 @@ export default function PagesTable({ websiteId, websiteDomain, limit, onExpand }
limit ? null : <FilterButtons buttons={buttons} selected={filter} onClick={setFilter} /> limit ? null : <FilterButtons buttons={buttons} selected={filter} onClick={setFilter} />
} }
websiteId={websiteId} websiteId={websiteId}
token={token}
limit={limit} limit={limit}
dataFilter={urlFilter} dataFilter={urlFilter}
filterOptions={{ domain: websiteDomain, raw: filter === FILTER_RAW }} filterOptions={{ domain: websiteDomain, raw: filter === FILTER_RAW }}

View File

@ -1,30 +0,0 @@
import React from 'react';
import ButtonGroup from 'components/common/ButtonGroup';
import { getDateRange } from 'lib/date';
import styles from './QuickButtons.module.css';
const options = [
{ label: '24h', value: '24hour' },
{ label: '7d', value: '7day' },
{ label: '30d', value: '30day' },
];
export default function QuickButtons({ value, onChange }) {
const selectedItem = options.find(item => item.value === value)?.value;
function handleClick(selected) {
if (selected !== value) {
onChange(getDateRange(selected));
}
}
return (
<ButtonGroup
size="xsmall"
className={styles.buttons}
items={options}
selectedItem={selectedItem}
onClick={handleClick}
/>
);
}

View File

@ -1,33 +0,0 @@
.buttons {
display: flex;
align-content: center;
position: absolute;
top: 0;
right: 0;
margin: auto;
}
.buttons button + button {
margin-left: 10px;
}
.buttons .button {
font-size: var(--font-size-xsmall);
padding: 4px 8px;
}
.active {
font-weight: 600;
}
@media only screen and (max-width: 768px) {
.buttons button:last-child {
display: none;
}
}
@media only screen and (max-width: 576px) {
.buttons {
display: none;
}
}

View File

@ -5,7 +5,13 @@ import { refFilter } from 'lib/filters';
import ButtonGroup from 'components/common/ButtonGroup'; import ButtonGroup from 'components/common/ButtonGroup';
import { FILTER_DOMAIN_ONLY, FILTER_COMBINED, FILTER_RAW } from 'lib/constants'; import { FILTER_DOMAIN_ONLY, FILTER_COMBINED, FILTER_RAW } from 'lib/constants';
export default function ReferrersTable({ websiteId, websiteDomain, limit, onExpand = () => {} }) { export default function ReferrersTable({
websiteId,
websiteDomain,
token,
limit,
onExpand = () => {},
}) {
const [filter, setFilter] = useState(FILTER_COMBINED); const [filter, setFilter] = useState(FILTER_COMBINED);
const buttons = [ const buttons = [
@ -20,9 +26,9 @@ export default function ReferrersTable({ websiteId, websiteDomain, limit, onExpa
{ label: <FormattedMessage id="metrics.filter.raw" defaultMessage="Raw" />, value: FILTER_RAW }, { label: <FormattedMessage id="metrics.filter.raw" defaultMessage="Raw" />, value: FILTER_RAW },
]; ];
const renderLink = ({ x: url }) => { const renderLink = ({ w: href, x: url }) => {
return url.startsWith('http') ? ( return (href || url).startsWith('http') ? (
<a href={url} target="_blank" rel="noreferrer"> <a href={href || url} target="_blank" rel="noreferrer">
{decodeURI(url)} {decodeURI(url)}
</a> </a>
) : ( ) : (
@ -40,6 +46,7 @@ export default function ReferrersTable({ websiteId, websiteDomain, limit, onExpa
} }
websiteId={websiteId} websiteId={websiteId}
websiteDomain={websiteDomain} websiteDomain={websiteDomain}
token={token}
limit={limit} limit={limit}
dataFilter={refFilter} dataFilter={refFilter}
filterOptions={{ filterOptions={{

View File

@ -3,17 +3,18 @@ import { useDispatch } from 'react-redux';
import classNames from 'classnames'; import classNames from 'classnames';
import PageviewsChart from './PageviewsChart'; import PageviewsChart from './PageviewsChart';
import MetricsBar from './MetricsBar'; import MetricsBar from './MetricsBar';
import WebsiteHeader from './WebsiteHeader';
import DateFilter from 'components/common/DateFilter'; import DateFilter from 'components/common/DateFilter';
import StickyHeader from 'components/helpers/StickyHeader'; import StickyHeader from 'components/helpers/StickyHeader';
import useFetch from 'hooks/useFetch'; import useFetch from 'hooks/useFetch';
import useDateRange from 'hooks/useDateRange';
import { getDateArray, getDateLength, getTimezone } from 'lib/date'; import { getDateArray, getDateLength, getTimezone } from 'lib/date';
import { setDateRange } from 'redux/actions/websites'; import { setDateRange } from 'redux/actions/websites';
import styles from './WebsiteChart.module.css'; import styles from './WebsiteChart.module.css';
import WebsiteHeader from './WebsiteHeader';
import { useDateRange } from '../../hooks/useDateRange';
export default function WebsiteChart({ export default function WebsiteChart({
websiteId, websiteId,
token,
title, title,
stickyHeader = false, stickyHeader = false,
showLink = false, showLink = false,
@ -30,6 +31,7 @@ export default function WebsiteChart({
end_at: +endDate, end_at: +endDate,
unit, unit,
tz: getTimezone(), tz: getTimezone(),
token,
}, },
{ onDataLoad, update: [modified] }, { onDataLoad, update: [modified] },
); );
@ -50,7 +52,7 @@ export default function WebsiteChart({
return ( return (
<> <>
<WebsiteHeader websiteId={websiteId} title={title} showLink={showLink} /> <WebsiteHeader websiteId={websiteId} token={token} title={title} showLink={showLink} />
<div className={classNames(styles.header, 'row')}> <div className={classNames(styles.header, 'row')}>
<StickyHeader <StickyHeader
className={classNames(styles.metrics, 'col row')} className={classNames(styles.metrics, 'col row')}
@ -58,7 +60,7 @@ export default function WebsiteChart({
enabled={stickyHeader} enabled={stickyHeader}
> >
<div className="col-12 col-lg-9"> <div className="col-12 col-lg-9">
<MetricsBar websiteId={websiteId} /> <MetricsBar websiteId={websiteId} token={token} />
</div> </div>
<div className={classNames(styles.filter, 'col-12 col-lg-3')}> <div className={classNames(styles.filter, 'col-12 col-lg-3')}>
<DateFilter <DateFilter

View File

@ -2,18 +2,18 @@ import React from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import Link from 'components/common/Link'; import Link from 'components/common/Link';
import PageHeader from 'components/layout/PageHeader'; import PageHeader from 'components/layout/PageHeader';
import RefreshButton from 'components/common/RefreshButton';
import ButtonLayout from 'components/layout/ButtonLayout';
import Icon from 'components/common/Icon';
import ActiveUsers from './ActiveUsers'; import ActiveUsers from './ActiveUsers';
import Arrow from 'assets/arrow-right.svg'; import Arrow from 'assets/arrow-right.svg';
import styles from './WebsiteHeader.module.css'; import styles from './WebsiteHeader.module.css';
import RefreshButton from '../common/RefreshButton';
import ButtonLayout from '../layout/ButtonLayout';
import Icon from '../common/Icon';
export default function WebsiteHeader({ websiteId, title, showLink = false }) { export default function WebsiteHeader({ websiteId, token, title, showLink = false }) {
return ( return (
<PageHeader> <PageHeader>
<div className={styles.title}>{title}</div> <div className={styles.title}>{title}</div>
<ActiveUsers className={styles.active} websiteId={websiteId} /> <ActiveUsers className={styles.active} websiteId={websiteId} token={token} />
<ButtonLayout> <ButtonLayout>
<RefreshButton websiteId={websiteId} /> <RefreshButton websiteId={websiteId} />
{showLink && ( {showLink && (

View File

@ -92,7 +92,7 @@ export default function AccountSettings() {
<> <>
<PageHeader> <PageHeader>
<div> <div>
<FormattedMessage id="settings.accounts" defaultMessage="Accounts" /> <FormattedMessage id="label.accounts" defaultMessage="Accounts" />
</div> </div>
<Button icon={<Plus />} size="small" onClick={() => setAddAccount(true)}> <Button icon={<Plus />} size="small" onClick={() => setAddAccount(true)}>
<div> <div>

View File

@ -1,29 +1,44 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import PageHeader from 'components/layout/PageHeader'; import PageHeader from 'components/layout/PageHeader';
import Button from 'components/common/Button'; import Button from 'components/common/Button';
import Modal from 'components/common/Modal'; import Modal from 'components/common/Modal';
import Toast from 'components/common/Toast'; import Toast from 'components/common/Toast';
import ChangePasswordForm from 'components/forms/ChangePasswordForm'; import ChangePasswordForm from 'components/forms/ChangePasswordForm';
import DateFilter from 'components/common/DateFilter';
import Dots from 'assets/ellipsis-h.svg'; import Dots from 'assets/ellipsis-h.svg';
import { getTimezone } from 'lib/date';
import { setItem } from 'lib/web';
import useDateRange from 'hooks/useDateRange';
import { setDateRange } from 'redux/actions/websites';
import styles from './ProfileSettings.module.css';
export default function ProfileSettings() { export default function ProfileSettings() {
const dispatch = useDispatch();
const user = useSelector(state => state.user); const user = useSelector(state => state.user);
const [changePassword, setChangePassword] = useState(false); const [changePassword, setChangePassword] = useState(false);
const [message, setMessage] = useState(); const [message, setMessage] = useState();
const { user_id } = user; const { user_id } = user;
const timezone = getTimezone();
const dateRange = useDateRange(0);
const { startDate, endDate, value } = dateRange;
function handleSave() { function handleSave() {
setChangePassword(false); setChangePassword(false);
setMessage(<FormattedMessage id="message.save-success" defaultMessage="Saved successfully." />); setMessage(<FormattedMessage id="message.save-success" defaultMessage="Saved successfully." />);
} }
function handleDateChange(values) {
setItem(`umami.date-range`, values);
dispatch(setDateRange(0, values));
}
return ( return (
<> <>
<PageHeader> <PageHeader>
<div> <div>
<FormattedMessage id="settings.profile" defaultMessage="Profile" /> <FormattedMessage id="label.profile" defaultMessage="Profile" />
</div> </div>
<Button icon={<Dots />} size="small" onClick={() => setChangePassword(true)}> <Button icon={<Dots />} size="small" onClick={() => setChangePassword(true)}>
<div> <div>
@ -36,6 +51,21 @@ export default function ProfileSettings() {
<FormattedMessage id="label.username" defaultMessage="Username" /> <FormattedMessage id="label.username" defaultMessage="Username" />
</dt> </dt>
<dd>{user.username}</dd> <dd>{user.username}</dd>
<dt>
<FormattedMessage id="label.timezone" defaultMessage="Timezone" />
</dt>
<dd>{timezone}</dd>
<dt>
<FormattedMessage id="label.default-date-range" defaultMessage="Default date range" />
</dt>
<dd className={styles.date}>
<DateFilter
value={value}
startDate={startDate}
endDate={endDate}
onChange={handleDateChange}
/>
</dd>
</dl> </dl>
{changePassword && ( {changePassword && (
<Modal <Modal

View File

@ -0,0 +1,3 @@
.date {
display: flex;
}

View File

@ -1,4 +1,5 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useRouter } from 'next/router';
import Page from 'components/layout/Page'; import Page from 'components/layout/Page';
import MenuLayout from 'components/layout/MenuLayout'; import MenuLayout from 'components/layout/MenuLayout';
import WebsiteSettings from './WebsiteSettings'; import WebsiteSettings from './WebsiteSettings';
@ -7,33 +8,38 @@ import ProfileSettings from './ProfileSettings';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
const WEBSITES = 1; const WEBSITES = '/settings';
const ACCOUNTS = 2; const ACCOUNTS = '/settings/accounts';
const PROFILE = 3; const PROFILE = '/settings/profile';
export default function Settings() { export default function Settings() {
const user = useSelector(state => state.user); const user = useSelector(state => state.user);
const [option, setOption] = useState(WEBSITES); const [option, setOption] = useState(WEBSITES);
const router = useRouter();
const { pathname } = router;
const menuOptions = [ const menuOptions = [
{ {
label: <FormattedMessage id="settings.websites" defaultMessage="Websites" />, label: <FormattedMessage id="label.websites" defaultMessage="Websites" />,
value: WEBSITES, value: WEBSITES,
}, },
{ {
label: <FormattedMessage id="settings.accounts" defaultMessage="Accounts" />, label: <FormattedMessage id="label.accounts" defaultMessage="Accounts" />,
value: ACCOUNTS, value: ACCOUNTS,
hidden: !user.is_admin, hidden: !user.is_admin,
}, },
{ label: <FormattedMessage id="settings.profile" defaultMessage="Profile" />, value: PROFILE }, {
label: <FormattedMessage id="label.profile" defaultMessage="Profile" />,
value: PROFILE,
},
]; ];
return ( return (
<Page> <Page>
<MenuLayout menu={menuOptions} selectedOption={option} onMenuSelect={setOption}> <MenuLayout menu={menuOptions} selectedOption={option} onMenuSelect={setOption}>
{option === WEBSITES && <WebsiteSettings />} {pathname === WEBSITES && <WebsiteSettings />}
{option === ACCOUNTS && <AccountSettings />} {pathname === ACCOUNTS && <AccountSettings />}
{option === PROFILE && <ProfileSettings />} {pathname === PROFILE && <ProfileSettings />}
</MenuLayout> </MenuLayout>
</Page> </Page>
); );

View File

@ -37,7 +37,7 @@ export default function WebsiteSettings() {
<Button <Button
icon={<LinkIcon />} icon={<LinkIcon />}
size="small" size="small"
tooltip={<FormattedMessage id="tooltip.get-share-url" defaultMessage="Get share URL" />} tooltip={<FormattedMessage id="message.get-share-url" defaultMessage="Get share URL" />}
tooltipId={`button-share-${row.website_id}`} tooltipId={`button-share-${row.website_id}`}
onClick={() => setShowUrl(row)} onClick={() => setShowUrl(row)}
/> />
@ -46,7 +46,7 @@ export default function WebsiteSettings() {
icon={<Code />} icon={<Code />}
size="small" size="small"
tooltip={ tooltip={
<FormattedMessage id="tooltip.get-tracking-code" defaultMessage="Get tracking code" /> <FormattedMessage id="message.get-tracking-code" defaultMessage="Get tracking code" />
} }
tooltipId={`button-code-${row.website_id}`} tooltipId={`button-code-${row.website_id}`}
onClick={() => setShowCode(row)} onClick={() => setShowCode(row)}
@ -111,7 +111,7 @@ export default function WebsiteSettings() {
<EmptyPlaceholder <EmptyPlaceholder
msg={ msg={
<FormattedMessage <FormattedMessage
id="placeholder.message.no-websites-configured" id="message.no-websites-configured"
defaultMessage="You don't have any websites configured." defaultMessage="You don't have any websites configured."
/> />
} }
@ -128,7 +128,7 @@ export default function WebsiteSettings() {
<> <>
<PageHeader> <PageHeader>
<div> <div>
<FormattedMessage id="settings.websites" defaultMessage="Websites" /> <FormattedMessage id="label.websites" defaultMessage="Websites" />
</div> </div>
<Button icon={<Plus />} size="small" onClick={() => setAddWebsite(true)}> <Button icon={<Plus />} size="small" onClick={() => setAddWebsite(true)}>
<div> <div>

View File

@ -1,8 +1,18 @@
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { parseISO } from 'date-fns';
import { getDateRange } from 'lib/date'; import { getDateRange } from 'lib/date';
import { getItem } from 'lib/web';
export default function useDateRange(websiteId, defaultDateRange = '24hour') {
const globalDefault = getItem('umami.date-range');
if (globalDefault) {
globalDefault.startDate = parseISO(globalDefault.startDate);
globalDefault.endDate = parseISO(globalDefault.endDate);
}
export function useDateRange(websiteId, defaultDateRange = '7day') {
return useSelector( return useSelector(
state => state.websites[websiteId]?.dateRange || getDateRange(defaultDateRange), state =>
state.websites[websiteId]?.dateRange || globalDefault || getDateRange(defaultDateRange),
); );
} }

View File

@ -1,30 +1,26 @@
{ {
"active-users.message": "{x} {x, plural, one {aktiver Besucher} other {aktive Besucher}}",
"button.add-account": "Konto hinzufügen", "button.add-account": "Konto hinzufügen",
"button.add-website": "Webseite hinzufügen", "button.add-website": "Webseite hinzufügen",
"button.back": "Zurück", "button.back": "Zurück",
"button.cancel": "Abbrechen", "button.cancel": "Abbrechen",
"button.change-password": "Passwort ändern", "button.change-password": "Passwort ändern",
"button.copy-to-clipboard": "In die Zwischenablage kopieren", "button.copy-to-clipboard": "In die Zwischenablage kopieren",
"button.date-range": "Date range",
"button.delete": "Löschen", "button.delete": "Löschen",
"button.edit": "Bearbeiten", "button.edit": "Bearbeiten",
"button.login": "Anmelden", "button.login": "Anmelden",
"button.more": "Mehr", "button.more": "Mehr",
"button.refresh": "Refresh", "button.refresh": "Refresh",
"button.save": "Speichern", "button.save": "Speichern",
"button.single-day": "Single day",
"button.view-details": "Details anzeigen", "button.view-details": "Details anzeigen",
"button.websites": "Webseiten", "button.websites": "Webseiten",
"device.desktop": "Desktop", "label.accounts": "Konten",
"device.laptop": "Laptop",
"device.mobile": "Mobile",
"device.tablet": "Tablet",
"footer.powered-by": "Powered by {name}",
"header.nav.dashboard": "Übersicht",
"header.nav.settings": "Einstellungen",
"label.administrator": "Administrator", "label.administrator": "Administrator",
"label.confirm-password": "Passwort wiederholen", "label.confirm-password": "Passwort wiederholen",
"label.current-password": "Derzeitiges Passwort", "label.current-password": "Derzeitiges Passwort",
"label.custom-range": "Custom range", "label.custom-range": "Custom range",
"label.dashboard": "Übersicht",
"label.domain": "Domain", "label.domain": "Domain",
"label.enable-share-url": "Freigabe-URL aktivieren", "label.enable-share-url": "Freigabe-URL aktivieren",
"label.invalid": "Ungültig", "label.invalid": "Ungültig",
@ -37,20 +33,29 @@
"label.new-password": "Neues Passwort", "label.new-password": "Neues Passwort",
"label.password": "Passwort", "label.password": "Passwort",
"label.passwords-dont-match": "Passwörter stimmen nicht überein", "label.passwords-dont-match": "Passwörter stimmen nicht überein",
"label.profile": "Profil",
"label.required": "Erforderlich", "label.required": "Erforderlich",
"label.settings": "Einstellungen",
"label.this-month": "Diesen Monat", "label.this-month": "Diesen Monat",
"label.this-week": "Diese Woche", "label.this-week": "Diese Woche",
"label.this-year": "Dieses Jahr", "label.this-year": "Dieses Jahr",
"label.today": "Heute", "label.today": "Heute",
"label.unknown": "Unknown", "label.unknown": "Unknown",
"label.username": "Benutzername", "label.username": "Benutzername",
"label.websites": "Webseiten",
"message.active-users": "{x} {x, plural, one {aktiver Besucher} other {aktive Besucher}}",
"message.confirm-delete": "Sind sie sich sicher {target} zu löschen?", "message.confirm-delete": "Sind sie sich sicher {target} zu löschen?",
"message.copied": "In Zwischenablage kopiert!", "message.copied": "In Zwischenablage kopiert!",
"message.delete-warning": "Alle zugehörigen Daten werden auch gelöscht.", "message.delete-warning": "Alle zugehörigen Daten werden auch gelöscht.",
"message.failure": "Es it ein Fehler aufgetreten.", "message.failure": "Es it ein Fehler aufgetreten.",
"message.get-share-url": "Freigabe-URL abrufen",
"message.get-tracking-code": "Erstelle Tracking Kennung",
"message.go-to-settings": "Zu den Einstellungen",
"message.incorrect-username-password": "Falsches Passwort oder Benutzername.", "message.incorrect-username-password": "Falsches Passwort oder Benutzername.",
"message.no-data-available": "Keine Daten vorhanden.", "message.no-data-available": "Keine Daten vorhanden.",
"message.no-websites-configured": "Es ist keine Webseite vorhanden.",
"message.page-not-found": "Seite nicht gefunden.", "message.page-not-found": "Seite nicht gefunden.",
"message.powered-by": "Powered by {name}",
"message.save-success": "Erfolgreich gespeichert.", "message.save-success": "Erfolgreich gespeichert.",
"message.share-url": "Dies ist der öffentliche URL zum Teilen für {target}.", "message.share-url": "Dies ist der öffentliche URL zum Teilen für {target}.",
"message.track-stats": "Um die Statistiken für {target} zu übermitteln, platzieren Sie bitte den folgenden Quelltext im {head} ihrer Homepage.", "message.track-stats": "Um die Statistiken für {target} zu übermitteln, platzieren Sie bitte den folgenden Quelltext im {head} ihrer Homepage.",
@ -60,6 +65,10 @@
"metrics.bounce-rate": "Absprungrate", "metrics.bounce-rate": "Absprungrate",
"metrics.browsers": "Browsers", "metrics.browsers": "Browsers",
"metrics.countries": "Länder", "metrics.countries": "Länder",
"metrics.device.desktop": "Desktop",
"metrics.device.laptop": "Laptop",
"metrics.device.mobile": "Mobile",
"metrics.device.tablet": "Tablet",
"metrics.devices": "Geräte", "metrics.devices": "Geräte",
"metrics.events": "Events", "metrics.events": "Events",
"metrics.filter.combined": "Kombiniert", "metrics.filter.combined": "Kombiniert",
@ -72,11 +81,6 @@
"metrics.unique-visitors": "Eindeutige Besucher", "metrics.unique-visitors": "Eindeutige Besucher",
"metrics.views": "Aufrufe", "metrics.views": "Aufrufe",
"metrics.visitors": "Besucher", "metrics.visitors": "Besucher",
"placeholder.message.go-to-settings": "Zu den Einstellungen",
"placeholder.message.no-websites-configured": "Es ist keine Webseite vorhanden.",
"settings.accounts": "Konten",
"settings.profile": "Profil",
"settings.websites": "Webseiten",
"title.add-account": "Konto hinzugfügen", "title.add-account": "Konto hinzugfügen",
"title.add-website": "Webseite hinzufügen", "title.add-website": "Webseite hinzufügen",
"title.change-password": "Passwort ändern", "title.change-password": "Passwort ändern",
@ -85,7 +89,5 @@
"title.edit-account": "Konto bearbeiten", "title.edit-account": "Konto bearbeiten",
"title.edit-website": "Webseite bearbeiten", "title.edit-website": "Webseite bearbeiten",
"title.share-url": "Freigabe-URL", "title.share-url": "Freigabe-URL",
"title.tracking-code": "Tracking Kennung", "title.tracking-code": "Tracking Kennung"
"tooltip.get-share-url": "Freigabe-URL abrufen",
"tooltip.get-tracking-code": "Erstelle Tracking Kennung"
} }

View File

@ -1,30 +1,26 @@
{ {
"active-users.message": "{x} current {x, plural, one {visitor} other {visitors}}",
"button.add-account": "Add account", "button.add-account": "Add account",
"button.add-website": "Add website", "button.add-website": "Add website",
"button.back": "Back", "button.back": "Back",
"button.cancel": "Cancel", "button.cancel": "Cancel",
"button.change-password": "Change password", "button.change-password": "Change password",
"button.copy-to-clipboard": "Copy to clipboard", "button.copy-to-clipboard": "Copy to clipboard",
"button.date-range": "Date range",
"button.delete": "Delete", "button.delete": "Delete",
"button.edit": "Edit", "button.edit": "Edit",
"button.login": "Login", "button.login": "Login",
"button.more": "More", "button.more": "More",
"button.refresh": "Refresh", "button.refresh": "Refresh",
"button.save": "Save", "button.save": "Save",
"button.single-day": "Single day",
"button.view-details": "View details", "button.view-details": "View details",
"button.websites": "Websites", "button.websites": "Websites",
"device.desktop": "Desktop", "label.accounts": "Accounts",
"device.laptop": "Laptop",
"device.mobile": "Mobile",
"device.tablet": "Tablet",
"footer.powered-by": "Powered by {name}",
"header.nav.dashboard": "Dashboard",
"header.nav.settings": "Settings",
"label.administrator": "Administrator", "label.administrator": "Administrator",
"label.confirm-password": "Confirm password", "label.confirm-password": "Confirm password",
"label.current-password": "Current password", "label.current-password": "Current password",
"label.custom-range": "Custom range", "label.custom-range": "Custom range",
"label.dashboard": "Dashboard",
"label.domain": "Domain", "label.domain": "Domain",
"label.enable-share-url": "Enable share URL", "label.enable-share-url": "Enable share URL",
"label.invalid": "Invalid", "label.invalid": "Invalid",
@ -37,20 +33,29 @@
"label.new-password": "New password", "label.new-password": "New password",
"label.password": "Password", "label.password": "Password",
"label.passwords-dont-match": "Passwords don't match", "label.passwords-dont-match": "Passwords don't match",
"label.profile": "Profile",
"label.required": "Required", "label.required": "Required",
"label.settings": "Settings",
"label.this-month": "This month", "label.this-month": "This month",
"label.this-week": "This week", "label.this-week": "This week",
"label.this-year": "This year", "label.this-year": "This year",
"label.today": "Today", "label.today": "Today",
"label.unknown": "Unknown", "label.unknown": "Unknown",
"label.username": "Username", "label.username": "Username",
"label.websites": "Websites",
"message.active-users": "{x} current {x, plural, one {visitor} other {visitors}}",
"message.confirm-delete": "Are your sure you want to delete {target}?", "message.confirm-delete": "Are your sure you want to delete {target}?",
"message.copied": "Copied!", "message.copied": "Copied!",
"message.delete-warning": "All associated data will be deleted as well.", "message.delete-warning": "All associated data will be deleted as well.",
"message.failure": "Something went wrong.", "message.failure": "Something went wrong.",
"message.get-share-url": "Get share URL",
"message.get-tracking-code": "Get tracking code",
"message.go-to-settings": "Go to settings",
"message.incorrect-username-password": "Incorrect username/password.", "message.incorrect-username-password": "Incorrect username/password.",
"message.no-data-available": "No data available.", "message.no-data-available": "No data available.",
"message.no-websites-configured": "You don't have any websites configured.",
"message.page-not-found": "Page not found.", "message.page-not-found": "Page not found.",
"message.powered-by": "Powered by {name}",
"message.save-success": "Saved successfully.", "message.save-success": "Saved successfully.",
"message.share-url": "This is the publicly shared URL for {target}.", "message.share-url": "This is the publicly shared URL for {target}.",
"message.track-stats": "To track stats for {target}, place the following code in the {head} section of your website.", "message.track-stats": "To track stats for {target}, place the following code in the {head} section of your website.",
@ -60,6 +65,10 @@
"metrics.bounce-rate": "Bounce rate", "metrics.bounce-rate": "Bounce rate",
"metrics.browsers": "Browsers", "metrics.browsers": "Browsers",
"metrics.countries": "Countries", "metrics.countries": "Countries",
"metrics.device.desktop": "Desktop",
"metrics.device.laptop": "Laptop",
"metrics.device.mobile": "Mobile",
"metrics.device.tablet": "Tablet",
"metrics.devices": "Devices", "metrics.devices": "Devices",
"metrics.events": "Events", "metrics.events": "Events",
"metrics.filter.combined": "Combined", "metrics.filter.combined": "Combined",
@ -72,11 +81,6 @@
"metrics.unique-visitors": "Unique visitors", "metrics.unique-visitors": "Unique visitors",
"metrics.views": "Views", "metrics.views": "Views",
"metrics.visitors": "Visitors", "metrics.visitors": "Visitors",
"placeholder.message.go-to-settings": "Go to settings",
"placeholder.message.no-websites-configured": "You don't have any websites configured.",
"settings.accounts": "Accounts",
"settings.profile": "Profile",
"settings.websites": "Websites",
"title.add-account": "Add account", "title.add-account": "Add account",
"title.add-website": "Add website", "title.add-website": "Add website",
"title.change-password": "Change password", "title.change-password": "Change password",
@ -85,7 +89,5 @@
"title.edit-account": "Edit account", "title.edit-account": "Edit account",
"title.edit-website": "Edit website", "title.edit-website": "Edit website",
"title.share-url": "Share URL", "title.share-url": "Share URL",
"title.tracking-code": "Tracking code", "title.tracking-code": "Tracking code"
"tooltip.get-share-url": "Get share URL",
"tooltip.get-tracking-code": "Get tracking code"
} }

View File

@ -1,30 +1,26 @@
{ {
"active-users.message": "{x} {x, plural, one {activo} other {activos}}",
"button.add-account": "Agregar usuario", "button.add-account": "Agregar usuario",
"button.add-website": "Agregar sitio", "button.add-website": "Agregar sitio",
"button.back": "Atrás", "button.back": "Atrás",
"button.cancel": "Cancelar", "button.cancel": "Cancelar",
"button.change-password": "Cambiar contraseña", "button.change-password": "Cambiar contraseña",
"button.copy-to-clipboard": "Copiar al portapapeles", "button.copy-to-clipboard": "Copiar al portapapeles",
"button.date-range": "Date range",
"button.delete": "Eliminar", "button.delete": "Eliminar",
"button.edit": "Editar", "button.edit": "Editar",
"button.login": "Iniciar sesión", "button.login": "Iniciar sesión",
"button.more": "Más", "button.more": "Más",
"button.refresh": "Refresh", "button.refresh": "Refresh",
"button.save": "Guardar", "button.save": "Guardar",
"button.single-day": "Single day",
"button.view-details": "Ver detalles", "button.view-details": "Ver detalles",
"button.websites": "Sitios", "button.websites": "Sitios",
"device.desktop": "Desktop", "label.accounts": "Usuarios",
"device.laptop": "Laptop",
"device.mobile": "Mobile",
"device.tablet": "Tablet",
"footer.powered-by": "Desarrollado con {name}",
"header.nav.dashboard": "Panel de control",
"header.nav.settings": "Configuraciones",
"label.administrator": "Administrador", "label.administrator": "Administrador",
"label.confirm-password": "Confirmar contraseña", "label.confirm-password": "Confirmar contraseña",
"label.current-password": "Contraseña actual", "label.current-password": "Contraseña actual",
"label.custom-range": "Custom range", "label.custom-range": "Custom range",
"label.dashboard": "Panel de control",
"label.domain": "Dominio", "label.domain": "Dominio",
"label.enable-share-url": "Habilitar compartir URL", "label.enable-share-url": "Habilitar compartir URL",
"label.invalid": "Inválido", "label.invalid": "Inválido",
@ -37,20 +33,29 @@
"label.new-password": "Nueva contraseña", "label.new-password": "Nueva contraseña",
"label.password": "Contraseña", "label.password": "Contraseña",
"label.passwords-dont-match": "Las contraseñas no coinciden", "label.passwords-dont-match": "Las contraseñas no coinciden",
"label.profile": "Perfil",
"label.required": "Requerido", "label.required": "Requerido",
"label.settings": "Configuraciones",
"label.this-month": "Este mes", "label.this-month": "Este mes",
"label.this-week": "Esta semana", "label.this-week": "Esta semana",
"label.this-year": "Este año", "label.this-year": "Este año",
"label.today": "Hoy", "label.today": "Hoy",
"label.unknown": "Unknown", "label.unknown": "Unknown",
"label.username": "Nombre de usuario", "label.username": "Nombre de usuario",
"label.websites": "Sitios",
"message.active-users": "{x} {x, plural, one {activo} other {activos}}",
"message.confirm-delete": "¿Estás seguro(a) de querer eliminar {target}?", "message.confirm-delete": "¿Estás seguro(a) de querer eliminar {target}?",
"message.copied": "Copiado!", "message.copied": "Copiado!",
"message.delete-warning": "Toda la información relacionada será eliminada.", "message.delete-warning": "Toda la información relacionada será eliminada.",
"message.failure": "Algo falló.", "message.failure": "Algo falló.",
"message.get-share-url": "Obtener URL para compartir",
"message.get-tracking-code": "Obtener código de rastreo",
"message.go-to-settings": "Ir a la configuración",
"message.incorrect-username-password": "Nombre de usuario o contraseña incorrectos.", "message.incorrect-username-password": "Nombre de usuario o contraseña incorrectos.",
"message.no-data-available": "Sin información disponible.", "message.no-data-available": "Sin información disponible.",
"message.no-websites-configured": "No tienes ningún sitio configurado.",
"message.page-not-found": "Page not found", "message.page-not-found": "Page not found",
"message.powered-by": "Desarrollado con {name}",
"message.save-success": "Guardado exitosamente.", "message.save-success": "Guardado exitosamente.",
"message.share-url": "Esta es la URL compartida públicamente para {target}.", "message.share-url": "Esta es la URL compartida públicamente para {target}.",
"message.track-stats": "Para registrar estadísticas para {target}, copia el siguiente código dentro de la etiqueta {head} de tu sitio.", "message.track-stats": "Para registrar estadísticas para {target}, copia el siguiente código dentro de la etiqueta {head} de tu sitio.",
@ -60,6 +65,10 @@
"metrics.bounce-rate": "Porcentaje de rebote", "metrics.bounce-rate": "Porcentaje de rebote",
"metrics.browsers": "Navegadores", "metrics.browsers": "Navegadores",
"metrics.countries": "Países", "metrics.countries": "Países",
"metrics.device.desktop": "Desktop",
"metrics.device.laptop": "Laptop",
"metrics.device.mobile": "Mobile",
"metrics.device.tablet": "Tablet",
"metrics.devices": "Dispositivos", "metrics.devices": "Dispositivos",
"metrics.events": "Eventos", "metrics.events": "Eventos",
"metrics.filter.combined": "Combinado", "metrics.filter.combined": "Combinado",
@ -72,11 +81,6 @@
"metrics.unique-visitors": "Visitantes únicos", "metrics.unique-visitors": "Visitantes únicos",
"metrics.views": "Vistas", "metrics.views": "Vistas",
"metrics.visitors": "Visitantes", "metrics.visitors": "Visitantes",
"placeholder.message.go-to-settings": "Ir a la configuración",
"placeholder.message.no-websites-configured": "No tienes ningún sitio configurado.",
"settings.accounts": "Usuarios",
"settings.profile": "Perfil",
"settings.websites": "Sitios",
"title.add-account": "Agregar usuario", "title.add-account": "Agregar usuario",
"title.add-website": "Agregar sitio", "title.add-website": "Agregar sitio",
"title.change-password": "Cambiar contraseña", "title.change-password": "Cambiar contraseña",
@ -85,7 +89,5 @@
"title.edit-account": "Editar usuario", "title.edit-account": "Editar usuario",
"title.edit-website": "Editar sitio", "title.edit-website": "Editar sitio",
"title.share-url": "Compartir URL", "title.share-url": "Compartir URL",
"title.tracking-code": "Código de rastreo", "title.tracking-code": "Código de rastreo"
"tooltip.get-share-url": "Obtener URL para compartir",
"tooltip.get-tracking-code": "Obtener código de rastreo"
} }

View File

@ -1,30 +1,26 @@
{ {
"active-users.message": "{x} {x, plural, one {visiteur} other {visiteurs}} actuellement",
"button.add-account": "Ajouter un compte", "button.add-account": "Ajouter un compte",
"button.add-website": "Ajouter un site", "button.add-website": "Ajouter un site",
"button.back": "Retour", "button.back": "Retour",
"button.cancel": "Annuler", "button.cancel": "Annuler",
"button.change-password": "Changer de mot de passse", "button.change-password": "Changer de mot de passse",
"button.copy-to-clipboard": "Copier dans le presse papier", "button.copy-to-clipboard": "Copier dans le presse papier",
"button.date-range": "Date range",
"button.delete": "Supprimer", "button.delete": "Supprimer",
"button.edit": "Modifier", "button.edit": "Modifier",
"button.login": "Connexion", "button.login": "Connexion",
"button.more": "Plus", "button.more": "Plus",
"button.refresh": "Refresh", "button.refresh": "Refresh",
"button.save": "Sauvegarder", "button.save": "Sauvegarder",
"button.single-day": "Single day",
"button.view-details": "Voir les details", "button.view-details": "Voir les details",
"button.websites": "Sites", "button.websites": "Sites",
"device.desktop": "Desktop", "label.accounts": "Comptes",
"device.laptop": "Laptop",
"device.mobile": "Mobile",
"device.tablet": "Tablet",
"footer.powered-by": "Propulsé par {name}",
"header.nav.dashboard": "Tableau de bord",
"header.nav.settings": "Paramètres",
"label.administrator": "Administrateur", "label.administrator": "Administrateur",
"label.confirm-password": "Confirmation du mot de passe", "label.confirm-password": "Confirmation du mot de passe",
"label.current-password": "Mot de passe actuel", "label.current-password": "Mot de passe actuel",
"label.custom-range": "Plage personnalisée", "label.custom-range": "Plage personnalisée",
"label.dashboard": "Tableau de bord",
"label.domain": "Domaine", "label.domain": "Domaine",
"label.enable-share-url": "Activer le partage d'URL", "label.enable-share-url": "Activer le partage d'URL",
"label.invalid": "Invalide", "label.invalid": "Invalide",
@ -37,20 +33,29 @@
"label.new-password": "Nouveau mot de passe", "label.new-password": "Nouveau mot de passe",
"label.password": "Mot de passe", "label.password": "Mot de passe",
"label.passwords-dont-match": "Les mots de passe ne correspondent pas", "label.passwords-dont-match": "Les mots de passe ne correspondent pas",
"label.profile": "Profile",
"label.required": "Requis", "label.required": "Requis",
"label.settings": "Paramètres",
"label.this-month": "Ce mois ci", "label.this-month": "Ce mois ci",
"label.this-week": "Cette semaine", "label.this-week": "Cette semaine",
"label.this-year": "Cette année", "label.this-year": "Cette année",
"label.today": "Aujourd'hui", "label.today": "Aujourd'hui",
"label.unknown": "Unknown", "label.unknown": "Unknown",
"label.username": "Nom d'utilisateur", "label.username": "Nom d'utilisateur",
"label.websites": "Sites",
"message.active-users": "{x} {x, plural, one {visiteur} other {visiteurs}} actuellement",
"message.confirm-delete": "Êtes-vous sur de vouloir supprimer {target}?", "message.confirm-delete": "Êtes-vous sur de vouloir supprimer {target}?",
"message.copied": "Copié !", "message.copied": "Copié !",
"message.delete-warning": "Toutes les données associées seront également supprimées.", "message.delete-warning": "Toutes les données associées seront également supprimées.",
"message.failure": "Un problème est survenu.", "message.failure": "Un problème est survenu.",
"message.get-share-url": "Obtenez l'URL de partage",
"message.get-tracking-code": "Obtenez le code de suivi",
"message.go-to-settings": "Aller aux paramètres",
"message.incorrect-username-password": "nom d'utilisateurs/mot de passe incorrect.", "message.incorrect-username-password": "nom d'utilisateurs/mot de passe incorrect.",
"message.no-data-available": "Pas de données disponibles.", "message.no-data-available": "Pas de données disponibles.",
"message.no-websites-configured": "Vous n'avez configuré aucun site Web.",
"message.page-not-found": "Page non trouvée.", "message.page-not-found": "Page non trouvée.",
"message.powered-by": "Propulsé par {name}",
"message.save-success": "Enregistré avec succès.", "message.save-success": "Enregistré avec succès.",
"message.share-url": "Ceci est l'URL partagée pour {target}.", "message.share-url": "Ceci est l'URL partagée pour {target}.",
"message.track-stats": "Pour suivre les statistiques de {target}, placez le code suivant dans la section {head} de votre site Web.", "message.track-stats": "Pour suivre les statistiques de {target}, placez le code suivant dans la section {head} de votre site Web.",
@ -60,6 +65,10 @@
"metrics.bounce-rate": "Taux de rebond", "metrics.bounce-rate": "Taux de rebond",
"metrics.browsers": "Navigateurs", "metrics.browsers": "Navigateurs",
"metrics.countries": "Pays", "metrics.countries": "Pays",
"metrics.device.desktop": "Desktop",
"metrics.device.laptop": "Laptop",
"metrics.device.mobile": "Mobile",
"metrics.device.tablet": "Tablet",
"metrics.devices": "Appareils", "metrics.devices": "Appareils",
"metrics.events": "Événements", "metrics.events": "Événements",
"metrics.filter.combined": "Combiné", "metrics.filter.combined": "Combiné",
@ -72,11 +81,6 @@
"metrics.unique-visitors": "Visiteurs uniques", "metrics.unique-visitors": "Visiteurs uniques",
"metrics.views": "Vues", "metrics.views": "Vues",
"metrics.visitors": "Visiteurs", "metrics.visitors": "Visiteurs",
"placeholder.message.go-to-settings": "Aller aux paramètres",
"placeholder.message.no-websites-configured": "Vous n'avez configuré aucun site Web.",
"settings.accounts": "Comptes",
"settings.profile": "Profile",
"settings.websites": "Sites",
"title.add-account": "Ajouter un compte", "title.add-account": "Ajouter un compte",
"title.add-website": "Ajouter un site", "title.add-website": "Ajouter un site",
"title.change-password": "Changer le mot de passe", "title.change-password": "Changer le mot de passe",
@ -85,7 +89,5 @@
"title.edit-account": "Modifier le compte", "title.edit-account": "Modifier le compte",
"title.edit-website": "Modifier le site", "title.edit-website": "Modifier le site",
"title.share-url": "Partager l'URL", "title.share-url": "Partager l'URL",
"title.tracking-code": "Code de suivi", "title.tracking-code": "Code de suivi"
"tooltip.get-share-url": "Obtenez l'URL de partage",
"tooltip.get-tracking-code": "Obtenez le code de suivi"
} }

View File

@ -1,30 +1,26 @@
{ {
"active-users.message": "{x}人が閲覧中です。",
"button.add-account": "アカウントを追加する", "button.add-account": "アカウントを追加する",
"button.add-website": "Webサイトを追加する", "button.add-website": "Webサイトを追加する",
"button.back": "戻る", "button.back": "戻る",
"button.cancel": "キャンセル", "button.cancel": "キャンセル",
"button.change-password": "パスワード変更", "button.change-password": "パスワード変更",
"button.copy-to-clipboard": "クリップボードにコピー", "button.copy-to-clipboard": "クリップボードにコピー",
"button.date-range": "Date range",
"button.delete": "削除", "button.delete": "削除",
"button.edit": "編集", "button.edit": "編集",
"button.login": "ログイン", "button.login": "ログイン",
"button.more": "さらに表示", "button.more": "さらに表示",
"button.refresh": "Refresh", "button.refresh": "Refresh",
"button.save": "保存", "button.save": "保存",
"button.single-day": "Single day",
"button.view-details": "詳細表示", "button.view-details": "詳細表示",
"button.websites": "Webサイト", "button.websites": "Webサイト",
"device.desktop": "Desktop", "label.accounts": "アカウント",
"device.laptop": "Laptop",
"device.mobile": "Mobile",
"device.tablet": "Tablet",
"footer.powered-by": "Powered by {name}",
"header.nav.dashboard": "ダッシュボード",
"header.nav.settings": "設定",
"label.administrator": "管理者", "label.administrator": "管理者",
"label.confirm-password": "パスワード(確認)", "label.confirm-password": "パスワード(確認)",
"label.current-password": "現在のパスワード", "label.current-password": "現在のパスワード",
"label.custom-range": "Custom range", "label.custom-range": "Custom range",
"label.dashboard": "ダッシュボード",
"label.domain": "ドメイン", "label.domain": "ドメイン",
"label.enable-share-url": "共有リンクを有効にする", "label.enable-share-url": "共有リンクを有効にする",
"label.invalid": "無効", "label.invalid": "無効",
@ -37,20 +33,29 @@
"label.new-password": "新しいパスワード", "label.new-password": "新しいパスワード",
"label.password": "パスワード", "label.password": "パスワード",
"label.passwords-dont-match": "パスワードが一致しません", "label.passwords-dont-match": "パスワードが一致しません",
"label.profile": "プロファイル",
"label.required": "必須", "label.required": "必須",
"label.settings": "設定",
"label.this-month": "今月", "label.this-month": "今月",
"label.this-week": "今週", "label.this-week": "今週",
"label.this-year": "今年", "label.this-year": "今年",
"label.today": "今日", "label.today": "今日",
"label.unknown": "Unknown", "label.unknown": "Unknown",
"label.username": "ユーザー名", "label.username": "ユーザー名",
"label.websites": "Webサイト",
"message.active-users": "{x}人が閲覧中です。",
"message.confirm-delete": "{target}を削除してもよろしいですか?", "message.confirm-delete": "{target}を削除してもよろしいですか?",
"message.copied": "コピーしました!", "message.copied": "コピーしました!",
"message.delete-warning": "関連するすべてのデータも削除されます。", "message.delete-warning": "関連するすべてのデータも削除されます。",
"message.failure": "問題が発生しました。", "message.failure": "問題が発生しました。",
"message.get-share-url": "共有リンクを取得",
"message.get-tracking-code": "トラッキングコードを取得",
"message.go-to-settings": "設定する",
"message.incorrect-username-password": "ユーザー名/パスワードが正しくありません。", "message.incorrect-username-password": "ユーザー名/パスワードが正しくありません。",
"message.no-data-available": "データがありません。", "message.no-data-available": "データがありません。",
"message.no-websites-configured": "Webサイトが設定されていません。",
"message.page-not-found": "ページが見つかりません。", "message.page-not-found": "ページが見つかりません。",
"message.powered-by": "Powered by {name}",
"message.save-success": "正常に保存されました。", "message.save-success": "正常に保存されました。",
"message.share-url": "これは {target} の共有リンクです。", "message.share-url": "これは {target} の共有リンクです。",
"message.track-stats": "{target}のアクセス解析を開始するには、次のコードをWebサイトの{head}セクションへ追加してください。", "message.track-stats": "{target}のアクセス解析を開始するには、次のコードをWebサイトの{head}セクションへ追加してください。",
@ -60,6 +65,10 @@
"metrics.bounce-rate": "直帰率", "metrics.bounce-rate": "直帰率",
"metrics.browsers": "ブラウザ", "metrics.browsers": "ブラウザ",
"metrics.countries": "国", "metrics.countries": "国",
"metrics.device.desktop": "Desktop",
"metrics.device.laptop": "Laptop",
"metrics.device.mobile": "Mobile",
"metrics.device.tablet": "Tablet",
"metrics.devices": "デバイス", "metrics.devices": "デバイス",
"metrics.events": "イベント", "metrics.events": "イベント",
"metrics.filter.combined": "パスまで", "metrics.filter.combined": "パスまで",
@ -72,11 +81,6 @@
"metrics.unique-visitors": "ユニーク訪問者数", "metrics.unique-visitors": "ユニーク訪問者数",
"metrics.views": "閲覧数", "metrics.views": "閲覧数",
"metrics.visitors": "訪問者数", "metrics.visitors": "訪問者数",
"placeholder.message.go-to-settings": "設定する",
"placeholder.message.no-websites-configured": "Webサイトが設定されていません。",
"settings.accounts": "アカウント",
"settings.profile": "プロファイル",
"settings.websites": "Webサイト",
"title.add-account": "アカウントの追加", "title.add-account": "アカウントの追加",
"title.add-website": "Webサイトの追加", "title.add-website": "Webサイトの追加",
"title.change-password": "パスワード変更", "title.change-password": "パスワード変更",
@ -85,7 +89,5 @@
"title.edit-account": "アカウントの編集", "title.edit-account": "アカウントの編集",
"title.edit-website": "Webサイトの編集", "title.edit-website": "Webサイトの編集",
"title.share-url": "共有リンク", "title.share-url": "共有リンク",
"title.tracking-code": "トラッキングコード", "title.tracking-code": "トラッキングコード"
"tooltip.get-share-url": "共有リンクを取得",
"tooltip.get-tracking-code": "トラッキングコードを取得"
} }

View File

@ -1,30 +1,26 @@
{ {
"active-users.message": "одоо {x} {x, plural, one {зочин} other {зочин}} байна",
"button.add-account": "Хэрэглэгч нэмэх", "button.add-account": "Хэрэглэгч нэмэх",
"button.add-website": "Веб нэмэх", "button.add-website": "Веб нэмэх",
"button.back": "Буцах", "button.back": "Буцах",
"button.cancel": "Цуцлах", "button.cancel": "Цуцлах",
"button.change-password": "Нууц үг солих", "button.change-password": "Нууц үг солих",
"button.copy-to-clipboard": "Хуулах", "button.copy-to-clipboard": "Хуулах",
"button.date-range": "Date range",
"button.delete": "Устгах", "button.delete": "Устгах",
"button.edit": "Засах", "button.edit": "Засах",
"button.login": "Нэвтрэх", "button.login": "Нэвтрэх",
"button.more": "Цааш", "button.more": "Цааш",
"button.refresh": "Refresh", "button.refresh": "Refresh",
"button.save": "Хадгалах", "button.save": "Хадгалах",
"button.single-day": "Single day",
"button.view-details": "Дэлгэрүүлж харах", "button.view-details": "Дэлгэрүүлж харах",
"button.websites": "Вебүүд", "button.websites": "Вебүүд",
"device.desktop": "Desktop", "label.accounts": "Хэрэглэгчид",
"device.laptop": "Laptop",
"device.mobile": "Mobile",
"device.tablet": "Tablet",
"footer.powered-by": "Powered by {name}",
"header.nav.dashboard": "Хянах самбар",
"header.nav.settings": "Тохиргоо",
"label.administrator": "Админ", "label.administrator": "Админ",
"label.confirm-password": "Шинэ нууц үгээ давтах", "label.confirm-password": "Шинэ нууц үгээ давтах",
"label.current-password": "Ашиглаж буй нууц үг", "label.current-password": "Ашиглаж буй нууц үг",
"label.custom-range": "Дурын хугацаа", "label.custom-range": "Дурын хугацаа",
"label.dashboard": "Хянах самбар",
"label.domain": "Домэйн", "label.domain": "Домэйн",
"label.enable-share-url": "Хуваалцах холбоос идэвхжүүлэх", "label.enable-share-url": "Хуваалцах холбоос идэвхжүүлэх",
"label.invalid": "Буруу", "label.invalid": "Буруу",
@ -37,20 +33,29 @@
"label.new-password": "Шинэ нууц үг", "label.new-password": "Шинэ нууц үг",
"label.password": "Нууц үг", "label.password": "Нууц үг",
"label.passwords-dont-match": "Нууц үг тохирохгүй байна", "label.passwords-dont-match": "Нууц үг тохирохгүй байна",
"label.profile": "Бүртгэл",
"label.required": "Шаардлагатай", "label.required": "Шаардлагатай",
"label.settings": "Тохиргоо",
"label.this-month": "Энэ сар", "label.this-month": "Энэ сар",
"label.this-week": "Энэ долоо хоног", "label.this-week": "Энэ долоо хоног",
"label.this-year": "Энэ жил", "label.this-year": "Энэ жил",
"label.today": "Өнөөдөр", "label.today": "Өнөөдөр",
"label.unknown": "Unknown", "label.unknown": "Unknown",
"label.username": "Хэрэглэгчийн нэр", "label.username": "Хэрэглэгчийн нэр",
"label.websites": "Вебүүд",
"message.active-users": "одоо {x} {x, plural, one {зочин} other {зочин}} байна",
"message.confirm-delete": "Та {target}-г устгахдаа итгэлтэй байна уу?", "message.confirm-delete": "Та {target}-г устгахдаа итгэлтэй байна уу?",
"message.copied": "Хуулсан!", "message.copied": "Хуулсан!",
"message.delete-warning": "Үүнтэй холбоотой бүх өгөгдөл устах болно.", "message.delete-warning": "Үүнтэй холбоотой бүх өгөгдөл устах болно.",
"message.failure": "Ямар нэг зүйл буруу боллоо.", "message.failure": "Ямар нэг зүйл буруу боллоо.",
"message.get-share-url": "Хуваалцах холбоос авах",
"message.get-tracking-code": "Мөрдөх код авах",
"message.go-to-settings": "Тохиргоо руу очих",
"message.incorrect-username-password": "Буруу хэрэглэгчийн нэр/нууц үг.", "message.incorrect-username-password": "Буруу хэрэглэгчийн нэр/нууц үг.",
"message.no-data-available": "Өгөгдөл алга.", "message.no-data-available": "Өгөгдөл алга.",
"message.no-websites-configured": "Та ямар нэгэн веб тохируулаагүй байна.",
"message.page-not-found": "Хуудас олдсонгүй.", "message.page-not-found": "Хуудас олдсонгүй.",
"message.powered-by": "Powered by {name}",
"message.save-success": "Амжилттай хадгаллаа.", "message.save-success": "Амжилттай хадгаллаа.",
"message.share-url": "{target}-г нийтэд хуваалцах холбоос.", "message.share-url": "{target}-г нийтэд хуваалцах холбоос.",
"message.track-stats": "{target} вебийн статистикийг бүртгэхийн тулд доорх кодыг вебийнхээ {head} хэсэгт байрлуулна уу.", "message.track-stats": "{target} вебийн статистикийг бүртгэхийн тулд доорх кодыг вебийнхээ {head} хэсэгт байрлуулна уу.",
@ -60,6 +65,10 @@
"metrics.bounce-rate": "Нэг хуудас үзээд гарсан", "metrics.bounce-rate": "Нэг хуудас үзээд гарсан",
"metrics.browsers": "Хөтөч", "metrics.browsers": "Хөтөч",
"metrics.countries": "Улс", "metrics.countries": "Улс",
"metrics.device.desktop": "Desktop",
"metrics.device.laptop": "Laptop",
"metrics.device.mobile": "Mobile",
"metrics.device.tablet": "Tablet",
"metrics.devices": "Төхөөрөмж", "metrics.devices": "Төхөөрөмж",
"metrics.events": "Үйлдэл", "metrics.events": "Үйлдэл",
"metrics.filter.combined": "Нэгтгэсэн", "metrics.filter.combined": "Нэгтгэсэн",
@ -72,11 +81,6 @@
"metrics.unique-visitors": "Зочид", "metrics.unique-visitors": "Зочид",
"metrics.views": "Үзсэн", "metrics.views": "Үзсэн",
"metrics.visitors": "Зочид", "metrics.visitors": "Зочид",
"placeholder.message.go-to-settings": "Тохиргоо руу очих",
"placeholder.message.no-websites-configured": "Та ямар нэгэн веб тохируулаагүй байна.",
"settings.accounts": "Хэрэглэгчид",
"settings.profile": "Бүртгэл",
"settings.websites": "Вебүүд",
"title.add-account": "Хэрэглэгч нэмэх", "title.add-account": "Хэрэглэгч нэмэх",
"title.add-website": "Веб нэмэх", "title.add-website": "Веб нэмэх",
"title.change-password": "Нууц үг солих", "title.change-password": "Нууц үг солих",
@ -85,7 +89,5 @@
"title.edit-account": "Хэрэглэгч засах", "title.edit-account": "Хэрэглэгч засах",
"title.edit-website": "Веб засах", "title.edit-website": "Веб засах",
"title.share-url": "Хуваалцах холбоос", "title.share-url": "Хуваалцах холбоос",
"title.tracking-code": "Мөрдөх код", "title.tracking-code": "Мөрдөх код"
"tooltip.get-share-url": "Хуваалцах холбоос авах",
"tooltip.get-tracking-code": "Мөрдөх код авах"
} }

View File

@ -1,30 +1,26 @@
{ {
"active-users.message": "{x} actieve {x, plural, one {bezoeker} other {bezoekers}}",
"button.add-account": "Account toevoegen", "button.add-account": "Account toevoegen",
"button.add-website": "Website toevoegen", "button.add-website": "Website toevoegen",
"button.back": "Terug", "button.back": "Terug",
"button.cancel": "Annuleren", "button.cancel": "Annuleren",
"button.change-password": "Wachtwoord wijzigen", "button.change-password": "Wachtwoord wijzigen",
"button.copy-to-clipboard": "Kopiëer naar klembord", "button.copy-to-clipboard": "Kopiëer naar klembord",
"button.date-range": "Date range",
"button.delete": "Verwijderen", "button.delete": "Verwijderen",
"button.edit": "Bewerken", "button.edit": "Bewerken",
"button.login": "Inloggen", "button.login": "Inloggen",
"button.more": "Toon meer", "button.more": "Toon meer",
"button.refresh": "Refresh", "button.refresh": "Refresh",
"button.save": "Opslaan", "button.save": "Opslaan",
"button.single-day": "Single day",
"button.view-details": "Meer details", "button.view-details": "Meer details",
"button.websites": "Websites", "button.websites": "Websites",
"device.desktop": "Desktop", "label.accounts": "Accounts",
"device.laptop": "Laptop",
"device.mobile": "Mobile",
"device.tablet": "Tablet",
"footer.powered-by": "mogelijk gemaakt door {name}",
"header.nav.dashboard": "Dashboard",
"header.nav.settings": "Instellingen",
"label.administrator": "Administrator", "label.administrator": "Administrator",
"label.confirm-password": "Wachtwoord bevestigen", "label.confirm-password": "Wachtwoord bevestigen",
"label.current-password": "Huidig wachtwoord", "label.current-password": "Huidig wachtwoord",
"label.custom-range": "Custom range", "label.custom-range": "Custom range",
"label.dashboard": "Dashboard",
"label.domain": "Domein", "label.domain": "Domein",
"label.enable-share-url": "Sta delen via openbare URL toe", "label.enable-share-url": "Sta delen via openbare URL toe",
"label.invalid": "Ongeldig", "label.invalid": "Ongeldig",
@ -37,20 +33,29 @@
"label.new-password": "Nieuw wachtwoord", "label.new-password": "Nieuw wachtwoord",
"label.password": "Wachtwoord", "label.password": "Wachtwoord",
"label.passwords-dont-match": "Wachtwoorden komen niet overeen", "label.passwords-dont-match": "Wachtwoorden komen niet overeen",
"label.profile": "Profiel",
"label.required": "Verplicht", "label.required": "Verplicht",
"label.settings": "Instellingen",
"label.this-month": "Deze maand", "label.this-month": "Deze maand",
"label.this-week": "Deze week", "label.this-week": "Deze week",
"label.this-year": "Dit jaar", "label.this-year": "Dit jaar",
"label.today": "Vandaag", "label.today": "Vandaag",
"label.unknown": "Unknown", "label.unknown": "Unknown",
"label.username": "Gebruikersnaam", "label.username": "Gebruikersnaam",
"label.websites": "Websites",
"message.active-users": "{x} actieve {x, plural, one {bezoeker} other {bezoekers}}",
"message.confirm-delete": "Weet je zeker dat je {target} wilt verwijderen?", "message.confirm-delete": "Weet je zeker dat je {target} wilt verwijderen?",
"message.copied": "Gekopiëerd!", "message.copied": "Gekopiëerd!",
"message.delete-warning": "Alle verwante gegezens zullen ook verwijderd worden.", "message.delete-warning": "Alle verwante gegezens zullen ook verwijderd worden.",
"message.failure": "Er is iets misgegaan.", "message.failure": "Er is iets misgegaan.",
"message.get-share-url": "Openbare URL",
"message.get-tracking-code": "Tracking code",
"message.go-to-settings": "Naar instellingen",
"message.incorrect-username-password": "Incorrecte gebruikersnaam/wachtwoord.", "message.incorrect-username-password": "Incorrecte gebruikersnaam/wachtwoord.",
"message.no-data-available": "Geen gegevens beschikbaar.", "message.no-data-available": "Geen gegevens beschikbaar.",
"message.no-websites-configured": "Je hebt geen websites ingesteld.",
"message.page-not-found": "Pagina niet gevonden.", "message.page-not-found": "Pagina niet gevonden.",
"message.powered-by": "mogelijk gemaakt door {name}",
"message.save-success": "Opslaan succesvol.", "message.save-success": "Opslaan succesvol.",
"message.share-url": "Met deze URL kan {target} openbaar gedeeld worden.", "message.share-url": "Met deze URL kan {target} openbaar gedeeld worden.",
"message.track-stats": "Om statistieken voor {target} bij te houden, plaats je de volgende code in het {head} gedeelte van je website.", "message.track-stats": "Om statistieken voor {target} bij te houden, plaats je de volgende code in het {head} gedeelte van je website.",
@ -60,6 +65,10 @@
"metrics.bounce-rate": "Bouncepercentage", "metrics.bounce-rate": "Bouncepercentage",
"metrics.browsers": "Browsers", "metrics.browsers": "Browsers",
"metrics.countries": "Landen", "metrics.countries": "Landen",
"metrics.device.desktop": "Desktop",
"metrics.device.laptop": "Laptop",
"metrics.device.mobile": "Mobile",
"metrics.device.tablet": "Tablet",
"metrics.devices": "Apparaten", "metrics.devices": "Apparaten",
"metrics.events": "Gebeurtenissen", "metrics.events": "Gebeurtenissen",
"metrics.filter.combined": "Gecombineerd", "metrics.filter.combined": "Gecombineerd",
@ -72,11 +81,6 @@
"metrics.unique-visitors": "Unieke bezoekers", "metrics.unique-visitors": "Unieke bezoekers",
"metrics.views": "Weergaven", "metrics.views": "Weergaven",
"metrics.visitors": "Bezoekers", "metrics.visitors": "Bezoekers",
"placeholder.message.go-to-settings": "Naar instellingen",
"placeholder.message.no-websites-configured": "Je hebt geen websites ingesteld.",
"settings.accounts": "Accounts",
"settings.profile": "Profiel",
"settings.websites": "Websites",
"title.add-account": "Account toevoegen", "title.add-account": "Account toevoegen",
"title.add-website": "Website toevoegen", "title.add-website": "Website toevoegen",
"title.change-password": "Wachtwoord wijzigen", "title.change-password": "Wachtwoord wijzigen",
@ -85,7 +89,5 @@
"title.edit-account": "Account bewerken", "title.edit-account": "Account bewerken",
"title.edit-website": "Website bewerken", "title.edit-website": "Website bewerken",
"title.share-url": "URL delen", "title.share-url": "URL delen",
"title.tracking-code": "Tracking code", "title.tracking-code": "Tracking code"
"tooltip.get-share-url": "Openbare URL",
"tooltip.get-tracking-code": "Tracking code"
} }

View File

@ -1,30 +1,26 @@
{ {
"active-users.message": "{x} текущих посетителей",
"button.add-account": "Добавить аккаунт", "button.add-account": "Добавить аккаунт",
"button.add-website": "Добавить сайт", "button.add-website": "Добавить сайт",
"button.back": "Назад", "button.back": "Назад",
"button.cancel": "Отменить", "button.cancel": "Отменить",
"button.change-password": "Изменить пароль", "button.change-password": "Изменить пароль",
"button.copy-to-clipboard": "Скопировать в буфер обмена", "button.copy-to-clipboard": "Скопировать в буфер обмена",
"button.date-range": "Date range",
"button.delete": "Удалить", "button.delete": "Удалить",
"button.edit": "Редактировать", "button.edit": "Редактировать",
"button.login": "Войти", "button.login": "Войти",
"button.more": "Больше", "button.more": "Больше",
"button.refresh": "Refresh", "button.refresh": "Refresh",
"button.save": "Сохранить", "button.save": "Сохранить",
"button.single-day": "Single day",
"button.view-details": "Посмотреть детали", "button.view-details": "Посмотреть детали",
"button.websites": "Сайты", "button.websites": "Сайты",
"device.desktop": "Desktop", "label.accounts": "Аккаунты",
"device.laptop": "Laptop",
"device.mobile": "Mobile",
"device.tablet": "Tablet",
"footer.powered-by": "на движке {name}",
"header.nav.dashboard": "Информационная панель",
"header.nav.settings": "Настройки",
"label.administrator": "Администратор", "label.administrator": "Администратор",
"label.confirm-password": "Подтвердить пароль", "label.confirm-password": "Подтвердить пароль",
"label.current-password": "Текущий пароль", "label.current-password": "Текущий пароль",
"label.custom-range": "Custom range", "label.custom-range": "Другой период",
"label.dashboard": "Информационная панель",
"label.domain": "Домен", "label.domain": "Домен",
"label.enable-share-url": "Разрешить делиться ссылкой", "label.enable-share-url": "Разрешить делиться ссылкой",
"label.invalid": "Некорректный", "label.invalid": "Некорректный",
@ -37,20 +33,29 @@
"label.new-password": "Новый пароль", "label.new-password": "Новый пароль",
"label.password": "Пароль", "label.password": "Пароль",
"label.passwords-dont-match": "Пароли не совпадают", "label.passwords-dont-match": "Пароли не совпадают",
"label.profile": "Профиль",
"label.required": "Обязательное", "label.required": "Обязательное",
"label.settings": "Настройки",
"label.this-month": "Этот месяц", "label.this-month": "Этот месяц",
"label.this-week": "Эта неделя", "label.this-week": "Эта неделя",
"label.this-year": "Этот год", "label.this-year": "Этот год",
"label.today": "Сегодня", "label.today": "Сегодня",
"label.unknown": "Unknown", "label.unknown": "Unknown",
"label.username": "Имя пользователя", "label.username": "Имя пользователя",
"label.websites": "Сайты",
"message.active-users": "{x} текущих посетителей",
"message.confirm-delete": "Вы уверены, что хотите удалить {target}?", "message.confirm-delete": "Вы уверены, что хотите удалить {target}?",
"message.copied": "Скопировано!", "message.copied": "Скопировано!",
"message.delete-warning": "Все связанные данные будут также удалены.", "message.delete-warning": "Все связанные данные будут также удалены.",
"message.failure": "Что-то пошло не так.", "message.failure": "Что-то пошло не так.",
"message.get-share-url": "Получить публичную ссылку",
"message.get-tracking-code": "Получить код отслеживания",
"message.go-to-settings": "Перейти к настройкам",
"message.incorrect-username-password": "Неверное имя пользователя/пароль.", "message.incorrect-username-password": "Неверное имя пользователя/пароль.",
"message.no-data-available": "Нет данных.", "message.no-data-available": "Нет данных.",
"message.no-websites-configured": "У вас нет настроенных сайтов.",
"message.page-not-found": "Страница не найдена.", "message.page-not-found": "Страница не найдена.",
"message.powered-by": "на движке {name}",
"message.save-success": "Успешно сохранено.", "message.save-success": "Успешно сохранено.",
"message.share-url": "Это публичная ссылка для {target}.", "message.share-url": "Это публичная ссылка для {target}.",
"message.track-stats": "Чтобы отслеживать статистику для {target}, поместите следующий код в раздел {head} вашего сайта.", "message.track-stats": "Чтобы отслеживать статистику для {target}, поместите следующий код в раздел {head} вашего сайта.",
@ -60,6 +65,10 @@
"metrics.bounce-rate": "Отказы", "metrics.bounce-rate": "Отказы",
"metrics.browsers": "Браузеры", "metrics.browsers": "Браузеры",
"metrics.countries": "Страны", "metrics.countries": "Страны",
"metrics.device.desktop": "Desktop",
"metrics.device.laptop": "Laptop",
"metrics.device.mobile": "Mobile",
"metrics.device.tablet": "Tablet",
"metrics.devices": "Устройства", "metrics.devices": "Устройства",
"metrics.events": "События", "metrics.events": "События",
"metrics.filter.combined": "Объединенные", "metrics.filter.combined": "Объединенные",
@ -72,11 +81,6 @@
"metrics.unique-visitors": "Уникальные посетители", "metrics.unique-visitors": "Уникальные посетители",
"metrics.views": "Просмотры", "metrics.views": "Просмотры",
"metrics.visitors": "Посетители", "metrics.visitors": "Посетители",
"placeholder.message.go-to-settings": "Перейти к настройкам",
"placeholder.message.no-websites-configured": "У вас нет настроенных сайтов.",
"settings.accounts": "Аккаунты",
"settings.profile": "Профиль",
"settings.websites": "Сайты",
"title.add-account": "Добавить аккаунт", "title.add-account": "Добавить аккаунт",
"title.add-website": "Добавить сайт", "title.add-website": "Добавить сайт",
"title.change-password": "Изменить пароль", "title.change-password": "Изменить пароль",
@ -85,7 +89,5 @@
"title.edit-account": "Редактировать аккаунт", "title.edit-account": "Редактировать аккаунт",
"title.edit-website": "Редактировать сайт", "title.edit-website": "Редактировать сайт",
"title.share-url": "Поделиться ссылкой", "title.share-url": "Поделиться ссылкой",
"title.tracking-code": "Код отслеживания", "title.tracking-code": "Код отслеживания"
"tooltip.get-share-url": "Получить публичную ссылку",
"tooltip.get-tracking-code": "Получить код отслеживания"
} }

View File

@ -1,30 +1,26 @@
{ {
"active-users.message": "{x} aktif ziyaretçi",
"button.add-account": "Yeni Hesap Ekle", "button.add-account": "Yeni Hesap Ekle",
"button.add-website": "Web sitesi ekle", "button.add-website": "Web sitesi ekle",
"button.back": "Geri", "button.back": "Geri",
"button.cancel": "İptal", "button.cancel": "İptal",
"button.change-password": "Şifre değiştir", "button.change-password": "Şifre değiştir",
"button.copy-to-clipboard": "Panoya kopyala", "button.copy-to-clipboard": "Panoya kopyala",
"button.date-range": "Date range",
"button.delete": "Sil", "button.delete": "Sil",
"button.edit": "Düzenle", "button.edit": "Düzenle",
"button.login": "Giriş Yap", "button.login": "Giriş Yap",
"button.more": "Detaylı göster", "button.more": "Detaylı göster",
"button.refresh": "Refresh", "button.refresh": "Refresh",
"button.save": "Kaydet", "button.save": "Kaydet",
"button.single-day": "Single day",
"button.view-details": "Detayı incele", "button.view-details": "Detayı incele",
"button.websites": "Web siteleri", "button.websites": "Web siteleri",
"device.desktop": "Desktop", "label.accounts": "Hesaplar",
"device.laptop": "Laptop",
"device.mobile": "Mobile",
"device.tablet": "Tablet",
"footer.powered-by": "Sağlayıcı: {name}",
"header.nav.dashboard": "Kontrol Paneli",
"header.nav.settings": "Ayarlar",
"label.administrator": "Yönetici", "label.administrator": "Yönetici",
"label.confirm-password": "Parolayı onayla", "label.confirm-password": "Parolayı onayla",
"label.current-password": "Mevcut parola", "label.current-password": "Mevcut parola",
"label.custom-range": "Custom range", "label.custom-range": "Custom range",
"label.dashboard": "Kontrol Paneli",
"label.domain": "Alan adı", "label.domain": "Alan adı",
"label.enable-share-url": "Anonim paylaşım URL'i aktif", "label.enable-share-url": "Anonim paylaşım URL'i aktif",
"label.invalid": "Geçeriz", "label.invalid": "Geçeriz",
@ -37,20 +33,29 @@
"label.new-password": "Yeni parola", "label.new-password": "Yeni parola",
"label.password": "Parola", "label.password": "Parola",
"label.passwords-dont-match": "Parolalar uyuşmuyor", "label.passwords-dont-match": "Parolalar uyuşmuyor",
"label.profile": "Profil",
"label.required": "Zorunlu alan", "label.required": "Zorunlu alan",
"label.settings": "Ayarlar",
"label.this-month": "Bu ay", "label.this-month": "Bu ay",
"label.this-week": "Bu hafta", "label.this-week": "Bu hafta",
"label.this-year": "Bu yıl", "label.this-year": "Bu yıl",
"label.today": "Bugün", "label.today": "Bugün",
"label.unknown": "Unknown", "label.unknown": "Unknown",
"label.username": "Kullanıcı adı", "label.username": "Kullanıcı adı",
"label.websites": "Web siteleri",
"message.active-users": "{x} aktif ziyaretçi",
"message.confirm-delete": "{target} kaydını silmek istediğinizden emin misiniz?", "message.confirm-delete": "{target} kaydını silmek istediğinizden emin misiniz?",
"message.copied": "Panoya kopyalandı!", "message.copied": "Panoya kopyalandı!",
"message.delete-warning": "İlişkili tüm veriler de silinecektir.", "message.delete-warning": "İlişkili tüm veriler de silinecektir.",
"message.failure": "Bir şeyler ters gitti!", "message.failure": "Bir şeyler ters gitti!",
"message.get-share-url": "Paylaşım adresini al",
"message.get-tracking-code": "İzleme kodunu al",
"message.go-to-settings": "Ayarlara git",
"message.incorrect-username-password": "Hatalı kullanıcı adı ya da parola.", "message.incorrect-username-password": "Hatalı kullanıcı adı ya da parola.",
"message.no-data-available": "Henüz hiç veri yok.", "message.no-data-available": "Henüz hiç veri yok.",
"message.no-websites-configured": "Henüz hiç web sitesi tanımlamadınız",
"message.page-not-found": "Sayfa bulunamadı.", "message.page-not-found": "Sayfa bulunamadı.",
"message.powered-by": "Sağlayıcı: {name}",
"message.save-success": "Başarıyla kaydedildi.", "message.save-success": "Başarıyla kaydedildi.",
"message.share-url": "{target} için kullanılabilir anonim paylaşım adresidir.", "message.share-url": "{target} için kullanılabilir anonim paylaşım adresidir.",
"message.track-stats": "{target} alanı adı istatistiklerini takip etmek için, aşağıdaki kodu web sitenizin {head} bloğuna yerleştirin.", "message.track-stats": "{target} alanı adı istatistiklerini takip etmek için, aşağıdaki kodu web sitenizin {head} bloğuna yerleştirin.",
@ -60,6 +65,10 @@
"metrics.bounce-rate": ıkma oranı", "metrics.bounce-rate": ıkma oranı",
"metrics.browsers": "Tarayıcılar", "metrics.browsers": "Tarayıcılar",
"metrics.countries": "Ülkeler", "metrics.countries": "Ülkeler",
"metrics.device.desktop": "Desktop",
"metrics.device.laptop": "Laptop",
"metrics.device.mobile": "Mobile",
"metrics.device.tablet": "Tablet",
"metrics.devices": "Cihazlar", "metrics.devices": "Cihazlar",
"metrics.events": "Olaylar", "metrics.events": "Olaylar",
"metrics.filter.combined": "Birleşik", "metrics.filter.combined": "Birleşik",
@ -72,11 +81,6 @@
"metrics.unique-visitors": "Tekil kullanıcı", "metrics.unique-visitors": "Tekil kullanıcı",
"metrics.views": "Görüntüleme", "metrics.views": "Görüntüleme",
"metrics.visitors": "Ziyaretçi", "metrics.visitors": "Ziyaretçi",
"placeholder.message.go-to-settings": "Ayarlara git",
"placeholder.message.no-websites-configured": "Henüz hiç web sitesi tanımlamadınız",
"settings.accounts": "Hesaplar",
"settings.profile": "Profil",
"settings.websites": "Web siteleri",
"title.add-account": "Hesap ekle", "title.add-account": "Hesap ekle",
"title.add-website": "Web sitesi ekle", "title.add-website": "Web sitesi ekle",
"title.change-password": "Şifre değiştir", "title.change-password": "Şifre değiştir",
@ -85,7 +89,5 @@
"title.edit-account": "Hesabı düzenle", "title.edit-account": "Hesabı düzenle",
"title.edit-website": "Web sitesini düzenle", "title.edit-website": "Web sitesini düzenle",
"title.share-url": "Paylaşım adresi", "title.share-url": "Paylaşım adresi",
"title.tracking-code": "İzleme kodu", "title.tracking-code": "İzleme kodu"
"tooltip.get-share-url": "Paylaşım adresini al",
"tooltip.get-tracking-code": "İzleme kodunu al"
} }

View File

@ -1,30 +1,26 @@
{ {
"active-users.message": "当前在线 {x} 人",
"button.add-account": "添加账户", "button.add-account": "添加账户",
"button.add-website": "添加网站", "button.add-website": "添加网站",
"button.back": "返回", "button.back": "返回",
"button.cancel": "取消", "button.cancel": "取消",
"button.change-password": "更新密码", "button.change-password": "更新密码",
"button.copy-to-clipboard": "复制", "button.copy-to-clipboard": "复制",
"button.date-range": "多日",
"button.delete": "删除", "button.delete": "删除",
"button.edit": "编辑", "button.edit": "编辑",
"button.login": "登录", "button.login": "登录",
"button.more": "更多", "button.more": "更多",
"button.refresh": "Refresh", "button.refresh": "刷新",
"button.save": "保存", "button.save": "保存",
"button.single-day": "单日",
"button.view-details": "查看更多", "button.view-details": "查看更多",
"button.websites": "网站", "button.websites": "网站",
"device.desktop": "Desktop", "label.accounts": "账户",
"device.laptop": "Laptop",
"device.mobile": "Mobile",
"device.tablet": "Tablet",
"footer.powered-by": "运行 {name}",
"header.nav.dashboard": "仪表板",
"header.nav.settings": "设置",
"label.administrator": "管理员", "label.administrator": "管理员",
"label.confirm-password": "确认密码", "label.confirm-password": "确认密码",
"label.current-password": "目前密码", "label.current-password": "目前密码",
"label.custom-range": "Custom range", "label.custom-range": "自定义时间段",
"label.dashboard": "仪表板",
"label.domain": "域名", "label.domain": "域名",
"label.enable-share-url": "激活共享链接", "label.enable-share-url": "激活共享链接",
"label.invalid": "输入无效", "label.invalid": "输入无效",
@ -37,20 +33,29 @@
"label.new-password": "新密码", "label.new-password": "新密码",
"label.password": "密码", "label.password": "密码",
"label.passwords-dont-match": "密码不一致", "label.passwords-dont-match": "密码不一致",
"label.profile": "个人资料",
"label.required": "必填", "label.required": "必填",
"label.settings": "设置",
"label.this-month": "本月", "label.this-month": "本月",
"label.this-week": "本周", "label.this-week": "本周",
"label.this-year": "今年", "label.this-year": "今年",
"label.today": "今天", "label.today": "今天",
"label.unknown": "Unknown", "label.unknown": "未知",
"label.username": "用户名", "label.username": "用户名",
"label.websites": "网站",
"message.active-users": "当前在线 {x} 人",
"message.confirm-delete": "你确定要删除{target}吗?", "message.confirm-delete": "你确定要删除{target}吗?",
"message.copied": "复制成功!", "message.copied": "复制成功!",
"message.delete-warning": "所有相关数据将会被删除.", "message.delete-warning": "所有相关数据将会被删除.",
"message.failure": "出现错误.", "message.failure": "出现错误.",
"message.get-share-url": "获得共享链接",
"message.get-tracking-code": "获得跟踪代码",
"message.go-to-settings": "去设置",
"message.incorrect-username-password": "用户名密码不正确.", "message.incorrect-username-password": "用户名密码不正确.",
"message.no-data-available": "无可用数据.", "message.no-data-available": "无可用数据.",
"message.no-websites-configured": "你还没有设置任何网站.",
"message.page-not-found": "网页未找到.", "message.page-not-found": "网页未找到.",
"message.powered-by": "运行 {name}",
"message.save-success": "成功保存.", "message.save-success": "成功保存.",
"message.share-url": "这是 {target} 的共享链接.", "message.share-url": "这是 {target} 的共享链接.",
"message.track-stats": "把以下代码放到你的网站的{head}部分来收集{target}的数据.", "message.track-stats": "把以下代码放到你的网站的{head}部分来收集{target}的数据.",
@ -60,6 +65,10 @@
"metrics.bounce-rate": "跳出率", "metrics.bounce-rate": "跳出率",
"metrics.browsers": "浏览器", "metrics.browsers": "浏览器",
"metrics.countries": "国家", "metrics.countries": "国家",
"metrics.device.desktop": "台式机",
"metrics.device.laptop": "笔记本",
"metrics.device.mobile": "手机",
"metrics.device.tablet": "平板",
"metrics.devices": "设备", "metrics.devices": "设备",
"metrics.events": "行为类别", "metrics.events": "行为类别",
"metrics.filter.combined": "总和", "metrics.filter.combined": "总和",
@ -72,11 +81,6 @@
"metrics.unique-visitors": "独立访客", "metrics.unique-visitors": "独立访客",
"metrics.views": "页面流量", "metrics.views": "页面流量",
"metrics.visitors": "独立访客", "metrics.visitors": "独立访客",
"placeholder.message.go-to-settings": "去设置",
"placeholder.message.no-websites-configured": "你还没有设置任何网站.",
"settings.accounts": "账户",
"settings.profile": "个人资料",
"settings.websites": "网站",
"title.add-account": "添加账户", "title.add-account": "添加账户",
"title.add-website": "添加网站", "title.add-website": "添加网站",
"title.change-password": "更新密码", "title.change-password": "更新密码",
@ -85,7 +89,5 @@
"title.edit-account": "编辑账户", "title.edit-account": "编辑账户",
"title.edit-website": "编辑网站", "title.edit-website": "编辑网站",
"title.share-url": "共享链接", "title.share-url": "共享链接",
"title.tracking-code": "跟踪代码", "title.tracking-code": "跟踪代码"
"tooltip.get-share-url": "获得共享链接",
"tooltip.get-tracking-code": "获得跟踪代码"
} }

View File

@ -1,9 +1,49 @@
import { parse } from 'cookie'; import { parse } from 'cookie';
import { parseSecureToken } from './crypto'; import { parseSecureToken, parseToken } from './crypto';
import { AUTH_COOKIE_NAME } from './constants'; import { AUTH_COOKIE_NAME } from './constants';
import { getWebsiteById } from './queries';
export async function verifyAuthToken(req) { export async function getAuthToken(req) {
const token = parse(req.headers.cookie || '')[AUTH_COOKIE_NAME]; const token = parse(req.headers.cookie || '')[AUTH_COOKIE_NAME];
return parseSecureToken(token); return parseSecureToken(token);
} }
export async function isValidToken(token, validation) {
try {
const result = await parseToken(token);
if (typeof validation === 'object') {
return !Object.keys(validation).find(key => result[key] !== validation[key]);
} else if (typeof validation === 'function') {
return validation(result);
}
} catch (e) {
return false;
}
return false;
}
export async function allowQuery(req, skipToken) {
const { id, token } = req.query;
const websiteId = +id;
const website = await getWebsiteById(websiteId);
if (website) {
if (token && !skipToken) {
return isValidToken(token, { website_id: websiteId });
}
const authToken = await getAuthToken(req);
if (authToken) {
const { user_id, is_admin } = authToken;
return is_admin || website.user_id === user_id;
}
}
return false;
}

View File

@ -27,7 +27,7 @@ export function uuid(...args) {
return v5(args.join(''), salt()); return v5(args.join(''), salt());
} }
export function isValidId(s) { export function isValidUuid(s) {
return validate(s); return validate(s);
} }

View File

@ -89,7 +89,7 @@ export function getDateRange(value) {
export function getDateRangeValues(startDate, endDate) { export function getDateRangeValues(startDate, endDate) {
let unit = 'year'; let unit = 'year';
if (differenceInHours(endDate, startDate) <= 72) { if (differenceInHours(endDate, startDate) <= 48) {
unit = 'hour'; unit = 'hour';
} else if (differenceInCalendarDays(endDate, startDate) <= 90) { } else if (differenceInCalendarDays(endDate, startDate) <= 90) {
unit = 'day'; unit = 'day';

View File

@ -1,6 +1,6 @@
import firstBy from 'thenby'; import firstBy from 'thenby';
import { BROWSERS, ISO_COUNTRIES } from './constants'; import { BROWSERS, ISO_COUNTRIES } from './constants';
import { removeTrailingSlash, getDomainName } from './url'; import { removeTrailingSlash, removeWWW, getDomainName } from './url';
export const urlFilter = (data, { raw }) => { export const urlFilter = (data, { raw }) => {
const isValidUrl = url => { const isValidUrl = url => {
@ -55,6 +55,7 @@ export const urlFilter = (data, { raw }) => {
export const refFilter = (data, { domain, domainOnly, raw }) => { export const refFilter = (data, { domain, domainOnly, raw }) => {
const domainName = getDomainName(domain); const domainName = getDomainName(domain);
const regex = new RegExp(`http[s]?://${domainName}`); const regex = new RegExp(`http[s]?://${domainName}`);
const links = {};
const isValidRef = ref => { const isValidRef = ref => {
return ref !== '' && !ref.startsWith('/') && !ref.startsWith('#'); return ref !== '' && !ref.startsWith('/') && !ref.startsWith('#');
@ -85,7 +86,7 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
const ref = searchParams.get('ref'); const ref = searchParams.get('ref');
const query = ref ? `?ref=${ref}` : ''; const query = ref ? `?ref=${ref}` : '';
return `${origin}${path}${query}`; return removeTrailingSlash(`${removeWWW(hostname)}${path}`) + query;
} }
return null; return null;
@ -101,6 +102,10 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
const url = cleanUrl(x); const url = cleanUrl(x);
if (!domainOnly && !raw) {
links[url] = x;
}
if (url) { if (url) {
if (!obj[url]) { if (!obj[url]) {
obj[url] = y; obj[url] = y;
@ -113,7 +118,7 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
}, {}); }, {});
return Object.keys(map) return Object.keys(map)
.map(key => ({ x: key, y: map[key] })) .map(key => ({ x: key, y: map[key], w: links[key] }))
.sort(firstBy('y', -1).thenBy('x')); .sort(firstBy('y', -1).thenBy('x'));
}; };

View File

@ -38,7 +38,7 @@ export const dateLocales = {
}; };
export const menuOptions = [ export const menuOptions = [
{ label: 'English', value: 'en', display: 'EN' }, { label: 'English', value: 'en-US', display: 'EN' },
{ label: '中文', value: 'zh-CN', display: 'CN' }, { label: '中文', value: 'zh-CN', display: 'CN' },
{ label: 'Deutsch', value: 'de-DE', display: 'DE' }, { label: 'Deutsch', value: 'de-DE', display: 'DE' },
{ label: 'Español', value: 'es-MX', display: 'ES' }, { label: 'Español', value: 'es-MX', display: 'ES' },

View File

@ -1,6 +1,6 @@
import cors from 'cors'; import cors from 'cors';
import { verifySession } from './session'; import { getSession } from './session';
import { verifyAuthToken } from './auth'; import { getAuthToken } from './auth';
import { unauthorized, badRequest, serverError } from './response'; import { unauthorized, badRequest, serverError } from './response';
export function use(middleware) { export function use(middleware) {
@ -21,7 +21,7 @@ export const useSession = use(async (req, res, next) => {
let session; let session;
try { try {
session = await verifySession(req); session = await getSession(req);
} catch (e) { } catch (e) {
return serverError(res, e.message); return serverError(res, e.message);
} }
@ -35,13 +35,7 @@ export const useSession = use(async (req, res, next) => {
}); });
export const useAuth = use(async (req, res, next) => { export const useAuth = use(async (req, res, next) => {
let token; const token = await getAuthToken(req);
try {
token = await verifyAuthToken(req);
} catch (e) {
return serverError(res, e.message);
}
if (!token) { if (!token) {
return unauthorized(res); return unauthorized(res);

View File

@ -1,8 +1,8 @@
import { getWebsiteByUuid, getSessionByUuid, createSession } from 'lib/queries'; import { getWebsiteByUuid, getSessionByUuid, createSession } from 'lib/queries';
import { getClientInfo } from 'lib/request'; import { getClientInfo } from 'lib/request';
import { uuid, isValidId } from 'lib/crypto'; import { uuid, isValidUuid } from 'lib/crypto';
export async function verifySession(req) { export async function getSession(req) {
const { payload } = req.body; const { payload } = req.body;
if (!payload) { if (!payload) {
@ -11,7 +11,7 @@ export async function verifySession(req) {
const { website: website_uuid, hostname, screen, language } = payload; const { website: website_uuid, hostname, screen, language } = payload;
if (!isValidId(website_uuid)) { if (!isValidUuid(website_uuid)) {
throw new Error(`Invalid website: ${website_uuid}`); throw new Error(`Invalid website: ${website_uuid}`);
} }

View File

@ -2,6 +2,10 @@ export function removeTrailingSlash(url) {
return url && url.length > 1 && url.endsWith('/') ? url.slice(0, -1) : url; return url && url.length > 1 && url.endsWith('/') ? url.slice(0, -1) : url;
} }
export function removeWWW(url) {
return url && url.length > 1 && url.startsWith('www.') ? url.slice(4) : url;
}
export function getDomainName(str) { export function getDomainName(str) {
try { try {
return new URL(str).hostname; return new URL(str).hostname;

View File

@ -19,7 +19,7 @@ export const apiRequest = (method, url, body) =>
return null; return null;
}); });
function parseQuery(url, params = {}) { const parseQuery = (url, params = {}) => {
const query = Object.keys(params).reduce((values, key) => { const query = Object.keys(params).reduce((values, key) => {
if (params[key] !== undefined) { if (params[key] !== undefined) {
return values.concat(`${key}=${encodeURIComponent(params[key])}`); return values.concat(`${key}=${encodeURIComponent(params[key])}`);
@ -27,7 +27,7 @@ function parseQuery(url, params = {}) {
return values; return values;
}, []); }, []);
return query.length ? `${url}?${query.join('&')}` : url; return query.length ? `${url}?${query.join('&')}` : url;
} };
export const get = (url, params) => apiRequest('get', parseQuery(url, params)); export const get = (url, params) => apiRequest('get', parseQuery(url, params));
@ -62,3 +62,14 @@ export const doNotTrack = () => {
return dnt === true || dnt === 1 || dnt === 'yes' || dnt === '1'; return dnt === true || dnt === 1 || dnt === 'yes' || dnt === '1';
}; };
export const setItem = (key, data, session) => {
if (typeof window !== 'undefined') {
(session ? sessionStorage : localStorage).setItem(key, JSON.stringify(data));
}
};
export const getItem = (key, session) =>
typeof window !== 'undefined'
? JSON.parse((session ? sessionStorage : localStorage).getItem(key))
: null;

View File

@ -1,6 +1,6 @@
{ {
"name": "umami", "name": "umami",
"version": "0.35.0", "version": "0.38.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",

View File

@ -1,4 +1,4 @@
import React, { useEffect } from 'react'; import React from 'react';
import { IntlProvider } from 'react-intl'; import { IntlProvider } from 'react-intl';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { useStore } from 'redux/store'; import { useStore } from 'redux/store';
@ -9,17 +9,10 @@ import 'styles/bootstrap-grid.css';
import 'styles/index.css'; import 'styles/index.css';
const Intl = ({ children }) => { const Intl = ({ children }) => {
const [locale, setLocale] = useLocale(); const [locale] = useLocale();
const Wrapper = ({ children }) => <span className={locale}>{children}</span>; const Wrapper = ({ children }) => <span className={locale}>{children}</span>;
useEffect(() => {
const saved = localStorage.getItem('locale');
if (saved) {
setLocale(saved);
}
});
return ( return (
<IntlProvider locale={locale} messages={messages[locale]} textComponent={Wrapper}> <IntlProvider locale={locale} messages={messages[locale]} textComponent={Wrapper}>
{children} {children}

View File

@ -9,7 +9,7 @@ export default async (req, res) => {
const { id } = req.query; const { id } = req.query;
const user_id = +id; const user_id = +id;
if (is_admin) { if (!is_admin) {
return unauthorized(res); return unauthorized(res);
} }

View File

@ -5,16 +5,16 @@ import { ok, unauthorized, methodNotAllowed } from 'lib/response';
export default async (req, res) => { export default async (req, res) => {
await useAuth(req, res); await useAuth(req, res);
const { is_admin: current_user_is_admin } = req.auth; const { is_admin } = req.auth;
if (!is_admin) {
return unauthorized(res);
}
if (req.method === 'GET') { if (req.method === 'GET') {
if (current_user_is_admin) { const accounts = await getAccounts();
const accounts = await getAccounts();
return ok(res, accounts); return ok(res, accounts);
}
return unauthorized(res);
} }
return methodNotAllowed(res); return methodNotAllowed(res);

View File

@ -1,5 +1,6 @@
import { getWebsiteByShareId } from 'lib/queries'; import { getWebsiteByShareId } from 'lib/queries';
import { ok, notFound, methodNotAllowed } from 'lib/response'; import { ok, notFound, methodNotAllowed } from 'lib/response';
import { createToken } from 'lib/crypto';
export default async (req, res) => { export default async (req, res) => {
const { id } = req.query; const { id } = req.query;
@ -8,7 +9,10 @@ export default async (req, res) => {
const website = await getWebsiteByShareId(id); const website = await getWebsiteByShareId(id);
if (website) { if (website) {
return ok(res, website); const websiteId = website.website_id;
const token = await createToken({ website_id: websiteId });
return ok(res, { websiteId, token });
} }
return notFound(res); return notFound(res);

View File

@ -1,31 +0,0 @@
import { deleteWebsite, getWebsiteById } from 'lib/queries';
import { useAuth } from 'lib/middleware';
import { methodNotAllowed, ok, unauthorized } from 'lib/response';
export default async (req, res) => {
const { id } = req.query;
const website_id = +id;
if (req.method === 'GET') {
const website = await getWebsiteById(website_id);
return ok(res, website);
}
if (req.method === 'DELETE') {
await useAuth(req, res);
const { user_id, is_admin } = req.auth;
const website = await getWebsiteById(website_id);
if (website.user_id === user_id || is_admin) {
await deleteWebsite(website_id);
return ok(res);
}
return unauthorized(res);
}
return methodNotAllowed(res);
};

View File

@ -1,12 +1,18 @@
import { getActiveVisitors } from 'lib/queries'; import { getActiveVisitors } from 'lib/queries';
import { methodNotAllowed, ok } from 'lib/response'; import { methodNotAllowed, ok, unauthorized } from 'lib/response';
import { allowQuery } from 'lib/auth';
export default async (req, res) => { export default async (req, res) => {
if (req.method === 'GET') { if (req.method === 'GET') {
const { id } = req.query; if (!(await allowQuery(req))) {
const website_id = +id; return unauthorized(res);
}
const result = await getActiveVisitors(website_id); const { id } = req.query;
const websiteId = +id;
const result = await getActiveVisitors(websiteId);
return ok(res, result); return ok(res, result);
} }

View File

@ -1,11 +1,16 @@
import moment from 'moment-timezone'; import moment from 'moment-timezone';
import { getEvents } from 'lib/queries'; import { getEvents } from 'lib/queries';
import { ok, badRequest, methodNotAllowed } from 'lib/response'; import { ok, badRequest, methodNotAllowed, unauthorized } from 'lib/response';
import { allowQuery } from 'lib/auth';
const unitTypes = ['year', 'month', 'hour', 'day']; const unitTypes = ['year', 'month', 'hour', 'day'];
export default async (req, res) => { export default async (req, res) => {
if (req.method === 'GET') { if (req.method === 'GET') {
if (!(await allowQuery(req))) {
return unauthorized(res);
}
const { id, start_at, end_at, unit, tz } = req.query; const { id, start_at, end_at, unit, tz } = req.query;
if (!moment.tz.zone(tz) || !unitTypes.includes(unit)) { if (!moment.tz.zone(tz) || !unitTypes.includes(unit)) {

View File

@ -0,0 +1,31 @@
import { deleteWebsite, getWebsiteById } from 'lib/queries';
import { methodNotAllowed, ok, unauthorized } from 'lib/response';
import { allowQuery } from 'lib/auth';
export default async (req, res) => {
const { id } = req.query;
const websiteId = +id;
if (req.method === 'GET') {
if (!(await allowQuery(req))) {
return unauthorized(res);
}
const website = await getWebsiteById(websiteId);
return ok(res, website);
}
if (req.method === 'DELETE') {
if (!(await allowQuery(req, true))) {
return unauthorized(res);
}
await deleteWebsite(websiteId);
return ok(res);
}
return methodNotAllowed(res);
};

View File

@ -1,9 +1,15 @@
import { getMetrics } from 'lib/queries'; import { getMetrics } from 'lib/queries';
import { methodNotAllowed, ok } from 'lib/response'; import { methodNotAllowed, ok, unauthorized } from 'lib/response';
import { allowQuery } from 'lib/auth';
export default async (req, res) => { export default async (req, res) => {
if (req.method === 'GET') { if (req.method === 'GET') {
if (!(await allowQuery(req))) {
return unauthorized(res);
}
const { id, start_at, end_at } = req.query; const { id, start_at, end_at } = req.query;
const websiteId = +id; const websiteId = +id;
const startDate = new Date(+start_at); const startDate = new Date(+start_at);
const endDate = new Date(+end_at); const endDate = new Date(+end_at);

View File

@ -1,21 +1,26 @@
import moment from 'moment-timezone'; import moment from 'moment-timezone';
import { getPageviews } from 'lib/queries'; import { getPageviews } from 'lib/queries';
import { ok, badRequest, methodNotAllowed } from 'lib/response'; import { ok, badRequest, methodNotAllowed, unauthorized } from 'lib/response';
import { allowQuery } from 'lib/auth';
const unitTypes = ['year', 'month', 'hour', 'day']; const unitTypes = ['year', 'month', 'hour', 'day'];
export default async (req, res) => { export default async (req, res) => {
if (req.method === 'GET') { if (req.method === 'GET') {
const { id, start_at, end_at, unit, tz } = req.query; if (!(await allowQuery(req))) {
return unauthorized(res);
if (!moment.tz.zone(tz) || !unitTypes.includes(unit)) {
return badRequest(res);
} }
const { id, start_at, end_at, unit, tz } = req.query;
const websiteId = +id; const websiteId = +id;
const startDate = new Date(+start_at); const startDate = new Date(+start_at);
const endDate = new Date(+end_at); const endDate = new Date(+end_at);
if (!moment.tz.zone(tz) || !unitTypes.includes(unit)) {
return badRequest(res);
}
const [pageviews, uniques] = await Promise.all([ const [pageviews, uniques] = await Promise.all([
getPageviews(websiteId, startDate, endDate, tz, unit, '*'), getPageviews(websiteId, startDate, endDate, tz, unit, '*'),
getPageviews(websiteId, startDate, endDate, tz, unit, 'distinct session_id'), getPageviews(websiteId, startDate, endDate, tz, unit, 'distinct session_id'),

View File

@ -1,6 +1,7 @@
import { getRankings } from 'lib/queries'; import { getRankings } from 'lib/queries';
import { ok, badRequest, methodNotAllowed } from 'lib/response'; import { ok, badRequest, methodNotAllowed, unauthorized } from 'lib/response';
import { DOMAIN_REGEX } from 'lib/constants'; import { DOMAIN_REGEX } from 'lib/constants';
import { allowQuery } from 'lib/auth';
const sessionColumns = ['browser', 'os', 'device', 'country']; const sessionColumns = ['browser', 'os', 'device', 'country'];
const pageviewColumns = ['url', 'referrer']; const pageviewColumns = ['url', 'referrer'];
@ -26,7 +27,12 @@ function getColumn(type) {
export default async (req, res) => { export default async (req, res) => {
if (req.method === 'GET') { if (req.method === 'GET') {
if (!(await allowQuery(req))) {
return unauthorized(res);
}
const { id, type, start_at, end_at, domain } = req.query; const { id, type, start_at, end_at, domain } = req.query;
const websiteId = +id; const websiteId = +id;
const startDate = new Date(+start_at); const startDate = new Date(+start_at);
const endDate = new Date(+end_at); const endDate = new Date(+end_at);

View File

@ -15,22 +15,21 @@ export default async (req, res) => {
if (website_id) { if (website_id) {
const website = await getWebsiteById(website_id); const website = await getWebsiteById(website_id);
if (website.user_id === user_id || is_admin) { if (website.user_id !== user_id && !is_admin) {
let { share_id } = website; return unauthorized(res);
console.log('exising id', share_id, website);
if (enable_share_url) {
share_id = share_id ? share_id : getRandomChars(8);
} else {
share_id = null;
}
await updateWebsite(website_id, { name, domain, share_id });
return ok(res);
} }
return unauthorized(res); let { share_id } = website;
if (enable_share_url) {
share_id = share_id ? share_id : getRandomChars(8);
} else {
share_id = null;
}
await updateWebsite(website_id, { name, domain, share_id });
return ok(res);
} else { } else {
const website_uuid = uuid(); const website_uuid = uuid();
const share_id = enable_share_url ? getRandomChars(8) : null; const share_id = enable_share_url ? getRandomChars(8) : null;

View File

@ -5,15 +5,16 @@ import { ok, methodNotAllowed, unauthorized } from 'lib/response';
export default async (req, res) => { export default async (req, res) => {
await useAuth(req, res); await useAuth(req, res);
const { user_id, is_admin } = req.auth; const { user_id: current_user_id, is_admin } = req.auth;
const { userId } = req.query; const { user_id } = req.query;
const userId = +user_id;
if (req.method === 'GET') { if (req.method === 'GET') {
if (userId && !is_admin) { if (userId && userId !== current_user_id && !is_admin) {
return unauthorized(res); return unauthorized(res);
} }
const websites = await getUserWebsites(+userId || user_id); const websites = await getUserWebsites(userId || current_user_id);
return ok(res, websites); return ok(res, websites);
} }

View File

@ -0,0 +1,3 @@
import Index from './index';
export default Index;

View File

@ -0,0 +1,3 @@
import Index from './index';
export default Index;

View File

@ -14,9 +14,11 @@ export default function SharePage() {
return null; return null;
} }
const { websiteId, token } = data;
return ( return (
<Layout> <Layout>
<WebsiteDetails websiteId={data.website_id} /> <WebsiteDetails websiteId={websiteId} token={token} />
</Layout> </Layout>
); );
} }

View File

@ -1,8 +1,9 @@
import { createSlice } from '@reduxjs/toolkit'; import { createSlice } from '@reduxjs/toolkit';
import { getItem } from 'lib/web';
const app = createSlice({ const app = createSlice({
name: 'app', name: 'app',
initialState: { locale: 'en-US' }, initialState: { locale: getItem('umami.locale') || 'en-US' },
reducers: { reducers: {
updateApp(state, action) { updateApp(state, action) {
state = action.payload; state = action.payload;

View File

@ -36,17 +36,6 @@ h6 {
font-weight: 400; font-weight: 400;
} }
#__next {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
#__modals {
z-index: 10;
}
button, button,
input, input,
select { select {
@ -87,16 +76,28 @@ label:empty {
dt { dt {
font-weight: 600; font-weight: 600;
margin: 0 0 5px 0;
} }
dd { dd {
margin: 0 0 10px 0; margin: 0 0 30px 0;
} }
main { main {
flex: 1; flex: 1;
} }
#__next {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
#__modals {
z-index: 10;
}
.container { .container {
padding: 0; padding: 0;
} }