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

@@ -1,6 +1,5 @@
'use client';
import { useState } from 'react';
import AnimateHeight from '@/components/animate-height';
import { CreateClientSuccess } from '@/components/clients/create-client-success';
import TagInput from '@/components/forms/tag-input';
@@ -17,6 +16,7 @@ import { cn } from '@/utils/cn';
import { zodResolver } from '@hookform/resolvers/zod';
import { SaveIcon } from 'lucide-react';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import type { SubmitHandler } from 'react-hook-form';
import { Controller, useForm } from 'react-hook-form';
import { toast } from 'sonner';
@@ -90,6 +90,7 @@ export default function AddClient(props: Props) {
className={cn(buttonVariants({ variant: 'secondary' }), 'flex-1')}
href="https://docs.openpanel.dev/docs"
target="_blank"
rel="noreferrer"
>
Read docs
</a>
@@ -171,7 +172,7 @@ export default function AddClient(props: Props) {
}
return `https://${trimmed}`;
})
.join(',')
.join(','),
);
}}
/>
@@ -265,37 +266,3 @@ export default function AddClient(props: Props) {
</ModalContent>
);
}
{
/* <div>
<div className="text-lg">
Select your framework and we'll generate a client for you.
</div>
<div className="flex flex-wrap gap-2 mt-8">
<FeatureButton
name="React"
logo="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/2300px-React-icon.svg.png"
/>
<FeatureButton
name="React Native"
logo="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/2300px-React-icon.svg.png"
/>
<FeatureButton
name="Next.js"
logo="https://static-00.iconduck.com/assets.00/nextjs-icon-512x512-y563b8iq.png"
/>
<FeatureButton
name="Remix"
logo="https://www.datocms-assets.com/205/1642515307-square-logo.svg"
/>
<FeatureButton
name="Vue"
logo="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ0UhQnp6TUPCwAr3ruTEwBDiTN5HLAWaoUD3AJIgtepQ&s"
/>
<FeatureButton
name="HTML"
logo="https://upload.wikimedia.org/wikipedia/commons/thumb/6/61/HTML5_logo_and_wordmark.svg/240px-HTML5_logo_and_wordmark.svg.png"
/>
</div>
</div> */
}

View File

@@ -1,8 +1,8 @@
import { useState } from 'react';
import { Button } from '@/components/ui/button';
import { Calendar } from '@/components/ui/calendar';
import { useBreakpoint } from '@/hooks/useBreakpoint';
import { subMonths } from 'date-fns';
import { useState } from 'react';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
@@ -28,7 +28,7 @@ export default function DateRangerPicker({
mode="range"
defaultMonth={subMonths(
startDate ? new Date(startDate) : new Date(),
isBelowSm ? 0 : 1
isBelowSm ? 0 : 1,
)}
selected={{
from: startDate,

View File

@@ -106,7 +106,7 @@ export default function EditClient({
}
return `https://${trimmed}`;
})
.join(',')
.join(','),
);
}}
/>

View File

@@ -1,6 +1,5 @@
'use client';
import { useEffect, useRef, useState } from 'react';
import { ListPropertiesIcon } from '@/components/events/list-properties-icon';
import { Pagination } from '@/components/pagination';
import { ProfileAvatar } from '@/components/profiles/profile-avatar';
@@ -13,6 +12,7 @@ import { api } from '@/trpc/client';
import { getProfileName } from '@/utils/getters';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { useEffect, useRef, useState } from 'react';
import type { IChartInput } from '@openpanel/validation';
@@ -47,7 +47,7 @@ export default function FunnelStepDetails(props: Props) {
return (
<DialogContent className="p-0">
<div className="p-4">
<ModalHeader title="Profiles"></ModalHeader>
<ModalHeader title="Profiles" />
<Pagination
count={data.length}
take={50}

View File

@@ -88,7 +88,7 @@ const Instructions = ({ framework, client }: Props) => {
return (
<div className="flex flex-col gap-4">
<p>Install dependencies</p>
<Syntax code={`pnpm install @openpanel/nextjs`} />
<Syntax code={'pnpm install @openpanel/nextjs'} />
<p>Add OpenPanelComponent to your root layout</p>
<Syntax
code={`import { OpenPanelComponent } from '@openpanel/nextjs';
@@ -128,7 +128,7 @@ useOpenPanel().track('my_event', { foo: 'bar' });
return (
<div className="flex flex-col gap-4">
<p>Install dependencies</p>
<Syntax code={`composer require bleckert/openpanel-laravel`} />
<Syntax code={'composer require bleckert/openpanel-laravel'} />
<p>Add environment variables</p>
<Syntax
code={`OPENPANEL_CLIENT_ID=${clientId}
@@ -164,6 +164,7 @@ $openpanel->event(
href="https://twitter.com/tbleckert"
target="_blank"
className="underline"
rel="noreferrer"
>
@tbleckert
</a>{' '}
@@ -216,7 +217,7 @@ $openpanel->event(
return (
<div className="flex flex-col gap-4">
<strong>Install dependencies</strong>
<Syntax code={`npm install @openpanel/express`} />
<Syntax code={'npm install @openpanel/express'} />
<strong>Usage</strong>
<p>Connect the middleware to your app.</p>
@@ -259,7 +260,7 @@ app.listen(3000, () => {
return (
<div className="flex flex-col gap-4">
<strong>Install dependencies</strong>
<Syntax code={`pnpm install @openpanel/sdk`} />
<Syntax code={'pnpm install @openpanel/sdk'} />
<strong>Create a instance</strong>
<p>
@@ -360,6 +361,7 @@ op.decrement({ name: 'app_opened', profile_id: '123', value: 5 }); // decrement
href="https://github.com/Openpanel-dev/examples/tree/main/expo-app"
target="_blank"
className="underline"
rel="noreferrer"
>
example app
</a>{' '}

View File

@@ -33,7 +33,7 @@ export function ModalHeader({
<div
className={cn(
'relative -m-6 mb-6 flex justify-between rounded-t-lg border-b bg-def-100 p-6',
className
className,
)}
style={{
backgroundImage: `url("data:image/svg+xml,<svg id='patternId' width='100%' height='100%' xmlns='http://www.w3.org/2000/svg'><defs><pattern id='a' patternUnits='userSpaceOnUse' width='20' height='20' patternTransform='scale(2) rotate(85)'><rect x='0' y='0' width='100%' height='100%' fill='hsla(0, 0%, 100%, 0)'/><path d='M 10,-2.55e-7 V 20 Z M -1.1677362e-8,10 H 20 Z' stroke-width='0.5' stroke='hsla(259, 0%, 52%, 0.46)' fill='none'/></pattern></defs><rect width='800%' height='800%' transform='translate(0,0)' fill='url(%23a)'/></svg>")`,
@@ -41,7 +41,7 @@ export function ModalHeader({
backgroundRepeat: 'repeat',
}}
>
<div className="absolute inset-0 bg-gradient-to-r from-def-100/95 to-def-100/80"></div>
<div className="absolute inset-0 bg-gradient-to-r from-def-100/95 to-def-100/80" />
<div className="row relative w-full items-start justify-between">
<div className="col mt-1 flex-1 gap-2">
<div className="text-3xl font-semibold">{title}</div>

View File

@@ -44,7 +44,7 @@ export default function SaveReport({ report }: SaveReportProps) {
router.push(
`/${organizationSlug}/${projectId}/reports/${
res.id
}?${searchParams?.toString()}`
}?${searchParams?.toString()}`,
);
},
});

View File

@@ -1,6 +1,5 @@
'use client';
import { useState } from 'react';
import {
InputOTP,
InputOTPGroup,
@@ -9,6 +8,7 @@ import {
import { getClerkError } from '@/utils/clerk-error';
import { useSignUp } from '@clerk/nextjs';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { toast } from 'sonner';
import { popModal } from '.';
@@ -51,7 +51,7 @@ export default function VerifyEmail({ email }: Props) {
const completeSignUp = await signUp.attemptEmailAddressVerification(
{
code,
}
},
);
if (completeSignUp.status !== 'complete') {

View File

@@ -1,4 +1,3 @@
import { useEffect, useState } from 'react';
import {
EventIconColors,
EventIconMapper,
@@ -15,6 +14,7 @@ import { useQueryClient } from '@tanstack/react-query';
import { getQueryKey } from '@trpc/react-query';
import { AnimatePresence, motion } from 'framer-motion';
import { UndoIcon } from 'lucide-react';
import { useEffect, useState } from 'react';
import { toast } from 'sonner';
import { popModal } from '.';
@@ -96,6 +96,7 @@ export default function EditEvent({ id }: Props) {
<div className={iconGrid}>
{Object.entries(EventIconMapper).map(([name, Icon]) => (
<button
type="button"
key={name}
onClick={() => {
setIcon(name);
@@ -105,7 +106,7 @@ export default function EditEvent({ id }: Props) {
'inline-flex h-8 w-8 flex-shrink-0 cursor-pointer items-center justify-center rounded-md bg-def-200 transition-all',
name === selectedIcon
? 'scale-110 ring-1 ring-black'
: '[&_svg]:opacity-50'
: '[&_svg]:opacity-50',
)}
>
<Icon size={16} />
@@ -123,7 +124,7 @@ export default function EditEvent({ id }: Props) {
>
<div className="row mb-4 items-center justify-between">
<div className="font-medium leading-none">Pick a color</div>
<button onClick={() => setStep('icon')}>
<button type="button" onClick={() => setStep('icon')}>
<Badge variant="muted">
Select icon
<UndoIcon className="ml-1 h-3 w-3" />
@@ -133,6 +134,7 @@ export default function EditEvent({ id }: Props) {
<div className={iconGrid}>
{EventIconColors.map((color) => (
<button
type="button"
key={color}
onClick={() => {
setColor(color);
@@ -140,7 +142,7 @@ export default function EditEvent({ id }: Props) {
className={cn(
'flex h-8 w-8 flex-shrink-0 cursor-pointer items-center justify-center rounded-md transition-all',
color === selectedColor ? 'ring-1 ring-black' : '',
getBg(color)
getBg(color),
)}
>
{SelectedIcon ? (

View File

@@ -158,7 +158,7 @@ export default function EventDetails({ id }: Props) {
setFilter(
`properties.${item.name}`,
item.value ? String(item.value) : '',
'is'
'is',
);
}}
/>
@@ -184,6 +184,7 @@ export default function EventDetails({ id }: Props) {
<div className="mb-2 flex justify-between font-medium">
<div>Similar events</div>
<button
type="button"
className="text-muted-foreground hover:underline"
onClick={() => {
setEvents([event.name]);