Feat/luna theme - #1
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
ⓘ Your Qodo trial ends soon. Ask your workspace admin to set up billing to keep reviews running after the trial. Manage billing |
PR Summary by QodoAdd Lunar theme and fix PNG export avatar embedding
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. Lunar icon transform overridden
|
| svg += ' <g transform="translate(85, ' + (cardHeight - 35) + ')">\n'; | ||
| svg += ' <animateTransform attributeName="transform" type="rotate" values="0 80 305;10 80 305;0 80 305" dur="4s" repeatCount="indefinite"/>\n'; | ||
| svg += ' <text x="0" y="0" font-size="24">🌙</text>\n'; | ||
| svg += ' </g>\n'; | ||
|
|
||
| svg += ' <g transform="translate(560, ' + (cardHeight - 35) + ')">\n'; | ||
| svg += ' <animateTransform attributeName="transform" type="translate" values="0 0;5 -5;0 0" dur="3s" repeatCount="indefinite"/>\n'; | ||
| svg += ' <text x="0" y="0" font-size="20">🚀</text>\n'; |
There was a problem hiding this comment.
1. Lunar icon transform overridden 🐞 Bug ≡ Correctness
In generateProfileCardSVG, the lunar 🌙/🚀 icons are placed with transform="translate(...)" but then an animateTransform animates the same transform attribute without additive="sum", so the base translation is replaced during the animation. This displaces the icons from their intended bottom positions while the animation runs.
Agent Prompt
### Issue description
The lunar SVG adds a base `transform="translate(...)"` to position the icon groups, but then animates `attributeName="transform"` on the same element. Because SMIL’s default is `additive="replace"`, the animation overwrites the translate transform, causing the icons to render in the wrong place during animation.
### Issue Context
This affects only the new lunar theme decorative icons (🌙 and 🚀) added in the PR.
### Fix Focus Areas
- index.html[1517-1525]
### Suggested fix
Use one of the following patterns:
1) **Nested groups (most compatible):** keep an outer `<g transform="translate(...)"` and put an inner `<g>` that carries the `animateTransform`.
2) Add `additive="sum"` to `animateTransform` (only if you’re confident your target SVG renderers support it consistently).
Example (nested group):
```js
svg += '<g transform="translate(85, ' + (cardHeight - 35) + ')">\n';
svg += ' <g>\n';
svg += ' <animateTransform attributeName="transform" type="rotate" ... />\n';
svg += ' <text ...>🌙</text>\n';
svg += ' </g>\n';
svg += '</g>\n';
```
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| tempCtx.drawImage(img, 0, 0, imgWidth, imgHeight); | ||
|
|
||
| var dataUrl = tempCanvas.toDataURL('image/png'); | ||
| avatarImg.setAttribute('href', dataUrl); | ||
| avatarImg.setAttribute('xlink:href', dataUrl); | ||
| } |
There was a problem hiding this comment.
2. Png export cors exception 🐞 Bug ☼ Reliability
downloadPNG() draws the avatar into a temporary canvas and calls tempCanvas.toDataURL() without any error handling; if the avatar image loads but is not CORS-readable, the canvas becomes tainted and toDataURL() throws. Because this happens inside img.onload (not img.onerror), PNG generation aborts without reaching the fallback path.
Agent Prompt
### Issue description
In `downloadPNG()`, the avatar is loaded into an `Image`, drawn into a temporary canvas, and then converted via `tempCanvas.toDataURL('image/png')`. If the image is cross-origin without usable CORS headers (or otherwise treated as non-exportable), `toDataURL()` throws a `SecurityError`, which is currently unhandled and prevents PNG export (and does not trigger the existing fallback).
### Issue Context
The current fallback only runs on `img.onerror` (avatar load failure). The failure mode here is different: the image can load successfully but still be non-exportable.
### Fix Focus Areas
- index.html[1869-1921]
### Suggested fix
Wrap the avatar canvas conversion (and/or the final canvas conversion) in `try/catch` and, on exception, run the existing fallback logic (serialize SVG to data URL and render that) or show a clear error.
Example:
```js
try {
tempCtx.drawImage(img, 0, 0, imgWidth, imgHeight);
var dataUrl = tempCanvas.toDataURL('image/png');
avatarImg.setAttribute('href', dataUrl);
avatarImg.setAttribute('xlink:href', dataUrl);
} catch (e) {
// fall back to the non-avatar-inlining path
return runSvgFallback(clonedSvg, width, height);
}
```
Where `runSvgFallback(...)` can reuse the code currently inside `img.onerror` to avoid duplication.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
No description provided.