-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
275 additions
and
110 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
apps/web-remix/app/components/pages/pipelines/build/FloatingInterfaces/FloatingBoard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { cn } from '~/utils/cn'; | ||
|
||
export function FloatingBoard({ | ||
className, | ||
children, | ||
...rest | ||
}: React.HTMLAttributes<HTMLDivElement>) { | ||
return ( | ||
<div | ||
className={cn( | ||
'hidden fixed z-[51] top-0 bottom-0 left-0 right-0 pointer-events-none lg:block', | ||
className, | ||
)} | ||
{...rest} | ||
> | ||
{children} | ||
</div> | ||
); | ||
} |
69 changes: 69 additions & 0 deletions
69
apps/web-remix/app/components/pages/pipelines/build/FloatingInterfaces/FloatingChat.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React from 'react'; | ||
import { MessageCircle } from 'lucide-react'; | ||
|
||
import { IconButton, IconButtonProps } from '~/components/iconButton'; | ||
import { BasicLink } from '~/components/link/BasicLink'; | ||
import { IInterfaceConfigForm } from '~/components/pages/pipelines/pipeline.types'; | ||
import { useOrganizationId } from '~/hooks/useOrganizationId'; | ||
import { usePipelineId } from '~/hooks/usePipelineId'; | ||
import { routes } from '~/utils/routes.utils'; | ||
|
||
export interface FloatingChatProps { | ||
config: IInterfaceConfigForm; | ||
chatUrl: string; | ||
} | ||
|
||
export function FloatingChat({ config, chatUrl }: FloatingChatProps) { | ||
const isConfigured = config.inputs.length > 0 && config.outputs.length > 0; | ||
|
||
if (!isConfigured) return <ChatErrorMessage />; | ||
return <ChatIframe chatUrl={chatUrl} />; | ||
} | ||
|
||
export function FloatingChatButton({ | ||
disabled, | ||
...props | ||
}: Omit<IconButtonProps, 'icon'>) { | ||
return ( | ||
<IconButton | ||
disabled={disabled} | ||
icon={<MessageCircle />} | ||
{...props} | ||
variant="outline" | ||
size="sm" | ||
title="Chat" | ||
/> | ||
); | ||
} | ||
|
||
function ChatErrorMessage() { | ||
const organizationId = useOrganizationId(); | ||
const pipelineId = usePipelineId(); | ||
|
||
return ( | ||
<p className="text-sm max-w-[400px] text-center"> | ||
You do not have inputs and outputs configured for this pipeline. Check the | ||
interface configuration{' '} | ||
<BasicLink | ||
target="_blank" | ||
to={routes.pipelineWebsiteChatbot(organizationId, pipelineId)} | ||
className="font-bold hover:underline" | ||
> | ||
here | ||
</BasicLink> | ||
. | ||
</p> | ||
); | ||
} | ||
|
||
function ChatIframe({ chatUrl }: { chatUrl: string }) { | ||
return ( | ||
<iframe | ||
src={chatUrl} | ||
width="600" | ||
height="500" | ||
title="chat" | ||
className="py-1 px-1" | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
apps/web-remix/app/components/pages/pipelines/build/FloatingInterfaces/FloatingLogs.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { Logs } from 'lucide-react'; | ||
|
||
import { IconButton, IconButtonProps } from '~/components/iconButton'; | ||
|
||
export function FloatingLogsButton({ | ||
disabled, | ||
...props | ||
}: Omit<IconButtonProps, 'icon'>) { | ||
return ( | ||
<IconButton | ||
disabled={disabled} | ||
icon={<Logs />} | ||
{...props} | ||
variant="outline" | ||
size="sm" | ||
title="Logs" | ||
/> | ||
); | ||
} |
Oops, something went wrong.