Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Pull Request Overview
This PR updates image and signature handling utilities, integrates new conversion helpers, refactors widget modal logic, and applies UI and translation tweaks to support a “Done” button label.
- Introduces
convertBase64ToImgandconvertJpegToPngfor scalable image conversion and format normalization. - Refactors
onSaveSign/onSaveImagein Utils and removesimgWHstate inWidgetsValueModal, updating handler signatures. - Adds
object-containlayout classes in placeholders and updates the i18n key from “finish” to “done” (with translations).
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/OpenSign/src/constant/Utils.jsx | Added image conversion functions and refactored save logic |
| apps/OpenSign/src/components/pdf/WidgetsValueModal.jsx | Removed imgWH state, updated handler parameters |
| apps/OpenSign/src/components/pdf/PlaceholderType.jsx | Added object-contain class and conditional styling |
| apps/OpenSign/src/components/Header.jsx | Added alt attribute and object-contain class for logo |
| apps/OpenSign/public/locales/*/translation.json | Added “done” translations across all supported locales |
Comments suppressed due to low confidence (4)
apps/OpenSign/src/constant/Utils.jsx:1409
- New utility
convertBase64ToImgwas added but there are no corresponding unit tests. Consider adding tests to verify scaling, centering, and output format.
/**
apps/OpenSign/src/constant/Utils.jsx:3682
- The JSDoc for
convertJpegToPngclaims to returnPromise<File>, but the function can also return a plain string synchronously when the input is already PNG. Update the@returnsto reflect both possible return types (e.g.,Promise<File|string>).
* @returns {Promise<File>} - A promise that resolves with a new PNG File.
apps/OpenSign/src/components/pdf/PlaceholderType.jsx:110
- [nitpick] There is a trailing space in
select-none-clswhich can be removed to keep class names consistent.
src={props.pos.SignUrl}
apps/OpenSign/src/constant/Utils.jsx:1343
- The default and initials branches were removed, so when
isTypeTextis falsegetIMGWHstays undefined and dimensions fall back to 150x60. Restore or replace the logic that calculates dimensions for default signatures/initials (e.g., usingupdatedImgWHorcalculateImgAspectRatio).
if (isTypeText) {
| ...(type === "type" ? { Width: posWidth } : {}), | ||
| ...(type === "type" ? { Height: posHeight } : {}), |
There was a problem hiding this comment.
[nitpick] You spread Width and Height in two separate objects only when type === "type". Consider combining them in one conditional spread for clarity: ...(type === "type" && { Width: posWidth, Height: posHeight }).
| ...(type === "type" ? { Width: posWidth } : {}), | |
| ...(type === "type" ? { Height: posHeight } : {}), | |
| ...(type === "type" && { Width: posWidth, Height: posHeight }), |
| img.src = base64Image; | ||
| await new Promise((resolve, reject) => { | ||
| img.onload = resolve; | ||
| img.onerror = reject; |
There was a problem hiding this comment.
It's safer to add an onerror handler on the Image before setting src to catch invalid or corrupted base64 data and reject the promise explicitly.
| img.src = base64Image; | |
| await new Promise((resolve, reject) => { | |
| img.onload = resolve; | |
| img.onerror = reject; | |
| await new Promise((resolve, reject) => { | |
| img.onload = resolve; | |
| img.onerror = reject; | |
| img.src = base64Image; |
v2.26.1