Skip to content

Commit e3de3fe

Browse files
committed
Update formatting
1 parent 59b823c commit e3de3fe

File tree

19 files changed

+4686
-318
lines changed

19 files changed

+4686
-318
lines changed

.eslintrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "next/core-web-vitals",
3+
"rules": {
4+
"no-restricted-imports": [
5+
"error",
6+
{
7+
"patterns": [".*"]
8+
}
9+
]
10+
}
11+
}

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false,
4+
"singleQuote": false,
5+
"trailingComma": "all",
6+
"semi": true,
7+
"printWidth": 120
8+
}

app/layout.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
1-
import "./globals.css";
1+
import "@/app/globals.css";
22

3-
const defaultUrl = process.env.VERCEL_URL
4-
? `https://${process.env.VERCEL_URL}`
5-
: "http://localhost:3000";
3+
const defaultUrl = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : "http://localhost:3000";
64

75
export const metadata = {
86
metadataBase: new URL(defaultUrl),
97
title: "Demospace",
108
description: "The AI-powered product expert that scales.",
119
};
1210

13-
export default function RootLayout({
14-
children,
15-
}: {
16-
children: React.ReactNode;
17-
}) {
11+
export default function RootLayout({ children }: { children: React.ReactNode }) {
1812
return (
1913
<html lang="en">
2014
<body className="bg-background text-foreground">
21-
<main className="min-h-screen flex flex-col items-center">
22-
{children}
23-
</main>
15+
<main className="min-h-screen flex flex-col items-center">{children}</main>
2416
</body>
2517
</html>
2618
);

app/login/client.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ type Props = ComponentProps<"button"> & {
77
pendingText?: string;
88
};
99

10-
export const SubmitButton: React.FC<Props> = ({
11-
children,
12-
pendingText,
13-
...props
14-
}) => {
10+
export const SubmitButton: React.FC<Props> = ({ children, pendingText, ...props }) => {
1511
const { pending, action } = useFormStatus();
1612

1713
const isPending = pending && action === props.formAction;

app/login/page.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1+
import { SubmitButton } from "@/app/login/client";
12
import { createClient } from "@/utils/supabase/server";
23
import { headers } from "next/headers";
34
import Link from "next/link";
45
import { redirect } from "next/navigation";
5-
import { SubmitButton } from "./client";
66

7-
export default function Login({
8-
searchParams,
9-
}: {
10-
searchParams: { message: string };
11-
}) {
7+
export default function Login({ searchParams }: { searchParams: { message: string } }) {
128
const signIn = async (formData: FormData) => {
139
"use server";
1410

@@ -109,9 +105,7 @@ export default function Login({
109105
Sign Up
110106
</SubmitButton>
111107
{searchParams?.message && (
112-
<p className="mt-4 p-4 bg-foreground/10 text-foreground text-center">
113-
{searchParams.message}
114-
</p>
108+
<p className="mt-4 p-4 bg-foreground/10 text-foreground text-center">{searchParams.message}</p>
115109
)}
116110
</form>
117111
</div>

components/ActiveCallDetail.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,11 @@ export const ActiveCallDetail: React.FC<{
1717
);
1818
};
1919

20-
const AssistantSpeechIndicator: React.FC<{ isSpeaking: boolean }> = ({
21-
isSpeaking,
22-
}) => {
20+
const AssistantSpeechIndicator: React.FC<{ isSpeaking: boolean }> = ({ isSpeaking }) => {
2321
return (
2422
<div className="flex items-center mb-2">
25-
<div
26-
className={cn(
27-
"w-5 h-5 mr-2 rounded",
28-
isSpeaking ? "bg-[#3ef07c]" : "bg-[#f03e3e]"
29-
)}
30-
/>
31-
<p className="bg-slate-50 m-0">
32-
{isSpeaking ? "Assistant speaking" : "Assistant not speaking"}
33-
</p>
23+
<div className={cn("w-5 h-5 mr-2 rounded", isSpeaking ? "bg-[#3ef07c]" : "bg-[#f03e3e]")} />
24+
<p className="bg-slate-50 m-0">{isSpeaking ? "Assistant speaking" : "Assistant not speaking"}</p>
3425
</div>
3526
);
3627
};

components/Demi.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { ActiveCallDetail } from "@/components/ActiveCallDetail";
44
import { Button } from "@/components/button/Button";
5-
import { Loading } from "@/components/button/loading/Loading";
5+
import { Loading } from "@/components/loading/Loading";
66
import { AssistantOptions } from "@/utils/vapi/config";
77
import Vapi from "@vapi-ai/web";
88
import { useEffect, useState } from "react";
@@ -54,14 +54,9 @@ export const Demi: React.FC = () => {
5454
return (
5555
<>
5656
{!connected ? (
57-
<Button onClick={startCallInline}>
58-
{connecting ? <Loading className="mx-auto" light /> : "Start Demo"}
59-
</Button>
57+
<Button onClick={startCallInline}>{connecting ? <Loading className="mx-auto" light /> : "Start Demo"}</Button>
6058
) : (
61-
<ActiveCallDetail
62-
assistantIsSpeaking={assistantIsSpeaking}
63-
onEndCallClick={endCall}
64-
/>
59+
<ActiveCallDetail assistantIsSpeaking={assistantIsSpeaking} onEndCallClick={endCall} />
6560
)}
6661
</>
6762
);
File renamed without changes.

components/button/Button.tsx

Lines changed: 32 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,46 @@
33
import { cn } from "@/utils/classnames";
44
import { TrashIcon } from "@heroicons/react/24/outline";
55
import { useRouter } from "next/navigation";
6-
import React, {
7-
InputHTMLAttributes,
8-
MouseEvent,
9-
MouseEventHandler,
10-
Ref,
11-
forwardRef,
12-
} from "react";
6+
import React, { InputHTMLAttributes, MouseEvent, MouseEventHandler, Ref, forwardRef } from "react";
137

148
interface ButtonProps extends InputHTMLAttributes<HTMLButtonElement> {
159
onClick?: MouseEventHandler<HTMLButtonElement> | (() => void);
1610
type?: "button" | "submit" | "reset";
1711
}
1812

19-
export const Button: React.FC<ButtonProps & { ref?: Ref<HTMLButtonElement> }> =
20-
forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
21-
const {
22-
onClick,
23-
type = "button",
24-
className,
25-
children,
26-
...remaining
27-
} = props;
28-
29-
const buttonStyle = cn(
30-
"text-white bg-blue-950 hover:bg-blue-900",
31-
"py-1 px-4 cursor-pointer font-semibold shadow-none rounded-md tracking-[1px] transition select-none",
32-
props.disabled &&
33-
"text-slate-600 bg-slate-300 hover:bg-slate-300 cursor-not-allowed",
34-
props.className
35-
);
36-
return (
37-
<button
38-
className={buttonStyle}
39-
type={type}
40-
ref={ref}
41-
onClick={props.onClick}
42-
{...remaining}
43-
>
44-
{props.children}
45-
</button>
46-
);
47-
});
13+
export const Button: React.FC<ButtonProps & { ref?: Ref<HTMLButtonElement> }> = forwardRef<
14+
HTMLButtonElement,
15+
ButtonProps
16+
>((props, ref) => {
17+
const { onClick, type = "button", className, children, ...remaining } = props;
18+
19+
const buttonStyle = cn(
20+
"text-white bg-blue-950 hover:bg-blue-900",
21+
"py-1 px-4 cursor-pointer font-semibold shadow-none rounded-md tracking-[1px] transition select-none",
22+
props.disabled && "text-slate-600 bg-slate-300 hover:bg-slate-300 cursor-not-allowed",
23+
props.className,
24+
);
25+
return (
26+
<button className={buttonStyle} type={type} ref={ref} onClick={props.onClick} {...remaining}>
27+
{props.children}
28+
</button>
29+
);
30+
});
31+
32+
Button.displayName = "Button";
4833

4934
type LinkButtonProps = {
5035
href: string;
5136
className?: string;
5237
children: React.ReactNode;
5338
};
5439

55-
export const LinkButton: React.FC<LinkButtonProps> = forwardRef<
56-
HTMLAnchorElement,
57-
LinkButtonProps
58-
>((props, ref) => {
40+
export const LinkButton: React.FC<LinkButtonProps> = forwardRef<HTMLAnchorElement, LinkButtonProps>((props, ref) => {
5941
const { href, className, children, ...remaining } = props;
6042

6143
const buttonStyle = cn(
6244
"flex items-center justify-center text-white bg-blue-950 hover:bg-blue-900 tracking-[1px] py-1 px-4 cursor-pointer font-bold shadow-none rounded-md transition select-none",
63-
props.className
45+
props.className,
6446
);
6547
return (
6648
<a className={buttonStyle} ref={ref} href={props.href} {...remaining}>
@@ -69,6 +51,8 @@ export const LinkButton: React.FC<LinkButtonProps> = forwardRef<
6951
);
7052
});
7153

54+
LinkButton.displayName = "LinkButton";
55+
7256
type FormButtonProps = {
7357
className?: string;
7458
children: React.ReactNode;
@@ -77,7 +61,7 @@ type FormButtonProps = {
7761
export const FormButton: React.FC<FormButtonProps> = (props) => {
7862
const buttonStyle = cn(
7963
"text-white bg-blue-950 hover:bg-blue-900 py-1 px-4 cursor-pointer font-bold shadow-none rounded-md tracking-[1px] transition select-none",
80-
props.className
64+
props.className,
8165
);
8266
return (
8367
<button className={buttonStyle} type="submit">
@@ -86,9 +70,7 @@ export const FormButton: React.FC<FormButtonProps> = (props) => {
8670
);
8771
};
8872

89-
export const BackButton: React.FC<InputHTMLAttributes<HTMLDivElement>> = (
90-
props
91-
) => {
73+
export const BackButton: React.FC<InputHTMLAttributes<HTMLDivElement>> = (props) => {
9274
const router = useRouter();
9375

9476
const onClick = (e: MouseEvent<HTMLDivElement>) => {
@@ -101,10 +83,7 @@ export const BackButton: React.FC<InputHTMLAttributes<HTMLDivElement>> = (
10183

10284
return (
10385
<div
104-
className={cn(
105-
"cursor-pointer select-none text-sm font-[500] hover:text-slate-600 w-fit",
106-
props.className
107-
)}
86+
className={cn("cursor-pointer select-none text-sm font-[500] hover:text-slate-600 w-fit", props.className)}
10887
onClick={onClick}
10988
>
11089
{String.fromCharCode(8592)} Back
@@ -119,17 +98,14 @@ type IconButtonProps = {
11998
children?: React.ReactNode;
12099
disabled?: boolean;
121100
};
122-
export const IconButton: React.FC<IconButtonProps> = forwardRef<
123-
HTMLButtonElement,
124-
IconButtonProps
125-
>((props, ref) => {
101+
export const IconButton: React.FC<IconButtonProps> = forwardRef<HTMLButtonElement, IconButtonProps>((props, ref) => {
126102
const { onClick, className, children, ...remaining } = props;
127103
const buttonStyle = cn(
128104
"font-semibold flex ",
129105
"py-1 px-4 cursor-pointer font-bold shadow-none rounded-md tracking-[1px] transition select-none",
130106
!props.disabled && "hover:bg-slate-100",
131107
props.disabled && "text-slate-400 cursor-not-allowed",
132-
props.className
108+
props.className,
133109
);
134110
return (
135111
<button
@@ -146,6 +122,8 @@ export const IconButton: React.FC<IconButtonProps> = forwardRef<
146122
);
147123
});
148124

125+
IconButton.displayName = "IconButton";
126+
149127
export const DeleteButton = (props: Omit<IconButtonProps, "icon">) => (
150128
<IconButton {...props} icon={<TrashIcon className="w-5 h-5" />} />
151129
);

0 commit comments

Comments
 (0)