Implement react-basics styles. Fix queries.

This commit is contained in:
Mike Cao 2022-12-08 23:43:43 -08:00
parent b57ecf33e6
commit 0a6ecfe3d2
59 changed files with 227 additions and 4336 deletions

View File

@ -2,9 +2,9 @@
display: flex;
justify-content: center;
align-items: center;
font-size: var(--font-size-normal);
color: var(--gray900);
background: var(--gray100);
font-size: var(--font-size-md);
color: var(--base900);
background: var(--base100);
padding: 8px 16px;
border-radius: 4px;
border: 0;
@ -14,11 +14,11 @@
}
.button:hover {
background: var(--gray200);
background: var(--base200);
}
.button:active {
color: var(--gray900);
color: var(--base900);
}
.label {
@ -33,26 +33,26 @@
}
.small {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
}
.xsmall {
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
}
.action,
.action:active {
color: var(--gray50);
background: var(--gray900);
color: var(--base50);
background: var(--base900);
}
.action:hover {
background: var(--gray800);
background: var(--base800);
}
.danger,
.danger:active {
color: var(--gray50);
color: var(--base50);
background: var(--red500);
}
@ -62,7 +62,7 @@
.light,
.light:active {
color: var(--gray900);
color: var(--base900);
background: transparent;
}
@ -85,18 +85,18 @@
.button:disabled {
cursor: default;
color: var(--gray500);
background: var(--gray75);
color: var(--base500);
background: var(--base75);
}
.button:disabled:active {
color: var(--gray500);
color: var(--base500);
}
.button:disabled:hover {
background: var(--gray75);
background: var(--base75);
}
.button.light:disabled {
background: var(--gray50);
background: var(--base50);
}

View File

@ -2,14 +2,14 @@
display: inline-flex;
border-radius: 4px;
overflow: hidden;
border: 1px solid var(--gray500);
border: 1px solid var(--base500);
}
.group .button {
border-radius: 0;
color: var(--gray800);
background: var(--gray50);
border-left: 1px solid var(--gray500);
color: var(--base800);
background: var(--base50);
border-left: 1px solid var(--base500);
padding: 4px 8px;
}
@ -18,7 +18,7 @@
}
.group .button:hover {
background: var(--gray100);
background: var(--base100);
}
.group .button + .button {
@ -26,6 +26,6 @@
}
.group .button.selected {
color: var(--gray900);
color: var(--base900);
font-weight: 600;
}

View File

@ -1,7 +1,7 @@
.calendar {
display: flex;
flex-direction: column;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
flex: 1;
min-height: 306px;
}
@ -12,7 +12,7 @@
}
.calendar td {
color: var(--gray800);
color: var(--base800);
cursor: pointer;
text-align: center;
vertical-align: center;
@ -23,17 +23,17 @@
}
.calendar td:hover {
border: 1px solid var(--gray300);
background: var(--gray75);
border: 1px solid var(--base300);
background: var(--base75);
}
.calendar td.faded {
color: var(--gray500);
color: var(--base500);
}
.calendar td.selected {
font-weight: 600;
border: 1px solid var(--gray600);
border: 1px solid var(--base600);
}
.calendar td.selected:hover {
@ -41,18 +41,18 @@
}
.calendar td.disabled {
color: var(--gray400);
background: var(--gray75);
color: var(--base400);
background: var(--base75);
}
.calendar td.disabled:hover {
cursor: default;
background: var(--gray75);
background: var(--base75);
border-color: transparent;
}
.calendar td.faded.disabled {
background: var(--gray100);
background: var(--base100);
}
.header {
@ -61,7 +61,7 @@
align-items: center;
font-weight: 700;
line-height: 40px;
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
}
.body {

View File

@ -11,7 +11,7 @@
align-items: center;
width: 20px;
height: 20px;
border: 1px solid var(--gray500);
border: 1px solid var(--base500);
border-radius: 4px;
}

View File

@ -1,5 +1,5 @@
.wrapper {
background: var(--gray50);
background: var(--base50);
margin-right: 10px;
border-radius: 100%;
}

View File

@ -3,7 +3,7 @@
display: flex;
justify-content: space-between;
align-items: center;
border: 1px solid var(--gray500);
border: 1px solid var(--base500);
border-radius: 4px;
cursor: pointer;
}
@ -12,7 +12,7 @@
flex: 1;
display: flex;
justify-content: space-between;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
flex-wrap: nowrap;
white-space: nowrap;
padding: 4px 16px;

View File

@ -6,7 +6,7 @@
margin: auto;
display: flex;
z-index: 1;
background-color: var(--gray50);
background-color: var(--base50);
padding: 10px;
}

View File

@ -4,11 +4,11 @@
}
.row .inactive {
color: var(--gray500);
color: var(--base500);
}
.row .active {
color: var(--gray900);
color: var(--base900);
font-weight: 600;
}

View File

@ -2,7 +2,7 @@ a.link,
a.link:active,
a.link:visited {
position: relative;
color: var(--gray900);
color: var(--base900);
text-decoration: none;
display: inline-flex;
align-items: center;
@ -21,11 +21,11 @@ a.link.large {
}
a.link.small {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
}
a.link.xsmall {
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
}
a.link .icon + * {

View File

@ -25,7 +25,7 @@
height: 100%;
width: 100%;
z-index: 10;
background: var(--gray400);
background: var(--base400);
opacity: 0.4;
}
@ -33,13 +33,13 @@
width: 10px;
height: 10px;
border-radius: 100%;
background: var(--gray400);
background: var(--base400);
animation: blink 1.4s infinite;
animation-fill-mode: both;
}
.loading.overlay div {
background: var(--gray900);
background: var(--base900);
}
.loading div + div {

View File

@ -1,22 +1,22 @@
.menu {
background: var(--gray50);
border: 1px solid var(--gray500);
background: var(--base50);
border: 1px solid var(--base500);
border-radius: 4px;
overflow: hidden;
z-index: 100;
}
.option {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
font-weight: normal;
background: var(--gray50);
background: var(--base50);
padding: 4px 16px;
cursor: pointer;
white-space: nowrap;
}
.option:hover {
background: var(--gray100);
background: var(--base100);
}
.float {
@ -43,7 +43,7 @@
}
.divider {
border-top: 1px solid var(--gray300);
border-top: 1px solid var(--base300);
}
.selected {

View File

@ -10,11 +10,11 @@
}
.text {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
}
.open,
.open:hover {
background: var(--gray50);
border: 1px solid var(--gray500);
background: var(--base50);
border: 1px solid var(--base500);
}

View File

@ -8,7 +8,7 @@
z-index: 100;
display: flex;
flex-direction: column;
background-color: var(--gray50);
background-color: var(--base50);
overflow: auto;
}

View File

@ -25,12 +25,12 @@
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: var(--gray50);
background: var(--base50);
min-width: 400px;
min-height: 100px;
max-width: 100vw;
z-index: 1;
border: 1px solid var(--gray300);
border: 1px solid var(--base300);
padding: 30px;
border-radius: 4px;
}

View File

@ -1,6 +1,6 @@
.menu {
color: var(--gray800);
border: 1px solid var(--gray500);
color: var(--base800);
border: 1px solid var(--base500);
border-radius: 4px;
overflow: hidden;
z-index: 2;
@ -13,10 +13,10 @@
}
.option:hover {
background: var(--gray75);
background: var(--base75);
}
.selected {
color: var(--gray900);
color: var(--base900);
font-weight: 600;
}

View File

@ -1,6 +1,6 @@
.container {
color: var(--gray500);
font-size: var(--font-size-normal);
color: var(--base500);
font-size: var(--font-size-md);
position: relative;
display: flex;
align-items: center;

View File

@ -5,16 +5,16 @@
.table label {
display: none;
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
font-weight: bold;
}
.header {
border-bottom: 1px solid var(--gray300);
border-bottom: 1px solid var(--base300);
}
.head {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
font-weight: 600;
line-height: 40px;
}
@ -26,7 +26,7 @@
}
.row {
border-bottom: 1px solid var(--gray300);
border-bottom: 1px solid var(--base300);
padding: 10px 0;
}

View File

@ -1,6 +1,6 @@
.tag {
padding: 2px 4px;
border: 1px solid var(--gray300);
border: 1px solid var(--base300);
border-radius: 4px;
margin-right: 10px;
}

View File

@ -17,7 +17,7 @@
}
.message {
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
}
.close {

View File

@ -6,7 +6,7 @@
}
.message {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
font-weight: 600;
flex: 1;
text-align: center;

View File

@ -16,7 +16,7 @@
.calendars > div + div {
margin-left: 20px;
padding-left: 20px;
border-left: 1px solid var(--gray300);
border-left: 1px solid var(--base300);
}
.filter {

View File

@ -3,7 +3,7 @@
}
.form {
border-right: 1px solid var(--gray300);
border-right: 1px solid var(--base300);
width: 420px;
}
@ -12,7 +12,7 @@
}
.filters + .filters {
border-top: 1px solid var(--gray300);
border-top: 1px solid var(--base300);
min-height: 250px;
}

View File

@ -43,7 +43,7 @@
.error {
width: 600px;
margin: 0 auto 30px;
background: var(--gray50);
background: var(--base50);
padding: 16px;
color: var(--red400);
border: 1px solid var(--red400);
@ -54,7 +54,7 @@
.success {
width: 600px;
margin: 60px auto;
background: var(--gray50);
background: var(--base50);
padding: 16px;
color: var(--green400);
border: 1px solid var(--green400);

View File

@ -2,7 +2,7 @@
display: flex;
justify-content: space-between;
align-items: center;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
text-align: center;
margin: 30px 0;
}

View File

@ -54,7 +54,7 @@
.msg {
color: var(--msgColor);
background: var(--red400);
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
padding: 4px 8px;
border-radius: 4px;
white-space: nowrap;
@ -78,8 +78,8 @@
margin: 20px 0;
padding: 4px 8px;
border-radius: 4px;
color: var(--gray50);
background: var(--gray800);
color: var(--base50);
background: var(--base800);
}
@media only screen and (max-width: 576px) {

View File

@ -9,12 +9,12 @@
}
.row {
border-top: 1px solid var(--gray300);
border-top: 1px solid var(--base300);
min-height: 430px;
}
.row > .col {
border-left: 1px solid var(--gray300);
border-left: 1px solid var(--base300);
padding: 20px;
}
@ -33,7 +33,7 @@
}
.row > .col {
border-top: 1px solid var(--gray300);
border-top: 1px solid var(--base300);
border-left: 0;
padding: 20px 0;
}

View File

@ -7,7 +7,7 @@
.title {
flex: 1;
font-size: var(--font-size-large);
font-size: var(--font-size-lg);
display: flex;
align-items: center;
line-height: 1.4;
@ -22,7 +22,7 @@
display: flex;
justify-content: center;
align-items: center;
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
font-weight: 600;
}

View File

@ -1,20 +1,32 @@
import { Container } from 'react-basics';
import Head from 'next/head';
import Header from 'components/layout/Header';
import Footer from 'components/layout/Footer';
import useLocale from 'hooks/useLocale';
import { useRouter } from 'next/router';
export default function Layout({ title, children, header = true, footer = true }) {
const { dir } = useLocale();
const { basePath } = useRouter();
return (
<>
<Container dir={dir} style={{ maxWidth: 1140 }}>
<Head>
<title>{title ? `${title} | umami` : 'umami'}</title>
<link rel="icon" href={`${basePath}/favicon.ico`} />
<link rel="apple-touch-icon" sizes="180x180" href={`${basePath}/apple-touch-icon.png`} />
<link rel="icon" type="image/png" sizes="32x32" href={`${basePath}/favicon-32x32.png`} />
<link rel="icon" type="image/png" sizes="16x16" href={`${basePath}/favicon-16x16.png`} />
<link rel="manifest" href={`${basePath}/site.webmanifest`} />
<link rel="mask-icon" href={`${basePath}/safari-pinned-tab.svg`} color="#5bbad5" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#fafafa" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#2f2f2f" media="(prefers-color-scheme: dark)" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</Head>
{header && <Header />}
<main>{children}</main>
{footer && <Footer />}
<div id="__modals" dir={dir} />
</>
</Container>
);
}

View File

@ -12,7 +12,7 @@
.container .content {
flex: 1;
position: relative;
border-left: 1px solid var(--gray300);
border-left: 1px solid var(--base300);
padding-left: 30px;
margin-left: 30px;
}
@ -30,7 +30,7 @@
}
.container .content {
border-top: 1px solid var(--gray300);
border-top: 1px solid var(--base300);
border-left: 0;
padding-left: 0;
margin-left: 0;

View File

@ -3,5 +3,6 @@
display: flex;
flex-direction: column;
padding: 0 30px;
background: var(--gray50);
background: var(--base50);
border-radius: 8px;
}

View File

@ -5,7 +5,7 @@
.text {
display: flex;
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
}
.value {

View File

@ -17,7 +17,7 @@
}
.title {
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
font-weight: 600;
}
@ -25,7 +25,7 @@
display: flex;
justify-content: center;
align-items: center;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
font-weight: 600;
}
@ -34,7 +34,7 @@
overflow: hidden;
border-radius: 100%;
margin-right: 8px;
background: var(--gray50);
background: var(--base50);
}
.color {

View File

@ -1,7 +1,7 @@
.table {
position: relative;
height: 100%;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
display: grid;
grid-template-rows: fit-content(100%) auto;
overflow: hidden;
@ -23,11 +23,11 @@
.title {
display: flex;
font-weight: 600;
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
}
.metric {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
font-weight: 600;
text-align: center;
width: 100px;
@ -80,8 +80,8 @@
.percent {
position: relative;
width: 50px;
color: var(--gray600);
border-left: 1px solid var(--gray600);
color: var(--base600);
border-left: 1px solid var(--base600);
padding-left: 10px;
z-index: 1;
}

View File

@ -8,7 +8,7 @@
.label {
display: flex;
align-items: center;
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
cursor: pointer;
}
@ -17,5 +17,5 @@
}
.hidden {
color: var(--gray400);
color: var(--base400);
}

View File

@ -6,7 +6,7 @@
}
.value {
font-size: var(--font-size-xlarge);
font-size: var(--font-size-xl);
line-height: 40px;
min-height: 40px;
font-weight: 600;
@ -14,7 +14,7 @@
}
.label {
font-size: var(--font-size-normal);
font-size: var(--font-size-md);
white-space: nowrap;
display: flex;
align-items: center;
@ -26,8 +26,8 @@
padding: 0 5px;
border-radius: 5px;
margin-left: 4px;
border: 1px solid var(--gray200);
color: var(--gray500);
border: 1px solid var(--base200);
color: var(--base500);
}
.change.positive {

View File

@ -2,7 +2,7 @@
position: relative;
min-height: 430px;
height: 100%;
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
display: flex;
flex-direction: column;
}

View File

@ -1,5 +1,5 @@
.table {
font-size: var(--font-size-xsmall);
font-size: var(--font-size-xs);
overflow: hidden;
height: 100%;
display: grid;
@ -19,7 +19,7 @@
display: flex;
align-items: center;
height: 40px;
border-bottom: 1px solid var(--gray300);
border-bottom: 1px solid var(--base300);
}
.body {
@ -50,7 +50,7 @@
}
.row .link {
color: var(--gray900);
color: var(--base900);
text-decoration: none;
}

View File

@ -31,8 +31,8 @@
position: fixed;
top: 0;
margin: auto;
background: var(--gray50);
border-bottom: 1px solid var(--gray300);
background: var(--base50);
border-bottom: 1px solid var(--base300);
z-index: 3;
}

View File

@ -1,57 +1,29 @@
import Arrow from 'assets/arrow-right.svg';
import classNames from 'classnames';
import { Row, Column } from 'react-basics';
import Favicon from 'components/common/Favicon';
import Link from 'components/common/Link';
import OverflowText from 'components/common/OverflowText';
import RefreshButton from 'components/common/RefreshButton';
import ButtonLayout from 'components/layout/ButtonLayout';
import PageHeader from 'components/layout/PageHeader';
import { FormattedMessage } from 'react-intl';
import ActiveUsers from './ActiveUsers';
import styles from './WebsiteHeader.module.css';
export default function WebsiteHeader({ websiteId, title, domain, showLink = false }) {
const header = showLink ? (
<>
<Favicon domain={domain} />
<Link
className={styles.titleLink}
href="/websites/[...id]"
as={`/websites/${websiteId}/${title}`}
>
<OverflowText tooltipId={`${websiteId}-title`}>{title}</OverflowText>
</Link>
</>
) : (
<>
<Favicon domain={domain} />
<OverflowText tooltipId={`${websiteId}-title`}>{title}</OverflowText>
</>
);
export default function WebsiteHeader({ websiteId, title, domain }) {
return (
<PageHeader className="row">
<div className={classNames(styles.title, 'col-10 col-lg-4 order-1 order-lg-1')}>{header}</div>
<div className={classNames(styles.active, 'col-12 col-lg-4 order-3 order-lg-2')}>
<ActiveUsers websiteId={websiteId} />
</div>
<div className="col-2 col-lg-4 order-2 order-lg-3">
<ButtonLayout align="right">
<RefreshButton websiteId={websiteId} />
{showLink && (
<Link
href="/websites/[...id]"
as={`/websites/${websiteId}/${title}`}
className={styles.link}
icon={<Arrow />}
size="small"
iconRight
>
<FormattedMessage id="label.view-details" defaultMessage="View details" />
</Link>
)}
</ButtonLayout>
</div>
<PageHeader>
<Row>
<Column className={styles.title} xs={12} sm={12} md={4} lg={4}>
<Favicon domain={domain} />
<OverflowText tooltipId={`${websiteId}-title`}>{title}</OverflowText>
</Column>
<Column className={styles.active} xs={12} sm={12} md={4} lg={4}>
<ActiveUsers websiteId={websiteId} />
</Column>
<Column xs={12} sm={12} md={4} lg={4}>
<ButtonLayout align="right">
<RefreshButton websiteId={websiteId} />
</ButtonLayout>
</Column>
</Row>
</PageHeader>
);
}

View File

@ -1,32 +1,15 @@
.title {
color: var(--gray900);
font-size: var(--font-size-large);
line-height: var(--font-size-xlarge);
align-items: center;
display: flex;
max-width: 100%;
flex-direction: row;
align-items: center;
gap: 10px;
font-size: var(--font-size-lg);
overflow: hidden;
}
.titleLink {
max-width: 100%;
}
.link {
font-weight: 600;
}
.active {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
@media only screen and (max-width: 992px) {
.active {
justify-content: flex-start;
}
a.link {
display: none;
}
}

View File

@ -16,19 +16,19 @@
.item h2 {
font-size: 14px;
color: var(--gray700);
color: var(--base700);
}
.text {
padding: 20px;
border-radius: 5px;
border: 1px solid var(--gray400);
background: var(--gray50);
border: 1px solid var(--base400);
background: var(--base50);
}
.active .text {
border-color: var(--gray600);
box-shadow: 4px 4px 4px var(--gray100);
border-color: var(--base600);
box-shadow: 4px 4px 4px var(--base100);
}
.dragActive {

View File

@ -1,4 +1,4 @@
import classNames from 'classnames';
import { Row, Column } from 'react-basics';
import Head from 'next/head';
import Link from 'next/link';
import { useRouter } from 'next/router';
@ -62,8 +62,8 @@ export default function TestConsole() {
</PageHeader>
{website && (
<>
<div className={classNames(styles.test, 'row')}>
<div className="col-4">
<Row className={styles.test}>
<Column xs="4">
<PageHeader>Page links</PageHeader>
<div>
<Link href={`/console/${websiteId}?page=1`}>
@ -87,22 +87,22 @@ export default function TestConsole() {
</a>
</Link>
</div>
</div>
<div className="col-4">
</Column>
<Column xs="4">
<PageHeader>CSS events</PageHeader>
<Button id="primary-button" className="umami--click--button-click" variant="action">
Send event
</Button>
</div>
<div className="col-4">
</Column>
<Column xs="4">
<PageHeader>Javascript events</PageHeader>
<Button id="manual-button" variant="action" onClick={handleClick}>
Run script
</Button>
</div>
</div>
<div className="row">
<div className="col-12">
</Column>
</Row>
<Row>
<Column>
<WebsiteChart
websiteId={website.id}
title={website.name}
@ -111,8 +111,8 @@ export default function TestConsole() {
/>
<PageHeader>Events</PageHeader>
<EventsChart websiteId={website.id} />
</div>
</div>
</Column>
</Row>
</>
)}
</Page>

View File

@ -1,5 +1,5 @@
.test {
border: 1px solid var(--gray200);
border: 1px solid var(--base200);
border-radius: 5px;
padding: 0 20px 20px 20px;
}

View File

@ -1,10 +1,10 @@
import React, { useState } from 'react';
import { useState } from 'react';
import { Row, Column } from 'react-basics';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import classNames from 'classnames';
import WebsiteChart from 'components/metrics/WebsiteChart';
import WorldMap from 'components/common/WorldMap';
import Page from 'components/layout/Page';
import GridLayout, { GridRow, GridColumn } from 'components/layout/GridLayout';
import MenuLayout from 'components/layout/MenuLayout';
import Link from 'components/common/Link';
import Loading from 'components/common/Loading';
@ -137,8 +137,8 @@ export default function WebsiteDetails({ websiteId }) {
return (
<Page>
<div className="row">
<div className={classNames(styles.chart, 'col')}>
<Row>
<Column className={styles.chart}>
<WebsiteChart
websiteId={websiteId}
title={data.name}
@ -148,47 +148,47 @@ export default function WebsiteDetails({ websiteId }) {
stickyHeader
/>
{!chartLoaded && <Loading />}
</div>
</div>
</Column>
</Row>
{chartLoaded && !view && (
<GridLayout>
<GridRow>
<GridColumn md={12} lg={6}>
<>
<Row>
<Column md={12} lg={6}>
<PagesTable {...tableProps} />
</GridColumn>
<GridColumn md={12} lg={6}>
</Column>
<Column md={12} lg={6}>
<ReferrersTable {...tableProps} />
</GridColumn>
</GridRow>
<GridRow>
<GridColumn md={12} lg={4}>
</Column>
</Row>
<Row>
<Column md={12} lg={4}>
<BrowsersTable {...tableProps} />
</GridColumn>
<GridColumn md={12} lg={4}>
</Column>
<Column md={12} lg={4}>
<OSTable {...tableProps} />
</GridColumn>
<GridColumn md={12} lg={4}>
</Column>
<Column md={12} lg={4}>
<DevicesTable {...tableProps} />
</GridColumn>
</GridRow>
<GridRow>
<GridColumn xs={12} md={12} lg={8}>
</Column>
</Row>
<Row>
<Column xs={12} md={12} lg={8}>
<WorldMap data={countryData} />
</GridColumn>
<GridColumn xs={12} md={12} lg={4}>
</Column>
<Column xs={12} md={12} lg={4}>
<CountriesTable {...tableProps} onDataLoad={setCountryData} />
</GridColumn>
</GridRow>
<GridRow className={classNames({ [styles.hidden]: !eventsData?.length > 0 })}>
<GridColumn xs={12} md={12} lg={4}>
</Column>
</Row>
<Row className={classNames({ [styles.hidden]: !eventsData?.length > 0 })}>
<Column xs={12} md={12} lg={4}>
<EventsTable {...tableProps} onDataLoad={setEventsData} />
</GridColumn>
<GridColumn xs={12} md={12} lg={8}>
</Column>
<Column xs={12} md={12} lg={8}>
<EventDataButton websiteId={websiteId} />
<EventsChart className={styles.eventschart} websiteId={websiteId} />
</GridColumn>
</GridRow>
</GridLayout>
</Column>
</Row>
</>
)}
{view && chartLoaded && (
<MenuLayout

View File

@ -3,11 +3,11 @@
}
.view {
border-top: 1px solid var(--gray300);
border-top: 1px solid var(--base300);
}
.menu {
font-size: var(--font-size-small);
font-size: var(--font-size-sm);
}
.content {

View File

@ -1,6 +1,6 @@
.website {
padding-bottom: 30px;
border-bottom: 1px solid var(--gray300);
border-bottom: 1px solid var(--base300);
margin-bottom: 30px;
align-self: stretch;
}

View File

@ -3,8 +3,8 @@
}
.panel {
background: var(--gray50);
border: 1px solid var(--gray500);
background: var(--base50);
border: 1px solid var(--base500);
border-radius: 4px;
display: flex;
flex-direction: column;

View File

@ -1,7 +1,7 @@
.username {
border-bottom: 1px solid var(--gray500);
border-bottom: 1px solid var(--base500);
}
.username:hover {
background: var(--gray50);
background: var(--base50);
}

View File

@ -1,11 +1,9 @@
import Head from 'next/head';
import { useRouter } from 'next/router';
import { IntlProvider } from 'react-intl';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { Container } from 'react-basics';
import useLocale from 'hooks/useLocale';
import useConfig from 'hooks/useConfig';
import 'react-basics/dist/styles.css';
import 'styles/variables.css';
import 'styles/index.css';
import '@fontsource/inter/400.css';
import '@fontsource/inter/600.css';
@ -13,8 +11,7 @@ import '@fontsource/inter/600.css';
const client = new QueryClient();
export default function App({ Component, pageProps }) {
const { locale, messages, dir } = useLocale();
const { basePath } = useRouter();
const { locale, messages } = useLocale();
useConfig();
const Wrapper = ({ children }) => <span className={locale}>{children}</span>;
@ -26,21 +23,7 @@ export default function App({ Component, pageProps }) {
return (
<QueryClientProvider client={client}>
<IntlProvider locale={locale} messages={messages[locale]} textComponent={Wrapper}>
<Head>
<link rel="icon" href={`${basePath}/favicon.ico`} />
<link rel="apple-touch-icon" sizes="180x180" href={`${basePath}/apple-touch-icon.png`} />
<link rel="icon" type="image/png" sizes="32x32" href={`${basePath}/favicon-32x32.png`} />
<link rel="icon" type="image/png" sizes="16x16" href={`${basePath}/favicon-16x16.png`} />
<link rel="manifest" href={`${basePath}/site.webmanifest`} />
<link rel="mask-icon" href={`${basePath}/safari-pinned-tab.svg`} color="#5bbad5" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#fafafa" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#2f2f2f" media="(prefers-color-scheme: dark)" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</Head>
<Container dir={dir}>
<Component {...pageProps} />
</Container>
<Component {...pageProps} />
</IntlProvider>
</QueryClientProvider>
);

View File

@ -34,7 +34,7 @@ export default async (
return badRequest(res);
}
const user = await getUser({ username }, true);
const user = await getUser({ username }, { includePassword: true });
if (user && checkPassword(password, user.password)) {
if (redis.enabled) {

View File

@ -13,7 +13,7 @@ export default async (req: NextApiRequestAuth, res: NextApiResponse<RealtimeInit
if (req.method === 'GET') {
const { id: userId } = req.auth.user;
const websites = await getUserWebsites({ userId });
const websites = await getUserWebsites(userId);
const ids = websites.map(({ id }) => id);
const token = createToken({ websites: ids }, secret());
const data = await getRealtimeData(ids, subMinutes(new Date(), 30));

View File

@ -1,5 +1,4 @@
import { WebsiteMetric } from 'lib/types';
import { NextApiRequestQueryBody } from 'lib/types';
import { WebsiteMetric, NextApiRequestQueryBody } from 'lib/types';
import { canViewWebsite } from 'lib/auth';
import { useAuth, useCors } from 'lib/middleware';
import { NextApiResponse } from 'next';

View File

@ -1,5 +1,4 @@
import { WebsiteMetric } from 'lib/types';
import { NextApiRequestQueryBody } from 'lib/types';
import { WebsiteMetric, NextApiRequestQueryBody } from 'lib/types';
import { canViewWebsite } from 'lib/auth';
import { useAuth, useCors } from 'lib/middleware';
import moment from 'moment-timezone';

View File

@ -1,5 +1,4 @@
import { Website } from 'lib/types';
import { NextApiRequestQueryBody } from 'lib/types';
import { Website, NextApiRequestQueryBody } from 'lib/types';
import { canViewWebsite, canUpdateWebsite, canDeleteWebsite } from 'lib/auth';
import { useAuth, useCors } from 'lib/middleware';
import { NextApiResponse } from 'next';

View File

@ -1,5 +1,4 @@
import { WebsiteMetric } from 'lib/types';
import { NextApiRequestQueryBody } from 'lib/types';
import { WebsiteMetric, NextApiRequestQueryBody } from 'lib/types';
import { canViewWebsite } from 'lib/auth';
import { FILTER_IGNORED } from 'lib/constants';
import { useAuth, useCors } from 'lib/middleware';

View File

@ -63,7 +63,7 @@ async function clickhouseQuery(
const { startDate, endDate, column, filters = {} } = data;
const { rawQuery, parseFilters, getBetweenDates } = clickhouse;
const website = await cache.fetchWebsite(websiteId);
const params = [websiteId, website?.revId || 0];
const params = [websiteId, website?.revId || 0, EVENT_TYPE.pageView];
const { filterQuery } = parseFilters(filters, params);
return rawQuery(
@ -71,9 +71,8 @@ async function clickhouseQuery(
from event
where website_id = $1
and rev_id = $2
and event_type = ${EVENT_TYPE.pageView}
${column !== 'event_name' ? `and event_name = ''` : `and event_name != ''`}
and ${getBetweenDates('created_at', startDate, endDate)}n
and event_type = $3
and ${getBetweenDates('created_at', startDate, endDate)}
${filterQuery}
group by x
order by y desc`,

File diff suppressed because it is too large Load Diff

View File

@ -13,11 +13,8 @@ body {
display: flex;
flex-direction: column;
flex: 1;
}
body {
color: var(--gray900);
background: var(--gray75);
color: var(--base800);
background: var(--base100);
}
.zh-CN {
@ -74,24 +71,6 @@ a:visited {
color: var(--primary400);
}
label {
flex: 1;
margin-right: 20px;
}
label:empty {
flex: 0;
}
dt {
font-weight: 600;
margin: 0 0 5px 0;
}
dd {
margin: 0 0 30px 0;
}
main {
flex: 1;
display: flex;
@ -109,7 +88,3 @@ svg {
height: 100%;
flex: 1;
}
#__modals {
z-index: 10;
}

View File

@ -1,55 +1,6 @@
:root {
--gray50: #ffffff;
--gray75: #fafafa;
--gray100: #f5f5f5;
--gray200: #eaeaea;
--gray300: #e1e1e1;
--gray400: #cacaca;
--gray500: #b3b3b3;
--gray600: #8e8e8e;
--gray700: #6e6e6e;
--gray800: #4b4b4b;
--gray900: #2c2c2c;
--primary400: #2680eb;
--primary500: #1473e6;
--primary600: #0d66d0;
--primary700: #095aba;
--font-size-xlarge: 36px;
--font-size-large: 24px;
--font-size-normal: 16px;
--font-size-small: 14px;
--font-size-xsmall: 12px;
--grid-size-small: 576px;
--grid-size-medium: 768px;
--grid-size-large: 992px;
--grid-size-xlarge: 1140px;
--red400: #e34850;
--red500: #d7373f;
--red600: #c9252d;
--red700: #bb121a;
--green400: #2d9d78;
--green500: #268e6c;
--green600: #12805c;
--green700: #107154;
--msgColor: #ffffff;
}
[data-theme='dark'] {
--gray50: #252525;
--gray75: #2f2f2f;
--gray100: #323232;
--gray200: #3e3e3e;
--gray300: #4a4a4a;
--gray400: #5a5a5a;
--gray500: #6e6e6e;
--gray600: #909090;
--gray700: #b9b9b9;
--gray800: #e3e3e3;
--gray900: #ffffff;
--primary400: var(--blue800);
--primary500: var(--blue900);
--primary600: var(--blue1000);
--primary700: var(--blue1100);
}