Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions components/editor/CodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useState } from 'react';
import Highlight from 'react-syntax-highlighter';

import { CheckIcon } from '@heroicons/react/outline';
import { twMerge } from 'tailwind-merge';
Comment on lines +4 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix import sorting to pass CI.

The pipeline is failing due to import order not matching the project's simple-import-sort configuration. The imports need to be reordered.

🔧 Proposed fix for import sorting
 import React, { useState } from 'react';
+
+import { CheckIcon } from '@heroicons/react/outline';
 import Highlight from 'react-syntax-highlighter';
+import { twMerge } from 'tailwind-merge';
 
-import { CheckIcon } from '@heroicons/react/outline';
-import { twMerge } from 'tailwind-merge';
 import Caption from '../Caption';
 import IconClipboard from '../icons/Clipboard';

Note: The exact order depends on the project's simple-import-sort configuration. Run npm run lint:fix or the equivalent autofix command to get the correct order.

🤖 Prompt for AI Agents
In `@components/editor/CodeBlock.tsx` around lines 4 - 5, Import order in
CodeBlock.tsx does not match the project's simple-import-sort rules; reorder the
imports so they comply (or run the autofix). Open CodeBlock.tsx and adjust the
two imports (CheckIcon from '@heroicons/react/outline' and twMerge from
'tailwind-merge') into the order expected by your simple-import-sort
configuration (or simply run npm run lint:fix to auto-fix), then re-run CI to
confirm and commit the updated import order.

import Caption from '../Caption';
import IconClipboard from '../icons/Clipboard';

Expand Down Expand Up @@ -333,13 +335,27 @@ export default function CodeBlock({
title='Copy to clipboard'
data-test='copy-button'
>
{showIsCopied && (
<span className='mr-2 inline-block pl-2 pt-1' data-testid='clicked-text'>
Copied!
<span className="relative inline-block mt-[3px] size-4">
<span
className={twMerge(
'absolute inset-0 transition-all duration-200 ease-out',
showIsCopied
? 'opacity-0 scale-50'
: 'opacity-100 scale-100',
)}
>
<IconClipboard />
</span>
<span
className={twMerge(
'absolute inset-0 transition-all duration-200 ease-out',
showIsCopied
? 'opacity-100 scale-100'
: 'opacity-0 scale-50',
)}
>
<CheckIcon />
</span>
Comment on lines +338 to 358
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix formatting issues to pass CI.

Multiple linting/formatting errors are causing the pipeline to fail:

  • Line 338: Use single quotes instead of double quotes for JSX attributes
  • Lines 344, 354: Remove trailing commas
  • Ternary operators should be on single lines per Prettier config
🔧 Proposed fix for formatting issues
-              <span className="relative inline-block mt-[3px] size-4">
+              <span className='relative inline-block mt-[3px] size-4'>
                 <span
                   className={twMerge(
                     'absolute inset-0 transition-all duration-200 ease-out',
-                    showIsCopied
-                      ? 'opacity-0 scale-50'
-                      : 'opacity-100 scale-100',
+                    showIsCopied ? 'opacity-0 scale-50' : 'opacity-100 scale-100'
                   )}
                 >
                   <IconClipboard />
                 </span>
                 <span
                   className={twMerge(
                     'absolute inset-0 transition-all duration-200 ease-out',
-                    showIsCopied
-                      ? 'opacity-100 scale-100'
-                      : 'opacity-0 scale-50',
+                    showIsCopied ? 'opacity-100 scale-100' : 'opacity-0 scale-50'
                   )}
                 >
                   <CheckIcon />
                 </span>
               </span>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<span className="relative inline-block mt-[3px] size-4">
<span
className={twMerge(
'absolute inset-0 transition-all duration-200 ease-out',
showIsCopied
? 'opacity-0 scale-50'
: 'opacity-100 scale-100',
)}
>
<IconClipboard />
</span>
<span
className={twMerge(
'absolute inset-0 transition-all duration-200 ease-out',
showIsCopied
? 'opacity-100 scale-100'
: 'opacity-0 scale-50',
)}
>
<CheckIcon />
</span>
<span className='relative inline-block mt-[3px] size-4'>
<span
className={twMerge(
'absolute inset-0 transition-all duration-200 ease-out',
showIsCopied ? 'opacity-0 scale-50' : 'opacity-100 scale-100'
)}
>
<IconClipboard />
</span>
<span
className={twMerge(
'absolute inset-0 transition-all duration-200 ease-out',
showIsCopied ? 'opacity-100 scale-100' : 'opacity-0 scale-50'
)}
>
<CheckIcon />
</span>
</span>
🧰 Tools
🪛 GitHub Actions: PR testing - if Node project

[error] 338-338: Replace "relative·inline-block·mt-[3px]·size-4" with 'relative·inline-block·mt-[3px]·size-4' prettier/prettier


[error] 338-338: Unexpected usage of doublequote. jsx-quotes


[error] 342-342: Replace ⏎······················?·'opacity-0·scale-50'⏎······················:·'opacity-100·scale-100', with ·?·'opacity-0·scale-50'·:·'opacity-100·scale-100' prettier/prettier


[error] 344-344: Unexpected trailing comma. comma-dangle


[error] 352-352: Replace ⏎······················?·'opacity-100·scale-100'⏎······················:·'opacity-0·scale-50', with ·?·'opacity-100·scale-100'·:·'opacity-0·scale-50' prettier/prettier


[error] 354-354: Unexpected trailing comma. comma-dangle

🤖 Prompt for AI Agents
In `@components/editor/CodeBlock.tsx` around lines 338 - 358, The JSX in the
CodeBlock component has Prettier/ESLint formatting issues: change double quotes
to single quotes for JSX attributes (e.g., className attributes on the span
elements), remove trailing commas in prop lists passed to twMerge, and collapse
the ternary expressions used inside twMerge onto single lines so each
conditional is one line (affecting the className calls that reference
showIsCopied, IconClipboard, and CheckIcon). Ensure the twMerge invocations and
the two nested span elements use single-quoted strings and no trailing commas
and that the ternary operators are formatted as single-line expressions.

)}
<span className='inline-block pt-1'>
<IconClipboard className='-mt-0.5 inline-block size-4' />
</span>
</button>
</div>
Expand Down
43 changes: 39 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading