Upgrade prisma. Lint fixes.

This commit is contained in:
Mike Cao 2023-11-30 21:58:11 -08:00
parent a3b5f05a32
commit a224a3caf3
11 changed files with 56 additions and 51 deletions

View file

@ -34,7 +34,7 @@ export function WebsiteSettings({ websiteId, openExternal = false, analyticsUrl
const handleReset = async value => {
if (value === 'delete') {
await router.push('/settings/websites');
router.push('/settings/websites');
} else if (value === 'reset') {
showSuccess();
}

View file

@ -1,4 +1,4 @@
import { Button, Text, Icon } from 'react-basics';
import { Button, Text, Icon, Icons } from 'react-basics';
import { useMemo } from 'react';
import { firstBy } from 'thenby';
import Link from 'next/link';
@ -7,7 +7,6 @@ import useDashboard from 'store/dashboard';
import WebsiteHeader from './WebsiteHeader';
import { WebsiteMetricsBar } from './WebsiteMetricsBar';
import { useMessages, useLocale } from 'components/hooks';
import Icons from 'components/icons';
export default function WebsiteChartList({ websites, showCharts, limit }) {
const { formatMessage, labels } = useMessages();

View file

@ -7,7 +7,7 @@ export function ErrorMessage() {
return (
<div className={styles.error}>
<Icon className={styles.icon} size="large">
<Icon className={styles.icon} size="lg">
<Icons.Alert />
</Icon>
<Text>{formatMessage(messages.error)}</Text>

View file

@ -10,9 +10,9 @@ import styles from './FilterLink.module.css';
export interface FilterLinkProps {
id: string;
value: string;
label: string;
externalUrl: string;
className: string;
label?: string;
externalUrl?: string;
className?: string;
children: ReactNode;
}

View file

@ -1,7 +1,6 @@
import { Button, Icon } from 'react-basics';
import { Button, Icon, Icons } from 'react-basics';
import { useState } from 'react';
import MobileMenu from './MobileMenu';
import Icons from 'components/icons';
export function HamburgerButton({ menuItems }: { menuItems: any[] }) {
const [active, setActive] = useState(false);

View file

@ -22,7 +22,7 @@ import User from 'assets/user.svg';
import Users from 'assets/users.svg';
import Visitor from 'assets/visitor.svg';
const icons: any = {
const icons = {
...Icons,
AddUser,
Bars,

View file

@ -45,7 +45,7 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
async function clickhouseQuery(
websiteId: string,
filters: QueryFilters,
): Promise<{ events: number; fields: number; records: number }> {
): Promise<{ events: number; fields: number; records: number }[]> {
const { rawQuery, parseFilters } = clickhouse;
const { filterQuery, params } = await parseFilters(websiteId, filters);

View file

@ -2,15 +2,15 @@ import { md5 } from 'next-basics';
import { getSessions, getEvents } from 'queries/index';
import { EVENT_TYPE } from 'lib/constants';
export async function getRealtimeData(websiteId, time) {
export async function getRealtimeData(websiteId: string, startDate: Date) {
const [pageviews, sessions, events] = await Promise.all([
getEvents(websiteId, time, EVENT_TYPE.pageView),
getSessions(websiteId, time),
getEvents(websiteId, time, EVENT_TYPE.customEvent),
getEvents(websiteId, startDate, EVENT_TYPE.pageView),
getSessions(websiteId, startDate),
getEvents(websiteId, startDate, EVENT_TYPE.customEvent),
]);
const decorate = (id, data) => {
return data.map(props => ({
const decorate = (id: string, data: any[]) => {
return data.map((props: { [key: string]: any }) => ({
...props,
__id: md5(id, ...Object.values(props)),
__type: id,

View file

@ -83,10 +83,17 @@ async function clickhouseQuery(
limit 500
`,
params,
);
).then(a => {
return Object.values(a).map(a => {
return {
x: a.x,
y: Number(a.y),
};
});
});
}
function parseFields(fields) {
function parseFields(fields: any[]) {
const query = fields.reduce(
(arr, field) => {
const { name } = field;
@ -99,7 +106,7 @@ function parseFields(fields) {
return query.join(',\n');
}
function parseGroupBy(fields) {
function parseGroupBy(fields: { name: any }[]) {
if (!fields.length) {
return '';
}