Skip to content

Commit

Permalink
Revert "first commit"
Browse files Browse the repository at this point in the history
This reverts commit 5f973b2.
  • Loading branch information
mckaywrigley committed Jan 21, 2024
1 parent 5f973b2 commit a905f24
Show file tree
Hide file tree
Showing 33 changed files with 78 additions and 274 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,3 @@ We are working on a guide for contributing.
## Contact

Message Mckay on [Twitter/X](https://twitter.com/mckaywrigley)
# chatbot-ui
2 changes: 1 addition & 1 deletion app/[locale]/help/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function HelpPage() {
return (
<div className="size-screen flex flex-col items-center justify-center">
<div className="flex h-screen w-screen flex-col items-center justify-center">
<div className="text-4xl">Help under construction.</div>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions app/[locale]/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { IconLoader2 } from "@tabler/icons-react"

export default function Loading() {
return (
<div className="flex size-full flex-col items-center justify-center">
<IconLoader2 className="mt-4 size-12 animate-spin" />
<div className="flex h-full w-full flex-col items-center justify-center">
<IconLoader2 className="mt-4 h-12 w-12 animate-spin" />
</div>
)
}
16 changes: 6 additions & 10 deletions app/[locale]/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,18 @@ export default async function Login({
const email = formData.get("email") as string
const password = formData.get("password") as string

const emailDomainWhitelist =
process.env.EMAIL_DOMAIN_WHITELIST?.split(",") ?? []
if (
emailDomainWhitelist.length > 0 &&
!emailDomainWhitelist.includes(email.split("@")[1])
) {
const emailDomainWhitelist = process.env.EMAIL_DOMAIN_WHITELIST?.split(",") ?? []
if (emailDomainWhitelist.length > 0 && !emailDomainWhitelist.includes(email.split("@")[1])) {
return redirect(
`/login?message=Email ${email} is not allowed to sign up.`
`/login?message=Email ${email} is not allowed to sign up.`
)
}

const emailWhitelist = process.env.EMAIL_WHITELIST?.split(",") ?? []
if (emailWhitelist.length > 0 && !emailWhitelist.includes(email)) {
return redirect(
`/login?message=Email ${email} is not allowed to sign up.`
)
return redirect(
`/login?message=Email ${email} is not allowed to sign up.`
)
}

const cookieStore = cookies()
Expand Down
194 changes: 12 additions & 182 deletions app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,198 +1,28 @@
"use client"

import { ChatbotUISVG } from "@/components/icons/chatbotui-svg"
import { ThemeSwitcher } from "@/components/utility/theme-switcher"
import { exportLocalStorageAsJSON } from "@/lib/export"
import {
IconBrandGithub,
IconBrandX,
IconFileDownload,
IconStarFilled,
IconVideo
} from "@tabler/icons-react"
import { IconArrowRight } from "@tabler/icons-react"
import { useTheme } from "next-themes"
import Link from "next/link"
import { useEffect, useState } from "react"

export default function HomePage() {
const { theme } = useTheme()

const [stars, setStars] = useState(19000)

useEffect(() => {
getGitHubRepoStars()
}, [])

const getGitHubRepoStars = async () => {
const url = `https://api.github.com/repos/mckaywrigley/chatbot-ui`

try {
const response = await fetch(url, {
headers: {
Accept: "application/vnd.github.v3+json"
}
})

if (!response.ok) {
throw new Error(`Error: ${response.status}`)
}

const data = await response.json()
setStars(data.stargazers_count)
} catch (error) {
console.error("Failed to fetch GitHub stars:", error)
return 0
}
}

return (
<div className="size-screen flex flex-col p-6">
<div className="flex items-center justify-between">
<div className="relative flex items-center space-x-4">
<div className="absolute left-0 top-[-16px] md:top-[-2px]">
<ChatbotUISVG
theme={theme === "dark" ? "dark" : "light"}
scale={0.25}
/>
</div>

<div className="hidden pl-11 text-3xl font-bold md:block">
Chatbot UI
</div>
</div>

<div className="flex items-center space-x-8">
<div className="space-x-4 md:space-x-8 md:text-lg">
<Link
className="cursor-pointer hover:opacity-50"
href="https://github.com/mckaywrigley/chatbot-ui"
target="_blank"
rel="noopener noreferrer"
>
About
</Link>

{/* <Link
className="cursor-pointer hover:opacity-50"
href="/updates"
>
Updates
</Link>
<Link
className="cursor-pointer hover:opacity-50"
href="/docs"
>
Docs
</Link> */}

<Link
className="cursor-pointer hover:opacity-50"
href="https://twitter.com/mckaywrigley"
target="_blank"
rel="noopener noreferrer"
>
Contact
</Link>
</div>

<div className="flex space-x-4">
<Link
className="text-md border-primary bg-primary text-secondary flex h-[40px] w-[100px] cursor-pointer items-center justify-center rounded-lg border-2 p-2 font-semibold hover:opacity-50"
href="https://x.com/mckaywrigley/status/1738273242283151777?s=20"
target="_blank"
rel="noopener noreferrer"
>
Demo
<IconVideo className="ml-1" size={20} />
</Link>

{/* <Link
className="text-md flex h-[40px] w-[90px] cursor-pointer items-center justify-center rounded-lg border-2 border-blue-500 bg-blue-500 p-2 font-semibold text-white hover:opacity-50"
href="login"
>
Login
</Link> */}
</div>
</div>
<div className="flex h-screen w-screen flex-col items-center justify-center">
<div>
<ChatbotUISVG theme={theme === "dark" ? "dark" : "light"} scale={0.3} />
</div>

<div className="flex grow flex-col items-center justify-center pb-20">
<div className="flex flex-col text-4xl font-semibold md:text-[56px]">
<div>The</div>
<div className="md:mt-4">open-source</div>
<div className="mt-1.5 md:mt-7">AI chat app</div>
<div className="mt-1 md:mt-6">for everyone.</div>
</div>

<div className="mt-5 flex flex-col items-center space-y-2 md:mt-10 md:flex-row md:space-x-4 md:space-y-0">
<Link
className="text-md border-primary bg-primary text-secondary flex cursor-pointer items-center rounded-lg border-2 p-2 font-semibold hover:opacity-50"
href="https://github.com/mckaywrigley/chatbot-ui"
target="_blank"
rel="noopener noreferrer"
>
<IconStarFilled className="mb-[1px]" size={18} />

<div className="ml-1.5">{stars.toLocaleString()} GitHub</div>
</Link>

{/* <Link
className="text-md flex cursor-pointer items-center rounded-lg border-2 border-blue-500 bg-blue-500 p-2 font-semibold text-white hover:opacity-50"
href="login"
>
Start Chatting
<IconArrowRight
className="ml-1"
size={22}
/>
</Link> */}
</div>
</div>
<div className="mt-2 text-4xl font-bold">Chatbot UI</div>

<div className="flex items-center justify-between">
<div className="flex min-w-[76px] items-center space-x-2">
<ThemeSwitcher />

<IconFileDownload
className="cursor-pointer hover:opacity-50"
size={32}
onClick={exportLocalStorageAsJSON}
/>
</div>

<div className="text-center">
Built by
<Link
className="ml-1 cursor-pointer hover:opacity-50"
href="https://twitter.com/takeoffai"
target="_blank"
rel="noopener noreferrer"
>
Takeoff AI
</Link>
</div>

<div className="flex space-x-3">
<Link
className="cursor-pointer hover:opacity-50"
href="https://twitter.com/ChatbotUI"
target="_blank"
rel="noopener noreferrer"
>
<IconBrandX size={28} />
</Link>

<Link
className="cursor-pointer hover:opacity-50"
href="https://github.com/mckaywrigley/chatbot-ui"
target="_blank"
rel="noopener noreferrer"
>
<IconBrandGithub size={28} />
</Link>
</div>
</div>
<Link
className="mt-4 flex w-[200px] items-center justify-center rounded-md bg-blue-500 p-2 font-semibold"
href="/chat"
>
Start Chatting
<IconArrowRight className="ml-1" size={20} />
</Link>
</div>
)
}
4 changes: 2 additions & 2 deletions components/chat/chat-files-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const ChatFilesDisplay: FC<ChatFilesDisplayProps> = ({}) => {
/>

<IconX
className="bg-muted-foreground border-primary absolute right-[-6px] top-[-2px] flex size-5 cursor-pointer items-center justify-center rounded-full border-[1px] text-[10px] hover:border-red-500 hover:bg-white hover:text-red-500"
className="bg-muted-foreground border-primary absolute right-[-6px] top-[-2px] flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border-[1px] text-[10px] hover:border-red-500 hover:bg-white hover:text-red-500"
onClick={e => {
e.stopPropagation()
setNewMessageImages(
Expand Down Expand Up @@ -208,7 +208,7 @@ export const ChatFilesDisplay: FC<ChatFilesDisplayProps> = ({}) => {
</div>

<IconX
className="bg-muted-foreground border-primary absolute right-[-6px] top-[-6px] flex size-5 cursor-pointer items-center justify-center rounded-full border-[1px] text-[10px] hover:border-red-500 hover:bg-white hover:text-red-500"
className="bg-muted-foreground border-primary absolute right-[-6px] top-[-6px] flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border-[1px] text-[10px] hover:border-red-500 hover:bg-white hover:text-red-500"
onClick={e => {
e.stopPropagation()
setNewMessageFiles(
Expand Down
2 changes: 1 addition & 1 deletion components/chat/chat-help.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const ChatHelp: FC<ChatHelpProps> = ({}) => {
return (
<DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
<DropdownMenuTrigger asChild>
<IconQuestionMark className="bg-primary text-secondary size-[24px] cursor-pointer rounded-full p-0.5 opacity-60 hover:opacity-50 lg:size-[30px] lg:p-1" />
<IconQuestionMark className="bg-primary text-secondary h-[24px] w-[24px] cursor-pointer rounded-full p-0.5 opacity-60 hover:opacity-50 lg:h-[30px] lg:w-[30px] lg:p-1" />
</DropdownMenuTrigger>

<DropdownMenuContent align="end">
Expand Down
2 changes: 1 addition & 1 deletion components/messages/message-replies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const MessageReplies: FC<MessageRepliesProps> = ({}) => {
onClick={() => setIsOpen(true)}
>
<IconMessage size={MESSAGE_ICON_SIZE} />
<div className="notification-indicator absolute right-[-4px] top-[-4px] flex size-3 items-center justify-center rounded-full bg-red-600 text-[8px] text-white">
<div className="notification-indicator absolute right-[-4px] top-[-4px] flex h-3 w-3 items-center justify-center rounded-full bg-red-600 text-[8px] text-white">
{1}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/sidebar/sidebar-create-buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const SidebarCreateButtons: FC<SidebarCreateButtonsProps> = ({
</Button>

{hasData && (
<Button className="size-[36px] p-1" onClick={handleCreateFolder}>
<Button className="h-[36px] w-[36px] p-1" onClick={handleCreateFolder}>
<IconFolderPlus size={20} />
</Button>
)}
Expand Down
2 changes: 1 addition & 1 deletion components/ui/accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const AccordionTrigger = React.forwardRef<
{...props}
>
{children}
<ChevronDown className="size-4 shrink-0 transition-transform duration-200" />
<ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
</AccordionPrimitive.Trigger>
</AccordionPrimitive.Header>
))
Expand Down
6 changes: 3 additions & 3 deletions components/ui/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Avatar = React.forwardRef<
<AvatarPrimitive.Root
ref={ref}
className={cn(
"relative flex size-10 shrink-0 overflow-hidden rounded-full",
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
className
)}
{...props}
Expand All @@ -26,7 +26,7 @@ const AvatarImage = React.forwardRef<
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square size-full", className)}
className={cn("aspect-square h-full w-full", className)}
{...props}
/>
))
Expand All @@ -39,7 +39,7 @@ const AvatarFallback = React.forwardRef<
<AvatarPrimitive.Fallback
ref={ref}
className={cn(
"bg-muted flex size-full items-center justify-center rounded-full",
"bg-muted flex h-full w-full items-center justify-center rounded-full",
className
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const buttonVariants = cva(
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "size-10"
icon: "h-10 w-10"
}
},
defaultVariants: {
Expand Down
8 changes: 4 additions & 4 deletions components/ui/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Calendar({
nav: "space-x-1 flex items-center",
nav_button: cn(
buttonVariants({ variant: "outline" }),
"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"
"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",
Expand All @@ -39,7 +39,7 @@ function Calendar({
cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&: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" }),
"size-9 p-0 font-normal aria-selected:opacity-100"
"h-9 w-9 p-0 font-normal aria-selected:opacity-100"
),
day_range_end: "day-range-end",
day_selected:
Expand All @@ -54,8 +54,8 @@ function Calendar({
...classNames
}}
components={{
IconLeft: ({ ...props }) => <ChevronLeft className="size-4" />,
IconRight: ({ ...props }) => <ChevronRight className="size-4" />
IconLeft: ({ ...props }) => <ChevronLeft className="h-4 w-4" />,
IconRight: ({ ...props }) => <ChevronRight className="h-4 w-4" />
}}
{...props}
/>
Expand Down
Loading

0 comments on commit a905f24

Please sign in to comment.