Skip to content

Use loading svg of etherpad#293

Open
Gared wants to merge 1 commit into
mainfrom
use_etherpad_loading_animation
Open

Use loading svg of etherpad#293
Gared wants to merge 1 commit into
mainfrom
use_etherpad_loading_animation

Conversation

@Gared
Copy link
Copy Markdown
Member

@Gared Gared commented May 27, 2026

No description provided.

@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Use Etherpad brand loading animation instead of custom SVG
✨ Enhancement

Grey Divider

Walkthroughs

Description
• Replace custom spinner SVG with Etherpad brand loading animation
• Increase default spinner size from 24 to 128 pixels
• Wrap spinner in Card component for improved styling
• Integrate LoadingSpinner into home page instance table
• Remove inline SVG implementation in favor of image asset
Diagram
flowchart LR
  A["Custom SVG Spinner"] -->|Replace with| B["Brand.svg Image"]
  C["Size: 24px"] -->|Increase to| D["Size: 128px"]
  E["Plain div container"] -->|Wrap in| F["Card Component"]
  G["Home page loading state"] -->|Integrate| H["LoadingSpinner component"]

Loading

Grey Divider

File Changes

1. src/components/ui/Spinner.tsx ✨ Enhancement +9/-20

Replace SVG spinner with Etherpad brand animation

• Replaced custom SVG spinner with brand.svg image asset
• Increased default size parameter from 24 to 128
• Wrapped spinner content in Card component for styling
• Removed cn utility import and animate-spin class
• Removed gray-900 background color from container
• Restructured loading text layout with centered div

src/components/ui/Spinner.tsx


2. src/pages/home.tsx ✨ Enhancement +4/-1

Integrate LoadingSpinner into home page

• Added LoadingSpinner component import
• Replaced plain "Loading..." text with LoadingSpinner component
• Updated loading state UI in instances table

src/pages/home.tsx


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects Bot commented May 27, 2026

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0)

Grey Divider


Action required

1. Unused className parameter 🐞 Bug ≡ Correctness
Description
LoadingSpinner destructures className but never uses it, which violates the repo’s
noUnusedParameters setting and will fail TypeScript compilation. This was previously used on the
<svg> but is now dropped during the refactor to <img>.
Code

src/components/ui/Spinner.tsx[R10-14]

Evidence
The repository is configured to fail compilation on unused parameters, and className is currently
unused after destructuring in LoadingSpinner.

src/components/ui/Spinner.tsx[10-22]
tsconfig.json[22-26]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`LoadingSpinner` destructures `className` but does not apply it to any element. With `noUnusedParameters: true`, this triggers a TypeScript compile error.

### Issue Context
The project enables strict unused checks in `tsconfig.json`, so unused function parameters block builds.

### Fix Focus Areas
- src/components/ui/Spinner.tsx[10-22]
- tsconfig.json[22-26]

### Suggested fix
Either:
1) Forward `className` to a rendered element (e.g., `<img className={className} ...>` or apply it to the `<Card>`), or
2) Remove `className` from the destructuring (and possibly from the props type) if you don’t want it supported anymore.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. SVG props on img 🐞 Bug ≡ Correctness
Description
ISVGProps extends SVGProps<SVGSVGElement>, but the component renders an HTML <img> and spreads
...props onto it; this is not type-compatible under strict TS (e.g., ref/attribute types differ)
and is likely to fail type-checking. It also suggests callers might pass SVG-only attributes that
will be meaningless/invalid on an <img>.
Code

src/components/ui/Spinner.tsx[R5-18]

Evidence
ISVGProps is explicitly defined as SVGProps<SVGSVGElement>, yet those props are spread onto an
<img> element; the repo uses strict TypeScript settings, making this mismatch a likely compile
error.

src/components/ui/Spinner.tsx[1-23]
tsconfig.json[22-26]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The component’s props type is SVG-specific (`SVGProps<SVGSVGElement>`) but the rendered element is `<img>`. Spreading `...props` onto `<img>` is not type-safe and will likely fail the project’s strict TypeScript checks.

### Issue Context
This component used to render an `<svg>`, but it now renders `<img src='/brand.svg' ...>`. The prop type wasn’t updated accordingly.

### Fix Focus Areas
- src/components/ui/Spinner.tsx[1-23]
- tsconfig.json[22-26]

### Suggested fix
Update the props type to image attributes, e.g.:
- Replace `SVGProps<SVGSVGElement>` with `React.ImgHTMLAttributes<HTMLImageElement>` (or `ComponentPropsWithoutRef<'img'>`).
- Remove the `SVGProps` import.
- Ensure `className` is forwarded to either `<img>` or `<Card>` (and avoid unused destructuring).
Example shape:
```ts
import type { ComponentPropsWithoutRef } from 'react';

type LoadingSpinnerProps = ComponentPropsWithoutRef<'img'> & { size?: number };
```
Then apply `...imgProps` to `<img>`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: Build

Failed stage: Build app [❌]

Failed test name: ""

Failure summary:

The action failed during pnpm run build because TypeScript compilation (tsc) errored with TS2322 in
src/components/ui/Spinner.tsx at (18,18).
The component is passing props (notably ref) that are
typed for an SVGSVGElement (Ref) to an element which expects Ref, making the props object
incompatible with DetailedHTMLProps<ImgHTMLAttributes, HTMLImageElement>.
As a result, tsc && vite build aborted and
the build step exited with code 2 (ELIFECYCLE).

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

221:  │                                                                              │
222:  │   Ignored build scripts: @swc/core@1.15.33.                                  │
223:  │   Run "pnpm approve-builds" to pick which dependencies should be allowed     │
224:  │   to run scripts.                                                            │
225:  │                                                                              │
226:  ╰──────────────────────────────────────────────────────────────────────────────╯
227:  Done in 1s using pnpm v10.34.1
228:  ##[group]Run pnpm run build
229:  �[36;1mpnpm run build�[0m
230:  shell: /usr/bin/bash -e {0}
231:  env:
232:  PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
233:  ##[endgroup]
234:  > ether-scan-ui@0.0.0 build /home/runner/work/ether-scan-ui/ether-scan-ui
235:  > tsc && vite build
236:  ##[error]src/components/ui/Spinner.tsx(18,18): error TS2322: Type '{ alt: string; suppressHydrationWarning?: boolean | undefined; color?: string | undefined; height: string | number; id?: string | undefined; lang?: string | undefined; max?: string | number | undefined; ... 481 more ...; src: string; }' is not assignable to type 'DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>'.
237:  Type '{ alt: string; suppressHydrationWarning?: boolean | undefined; color?: string | undefined; height: string | number; id?: string | undefined; lang?: string | undefined; max?: string | number | undefined; ... 481 more ...; src: string; }' is not assignable to type 'ClassAttributes<HTMLImageElement>'.
238:  Types of property 'ref' are incompatible.
239:  Type 'Ref<SVGSVGElement> | undefined' is not assignable to type 'Ref<HTMLImageElement> | undefined'.
240:  Type '(instance: SVGSVGElement | null) => void | (() => VoidOrUndefinedOnly)' is not assignable to type 'Ref<HTMLImageElement> | undefined'.
241:  Type '(instance: SVGSVGElement | null) => void | (() => VoidOrUndefinedOnly)' is not assignable to type '(instance: HTMLImageElement | null) => void | (() => VoidOrUndefinedOnly)'.
242:  Types of parameters 'instance' and 'instance' are incompatible.
243:  Type 'HTMLImageElement | null' is not assignable to type 'SVGSVGElement | null'.
244:  Type 'HTMLImageElement' is missing the following properties from type 'SVGSVGElement': currentScale, currentTranslate, animationsPaused, checkEnclosure, and 51 more.
245:  ELIFECYCLE  Command failed with exit code 2.
246:  ##[error]Process completed with exit code 2.
247:  Post job cleanup.

Comment on lines 10 to 14
export const LoadingSpinner = ({
size = 24,
size = 128,
className,
...props
}: ISVGProps) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Unused classname parameter 🐞 Bug ≡ Correctness

LoadingSpinner destructures className but never uses it, which violates the repo’s
noUnusedParameters setting and will fail TypeScript compilation. This was previously used on the
<svg> but is now dropped during the refactor to <img>.
Agent Prompt
### Issue description
`LoadingSpinner` destructures `className` but does not apply it to any element. With `noUnusedParameters: true`, this triggers a TypeScript compile error.

### Issue Context
The project enables strict unused checks in `tsconfig.json`, so unused function parameters block builds.

### Fix Focus Areas
- src/components/ui/Spinner.tsx[10-22]
- tsconfig.json[22-26]

### Suggested fix
Either:
1) Forward `className` to a rendered element (e.g., `<img className={className} ...>` or apply it to the `<Card>`), or
2) Remove `className` from the destructuring (and possibly from the props type) if you don’t want it supported anymore.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 5 to +18
export interface ISVGProps extends SVGProps<SVGSVGElement> {
size?: number;
className?: string;
}

export const LoadingSpinner = ({
size = 24,
size = 128,
className,
...props
}: ISVGProps) => {
return createPortal(
<div className="flex bg-gray-900 pl-5 pr-5 pt-2 pb-2 rounded" id="loading-inner">
<svg
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
{...props}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className={cn("animate-spin", className)}
>
<path d="M21 12a9 9 0 1 1-6.219-8.56"/>
</svg>
<span className="ml-2 loading">Loading<span>.</span><span>.</span><span>.</span></span>

<div className="flex pl-5 pr-5 pt-2 pb-2 rounded" id="loading-inner">
<Card className="border-border bg-accent">
<img width={size} height={size} src='/brand.svg' {...props} alt='Loading animation'/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Svg props on img 🐞 Bug ≡ Correctness

ISVGProps extends SVGProps<SVGSVGElement>, but the component renders an HTML <img> and spreads
...props onto it; this is not type-compatible under strict TS (e.g., ref/attribute types differ)
and is likely to fail type-checking. It also suggests callers might pass SVG-only attributes that
will be meaningless/invalid on an <img>.
Agent Prompt
### Issue description
The component’s props type is SVG-specific (`SVGProps<SVGSVGElement>`) but the rendered element is `<img>`. Spreading `...props` onto `<img>` is not type-safe and will likely fail the project’s strict TypeScript checks.

### Issue Context
This component used to render an `<svg>`, but it now renders `<img src='/brand.svg' ...>`. The prop type wasn’t updated accordingly.

### Fix Focus Areas
- src/components/ui/Spinner.tsx[1-23]
- tsconfig.json[22-26]

### Suggested fix
Update the props type to image attributes, e.g.:
- Replace `SVGProps<SVGSVGElement>` with `React.ImgHTMLAttributes<HTMLImageElement>` (or `ComponentPropsWithoutRef<'img'>`).
- Remove the `SVGProps` import.
- Ensure `className` is forwarded to either `<img>` or `<Card>` (and avoid unused destructuring).
Example shape:
```ts
import type { ComponentPropsWithoutRef } from 'react';

type LoadingSpinnerProps = ComponentPropsWithoutRef<'img'> & { size?: number };
```
Then apply `...imgProps` to `<img>`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant