Use loading svg of etherpad#293
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Review Summary by QodoUse Etherpad brand loading animation instead of custom SVG WalkthroughsDescription• 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 Diagramflowchart 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"]
File Changes1. src/components/ui/Spinner.tsx
|
Code Review by Qodo
1. Unused className parameter
|
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
| export const LoadingSpinner = ({ | ||
| size = 24, | ||
| size = 128, | ||
| className, | ||
| ...props | ||
| }: ISVGProps) => { |
There was a problem hiding this comment.
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
| 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'/> |
There was a problem hiding this comment.
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
No description provided.