Skip to content

Added cloudinary#222

Merged
hrx01-dev merged 5 commits into
mainfrom
added-cloudinary
Jun 27, 2026
Merged

Added cloudinary#222
hrx01-dev merged 5 commits into
mainfrom
added-cloudinary

Conversation

@hrx01-dev

@hrx01-dev hrx01-dev commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Description

This PR integrates cloudinary in the portfolio project management

Summary by CodeRabbit

  • New Features
    • Added a Cloudinary-powered option to upload portfolio cover images, alongside manual URL entry.
    • Included an “Upload Image” button that activates after the widget is ready and automatically fills the cover image field after a successful upload.
  • Security & Improvements
    • Enhanced the cover image preview to show only sanitized, safe URL/path values and prevent protocol-relative or otherwise invalid inputs.
  • Chores
    • Updated the Firebase deploy build step to include Cloudinary configuration variables from secrets.

@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
servio Ready Ready Preview, Comment Jun 27, 2026 11:24am

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b4cc20ad-19c1-4abc-8da8-33e13032658e

📥 Commits

Reviewing files that changed from the base of the PR and between da18119 and 2976967.

📒 Files selected for processing (2)
  • src/admin/components/CloudinaryUploadWidget.tsx
  • src/admin/pages/PortfolioManagement.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/admin/components/CloudinaryUploadWidget.tsx
  • src/admin/pages/PortfolioManagement.tsx

📝 Walkthrough

Walkthrough

The Firebase deploy workflow now exports Cloudinary build variables. A new admin upload widget loads Cloudinary’s script and returns uploaded image URLs. Portfolio management uses it for cover images, alongside manual URLs and sanitized previews.

Changes

Cloudinary cover image upload

Layer / File(s) Summary
Widget and build env
.github/workflows/firebase-deploy.yml, src/admin/components/CloudinaryUploadWidget.tsx
The Firebase deploy build step now passes Cloudinary env vars, and the new upload widget loads the Cloudinary script, creates an upload widget, and forwards successful upload URLs to onSuccess.
Portfolio cover image form
src/admin/pages/PortfolioManagement.tsx
The portfolio form imports the upload widget, replaces the cover image URL-only control with URL and upload inputs, updates imageUrl on upload success, and renders a sanitized preview when a URL is present.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A bunny hopped by with a fluffy white grin,
and found a new upload path tucked neatly within.
With a whisker and click, the cover pic flew,
then previewed so bright like a dew-kissed new view. 🐰

Possibly related PRs

  • hrx01-dev/Servio#61: Also updates .github/workflows/firebase-deploy.yml to inject VITE_* build-time environment variables for the Firebase deploy workflow.
  • hrx01-dev/Servio#159: Also modifies the Firebase deploy workflow’s build-step environment to pass additional VITE_* variables.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is related to the change, but it is too vague to explain the main impact of adding Cloudinary uploads and workflow config. Use a more specific title, such as "Add Cloudinary image uploads to portfolio management".
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch added-cloudinary

Comment @coderabbitai help to get the list of available commands.

Comment thread src/admin/pages/PortfolioManagement.tsx Fixed
@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 2976967):

https://servio-0--pr222-added-cloudinary-onlgp3it.web.app

(expires Sat, 04 Jul 2026 11:25:10 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 15915abb5951eb298a844eda460b24f444d93a69

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/admin/components/CloudinaryUploadWidget.tsx (1)

11-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Define the Cloudinary widget types once in src/vite-env.d.ts. window.cloudinary is undeclared, which forces useRef<any>, @ts-ignore, and the any callback types in src/admin/components/CloudinaryUploadWidget.tsx. Add a local Window.cloudinary/widget type and reuse it here to remove the suppressions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/admin/components/CloudinaryUploadWidget.tsx` around lines 11 - 12, The
Cloudinary widget usage in CloudinaryUploadWidget is relying on undeclared
globals and any-typed refs, so define the shared Cloudinary/window widget types
once in src/vite-env.d.ts and then reuse those types here. Update the
CloudinaryUploadWidget component to type cloudinaryRef, widgetRef, and the
widget callback payloads with the new Window.cloudinary/widget types, and remove
the `@ts-ignore` and any suppressions.

Sources: Linters/SAST tools, Pipeline failures

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/admin/components/CloudinaryUploadWidget.tsx`:
- Around line 19-29: The widget readiness flag is being set too early in
CloudinaryUploadWidget’s onScriptLoad, before the env check and before
createUploadWidget returns a real instance. Move setIsLoaded(true) so it only
runs after widgetRef.current has been assigned successfully, and keep it false
on any early return or initialization failure; also make sure the button state
in the render logic only depends on widgetRef.current being present, so the
click handler never becomes a no-op when the widget was not created.

---

Nitpick comments:
In `@src/admin/components/CloudinaryUploadWidget.tsx`:
- Around line 11-12: The Cloudinary widget usage in CloudinaryUploadWidget is
relying on undeclared globals and any-typed refs, so define the shared
Cloudinary/window widget types once in src/vite-env.d.ts and then reuse those
types here. Update the CloudinaryUploadWidget component to type cloudinaryRef,
widgetRef, and the widget callback payloads with the new
Window.cloudinary/widget types, and remove the `@ts-ignore` and any suppressions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 611a5743-adba-4505-a4ba-e5bf27bd4a8f

📥 Commits

Reviewing files that changed from the base of the PR and between 8664437 and 181aa17.

📒 Files selected for processing (3)
  • .github/workflows/firebase-deploy.yml
  • src/admin/components/CloudinaryUploadWidget.tsx
  • src/admin/pages/PortfolioManagement.tsx

Comment on lines +19 to +29
const onScriptLoad = () => {
setIsLoaded(true);
// @ts-ignore
cloudinaryRef.current = window.cloudinary;

const cloudName = import.meta.env.VITE_CLOUDINARY_CLOUD_NAME;
const uploadPreset = import.meta.env.VITE_CLOUDINARY_UPLOAD_PRESET;

if (!cloudName || !uploadPreset) {
console.error("Cloudinary environment variables are missing.");
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Only enable the button after the widget is created.

Line 20 marks the widget as ready before the env check and before createUploadWidget(...) returns. If initialization fails, Line 72 becomes a clickable no-op because widgetRef.current was never set. Keep isLoaded false until the widget instance exists.

Minimal fix
     const onScriptLoad = () => {
-      setIsLoaded(true);
       // `@ts-ignore`
       cloudinaryRef.current = window.cloudinary;
@@
       widgetRef.current = cloudinaryRef.current.createUploadWidget(
         {
@@
         }
       );
+      setIsLoaded(true);
     };

Also applies to: 32-45, 71-72

🧰 Tools
🪛 ESLint

[error] 21-21: Use "@ts-expect-error" instead of "@ts-ignore", as "@ts-ignore" will do nothing if the following line is error-free.

(@typescript-eslint/ban-ts-comment)

🪛 GitHub Check: Type check, lint & build

[failure] 21-21:
Use "@ts-expect-error" instead of "@ts-ignore", as "@ts-ignore" will do nothing if the following line is error-free

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/admin/components/CloudinaryUploadWidget.tsx` around lines 19 - 29, The
widget readiness flag is being set too early in CloudinaryUploadWidget’s
onScriptLoad, before the env check and before createUploadWidget returns a real
instance. Move setIsLoaded(true) so it only runs after widgetRef.current has
been assigned successfully, and keep it false on any early return or
initialization failure; also make sure the button state in the render logic only
depends on widgetRef.current being present, so the click handler never becomes a
no-op when the widget was not created.

Comment thread src/admin/pages/PortfolioManagement.tsx Fixed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/admin/pages/PortfolioManagement.tsx`:
- Around line 67-69: The root-relative branch in the URL validation helper
inside PortfolioManagement.tsx currently accepts protocol-relative values
because it only checks startsWith("/"). Update the helper to reject inputs
beginning with "//" while still allowing genuine root-relative paths, and keep
the existing validation flow intact so the DOM-sink guard only returns safe
local URLs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5581ce04-042a-4b73-b6fd-8a7f2cbbb137

📥 Commits

Reviewing files that changed from the base of the PR and between e005305 and 171b2cc.

📒 Files selected for processing (1)
  • src/admin/pages/PortfolioManagement.tsx

Comment thread src/admin/pages/PortfolioManagement.tsx
@hrx01-dev hrx01-dev merged commit 38838c4 into main Jun 27, 2026
8 checks passed
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.

2 participants