Connect, collaborate, and grow with a community of TypeScript developers
Add a format script and changed the eslint rule for quotes (#84)
Sean Boult08eb2aa4862a
diff --git a/.eslintrc.cjs b/.eslintrc.cjsindex 1c456094..81f3199a 100644--- a/.eslintrc.cjs+++ b/.eslintrc.cjs@@ -19,6 +19,7 @@ const config = {plugins: ['@typescript-eslint'],extends: ['next/core-web-vitals', 'plugin:@typescript-eslint/recommended'],rules: {+ quotes: ['error', 'single'],'@typescript-eslint/consistent-type-imports': ['warn',{diff --git a/.vscode/settings.json b/.vscode/settings.jsonindex 3662b370..25fa6215 100644--- a/.vscode/settings.json+++ b/.vscode/settings.json@@ -1,3 +1,3 @@{"typescript.tsdk": "node_modules/typescript/lib"-}\ No newline at end of file+}diff --git a/package.json b/package.jsonindex 5535c892..12f7bc51 100644--- a/package.json+++ b/package.json@@ -8,6 +8,7 @@"postinstall": "prisma generate","lint": "next lint","reset": "prisma db push --force-reset --preview-feature",+ "format": "prettier -w 'src/**/*.{ts,tsx,css,cjs,mjs,json}'","start": "next start","refresh": "pnpm reset && pnpm prisma db seed","typecheck": "tsc --noEmit"diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 08f5ab4d..b944bad6 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1,9 +1,5 @@lockfileVersion: '6.0'-settings:- autoInstallPeers: true- excludeLinksFromLockfile: false-settings:autoInstallPeers: trueexcludeLinksFromLockfile: false@@ -1649,6 +1645,47 @@ packages:react-dom: 18.2.0([email protected])dev: false+ /@radix-ui/[email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected]):+ resolution: {integrity: sha512-DmNFOiwEc2UDigsYj6clJENma58OelxD24O4IODoZ+3sQc3Zb+L8w1EP+y9laTuKCLAysPw4fD6/v0j4KNV8rg==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0+ react-dom: ^16.8 || ^17.0 || ^18.0+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+ dependencies:+ '@babel/runtime': 7.22.5+ '@radix-ui/primitive': 1.0.1+ '@radix-ui/react-compose-refs': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-context': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-dismissable-layer': 1.0.4(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-id': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-popper': 1.1.2(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-portal': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-presence': 1.0.1(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-primitive': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-slot': 1.0.2(@types/[email protected])([email protected])+ '@radix-ui/react-use-controllable-state': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-visually-hidden': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@types/react': 18.2.8+ '@types/react-dom': 18.2.4+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ dev: false++ /@radix-ui/[email protected]([email protected]):+ resolution: {integrity: sha512-GZtyzoHz95Rhs6S63D2t/eqvdFCm7I+yHMLVQheKM7nBD8mbZIt+ct1jz4536MDnaOGKIxynJ8eHTkVGVVkoTg==}+ peerDependencies:+ react: ^16.8 || ^17.0 || ^18.0+ dependencies:+ '@babel/runtime': 7.22.5+ react: 18.2.0+ dev: false+resolution: {integrity: sha512-D94LjX4Sp0xJFVaoQOd3OO9k7tpBYNOXdVhkltUbGv2Qb9OXdrg/CpsjlZv7ia14Sylv398LswWBVVu5nqKzAQ==}peerDependencies:@@ -6115,6 +6152,33 @@ packages:vfile-message: 3.1.4dev: false+ resolution: {integrity: sha512-nT8kCiJp8dQh8g991J/R5w5eE2KnO8EAIP0xocWlh9l2okngMWglOPoMZzJvek8Q1KUc4XE/mJxTZnvOB1sTYg==}+ dependencies:+ '@types/d3-array': 3.0.5+ '@types/d3-ease': 3.0.0+ '@types/d3-interpolate': 3.0.1+ '@types/d3-scale': 4.0.3+ '@types/d3-shape': 3.1.1+ '@types/d3-time': 3.0.0+ '@types/d3-timer': 3.0.0+ d3-array: 3.2.4+ d3-ease: 3.0.1+ d3-interpolate: 3.0.1+ d3-scale: 4.0.2+ d3-shape: 3.2.0+ d3-time: 3.1.0+ d3-timer: 3.0.1+ dev: false++ resolution: {integrity: sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==}+ engines: {node: '>=10.13.0'}+ dependencies:+ glob-to-regexp: 0.4.1+ graceful-fs: 4.2.11+ dev: false+resolution: {integrity: sha512-7FjigXNsBfopEj+5DV2nhNpfic2vumtjjgPmeDKk45z+MJwXKKfhPB7118Pfzrmh4jqOMST6Ch37iPAHoImg5g==}dependencies:diff --git a/prettier.config.cjs b/prettier.config.cjsindex ec129f13..0ef8be28 100644--- a/prettier.config.cjs+++ b/prettier.config.cjs@@ -1,9 +1,9 @@/** @type {import("prettier").Config} */const config = {singleQuote: true,- trailingComma: "all",+ trailingComma: 'all',printWidth: 100,- plugins: [require.resolve("prettier-plugin-tailwindcss")],+ plugins: [require.resolve('prettier-plugin-tailwindcss')],};module.exports = config;diff --git a/prisma/challenges.mock.ts b/prisma/challenges.mock.tsindex dd6d791b..6b54d766 100644--- a/prisma/challenges.mock.ts+++ b/prisma/challenges.mock.ts@@ -32,10 +32,10 @@ export const CHALLENGE_MAP: Record<updatedAt: new Date(),Bookmark: randomTrueOrFalse()? {- create: {- userId: randomTrueOrFalse() ? trashId : gId,- },- }+ create: {+ userId: randomTrueOrFalse() ? trashId : gId,+ },+ }: undefined,description: loadChallenegeSync('beginner/desc'),shortDescription,diff --git a/src/components/challenge/editor/twoslash.ts b/src/components/challenge/editor/twoslash.tsindex 6cf7b594..985bfc73 100644--- a/src/components/challenge/editor/twoslash.ts+++ b/src/components/challenge/editor/twoslash.ts@@ -2,7 +2,7 @@import type * as monaco from 'monaco-editor';export const createTwoslashInlayProvider = (- m: typeof monaco,+ m: typeof monaco,worker: monaco.languages.typescript.TypeScriptWorker,) => {const provider: monaco.languages.InlayHintsProvider = {@@ -33,7 +33,9 @@ export const createTwoslashInlayProvider = (};}- const hint = await worker.getQuickInfoAtPosition(model.uri.toString(), inspectionOff) as { displayParts: { text:string}[]};+ const hint = (await worker.getQuickInfoAtPosition(model.uri.toString(), inspectionOff)) as {+ displayParts: { text: string }[];+ };if (!hint || !hint.displayParts) continue;// Make a one-linerdiff --git a/src/components/challenge/share-form.tsx b/src/components/challenge/share-form.tsxindex f0a6c966..024725c0 100644--- a/src/components/challenge/share-form.tsx+++ b/src/components/challenge/share-form.tsx@@ -25,10 +25,14 @@ export function ShareForm() {return (<div className="flex flex-col space-y-4"><p>Copy this challenge url to share with your friends!</p>- <code className="px-4 py-2 border dark:border-gray-300 rounded-md">{url}</code>+ <code className="rounded-md border px-4 py-2 dark:border-gray-300">{url}</code><buttonclassName={`ml-auto mt-4 flex items-center justify-between space-x-2 rounded-lg px-3 py-2 duration-300 active:scale-75- ${copied ? 'text-green-500 border border-green-500 dark:border-green-700 dark:bg-green-700 dark:text-white' : 'text-black dark:bg-white border border-gray-100 hover:bg-gray-100'}`}+ ${+ copied+ ? 'border border-green-500 text-green-500 dark:border-green-700 dark:bg-green-700 dark:text-white'+ : 'border border-gray-100 text-black hover:bg-gray-100 dark:bg-white'+ }`}onClick={() => void copyToClipboard()}><span>{copied ? 'Copied!' : 'Copy'}</span>diff --git a/src/components/dashboard/DashboardPage.tsx b/src/components/dashboard/DashboardPage.tsxindex 42adf6f2..774c8668 100644--- a/src/components/dashboard/DashboardPage.tsx+++ b/src/components/dashboard/DashboardPage.tsx@@ -1,6 +1,6 @@-import { Metadata } from 'next';+import type { Metadata } from 'next';import Image from 'next/image';-import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '~/components/ui/card';+import { Card, CardContent, CardHeader, CardTitle } from '~/components/ui/card';import { Tabs, TabsContent, TabsList, TabsTrigger } from '~/components/ui/tabs';import { Overview } from '~/components/dashboard/overview';import { InProgressTab } from '~/components/dashboard/in-progress-tab-mock';diff --git a/src/components/explore/explore-card-skeleton.tsx b/src/components/explore/explore-card-skeleton.tsxindex dafde909..c1e609f3 100644--- a/src/components/explore/explore-card-skeleton.tsx+++ b/src/components/explore/explore-card-skeleton.tsx@@ -2,7 +2,7 @@ import { Card, CardDescription, CardHeader, CardTitle } from '../ui/card';export function ExploreCardSkeleton() {return (- <Card className={`group duration-300 hover:bg-card-hovered group-focus:bg-card-hovered`}>+ <Card className="group duration-300 hover:bg-card-hovered group-focus:bg-card-hovered"><CardHeader className="grid items-start gap-4 space-y-0"><div className="space-y-1"><CardTitle className="h-5 w-1/2 rounded-lg bg-slate-300 dark:bg-slate-700">diff --git a/src/components/explore/explore-card.tsx b/src/components/explore/explore-card.tsxindex 238b0b49..09c4b4cb 100644--- a/src/components/explore/explore-card.tsx+++ b/src/components/explore/explore-card.tsx@@ -51,26 +51,23 @@ const rtf = new Intl.RelativeTimeFormat('en', {// TODO: style: 'short' on 640px - 720px});-// TODO: typescript+// get relevant time from a date objectconst getRelativeTime = (date: Date) => {- const now = new Date();- // @ts-ignore- const elapsed = date - now;+ const elapsed = date.getTime() - Date.now();- // "Math.abs" accounts for both "past" & "future" scenarios- // @ts-ignore- for (const u in units)- // @ts-ignore- if (Math.abs(elapsed) > units[u] || u == 'second')- // @ts-ignore- return rtf.format(Math.round(elapsed / units[u]), u);+ for (const [unit, ms] of Object.entries(units)) {+ if (Math.abs(elapsed) > ms || unit === 'second') {+ return rtf.format(Math.round(elapsed / ms), unit as Intl.RelativeTimeFormatUnit);+ }+ }};export function ExploreCard({ challenge }: Props) {return (<Card- className={`group duration-300 hover:bg-card-hovered group-focus:bg-card-hovered ${SHADOWS_BY_DIFFICULTY[challenge.difficulty]- } ${BORDERS_BY_DIFFICULTY[challenge.difficulty]}`}+ className={`group duration-300 hover:bg-card-hovered group-focus:bg-card-hovered ${+ SHADOWS_BY_DIFFICULTY[challenge.difficulty]+ } ${BORDERS_BY_DIFFICULTY[challenge.difficulty]}`}><CardHeader className="grid items-start gap-4 space-y-0"><div className="space-y-1">diff --git a/src/components/ui/avatar.tsx b/src/components/ui/avatar.tsxindex b84ecbde..5e54c995 100644--- a/src/components/ui/avatar.tsx+++ b/src/components/ui/avatar.tsx@@ -1,9 +1,9 @@-"use client"+'use client';-import * as React from "react"-import * as AvatarPrimitive from "@radix-ui/react-avatar"+import * as React from 'react';+import * as AvatarPrimitive from '@radix-ui/react-avatar';-import { cn } from "~/utils/cn"+import { cn } from '~/utils/cn';const Avatar = React.forwardRef<React.ElementRef<typeof AvatarPrimitive.Root>,@@ -11,14 +11,11 @@ const Avatar = React.forwardRef<>(({ className, ...props }, ref) => (<AvatarPrimitive.Rootref={ref}- className={cn(- "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",- className- )}+ className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}{...props}/>-))-Avatar.displayName = AvatarPrimitive.Root.displayName+));+Avatar.displayName = AvatarPrimitive.Root.displayName;const AvatarImage = React.forwardRef<React.ElementRef<typeof AvatarPrimitive.Image>,@@ -26,11 +23,11 @@ const AvatarImage = React.forwardRef<>(({ className, ...props }, ref) => (<AvatarPrimitive.Imageref={ref}- className={cn("aspect-square h-full w-full", className)}+ className={cn('aspect-square h-full w-full', className)}{...props}/>-))-AvatarImage.displayName = AvatarPrimitive.Image.displayName+));+AvatarImage.displayName = AvatarPrimitive.Image.displayName;const AvatarFallback = React.forwardRef<React.ElementRef<typeof AvatarPrimitive.Fallback>,@@ -39,12 +36,12 @@ const AvatarFallback = React.forwardRef<<AvatarPrimitive.Fallbackref={ref}className={cn(- "flex h-full w-full items-center justify-center rounded-full bg-muted",- className+ 'flex h-full w-full items-center justify-center rounded-full bg-muted',+ className,)}{...props}/>-))-AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName+));+AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;-export { Avatar, AvatarImage, AvatarFallback }+export { Avatar, AvatarImage, AvatarFallback };diff --git a/src/components/ui/calendar.tsx b/src/components/ui/calendar.tsxindex ac67a3c2..83424dda 100644--- a/src/components/ui/calendar.tsx+++ b/src/components/ui/calendar.tsx@@ -1,64 +1,57 @@-"use client"+'use client';-import * as React from "react"-import { ChevronLeft, ChevronRight } from "lucide-react"-import { DayPicker } from "react-day-picker"+import * as React from 'react';+import { ChevronLeft, ChevronRight } from 'lucide-react';+import { DayPicker } from 'react-day-picker';-import { cn } from "~/utils/cn"-import { buttonVariants } from "~/components/ui/button"+import { cn } from '~/utils/cn';+import { buttonVariants } from '~/components/ui/button';-export type CalendarProps = React.ComponentProps<typeof DayPicker>+export type CalendarProps = React.ComponentProps<typeof DayPicker>;-function Calendar({- className,- classNames,- showOutsideDays = true,- ...props-}: CalendarProps) {+function Calendar({ className, classNames, showOutsideDays = true, ...props }: CalendarProps) {return (<DayPickershowOutsideDays={showOutsideDays}- className={cn("p-3", className)}+ className={cn('p-3', className)}classNames={{- months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",- month: "space-y-4",- caption: "flex justify-center pt-1 relative items-center",- caption_label: "text-sm font-medium",- nav: "space-x-1 flex items-center",+ months: 'flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0',+ month: 'space-y-4',+ caption: 'flex justify-center pt-1 relative items-center',+ caption_label: 'text-sm font-medium',+ nav: 'space-x-1 flex items-center',nav_button: cn(- buttonVariants({ variant: "outline" }),- "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"+ buttonVariants({ variant: 'outline' }),+ 'h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100',),- nav_button_previous: "absolute left-1",- nav_button_next: "absolute right-1",- table: "w-full border-collapse space-y-1",- head_row: "flex",- head_cell:- "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",- row: "flex w-full mt-2",- cell: "text-center text-sm p-0 relative [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",+ nav_button_previous: 'absolute left-1',+ nav_button_next: 'absolute right-1',+ table: 'w-full border-collapse space-y-1',+ head_row: 'flex',+ head_cell: 'text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]',+ row: 'flex w-full mt-2',+ cell: 'text-center text-sm p-0 relative [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20',day: cn(- buttonVariants({ variant: "ghost" }),- "h-9 w-9 p-0 font-normal aria-selected:opacity-100"+ buttonVariants({ variant: 'ghost' }),+ 'h-9 w-9 p-0 font-normal aria-selected:opacity-100',),day_selected:- "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",- day_today: "bg-accent text-accent-foreground",- day_outside: "text-muted-foreground opacity-50",- day_disabled: "text-muted-foreground opacity-50",- day_range_middle:- "aria-selected:bg-accent aria-selected:text-accent-foreground",- day_hidden: "invisible",+ 'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground',+ day_today: 'bg-accent text-accent-foreground',+ day_outside: 'text-muted-foreground opacity-50',+ day_disabled: 'text-muted-foreground opacity-50',+ day_range_middle: 'aria-selected:bg-accent aria-selected:text-accent-foreground',+ day_hidden: 'invisible',...classNames,}}components={{- IconLeft: ({ ...props }) => <ChevronLeft className="h-4 w-4" />,- IconRight: ({ ...props }) => <ChevronRight className="h-4 w-4" />,+ IconLeft: () => <ChevronLeft className="h-4 w-4" />,+ IconRight: () => <ChevronRight className="h-4 w-4" />,}}{...props}/>- )+ );}-Calendar.displayName = "Calendar"+Calendar.displayName = 'Calendar';-export { Calendar }+export { Calendar };diff --git a/src/components/ui/command.tsx b/src/components/ui/command.tsxindex 17f95e13..1900971c 100644--- a/src/components/ui/command.tsx+++ b/src/components/ui/command.tsx@@ -1,6 +1,6 @@'use client';import * as React from 'react';-import { DialogProps } from '@radix-ui/react-dialog';+import type { DialogProps } from '@radix-ui/react-dialog';import { Command as CommandPrimitive } from 'cmdk';import { Search } from 'lucide-react';diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsxindex 71dffbaf..94671624 100644--- a/src/components/ui/input.tsx+++ b/src/components/ui/input.tsx@@ -1,10 +1,9 @@-"use client";-import * as React from "react";+'use client';+import * as React from 'react';-import { cn } from "~/utils/cn";+import { cn } from '~/utils/cn';-export interface InputProps- extends React.InputHTMLAttributes<HTMLInputElement> {}+export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}const Input = React.forwardRef<HTMLInputElement, InputProps>(({ className, type, ...props }, ref) => {@@ -12,15 +11,15 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(<inputtype={type}className={cn(- "flex h-10 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",- className+ 'flex h-10 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',+ className,)}ref={ref}{...props}/>);- }+ },);-Input.displayName = "Input";+Input.displayName = 'Input';export { Input };diff --git a/src/components/ui/tooltip.tsx b/src/components/ui/tooltip.tsxindex 5500d646..c19b2621 100644--- a/src/components/ui/tooltip.tsx+++ b/src/components/ui/tooltip.tsx@@ -1,15 +1,15 @@-"use client"+'use client';-import * as React from "react"-import * as TooltipPrimitive from "@radix-ui/react-tooltip"+import * as React from 'react';+import * as TooltipPrimitive from '@radix-ui/react-tooltip';-import { cn } from "~/utils/cn"+import { cn } from '~/utils/cn';-const TooltipProvider = TooltipPrimitive.Provider+const TooltipProvider = TooltipPrimitive.Provider;-const Tooltip = TooltipPrimitive.Root+const Tooltip = TooltipPrimitive.Root;-const TooltipTrigger = TooltipPrimitive.Trigger+const TooltipTrigger = TooltipPrimitive.Trigger;const TooltipContent = React.forwardRef<React.ElementRef<typeof TooltipPrimitive.Content>,@@ -19,12 +19,12 @@ const TooltipContent = React.forwardRef<ref={ref}sideOffset={sideOffset}className={cn(- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",- className+ 'z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',+ className,)}{...props}/>-))-TooltipContent.displayName = TooltipPrimitive.Content.displayName+));+TooltipContent.displayName = TooltipPrimitive.Content.displayName;-export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }+export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };diff --git a/src/components/user/profile.tsx b/src/components/user/profile.tsxindex ed43f728..67dc8112 100644--- a/src/components/user/profile.tsx+++ b/src/components/user/profile.tsx@@ -1,6 +1,5 @@import { notFound } from 'next/navigation';import { prisma } from '~/server/db';-import Image from 'next/image';import DashboardPage from '../dashboard/DashboardPage';interface Props {@@ -20,18 +19,5 @@ export async function Profile({ username: usernameFromQuery }: Props) {notFound();}- return (- <DashboardPage />- // <h1>{user.id}</h1>- // <Image alt="user avatar" width="100" height="100" src={user.image ?? ''} />--- // <p>{user.email}</p>-- // <h2 className="text-xl">Raw user:</h2>- // <pre>{JSON.stringify(user, null, 4)}</pre>- // {/* <button onClick={() => handleClick(user.id)}>update user name for id: {user.id}</button> */}- // </>-- );+ return <DashboardPage />;}diff --git a/src/utils/api.ts b/src/utils/api.tsindex b2d5afd0..0e00d408 100644--- a/src/utils/api.ts+++ b/src/utils/api.ts@@ -4,14 +4,14 @@** We also create a few inference helpers for input and output types.*/-import { httpBatchLink, loggerLink } from "@trpc/client";-import { createTRPCNext } from "@trpc/next";-import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server";-import superjson from "superjson";-import { type AppRouter } from "~/server/api/root";+import { httpBatchLink, loggerLink } from '@trpc/client';+import { createTRPCNext } from '@trpc/next';+import { type inferRouterInputs, type inferRouterOutputs } from '@trpc/server';+import superjson from 'superjson';+import { type AppRouter } from '~/server/api/root';const getBaseUrl = () => {- if (typeof window !== "undefined") return ""; // browser should use relative url+ if (typeof window !== 'undefined') return ''; // browser should use relative urlif (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel urlreturn `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost};@@ -35,8 +35,8 @@ export const api = createTRPCNext<AppRouter>({links: [loggerLink({enabled: (opts) =>- process.env.NODE_ENV === "development" ||- (opts.direction === "down" && opts.result instanceof Error),+ process.env.NODE_ENV === 'development' ||+ (opts.direction === 'down' && opts.result instanceof Error),}),httpBatchLink({url: `${getBaseUrl()}/api/trpc`,diff --git a/src/utils/cn.ts b/src/utils/cn.tsindex a5ef1935..2819a830 100644--- a/src/utils/cn.ts+++ b/src/utils/cn.ts@@ -1,5 +1,5 @@-import { clsx, type ClassValue } from "clsx";-import { twMerge } from "tailwind-merge";+import { clsx, type ClassValue } from 'clsx';+import { twMerge } from 'tailwind-merge';export function cn(...inputs: ClassValue[]) {return twMerge(clsx(inputs));