chore(root): migrate to biome

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-09-16 12:20:40 +02:00
parent 1f6e198336
commit 32e91959f6
383 changed files with 1943 additions and 3085 deletions

View File

@@ -11,8 +11,8 @@ const Page = ({ children }: Props) => {
return (
<>
<div className="fixed inset-0 hidden md:grid md:grid-cols-[30vw_1fr] lg:grid-cols-[30vw_1fr]">
<div className=""></div>
<div className="border-l border-border bg-card"></div>
<div className="" />
<div className="border-l border-border bg-card" />
</div>
<div className="relative min-h-screen bg-card md:bg-transparent">
<FullWidthNavbar>

View File

@@ -21,6 +21,7 @@ const ConnectApp = ({ client }: Props) => {
<div className="mt-4 grid gap-4 md:grid-cols-2">
{frameworks.app.map((framework) => (
<button
type="button"
onClick={() =>
pushModal('Instructions', {
framework,

View File

@@ -21,6 +21,7 @@ const ConnectBackend = ({ client }: Props) => {
<div className="mt-4 grid gap-4 md:grid-cols-2">
{frameworks.backend.map((framework) => (
<button
type="button"
onClick={() =>
pushModal('Instructions', {
framework,

View File

@@ -21,6 +21,7 @@ const ConnectWeb = ({ client }: Props) => {
<div className="mt-4 grid gap-4 md:grid-cols-2">
{frameworks.website.map((framework) => (
<button
type="button"
onClick={() =>
pushModal('Instructions', {
framework,

View File

@@ -1,12 +1,12 @@
'use client';
import { useState } from 'react';
import { Badge } from '@/components/ui/badge';
import useWS from '@/hooks/useWS';
import { pushModal } from '@/modals';
import { cn } from '@/utils/cn';
import { timeAgo } from '@/utils/date';
import { CheckCircle2Icon, CheckIcon, Loader2 } from 'lucide-react';
import { useState } from 'react';
import type {
IServiceClient,
@@ -28,7 +28,7 @@ const VerifyListener = ({ client, events: _events, onVerified }: Props) => {
(data) => {
setEvents((prev) => [...prev, data]);
onVerified(true);
}
},
);
const isConnected = events.length > 0;
@@ -70,7 +70,7 @@ const VerifyListener = ({ client, events: _events, onVerified }: Props) => {
'my-6 flex gap-6 rounded-xl p-4 md:p-6',
isConnected
? 'bg-emerald-100 dark:bg-emerald-700'
: 'bg-blue-100 dark:bg-blue-700'
: 'bg-blue-100 dark:bg-blue-700',
)}
>
{renderIcon()}
@@ -87,7 +87,7 @@ const VerifyListener = ({ client, events: _events, onVerified }: Props) => {
</div>
)}
{events.slice(-5).map((event, index) => (
<div key={index} className="flex items-center gap-2 ">
<div key={event.id} className="flex items-center gap-2 ">
<CheckIcon size={14} />{' '}
<span className="font-medium">{event.name}</span>{' '}
<span className="ml-auto text-emerald-800">
@@ -108,6 +108,7 @@ const VerifyListener = ({ client, events: _events, onVerified }: Props) => {
<div className="mt-2 text-sm text-muted-foreground">
You can{' '}
<button
type="button"
className="underline"
onClick={() => {
pushModal('OnboardingTroubleshoot', {

View File

@@ -1,10 +1,10 @@
'use client';
import { useState } from 'react';
import { ButtonContainer } from '@/components/button-container';
import { LinkButton } from '@/components/ui/button';
import { cn } from '@/utils/cn';
import Link from 'next/link';
import { useState } from 'react';
import type { IServiceEvent, IServiceProjectWithClients } from '@openpanel/db';
@@ -84,7 +84,7 @@ const Verify = ({ project, events }: Props) => {
size="lg"
className={cn(
'min-w-28 self-start',
!verified && 'pointer-events-none select-none opacity-20'
!verified && 'pointer-events-none select-none opacity-20',
)}
>
Your dashboard

View File

@@ -2,10 +2,10 @@ import { cookies } from 'next/headers';
import { escape } from 'sqlstring';
import {
TABLE_NAMES,
getCurrentOrganizations,
getEvents,
getProjectWithClients,
TABLE_NAMES,
} from '@openpanel/db';
import OnboardingVerify from './onboarding-verify';
@@ -25,7 +25,7 @@ const Verify = async ({ params: { projectId } }: Props) => {
const [project, events] = await Promise.all([
await getProjectWithClients(projectId),
getEvents(
`SELECT * FROM ${TABLE_NAMES.events} WHERE project_id = ${escape(projectId)} LIMIT 100`
`SELECT * FROM ${TABLE_NAMES.events} WHERE project_id = ${escape(projectId)} LIMIT 100`,
),
]);

View File

@@ -1,6 +1,5 @@
'use client';
import { useEffect } from 'react';
import AnimateHeight from '@/components/animate-height';
import { ButtonContainer } from '@/components/button-container';
import { CheckboxItem } from '@/components/forms/checkbox-item';
@@ -19,6 +18,7 @@ import {
SmartphoneIcon,
} from 'lucide-react';
import { useRouter } from 'next/navigation';
import { useEffect } from 'react';
import type { SubmitHandler } from 'react-hook-form';
import { Controller, useForm, useWatch } from 'react-hook-form';
import type { z } from 'zod';
@@ -185,7 +185,7 @@ const Tracking = ({
}
return `https://${trimmed}`;
})
.join(',')
.join(','),
);
}}
/>

View File

@@ -1,11 +1,11 @@
'use client';
import { useEffect } from 'react';
import { showConfirm } from '@/modals';
import { api } from '@/trpc/client';
import { useAuth } from '@clerk/nextjs';
import { ChevronLastIcon } from 'lucide-react';
import { usePathname, useRouter } from 'next/navigation';
import { useEffect } from 'react';
const SkipOnboarding = () => {
const router = useRouter();
@@ -20,6 +20,7 @@ const SkipOnboarding = () => {
return (
<button
type="button"
onClick={() => {
if (res.data?.canSkip && res.data?.url) {
router.push(res.data.url);

View File

@@ -39,7 +39,7 @@ function useSteps(path: string) {
];
const matchIndex = steps.findLastIndex((step) =>
path.match(new RegExp(step.match))
path.match(new RegExp(step.match)),
);
return steps.map((step, index) => {
@@ -59,17 +59,17 @@ const Steps = ({ className }: Props) => {
const currentIndex = steps.findIndex((i) => i.status === 'current');
return (
<div className="relative">
<div className="absolute bottom-4 left-4 top-4 w-px bg-def-200"></div>
<div className="absolute bottom-4 left-4 top-4 w-px bg-def-200" />
<div
className="absolute left-4 top-4 w-px bg-highlight"
style={{
height: `calc(${((currentIndex + 1) / steps.length) * 100}% - 3.5rem)`,
}}
></div>
/>
<div
className={cn(
'relative flex gap-4 overflow-hidden md:-ml-3 md:flex-col md:gap-8',
className
className,
)}
>
{steps.map((step, index) => (
@@ -80,32 +80,31 @@ const Steps = ({ className }: Props) => {
'rounded-xl border border-border bg-card',
step.status === 'completed' &&
index !== currentIndex - 1 &&
'max-md:hidden'
'max-md:hidden',
)}
key={step.name}
>
<div
className={cn(
'relative flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-white'
'relative flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-white',
)}
>
<div
className={cn(
'absolute inset-0 z-0 rounded-full bg-highlight',
step.status === 'pending' && 'bg-def-400'
step.status === 'pending' && 'bg-def-400',
)}
></div>
/>
{step.status === 'current' && (
<div className="absolute inset-1 z-0 animate-ping-slow rounded-full bg-highlight"></div>
<div className="absolute inset-1 z-0 animate-ping-slow rounded-full bg-highlight" />
)}
<div className="relative">
{step.status === 'completed' && <CheckCheckIcon size={14} />}
{/* {step.status === 'current' && (
<ArrowRightCircleIcon size={14} />
)} */}
{(step.status === 'pending' || step.status === 'current') && (
<>{index + 1}</>
)}
{(step.status === 'pending' || step.status === 'current') &&
index + 1}
</div>
</div>