Skip to content

Commit

Permalink
Inline code + effect clarity (#2715)
Browse files Browse the repository at this point in the history
* cleaner code blocks + form context

* cleaner

* nit
  • Loading branch information
pablodanswer authored Oct 7, 2024
1 parent 1a3469d commit 4214a3a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 26 deletions.
49 changes: 25 additions & 24 deletions web/src/app/chat/message/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,33 @@ export const CodeBlock = memo(function CodeBlock({
</div>
);

if (typeof children === "string") {
return (
<span
className={`
font-mono
text-gray-800
bg-gray-50
border
border-gray-300
rounded
align-bottom
px-1
py-[3px]
text-xs
inline-block
whitespace-pre-wrap
break-words
${className}
`}
>
{children}
</span>
);
}

const CodeContent = () => {
if (!language) {
if (typeof children === "string") {
return (
<code
className={`
font-mono
text-gray-800
bg-gray-50
border
border-gray-300
rounded
px-1
py-[3px]
text-xs
whitespace-pre-wrap
break-words
overflow-hidden
mb-1
${className}
`}
>
{children}
</code>
);
}
return (
<pre style={CODE_BLOCK_PADDING}>
<code className={`text-sm ${className}`}>
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/context/EmbeddingContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const EmbeddingFormProvider: React.FC<{
if (stepFromUrl !== formStep) {
setFormStep(stepFromUrl);
}
}, [searchParams, formStep]);
}, [searchParams]);

const contextValue: EmbeddingFormContextType = {
formStep,
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/context/FormContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const FormProvider: React.FC<{
if (stepFromUrl !== formStep) {
setFormStep(stepFromUrl);
}
}, [searchParams, formStep]);
}, [searchParams]);

const contextValue: FormContextType = {
formStep,
Expand Down

0 comments on commit 4214a3a

Please sign in to comment.