From f34d297db41244f35c68cc237f04b23a75eec4a9 Mon Sep 17 00:00:00 2001 From: Thibault Le Ouay Date: Thu, 17 Aug 2023 09:07:23 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20lint=20(#192)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/app/_components/input-search.tsx | 18 +++++++++--------- apps/web/src/app/action.ts | 10 ---------- apps/web/src/app/api/checker/cron/_cron.ts | 1 - apps/web/src/app/api/webhook/clerk/route.ts | 3 --- .../incidents/_components/action-button.tsx | 1 - .../[workspaceSlug]/incidents/page.tsx | 3 --- apps/web/src/app/blog/[slug]/page.tsx | 1 - apps/web/src/app/legal/[slug]/page.tsx | 1 - .../data-table/data-table-column-header.tsx | 3 +-- apps/web/src/components/incidents/events.tsx | 2 +- apps/web/src/components/ui/radio-group.tsx | 2 +- apps/web/src/middleware.ts | 6 +++--- 12 files changed, 15 insertions(+), 36 deletions(-) diff --git a/apps/web/src/app/_components/input-search.tsx b/apps/web/src/app/_components/input-search.tsx index 6376cfa0..2e0c12ce 100644 --- a/apps/web/src/app/_components/input-search.tsx +++ b/apps/web/src/app/_components/input-search.tsx @@ -1,6 +1,6 @@ "use client"; -import * as React from "react"; +import React, { useEffect, useMemo, useRef, useState } from "react"; import { Command as CommandPrimitive, useCommandState } from "cmdk"; import type { Ping } from "@openstatus/tinybird"; @@ -21,13 +21,13 @@ export function InputSearch({ onSearch(value: Record): void; events: Ping[]; }) { - const inputRef = React.useRef(null); - const [open, setOpen] = React.useState(false); - const [inputValue, setInputValue] = React.useState(""); - const [currentWord, setCurrentWord] = React.useState(""); + const inputRef = useRef(null); + const [open, setOpen] = useState(false); + const [inputValue, setInputValue] = useState(""); + const [currentWord, setCurrentWord] = useState(""); // TODO: check if there is a move efficient way - React.useEffect(() => { + useEffect(() => { const searchparams = inputValue .trim() .split(" ") @@ -43,10 +43,10 @@ export function InputSearch({ {} as Record, ); onSearch(searchparams); - }, [onSearch, inputValue]); + }, [onSearch, inputValue, currentWord]); // DEFINE YOUR SEARCH PARAMETERS - const search = React.useMemo( + const search = useMemo( () => events.reduce( (prev, curr) => { @@ -71,7 +71,7 @@ export function InputSearch({ return ( { + filter={(value) => { if (value.includes(currentWord.toLowerCase())) return 1; return 0; }} diff --git a/apps/web/src/app/action.ts b/apps/web/src/app/action.ts index 430d3076..0785dcbf 100644 --- a/apps/web/src/app/action.ts +++ b/apps/web/src/app/action.ts @@ -5,7 +5,6 @@ import { Resend } from "resend"; import { validateEmailNotDisposable, WaitingList } from "@openstatus/emails"; -import { EmailTemplate } from "@/components/templates/email-template"; import { env } from "@/env"; const redis = Redis.fromEnv(); @@ -40,15 +39,6 @@ const write = async (email: string) => { return res[1]; }; -// MOCK -const wait = (ms: number): Promise => { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, ms); - }); -}; - // Resend export const sendWaitingListEmail = async (email: string) => { const isValid = await validateEmailNotDisposable(email); diff --git a/apps/web/src/app/api/checker/cron/_cron.ts b/apps/web/src/app/api/checker/cron/_cron.ts index 467aa34b..a0f169d6 100644 --- a/apps/web/src/app/api/checker/cron/_cron.ts +++ b/apps/web/src/app/api/checker/cron/_cron.ts @@ -5,7 +5,6 @@ import { and, db, eq } from "@openstatus/db"; import { monitor, monitorsToPages, - RegionEnum, selectMonitorSchema, } from "@openstatus/db/src/schema"; import { availableRegions } from "@openstatus/tinybird"; diff --git a/apps/web/src/app/api/webhook/clerk/route.ts b/apps/web/src/app/api/webhook/clerk/route.ts index 7445fa47..db2f1ee9 100644 --- a/apps/web/src/app/api/webhook/clerk/route.ts +++ b/apps/web/src/app/api/webhook/clerk/route.ts @@ -1,13 +1,10 @@ import type { NextRequest } from "next/server"; import { NextResponse } from "next/server"; -import { Webhook } from "svix"; import { createTRPCContext } from "@openstatus/api"; import { lambdaRouter } from "@openstatus/api/src/lambda"; import { clerkEvent } from "@openstatus/api/src/router/clerk/type"; -import { env } from "@/env"; - // import { clerkEvent } from "@openstatus/api/src/router/clerk"; // export const config = { diff --git a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/incidents/_components/action-button.tsx b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/incidents/_components/action-button.tsx index d124a775..0c2fea47 100644 --- a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/incidents/_components/action-button.tsx +++ b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/incidents/_components/action-button.tsx @@ -9,7 +9,6 @@ import type * as z from "zod"; import { insertIncidentSchema, // insertIncidentUpdateSchema, - insertMonitorSchema, } from "@openstatus/db/src/schema"; import { LoadingAnimation } from "@/components/loading-animation"; diff --git a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/incidents/page.tsx b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/incidents/page.tsx index 225de729..97a8c4d0 100644 --- a/apps/web/src/app/app/(dashboard)/[workspaceSlug]/incidents/page.tsx +++ b/apps/web/src/app/app/(dashboard)/[workspaceSlug]/incidents/page.tsx @@ -8,10 +8,8 @@ import { Icons } from "@/components/icons"; import { AffectedMonitors } from "@/components/incidents/affected-monitors"; import { Events } from "@/components/incidents/events"; import { StatusBadge } from "@/components/incidents/status-badge"; -import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { statusDict } from "@/data/incidents-dictionary"; -import { cn } from "@/lib/utils"; import { api } from "@/trpc/server"; import { ActionButton } from "./_components/action-button"; import { EmptyState } from "./_components/empty-state"; @@ -37,7 +35,6 @@ export default async function IncidentPage({ {incidents?.map((incident, i) => { const { label, icon } = statusDict[incident.status as keyof typeof statusDict]; - const Icon = Icons[icon]; return (