🧹 clean up duty 🧹

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-03-28 10:40:49 +01:00
parent 677ae32c84
commit 444e553b74
127 changed files with 218 additions and 5284 deletions

View File

@@ -1,11 +1,11 @@
'use client';
import { api, handleErrorToastOptions } from '@/app/_trpc/client';
import { Card, CardActions, CardActionsItem } from '@/components/card';
import { FullPageEmptyState } from '@/components/full-page-empty-state';
import { Button } from '@/components/ui/button';
import { useAppParams } from '@/hooks/useAppParams';
import { pushModal } from '@/modals';
import { api, handleErrorToastOptions } from '@/trpc/client';
import { LayoutPanelTopIcon, Pencil, PlusIcon, Trash } from 'lucide-react';
import Link from 'next/link';
import { useRouter } from 'next/navigation';

View File

@@ -184,7 +184,7 @@ export function EventDetails({ event, open, setOpen }: Props) {
key={item.name}
name={item.name}
value={item.value}
onClick={item.onClick}
onClick={() => item.onClick?.()}
/>
))}
</div>
@@ -225,7 +225,7 @@ export function EventDetails({ event, open, setOpen }: Props) {
className="w-full"
onClick={() => setIsEditOpen(true)}
>
Customize "{name}"
Customize &quot;{name}&quot;
</Button>
</SheetFooter>
</SheetContent>

View File

@@ -1,6 +1,5 @@
import type { Dispatch, SetStateAction } from 'react';
import { useEffect, useState } from 'react';
import { api } from '@/app/_trpc/client';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
import { Label } from '@/components/ui/label';
@@ -11,6 +10,7 @@ import {
SheetHeader,
SheetTitle,
} from '@/components/ui/sheet';
import { api } from '@/trpc/client';
import { cn } from '@/utils/cn';
import { useRouter } from 'next/navigation';
import { toast } from 'sonner';
@@ -78,7 +78,7 @@ export function EventEdit({ event, open, setOpen }: Props) {
<Sheet open={open} onOpenChange={setOpen}>
<SheetContent>
<SheetHeader>
<SheetTitle>Edit "{name}"</SheetTitle>
<SheetTitle>Edit &quot;{name}&quot;</SheetTitle>
</SheetHeader>
<div className="my-8 flex flex-col gap-8">
<div>

View File

@@ -1,5 +1,4 @@
import { useEffect, useState } from 'react';
import { api } from '@/app/_trpc/client';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
import { Label } from '@/components/ui/label';
@@ -12,6 +11,7 @@ import {
SheetTrigger,
} from '@/components/ui/sheet';
import { Tooltip, TooltipContent } from '@/components/ui/tooltip';
import { api } from '@/trpc/client';
import { cn } from '@/utils/cn';
import { TooltipTrigger } from '@radix-ui/react-tooltip';
import type { VariantProps } from 'class-variance-authority';

View File

@@ -36,7 +36,7 @@ export default function LayoutOrganizationSelector({
.filter((item) => item.slug)
.map((item) => ({
label: item.name,
value: item.slug!,
value: item.slug,
})) ?? []
}
onChange={(value) => {

View File

@@ -1,9 +1,9 @@
'use client';
import { api, handleError } from '@/app/_trpc/client';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
import { Widget, WidgetBody, WidgetHead } from '@/components/widget';
import { api, handleError } from '@/trpc/client';
import { useRouter } from 'next/navigation';
import { useForm } from 'react-hook-form';
import { toast } from 'sonner';

View File

@@ -1,4 +1,3 @@
import { api } from '@/app/_trpc/client';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
import { ComboboxAdvanced } from '@/components/ui/combobox-advanced';
@@ -15,6 +14,7 @@ import {
SheetTrigger,
} from '@/components/ui/sheet';
import { useAppParams } from '@/hooks/useAppParams';
import { api } from '@/trpc/client';
import { zodResolver } from '@hookform/resolvers/zod';
import { PlusIcon, SendIcon } from 'lucide-react';
import { useRouter } from 'next/navigation';

View File

@@ -1,7 +1,6 @@
'use client';
import { useState } from 'react';
import { api } from '@/app/_trpc/client';
import { ComboboxAdvanced } from '@/components/ui/combobox-advanced';
import {
Table,
@@ -12,6 +11,7 @@ import {
TableRow,
} from '@/components/ui/table';
import { Widget, WidgetHead } from '@/components/widget';
import { api } from '@/trpc/client';
import type { IServiceMember, IServiceProject } from '@openpanel/db';

View File

@@ -1,9 +1,9 @@
'use client';
import { api, handleError } from '@/app/_trpc/client';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
import { Widget, WidgetBody, WidgetHead } from '@/components/widget';
import { api, handleError } from '@/trpc/client';
import { zodResolver } from '@hookform/resolvers/zod';
import { useRouter } from 'next/navigation';
import { useForm } from 'react-hook-form';

View File

@@ -5,6 +5,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useAppParams } from '@/hooks/useAppParams';
import { api, handleError } from '@/trpc/client';
import { zodResolver } from '@hookform/resolvers/zod';
import { SaveIcon } from 'lucide-react';
import { useRouter } from 'next/navigation';
@@ -13,8 +14,6 @@ import { useForm } from 'react-hook-form';
import { toast } from 'sonner';
import { z } from 'zod';
import { api, handleError } from '../../_trpc/client';
const validation = z.object({
name: z.string().min(1),
});

View File

@@ -5,7 +5,6 @@ import { notFound, redirect } from 'next/navigation';
import {
getCurrentProjects,
getOrganizationBySlug,
getProjectsByOrganizationSlug,
isWaitlistUserAccepted,
} from '@openpanel/db';
@@ -36,8 +35,8 @@ export default async function Page({ params: { organizationId } }: PageProps) {
<LogoSquare className="mb-8 w-20 md:w-28" />
<h1 className="text-3xl font-medium">Not quite there yet</h1>
<div className="text-lg">
We're still working on Openpanel, but we're not quite there yet.
We'll let you know when we're ready to go!
We&apos;re still working on Openpanel, but we&apos;re not quite
there yet. We&apos;ll let you know when we&apos;re ready to go!
</div>
</div>
</div>

View File

@@ -6,6 +6,7 @@ import { Button, buttonVariants } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { api, handleError } from '@/trpc/client';
import { cn } from '@/utils/cn';
import { zodResolver } from '@hookform/resolvers/zod';
import { SaveIcon, WallpaperIcon } from 'lucide-react';
@@ -14,8 +15,6 @@ import type { SubmitHandler } from 'react-hook-form';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { api, handleError } from '../_trpc/client';
const validation = z
.object({
organization: z.string().min(3),
@@ -61,8 +60,8 @@ export function CreateOrganization() {
<LogoSquare className="mb-4 w-20" />
<h1 className="text-3xl font-medium">Nice job!</h1>
<div className="mb-4">
You're ready to start using our SDK. Save the client ID and secret (if
you have any)
You&apos;re ready to start using our SDK. Save the client ID and
secret (if you have any)
</div>
<CreateClientSuccess {...mutation.data.client} />
<div className="mt-4 flex gap-4">

View File

@@ -18,8 +18,8 @@ export default async function Page() {
<LogoSquare className="mb-8 w-20 md:w-28" />
<h1 className="text-3xl font-medium">Not quite there yet</h1>
<div className="text-lg">
We're still working on Openpanel, but we're not quite there yet.
We'll let you know when we're ready to go!
We&apos;re still working on Openpanel, but we&apos;re not quite
there yet. We&apos;ll let you know when we&apos;re ready to go!
</div>
</div>
</div>

View File

@@ -1,39 +0,0 @@
import type { AppRouter } from '@/server/api/root';
import type { TRPCClientErrorBase } from '@trpc/react-query';
import { createTRPCReact } from '@trpc/react-query';
import type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
import type { ExternalToast } from 'sonner';
import { toast } from 'sonner';
export const api = createTRPCReact<AppRouter>({});
/**
* Inference helper for inputs.
*
* @example type HelloInput = RouterInputs['example']['hello']
*/
export type RouterInputs = inferRouterInputs<AppRouter>;
/**
* Inference helper for outputs.
*
* @example type HelloOutput = RouterOutputs['example']['hello']
*/
export type RouterOutputs = inferRouterOutputs<AppRouter>;
export type IChartData = RouterOutputs['chart']['chart'];
export type IChartSerieDataItem = IChartData['series'][number]['data'][number];
export function handleError(error: TRPCClientErrorBase<any>) {
toast('Error', {
description: error.message,
});
}
export function handleErrorToastOptions(options: ExternalToast) {
return function (error: TRPCClientErrorBase<any>) {
toast('Error', {
description: error.message,
...options,
});
};
}

View File

@@ -32,6 +32,6 @@ export async function POST(request: Request) {
return Response.json({ message: 'Webhook received!' });
}
export async function GET() {
export function GET() {
return Response.json({ message: 'Hello World!' });
}

View File

@@ -1,4 +1,4 @@
import { appRouter } from '@/server/api/root';
import { appRouter } from '@/trpc/api/root';
import { getAuth } from '@clerk/nextjs/server';
import { fetchRequestHandler } from '@trpc/server/adapters/fetch';
@@ -7,7 +7,7 @@ const handler = (req: Request) =>
endpoint: '/api/trpc',
req,
router: appRouter,
async createContext({ req }) {
createContext({ req }) {
const session = getAuth(req as any);
return {
session,

View File

@@ -1,19 +0,0 @@
"use client";
import * as Sentry from "@sentry/nextjs";
import Error from "next/error";
import { useEffect } from "react";
export default function GlobalError({ error }) {
useEffect(() => {
Sentry.captureException(error);
}, [error]);
return (
<html>
<body>
<Error />
</body>
</html>
);
}

View File

@@ -0,0 +1,23 @@
'use client';
import { useEffect } from 'react';
import * as Sentry from '@sentry/nextjs';
export default function GlobalError({
error,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
Sentry.captureException(error);
}, [error]);
return (
<html lang="en">
<body>
<h1>Something went wrong</h1>
</body>
</html>
);
}

View File

@@ -1,11 +1,11 @@
'use client';
import React, { useRef, useState } from 'react';
import { api } from '@/app/_trpc/client';
import { TooltipProvider } from '@/components/ui/tooltip';
import { ModalProvider } from '@/modals';
import type { AppStore } from '@/redux';
import makeStore from '@/redux';
import { api } from '@/trpc/client';
import { ClerkProvider, useAuth } from '@clerk/nextjs';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { httpLink } from '@trpc/client';