refactor(chat): improve UI layout, artifact handling, and template naming
- Restructured alert components in BaseChat for better layout organization - Updated artifact component to display dynamic titles based on state - Simplified template names in constants for better readability - Enhanced snapshot restoration process by consolidating command actions into a single artifact
This commit is contained in:
@@ -75,7 +75,7 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => {
|
||||
>
|
||||
<div className="px-5 p-3.5 w-full text-left">
|
||||
<div className="w-full text-bolt-elements-textPrimary font-medium leading-5 text-sm">
|
||||
{artifact.type === 'bundled' ? 'Setup Project' : artifact?.title}
|
||||
{artifact?.title}
|
||||
</div>
|
||||
<div className="w-full w-full text-bolt-elements-textSecondary text-xs mt-0.5">
|
||||
Click to open Workbench
|
||||
@@ -109,7 +109,13 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => {
|
||||
<div className="i-svg-spinners:90-ring-with-bg"></div>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-bolt-elements-textPrimary font-medium leading-5 text-sm">Create initial files</div>
|
||||
<div className="text-bolt-elements-textPrimary font-medium leading-5 text-sm">
|
||||
{allActionFinished
|
||||
? artifact.id === 'imported-files'
|
||||
? 'Restore files from snapshot'
|
||||
: 'Initial files created'
|
||||
: 'Creating initial files'}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<AnimatePresence>
|
||||
|
||||
@@ -367,33 +367,32 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
||||
}}
|
||||
</ClientOnly>
|
||||
</StickToBottom.Content>
|
||||
{deployAlert && (
|
||||
<DeployChatAlert
|
||||
alert={deployAlert}
|
||||
clearAlert={() => clearDeployAlert?.()}
|
||||
postMessage={(message: string | undefined) => {
|
||||
sendMessage?.({} as any, message);
|
||||
clearSupabaseAlert?.();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{supabaseAlert && (
|
||||
<SupabaseChatAlert
|
||||
alert={supabaseAlert}
|
||||
clearAlert={() => clearSupabaseAlert?.()}
|
||||
postMessage={(message) => {
|
||||
sendMessage?.({} as any, message);
|
||||
clearSupabaseAlert?.();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<ScrollToBottom />
|
||||
<div
|
||||
className={classNames('my-auto flex flex-col gap-2 w-full max-w-chat mx-auto z-prompt mb-6', {
|
||||
'sticky bottom-2': chatStarted,
|
||||
})}
|
||||
>
|
||||
<div className="bg-bolt-elements-background-depth-2">
|
||||
<div className="flex flex-col gap-2">
|
||||
{deployAlert && (
|
||||
<DeployChatAlert
|
||||
alert={deployAlert}
|
||||
clearAlert={() => clearDeployAlert?.()}
|
||||
postMessage={(message: string | undefined) => {
|
||||
sendMessage?.({} as any, message);
|
||||
clearSupabaseAlert?.();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{supabaseAlert && (
|
||||
<SupabaseChatAlert
|
||||
alert={supabaseAlert}
|
||||
clearAlert={() => clearSupabaseAlert?.()}
|
||||
postMessage={(message) => {
|
||||
sendMessage?.({} as any, message);
|
||||
clearSupabaseAlert?.();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{actionAlert && (
|
||||
<ChatAlert
|
||||
alert={actionAlert}
|
||||
@@ -405,10 +404,11 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<ScrollToBottom />
|
||||
{progressAnnotations && <ProgressCompilation data={progressAnnotations} />}
|
||||
<div
|
||||
className={classNames(
|
||||
'bg-bolt-elements-background-depth-2 p-3 rounded-lg border border-bolt-elements-borderColor relative w-full max-w-chat mx-auto z-prompt',
|
||||
'relative bg-bolt-elements-background-depth-2 p-3 rounded-lg border border-bolt-elements-borderColor relative w-full max-w-chat mx-auto z-prompt',
|
||||
|
||||
/*
|
||||
* {
|
||||
@@ -686,7 +686,7 @@ function ScrollToBottom() {
|
||||
return (
|
||||
!isAtBottom && (
|
||||
<button
|
||||
className="absolute z-50 top-[50%] translate-y-[-60%] text-4xl rounded-lg left-[50%] translate-x-[-50%] px-1.5 py-0.5 flex items-center gap-2 bg-bolt-elements-background-depth-3 border border-bolt-elements-borderColor text-bolt-elements-textPrimary text-sm"
|
||||
className="absolute z-50 top-[0%] translate-y-[-100%] text-4xl rounded-lg left-[50%] translate-x-[-50%] px-1.5 py-0.5 flex items-center gap-2 bg-bolt-elements-background-depth-3 border border-bolt-elements-borderColor text-bolt-elements-textPrimary text-sm"
|
||||
onClick={() => scrollToBottom()}
|
||||
>
|
||||
Go to last message
|
||||
|
||||
@@ -316,14 +316,14 @@ export const ChatImpl = memo(
|
||||
setFakeLoading(true);
|
||||
|
||||
if (autoSelectTemplate) {
|
||||
const { template, title } = await selectStarterTemplate({
|
||||
const { template } = await selectStarterTemplate({
|
||||
message: messageContent,
|
||||
model,
|
||||
provider,
|
||||
});
|
||||
|
||||
if (template !== 'blank') {
|
||||
const temResp = await getTemplates(template, title).catch((e) => {
|
||||
const temResp = await getTemplates(template).catch((e) => {
|
||||
if (e.message.includes('rate limit')) {
|
||||
toast.warning('Rate limit exceeded. Skipping starter template\n Continuing with blank template');
|
||||
} else {
|
||||
|
||||
@@ -99,7 +99,7 @@ export function SupabaseChatAlert({ alert, clearAlert, postMessage }: Props) {
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
exit={{ opacity: 0, y: -20 }}
|
||||
transition={{ duration: 0.3 }}
|
||||
className="max-w-chat rounded-lg border-l-2 border-l-[#098F5F] border-bolt-elements-borderColor bg-bolt-elements-background-depth-2"
|
||||
className="max-w-chat rounded-lg border-l-2 border-l-[#098F5F] border border-bolt-elements-borderColor bg-bolt-elements-background-depth-2"
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="p-4 pb-2">
|
||||
|
||||
Reference in New Issue
Block a user