Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

Format (#137)

Sean Boultff94e4b35923
diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx
index 9ac44855..a26e17a2 100644
--- a/src/app/admin/page.tsx
+++ b/src/app/admin/page.tsx
@@ -40,7 +40,7 @@ const ModerationView = async () => {
return (
<div>
<p className="text-center text-2xl text-white">Moderation View</p>
- <div className='m-8'>
+ <div className="m-8">
Roles:
<div>{JSON.stringify(roles)}</div>
</div>
diff --git a/src/app/create/loading.tsx b/src/app/create/loading.tsx
index 62269332..f694aa37 100644
--- a/src/app/create/loading.tsx
+++ b/src/app/create/loading.tsx
@@ -1,2 +1,2 @@
// TODO actually make a skeleton
-export { default as default} from '../challenge/[id]/loading'
\ No newline at end of file
+export { default as default } from '../challenge/[id]/loading';
diff --git a/src/components/challenge/editor/index.tsx b/src/components/challenge/editor/index.tsx
index a0746170..7f5b8530 100644
--- a/src/components/challenge/editor/index.tsx
+++ b/src/components/challenge/editor/index.tsx
@@ -29,10 +29,10 @@ import { createTwoslashInlayProvider } from './twoslash';
import { VimStatusBar } from './vimMode';
loader.config({
- paths: {
- vs: 'https://typescript.azureedge.net/cdn/5.1.6/monaco/min/vs'
- }
-})
+ paths: {
+ vs: 'https://typescript.azureedge.net/cdn/5.1.6/monaco/min/vs',
+ },
+});
const DEFAULT_OPTIONS = {
lineNumbers: 'on',
diff --git a/src/components/challenge/report.action.ts b/src/components/challenge/report.action.ts
index ccbd6230..8f4fc0c4 100644
--- a/src/components/challenge/report.action.ts
+++ b/src/components/challenge/report.action.ts
@@ -9,19 +9,19 @@ export async function doTheThing() {
}
export async function addReport(challengeId: number, userId: string, data: FormValues) {
- if(userId === undefined) return 'not_logged_in';
+ if (userId === undefined) return 'not_logged_in';
const report = await prisma.report.findMany({
where: {
challengeId,
userId,
- }
+ },
});
- if(report.length > 0) {
+ if (report.length > 0) {
console.info(report);
return 'report_already_made';
}
-
+
await prisma.report.create({
data: {
challengeId,
@@ -29,8 +29,8 @@ export async function addReport(challengeId: number, userId: string, data: FormV
text: data.comments,
unclear: data.examples,
derogatory: data.derogatory,
- }
- })
+ },
+ });
return 'created';
-}
\ No newline at end of file
+}
diff --git a/src/components/challenge/solutions/index.tsx b/src/components/challenge/solutions/index.tsx
index 266a742c..d5961999 100644
--- a/src/components/challenge/solutions/index.tsx
+++ b/src/components/challenge/solutions/index.tsx
@@ -33,7 +33,9 @@ export function Solutions({ challenge }: Props) {
<div className="flex gap-2 rounded-xl bg-blue-600/10 px-4 py-1 text-blue-600 dark:bg-blue-400/10 dark:text-blue-400">
All
</div>
- <div className="flex gap-2 rounded-xl bg-black/5 px-4 py-1 text-neutral-500 dark:bg-white/5 dark:text-neutral-400">generics</div>
+ <div className="flex gap-2 rounded-xl bg-black/5 px-4 py-1 text-neutral-500 dark:bg-white/5 dark:text-neutral-400">
+ generics
+ </div>
</div>
<Button
className="h-8 rounded-xl bg-emerald-600 hover:bg-emerald-500 dark:bg-emerald-400 dark:hover:bg-emerald-300"
diff --git a/src/components/challenge/solutions/solution-editor.tsx b/src/components/challenge/solutions/solution-editor.tsx
index 8f2ac66d..c1fa2254 100644
--- a/src/components/challenge/solutions/solution-editor.tsx
+++ b/src/components/challenge/solutions/solution-editor.tsx
@@ -73,7 +73,6 @@ export function SolutionEditor({ setOpen, challenge }: Props) {
} finally {
setOpen(false);
}
-
};
const { theme } = useTheme();
diff --git a/src/components/ui/action-menu.tsx b/src/components/ui/action-menu.tsx
index 0927580c..f76c8ac4 100644
--- a/src/components/ui/action-menu.tsx
+++ b/src/components/ui/action-menu.tsx
@@ -1,6 +1,6 @@
'use client';
import React from 'react';
-import {
+import {
DropdownMenu,
DropdownMenuTrigger,
DropdownMenuContent,
@@ -27,25 +27,23 @@ export function ActionMenu(props: ActionMenuProps) {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <AllIcons.MoreHorizontal size={16} />
+ <AllIcons.MoreHorizontal size={16} />
</DropdownMenuTrigger>
- <DropdownMenuContent>
- {
- props.items.map(item => {
- const Icon = (item.icon ? AllIcons[item.icon] : null) as OptionalIcon;
- return (
- <DropdownMenuItem onClick={() => props.onChange(item)} key={item.key} className="p-2 flex gap-2 items-center">
- <div>
- {Icon ? <Icon size={16} /> : null}
- </div>
- <div>
- {item.label}
- </div>
- </DropdownMenuItem>
- );
- })
- }
+ <DropdownMenuContent>
+ {props.items.map((item) => {
+ const Icon = (item.icon ? AllIcons[item.icon] : null) as OptionalIcon;
+ return (
+ <DropdownMenuItem
+ onClick={() => props.onChange(item)}
+ key={item.key}
+ className="flex items-center gap-2 p-2"
+ >
+ <div>{Icon ? <Icon size={16} /> : null}</div>
+ <div>{item.label}</div>
+ </DropdownMenuItem>
+ );
+ })}
</DropdownMenuContent>
</DropdownMenu>
- )
-}
\ No newline at end of file
+ );
+}
diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsx
index 09bc0997..ad6c9ff1 100644
--- a/src/components/ui/checkbox.tsx
+++ b/src/components/ui/checkbox.tsx
@@ -1,10 +1,10 @@
-'use client'
+'use client';
-import * as React from 'react'
-import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
-import { Check } from 'lucide-react'
+import * as React from 'react';
+import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
+import { Check } from 'lucide-react';
-import { cn } from '~/utils/cn'
+import { cn } from '~/utils/cn';
const Checkbox = React.forwardRef<
React.ElementRef<typeof CheckboxPrimitive.Root>,
@@ -14,17 +14,15 @@ const Checkbox = React.forwardRef<
ref={ref}
className={cn(
'peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
- className
+ className,
)}
{...props}
>
- <CheckboxPrimitive.Indicator
- className={cn('flex items-center justify-center text-current')}
- >
+ <CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current')}>
<Check className="h-4 w-4" />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
-))
-Checkbox.displayName = CheckboxPrimitive.Root.displayName
+));
+Checkbox.displayName = CheckboxPrimitive.Root.displayName;
-export { Checkbox }
+export { Checkbox };
diff --git a/src/components/ui/icon-button.tsx b/src/components/ui/icon-button.tsx
index bbb5befe..5b964b87 100644
--- a/src/components/ui/icon-button.tsx
+++ b/src/components/ui/icon-button.tsx
@@ -15,10 +15,8 @@ export interface IconButtonProps extends ButtonProps {
export function IconButton({ icon, iconSize, ...props }: IconButtonProps) {
const Icon = AllIcons[icon] as Icon;
return (
- <Button
- {...props}
- >
+ <Button {...props}>
<Icon size={iconSize} />
</Button>
- )
+ );
}
diff --git a/src/components/ui/textarea.tsx b/src/components/ui/textarea.tsx
index 23d059f8..716e4579 100644
--- a/src/components/ui/textarea.tsx
+++ b/src/components/ui/textarea.tsx
@@ -1,9 +1,8 @@
-import * as React from 'react'
+import * as React from 'react';
-import { cn } from '~/utils/cn'
+import { cn } from '~/utils/cn';
-export interface TextareaProps
- extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
+export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, ...props }, ref) => {
@@ -11,14 +10,14 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
<textarea
className={cn(
'flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background 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
+ className,
)}
ref={ref}
{...props}
/>
- )
- }
-)
-Textarea.displayName = 'Textarea'
+ );
+ },
+);
+Textarea.displayName = 'Textarea';
-export { Textarea }
+export { Textarea };
diff --git a/src/components/user/dashboard/bookmark-tab.tsx b/src/components/user/dashboard/bookmark-tab.tsx
index b54dc38a..aee6dec9 100644
--- a/src/components/user/dashboard/bookmark-tab.tsx
+++ b/src/components/user/dashboard/bookmark-tab.tsx
@@ -1,39 +1,38 @@
import {
- Table,
- TableBody,
- TableCaption,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
- } from '~/components/ui/table';
-
- const challengesList = [
- {
- challengeTitle: 'Extreme Challenge 5000',
- challengeStatus: 'N/A',
- }
- ];
-
- export function BookmarkTab() {
- return (
- <Table>
- <TableCaption>A list of your recent challenges.</TableCaption>
- <TableHeader>
- <TableRow>
- <TableHead>Challenge</TableHead>
- <TableHead>Status</TableHead>
+ Table,
+ TableBody,
+ TableCaption,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from '~/components/ui/table';
+
+const challengesList = [
+ {
+ challengeTitle: 'Extreme Challenge 5000',
+ challengeStatus: 'N/A',
+ },
+];
+
+export function BookmarkTab() {
+ return (
+ <Table>
+ <TableCaption>A list of your recent challenges.</TableCaption>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Challenge</TableHead>
+ <TableHead>Status</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {challengesList.map((challengeTitle) => (
+ <TableRow key={challengeTitle.challengeTitle}>
+ <TableCell className="font-medium">{challengeTitle.challengeTitle}</TableCell>
+ <TableCell>{challengeTitle.challengeStatus}</TableCell>
</TableRow>
- </TableHeader>
- <TableBody>
- {challengesList.map((challengeTitle) => (
- <TableRow key={challengeTitle.challengeTitle}>
- <TableCell className="font-medium">{challengeTitle.challengeTitle}</TableCell>
- <TableCell>{challengeTitle.challengeStatus}</TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- );
- }
-
\ No newline at end of file
+ ))}
+ </TableBody>
+ </Table>
+ );
+}
diff --git a/src/styles/globals.css b/src/styles/globals.css
index b75b9e0b..442f5e24 100644
--- a/src/styles/globals.css
+++ b/src/styles/globals.css
@@ -85,4 +85,3 @@ body,
main {
height: 100%;
}
-