Skip to content

Commit

Permalink
Fix lint failures
Browse files Browse the repository at this point in the history
  • Loading branch information
benvinegar committed Jun 19, 2024
1 parent 7d42211 commit aa8f89d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 25 deletions.
15 changes: 4 additions & 11 deletions app/analytics/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,9 @@ export class AnalyticsEngineAPI {
column: T,
interval: string,
tz?: string,
page?: number,
limit?: number,
page: number = 1,
limit: number = 10,
) {
limit = limit || 10;
page = page || 1;

const intervalSql = intervalToSql(interval, tz);

const _column = ColumnMappings[column];
Expand Down Expand Up @@ -369,13 +366,9 @@ export class AnalyticsEngineAPI {
column: T,
interval: string,
tz?: string,
page?: number,
limit?: number,
page: number = 1,
limit: number = 10,

Check warning on line 370 in app/analytics/query.ts

View check run for this annotation

Codecov / codecov/patch

app/analytics/query.ts#L369-L370

Added lines #L369 - L370 were not covered by tests
) {
// defaults to 1 day if not specified
limit = limit || 10;
page = page || 1;

const intervalSql = intervalToSql(interval, tz);

const _column = ColumnMappings[column];
Expand Down
6 changes: 1 addition & 5 deletions app/components/PaginatedTableCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ const ReferrerCard = ({
}: {
siteId: string;
interval: string;
dataFetcher: any;
dataFetcher: any; // ignore type for now

Check warning on line 16 in app/components/PaginatedTableCard.tsx

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
columnHeaders: string[];
loaderUrl: string;
}) => {
// const dataFetcher = useFetcher<typeof loader>();
const countsByProperty = dataFetcher.data?.countsByProperty || [];
const page = dataFetcher.data?.page || 1;

useEffect(() => {
// Your code here
if (dataFetcher.state === "idle") {
dataFetcher.load(
`${loaderUrl}?site=${siteId}&interval=${interval}`,
Expand All @@ -31,7 +29,6 @@ const ReferrerCard = ({
}, []);

Check warning on line 29 in app/components/PaginatedTableCard.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useEffect has missing dependencies: 'dataFetcher', 'interval', 'loaderUrl', and 'siteId'. Either include them or remove the dependency array

useEffect(() => {
// NOTE: intentionally resets page to default when interval or site changes
if (dataFetcher.state === "idle") {
dataFetcher.load(
`${loaderUrl}?site=${siteId}&interval=${interval}`,
Expand All @@ -40,7 +37,6 @@ const ReferrerCard = ({
}, [siteId, interval]);

Check warning on line 37 in app/components/PaginatedTableCard.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useEffect has missing dependencies: 'dataFetcher' and 'loaderUrl'. Either include them or remove the dependency array

function handlePagination(page: number) {
// TODO: is there a way of updating the query string with this state without triggering a navigation?
dataFetcher.load(
`${loaderUrl}?site=${siteId}&interval=${interval}&page=${page}`,
);
Expand Down
8 changes: 4 additions & 4 deletions app/components/PaginationButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const PaginationButtons: React.FC<PaginationButtonsProps> = ({
return (
<div className="p-2 pr-0 grid grid-cols-[auto,2rem,2rem] text-right">
<div></div>
<a
<button
onClick={() => {
if (page > 1) handlePagination(page - 1);
}}

Check warning on line 22 in app/components/PaginationButtons.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/PaginationButtons.tsx#L21-L22

Added lines #L21 - L22 were not covered by tests
Expand All @@ -27,8 +27,8 @@ const PaginationButtons: React.FC<PaginationButtonsProps> = ({
}
>
<ArrowLeft />
</a>
<a
</button>
<button
onClick={() => {
if (hasMore) handlePagination(page + 1);
}}

Check warning on line 34 in app/components/PaginationButtons.tsx

View check run for this annotation

Codecov / codecov/patch

app/components/PaginationButtons.tsx#L33-L34

Added lines #L33 - L34 were not covered by tests
Expand All @@ -39,7 +39,7 @@ const PaginationButtons: React.FC<PaginationButtonsProps> = ({
}
>
<ArrowRight />
</a>
</button>
</div>
);
};
Expand Down
2 changes: 0 additions & 2 deletions app/components/TableCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
TableRow,
} from "~/components/ui/table";

import { Card } from "~/components/ui/card";

type CountByProperty = [string, string][];

function calculateCountPercentages(countByProperty: CountByProperty) {
Expand Down
1 change: 0 additions & 1 deletion app/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
import * as React from "react";

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
Expand Down
1 change: 0 additions & 1 deletion app/routes/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {

import { AnalyticsEngineAPI } from "../analytics/query";

import TableCard from "~/components/TableCard";
import { ReferrerCard } from "./resources.referrer";
import { PathsCard } from "./resources.paths";
import { BrowserCard } from "./resources.browser";
Expand Down
1 change: 0 additions & 1 deletion app/routes/resources.referrer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useEffect } from "react";
import { useFetcher } from "@remix-run/react";

import type { LoaderFunctionArgs } from "@remix-run/cloudflare";
Expand Down

0 comments on commit aa8f89d

Please sign in to comment.