mirror of
https://github.com/stackblitz/bolt.new
synced 2025-06-26 18:17:50 +00:00
Merge pull request #6 from mnsdojo/chore/fix-typos-and-improve-code
fix: fixed typos and optimized code
This commit is contained in:
commit
fa02511efb
@ -26,7 +26,7 @@ interface ArtifactProps {
|
||||
|
||||
export const Artifact = memo(({ messageId }: ArtifactProps) => {
|
||||
const userToggledActions = useRef(false);
|
||||
const [showActions, setShowActions] = useState(false);
|
||||
const [showActions, setShowActions] = useState<boolean>(false);
|
||||
|
||||
const artifacts = useStore(workbenchStore.artifacts);
|
||||
const artifact = artifacts[messageId];
|
||||
@ -43,10 +43,10 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (actions.length && !showActions && !userToggledActions.current) {
|
||||
if (actions.length > 0 && !showActions && !userToggledActions.current) {
|
||||
setShowActions(true);
|
||||
}
|
||||
}, [actions]);
|
||||
}, [actions, showActions]);
|
||||
|
||||
return (
|
||||
<div className="artifact border border-bolt-elements-borderColor flex flex-col overflow-hidden rounded-lg w-full transition-border duration-150">
|
||||
@ -60,7 +60,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?.title}</div>
|
||||
<div className="w-full w-full text-bolt-elements-textSecondary text-xs mt-0.5">Click to open Workbench</div>
|
||||
<div className=" w-full text-bolt-elements-textSecondary text-xs mt-0.5">Click to open Workbench</div>
|
||||
</div>
|
||||
</button>
|
||||
<div className="bg-bolt-elements-artifacts-borderColor w-[1px]" />
|
||||
@ -102,14 +102,14 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => {
|
||||
});
|
||||
|
||||
interface ShellCodeBlockProps {
|
||||
classsName?: string;
|
||||
className?: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
function ShellCodeBlock({ classsName, code }: ShellCodeBlockProps) {
|
||||
function ShellCodeBlock({ className, code }: ShellCodeBlockProps) {
|
||||
return (
|
||||
<div
|
||||
className={classNames('text-xs', classsName)}
|
||||
className={classNames('text-xs', className)}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: shellHighlighter.codeToHtml(code, {
|
||||
lang: 'shell',
|
||||
@ -175,7 +175,7 @@ const ActionList = memo(({ actions }: ActionListProps) => {
|
||||
</div>
|
||||
{type === 'shell' && (
|
||||
<ShellCodeBlock
|
||||
classsName={classNames('mt-1', {
|
||||
className={classNames('mt-1', {
|
||||
'mb-3.5': !isLast,
|
||||
})}
|
||||
code={content}
|
||||
|
||||
@ -46,7 +46,7 @@ export const CodeBlock = memo(
|
||||
};
|
||||
|
||||
processCode();
|
||||
}, [code]);
|
||||
}, [code, language, theme]);
|
||||
|
||||
return (
|
||||
<div className={classNames('relative group text-left', className)}>
|
||||
|
||||
@ -25,7 +25,7 @@ export const Messages = React.forwardRef<HTMLDivElement, MessagesProps>((props:
|
||||
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
key={message.id || `message-${index}`}
|
||||
className={classNames('flex gap-4 p-6 w-full rounded-[calc(0.75rem-1px)]', {
|
||||
'bg-bolt-elements-messages-background': isUserMessage || !isStreaming || (isStreaming && !isLast),
|
||||
'bg-gradient-to-b from-bolt-elements-messages-background from-30% to-transparent':
|
||||
|
||||
@ -87,7 +87,7 @@ export function HeaderActionButtons({}: HeaderActionButtonsProps) {
|
||||
interface ButtonProps {
|
||||
active?: boolean;
|
||||
disabled?: boolean;
|
||||
children?: any;
|
||||
children?: React.ReactNode;
|
||||
onClick?: VoidFunction;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@ import { motion, type Variants } from 'framer-motion';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/components/ui/Dialog';
|
||||
import { IconButton } from '~/components/ui/IconButton';
|
||||
import { ThemeSwitch } from '~/components/ui/ThemeSwitch';
|
||||
import { db, deleteById, getAll, chatId, type ChatHistoryItem } from '~/lib/persistence';
|
||||
import { cubicEasingFn } from '~/utils/easings';
|
||||
|
||||
24899
package-lock.json
generated
Normal file
24899
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user