From bcc89ee60e352857fba26d39bd8e8038175d56dc Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 22 Jan 2024 01:40:14 -0500 Subject: [PATCH] format all files --- ui/.prettierignore | 3 ++ ui/src/App.tsx | 12 ++--- ui/src/components/link.tsx | 18 +++---- ui/src/components/loading.tsx | 2 +- ui/src/components/navbar.tsx | 18 +++---- ui/src/components/ui/alert-dialog.tsx | 54 ++++++++++---------- ui/src/components/ui/avatar.tsx | 39 ++++++++++----- ui/src/components/ui/badge.tsx | 45 +++++++++-------- ui/src/components/ui/button.tsx | 70 +++++++++++++++----------- ui/src/components/ui/card.tsx | 46 +++++++++-------- ui/src/components/ui/combobox.tsx | 70 +++++++++++++------------- ui/src/components/ui/hover-card.tsx | 26 +++++----- ui/src/components/ui/select.tsx | 38 +++++++------- ui/src/components/ui/switch.tsx | 26 ++++++---- ui/src/components/ui/table.tsx | 72 +++++++++++++++++---------- ui/src/components/ui/tabs.tsx | 65 +++++++++++++++++------- ui/src/components/ui/tooltip.tsx | 24 ++++----- ui/src/env.d.ts | 12 ++--- ui/src/index.css | 8 ++- ui/src/index.tsx | 16 +++--- ui/src/interface.ts | 2 +- ui/src/lib/utils.ts | 38 +++++++------- ui/src/model/game.ts | 64 ++++++++++++------------ ui/src/model/prediction.ts | 12 ++--- ui/src/pages/Home.tsx | 18 ++----- 25 files changed, 432 insertions(+), 366 deletions(-) create mode 100644 ui/.prettierignore diff --git a/ui/.prettierignore b/ui/.prettierignore new file mode 100644 index 0000000..b12f6f1 --- /dev/null +++ b/ui/.prettierignore @@ -0,0 +1,3 @@ +# Ignore +**/env +**/.idea \ No newline at end of file diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 116c0cc..4821d36 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -1,15 +1,13 @@ -import { Component, createSignal } from 'solid-js'; -import { Navbar } from '~/components/navbar'; +import { Component, createSignal } from "solid-js"; +import { Navbar } from "~/components/navbar"; const App: Component = (props: any) => { - let preferredTheme = localStorage.getItem('theme'); - const [theme, setTheme] = createSignal( - preferredTheme ? preferredTheme : 'blackout', - ); + let preferredTheme = localStorage.getItem("theme"); + const [theme, setTheme] = createSignal(preferredTheme ? preferredTheme : "blackout"); const changeThemeCallback = (theme: string) => { setTheme(theme); - localStorage.setItem('theme', theme); + localStorage.setItem("theme", theme); }; return ( diff --git a/ui/src/components/link.tsx b/ui/src/components/link.tsx index df695c0..db43326 100644 --- a/ui/src/components/link.tsx +++ b/ui/src/components/link.tsx @@ -2,15 +2,15 @@ import { A } from "@solidjs/router"; import { Component } from "solid-js"; interface ILink { - href: string; - children: string; - class?: string; + href: string; + children: string; + class?: string; } export const Link: Component = (props: ILink) => { - return ( - - {props.children} - - ); -} \ No newline at end of file + return ( + + {props.children} + + ); +}; diff --git a/ui/src/components/loading.tsx b/ui/src/components/loading.tsx index aa53191..c1aea94 100644 --- a/ui/src/components/loading.tsx +++ b/ui/src/components/loading.tsx @@ -1,4 +1,4 @@ -import { Component } from 'solid-js'; +import { Component } from "solid-js"; export const Loading: Component = () => { return ( diff --git a/ui/src/components/navbar.tsx b/ui/src/components/navbar.tsx index 51e1c94..5eaa498 100644 --- a/ui/src/components/navbar.tsx +++ b/ui/src/components/navbar.tsx @@ -1,12 +1,12 @@ -import { Link } from './link'; -import { Component, createSignal } from 'solid-js'; +import { Link } from "./link"; +import { Component, createSignal } from "solid-js"; import { Select, SelectContent, SelectItem, SelectTrigger, - SelectValue, -} from '~/components/ui/select.tsx'; + SelectValue +} from "~/components/ui/select.tsx"; interface Props { theme: string; @@ -29,16 +29,12 @@ export const Navbar: Component = (props: Props) => { diff --git a/ui/src/components/ui/alert-dialog.tsx b/ui/src/components/ui/alert-dialog.tsx index 404aa13..9a17a92 100644 --- a/ui/src/components/ui/alert-dialog.tsx +++ b/ui/src/components/ui/alert-dialog.tsx @@ -1,17 +1,17 @@ -import type { Component } from "solid-js" -import { splitProps } from "solid-js" +import type { Component } from "solid-js"; +import { splitProps } from "solid-js"; -import { AlertDialog as AlertDialogPrimitive } from "@kobalte/core" -import { TbX } from "solid-icons/tb" +import { AlertDialog as AlertDialogPrimitive } from "@kobalte/core"; +import { TbX } from "solid-icons/tb"; -import { cn } from "~/lib/utils" +import { cn } from "~/lib/utils"; -const AlertDialog = AlertDialogPrimitive.Root -const AlertDialogTrigger = AlertDialogPrimitive.Trigger -const AlertDialogPortal = AlertDialogPrimitive.Portal +const AlertDialog = AlertDialogPrimitive.Root; +const AlertDialogTrigger = AlertDialogPrimitive.Trigger; +const AlertDialogPortal = AlertDialogPrimitive.Portal; -const AlertDialogOverlay: Component = (props) => { - const [, rest] = splitProps(props, ["class"]) +const AlertDialogOverlay: Component = props => { + const [, rest] = splitProps(props, ["class"]); return ( - ) -} + ); +}; -const AlertDialogContent: Component = (props) => { - const [, rest] = splitProps(props, ["class", "children"]) +const AlertDialogContent: Component = props => { + const [, rest] = splitProps(props, ["class", "children"]); return ( @@ -42,25 +42,25 @@ const AlertDialogContent: Component - ) -} + ); +}; -const AlertDialogTitle: Component = (props) => { - const [, rest] = splitProps(props, ["class"]) - return -} +const AlertDialogTitle: Component = props => { + const [, rest] = splitProps(props, ["class"]); + return ; +}; -const AlertDialogDescription: Component = ( - props -) => { - const [, rest] = splitProps(props, ["class"]) +const AlertDialogDescription: Component< + AlertDialogPrimitive.AlertDialogDescriptionProps +> = props => { + const [, rest] = splitProps(props, ["class"]); return ( - ) -} + ); +}; export { AlertDialog, @@ -70,4 +70,4 @@ export { AlertDialogContent, AlertDialogTitle, AlertDialogDescription -} +}; diff --git a/ui/src/components/ui/avatar.tsx b/ui/src/components/ui/avatar.tsx index 7554433..86fdc44 100644 --- a/ui/src/components/ui/avatar.tsx +++ b/ui/src/components/ui/avatar.tsx @@ -1,23 +1,36 @@ -import type { Component } from 'solid-js'; -import { splitProps } from 'solid-js'; +import type { Component } from "solid-js"; +import { splitProps } from "solid-js"; -import { Image as ImagePrimitive } from '@kobalte/core'; +import { Image as ImagePrimitive } from "@kobalte/core"; -import { cn } from '~/lib/utils'; +import { cn } from "~/lib/utils"; -const Avatar: Component = (props) => { - const [, rest] = splitProps(props, ['class']); - return ; +const Avatar: Component = props => { + const [, rest] = splitProps(props, ["class"]); + return ( + + ); }; -const AvatarImage: Component = (props) => { - const [, rest] = splitProps(props, ['class']); - return ; +const AvatarImage: Component = props => { + const [, rest] = splitProps(props, ["class"]); + return ; }; -const AvatarFallback: Component = (props) => { - const [, rest] = splitProps(props, ['class']); - return ; +const AvatarFallback: Component = props => { + const [, rest] = splitProps(props, ["class"]); + return ( + + ); }; export { Avatar, AvatarFallback, AvatarImage }; diff --git a/ui/src/components/ui/badge.tsx b/ui/src/components/ui/badge.tsx index 9778067..7ff4cff 100644 --- a/ui/src/components/ui/badge.tsx +++ b/ui/src/components/ui/badge.tsx @@ -1,29 +1,34 @@ -import type { Component, ComponentProps } from 'solid-js'; -import { splitProps } from 'solid-js'; +import type { Component, ComponentProps } from "solid-js"; +import { splitProps } from "solid-js"; -import type { VariantProps } from 'class-variance-authority'; -import { cva } from 'class-variance-authority'; +import type { VariantProps } from "class-variance-authority"; +import { cva } from "class-variance-authority"; -import { cn } from '~/lib/utils'; +import { cn } from "~/lib/utils"; -const badgeVariants = cva('focus:ring-ring inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2', { - variants: { - variant: { - default: 'bg-primary text-primary-foreground hover:bg-primary/80 border-transparent', - secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent', - destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent', - outline: 'text-foreground', +const badgeVariants = cva( + "focus:ring-ring inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2", + { + variants: { + variant: { + default: "bg-primary text-primary-foreground hover:bg-primary/80 border-transparent", + secondary: + "bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent", + destructive: + "bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent", + outline: "text-foreground" + } }, - }, - defaultVariants: { - variant: 'default', - }, -}); + defaultVariants: { + variant: "default" + } + } +); -export interface BadgeProps extends ComponentProps<'div'>, VariantProps {} +export interface BadgeProps extends ComponentProps<"div">, VariantProps {} -const Badge: Component = (props) => { - const [, rest] = splitProps(props, ['variant', 'class']); +const Badge: Component = props => { + const [, rest] = splitProps(props, ["variant", "class"]); return
; }; diff --git a/ui/src/components/ui/button.tsx b/ui/src/components/ui/button.tsx index 4b82f2d..0beb2ed 100644 --- a/ui/src/components/ui/button.tsx +++ b/ui/src/components/ui/button.tsx @@ -1,39 +1,49 @@ -import type { Component, ComponentProps } from 'solid-js'; -import { splitProps } from 'solid-js'; +import type { Component, ComponentProps } from "solid-js"; +import { splitProps } from "solid-js"; -import type { VariantProps } from 'class-variance-authority'; -import { cva } from 'class-variance-authority'; +import type { VariantProps } from "class-variance-authority"; +import { cva } from "class-variance-authority"; -import { cn } from '~/lib/utils'; +import { cn } from "~/lib/utils"; -const buttonVariants = cva('ring-offset-background focus-visible:ring-ring inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', { - variants: { - variant: { - default: 'bg-primary text-primary-foreground hover:bg-primary/90', - destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90', - outline: 'border-input hover:bg-accent hover:text-accent-foreground border', - secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80', - ghost: 'hover:bg-accent hover:text-accent-foreground', - link: 'text-primary underline-offset-4 hover:underline', +const buttonVariants = cva( + "ring-offset-background focus-visible:ring-ring inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", + { + variants: { + variant: { + default: "bg-primary text-primary-foreground hover:bg-primary/90", + destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90", + outline: "border-input hover:bg-accent hover:text-accent-foreground border", + secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", + ghost: "hover:bg-accent hover:text-accent-foreground", + link: "text-primary underline-offset-4 hover:underline" + }, + size: { + default: "h-10 px-4 py-2", + sm: "h-9 rounded-md px-3", + lg: "h-11 rounded-md px-8", + icon: "h-10 w-10" + } }, - size: { - default: 'h-10 px-4 py-2', - sm: 'h-9 rounded-md px-3', - lg: 'h-11 rounded-md px-8', - icon: 'h-10 w-10', - }, - }, - defaultVariants: { - variant: 'default', - size: 'default', - }, -}); + defaultVariants: { + variant: "default", + size: "default" + } + } +); -export interface ButtonProps extends ComponentProps<'button'>, VariantProps {} +export interface ButtonProps + extends ComponentProps<"button">, + VariantProps {} -const Button: Component = (props) => { - const [, rest] = splitProps(props, ['variant', 'size', 'class']); - return