From 2c1e40ffee59403e17c0926dcfdab7afaff0af20 Mon Sep 17 00:00:00 2001 From: Kevin Chen Date: Thu, 4 Jan 2024 21:15:56 -0500 Subject: [PATCH] chore: format (#85) --- ui/src/app/dashboard/actions.ts | 28 ++++---- ui/src/app/dashboard/page.tsx | 108 +++++++++++++++--------------- ui/src/components/ui/button.tsx | 42 ++++++------ ui/src/components/ui/calendar.tsx | 70 +++++++++---------- ui/src/components/ui/dialog.tsx | 36 +++++----- ui/src/components/ui/form.tsx | 40 +++++------ ui/src/components/ui/input.tsx | 12 ++-- ui/src/components/ui/label.tsx | 12 ++-- ui/src/components/ui/popover.tsx | 14 ++-- ui/src/components/ui/sonner.tsx | 18 ++--- 10 files changed, 190 insertions(+), 190 deletions(-) diff --git a/ui/src/app/dashboard/actions.ts b/ui/src/app/dashboard/actions.ts index 26e7b6b..244d422 100644 --- a/ui/src/app/dashboard/actions.ts +++ b/ui/src/app/dashboard/actions.ts @@ -1,16 +1,16 @@ -"use server"; +'use server' -import { Timestamp } from "@bufbuild/protobuf"; -import { createPromiseClient } from "@connectrpc/connect"; -import { TemporalService } from "@buf/kevinmichaelchen_temporalapis.connectrpc_es/temporal/v1beta1/api_connect"; -import { createConnectTransport } from "@connectrpc/connect-web"; +import { Timestamp } from '@bufbuild/protobuf' +import { createPromiseClient } from '@connectrpc/connect' +import { TemporalService } from '@buf/kevinmichaelchen_temporalapis.connectrpc_es/temporal/v1beta1/api_connect' +import { createConnectTransport } from '@connectrpc/connect-web' const temporalClient = createPromiseClient( TemporalService, createConnectTransport({ - baseUrl: "http://localhost:8081", + baseUrl: 'http://localhost:8081', }), -); +) export async function createOnboardingWorkflow({ orgName, @@ -18,12 +18,12 @@ export async function createOnboardingWorkflow({ start, end, }: { - orgName: string; - profileName: string; - start: Date; - end: Date; + orgName: string + profileName: string + start: Date + end: Date }) { - "use server"; + 'use server' const response = await temporalClient.createOnboardingWorkflow({ org: { name: orgName, @@ -35,6 +35,6 @@ export async function createOnboardingWorkflow({ profile: { name: profileName, }, - }); - return response; + }) + return response } diff --git a/ui/src/app/dashboard/page.tsx b/ui/src/app/dashboard/page.tsx index 40618ac..8fb72d4 100644 --- a/ui/src/app/dashboard/page.tsx +++ b/ui/src/app/dashboard/page.tsx @@ -1,9 +1,9 @@ -"use client"; +'use client' -import * as React from "react"; -import { Button } from "@/components/ui/button"; -import Link from "next/link"; -import { toast } from "sonner"; +import * as React from 'react' +import { Button } from '@/components/ui/button' +import Link from 'next/link' +import { toast } from 'sonner' import { Dialog, DialogContent, @@ -12,7 +12,7 @@ import { DialogHeader, DialogTitle, DialogTrigger, -} from "@/components/ui/dialog"; +} from '@/components/ui/dialog' import { Form, FormControl, @@ -21,22 +21,22 @@ import { FormItem, FormLabel, FormMessage, -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; -import { DateFormatter } from "react-day-picker"; -import { CalendarIcon } from "@radix-ui/react-icons"; -import { cn } from "@/lib/utils"; -import { format } from "date-fns"; -import { Calendar } from "@/components/ui/calendar"; +} from '@/components/ui/form' +import { Input } from '@/components/ui/input' +import { DateFormatter } from 'react-day-picker' +import { CalendarIcon } from '@radix-ui/react-icons' +import { cn } from '@/lib/utils' +import { format } from 'date-fns' +import { Calendar } from '@/components/ui/calendar' import { Popover, PopoverContent, PopoverTrigger, -} from "@/components/ui/popover"; -import { useForm } from "react-hook-form"; -import { zodResolver } from "@hookform/resolvers/zod"; -import * as z from "zod"; -import { createOnboardingWorkflow } from "@/app/dashboard/actions"; +} from '@/components/ui/popover' +import { useForm } from 'react-hook-form' +import { zodResolver } from '@hookform/resolvers/zod' +import * as z from 'zod' +import { createOnboardingWorkflow } from '@/app/dashboard/actions' // `app/dashboard/page.tsx` is the UI for the `/dashboard` URL export default function Page() { @@ -50,70 +50,70 @@ export default function Page() { - ); + ) } const seasonEmoji: Record = { - winter: "⛄️", - spring: "🌸", - summer: "🌻", - autumn: "🍂", -}; + winter: '⛄️', + spring: '🌸', + summer: '🌻', + autumn: '🍂', +} const getSeason = (month: Date): string => { - const monthNumber = month.getMonth(); - if (monthNumber >= 0 && monthNumber < 3) return "winter"; - if (monthNumber >= 3 && monthNumber < 6) return "spring"; - if (monthNumber >= 6 && monthNumber < 9) return "summer"; - else return "autumn"; -}; + const monthNumber = month.getMonth() + if (monthNumber >= 0 && monthNumber < 3) return 'winter' + if (monthNumber >= 3 && monthNumber < 6) return 'spring' + if (monthNumber >= 6 && monthNumber < 9) return 'summer' + else return 'autumn' +} const formatCaption: DateFormatter = (month, options) => { - const season = getSeason(month); + const season = getSeason(month) return ( <> {seasonEmoji[season]} - {" "} - {format(month, "LLLL", { locale: options?.locale })} + {' '} + {format(month, 'LLLL', { locale: options?.locale })} - ); -}; + ) +} const formSchema = z.object({ orgName: z.string().min(2, { - message: "Organization name must be at least 2 characters.", + message: 'Organization name must be at least 2 characters.', }), profileName: z.string().min(2, { - message: "User display name must be at least 2 characters.", + message: 'User display name must be at least 2 characters.', }), startDate: z.date({ - required_error: "Please select a date", + required_error: 'Please select a date', invalid_type_error: "That's not a date!", }), endDate: z.date({ - required_error: "Please select a date", + required_error: 'Please select a date', invalid_type_error: "That's not a date!", }), -}); +}) export function CreateWorkflowDialog() { const form = useForm>({ resolver: zodResolver(formSchema), - }); + }) async function onSubmit(values: z.infer) { // Do something with the form values. // ✅ This will be type-safe and validated. - console.log(values); - toast("form submit" + JSON.stringify(values)); + console.log(values) + toast('form submit' + JSON.stringify(values)) const response = await createOnboardingWorkflow({ orgName: values.orgName, profileName: values.profileName, start: values.startDate, end: values.startDate, - }); - toast(response.toJsonString()); + }) + toast(response.toJsonString()) } return ( @@ -173,14 +173,14 @@ export function CreateWorkflowDialog() {