Repository navigation
brand review layout update - #130
gamersprogrammer wants to merge 2 commits into
Conversation
WalkthroughThe pull request refactors the Brand onboarding review section with a new ReadOnlyField component for presenting structured, sectioned details (Brand Details, Contact Information, Platforms, Collaboration Preferences) in a read-only format. It adds enhanced styling, status messaging for submission states, and UI refinements to the Brand review flow. Changes
Sequence DiagramsequenceDiagram
actor User
participant BrandForm as Brand Form
participant ReviewUI as Review & Submit Section
participant ReadOnlyField as ReadOnlyField Component
participant Submission as Submit Handler
User->>BrandForm: Enter brand details
BrandForm->>ReviewUI: Trigger review phase
ReviewUI->>ReadOnlyField: Render Brand Details section
ReadOnlyField-->>ReviewUI: Display labeled read-only fields
ReviewUI->>ReadOnlyField: Render Contact Information section
ReviewUI->>ReadOnlyField: Render Platforms section
ReviewUI->>ReadOnlyField: Render Collaboration Preferences section
User->>ReviewUI: Click Submit button
ReviewUI->>Submission: Submit brand data
alt Submission Success
Submission-->>ReviewUI: brandSubmitSuccess = true
ReviewUI-->>User: Show green success message
else Submission Error
Submission-->>ReviewUI: brandSubmitError set
ReviewUI-->>User: Show red error message
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
Frontend/index.html(1 hunks)Frontend/src/components/Onboarding.tsx(2 hunks)
| {(brandLogoPreview || brandData.logo) ? ( | ||
| <img | ||
| src={brandLogoPreview || (brandData.logo ? URL.createObjectURL(brandData.logo) : undefined)} | ||
| alt="Logo Preview" | ||
| className="h-20 w-20 rounded-full object-cover border" | ||
| /> | ||
| ) : ( | ||
| <div className="h-20 w-20 rounded-full bg-gray-100 flex items-center justify-center text-gray-400 border border-purple-600"> | ||
| No Logo | ||
| </div> | ||
| )} | ||
| </div> | ||
|
|
||
| {/* Brand Details */} | ||
| <section> | ||
| <h3 className="text-lg font-semibold text-purple-500 mb-3">Brand Details</h3> | ||
| <div className="grid grid-cols-1 sm:grid-cols-2 gap-4"> | ||
| <ReadOnlyField label="Name" value={brandData.brand_name} /> | ||
| <ReadOnlyField label="Website" value={brandData.website_url} /> | ||
| <ReadOnlyField label="Industry" value={brandData.industry} /> | ||
| <ReadOnlyField label="Company Size" value={brandData.company_size} /> | ||
| <ReadOnlyField label="Location" value={brandData.location} /> | ||
| <ReadOnlyField label="Description" value={brandData.description} /> | ||
| </div> | ||
| <div className="mb-4"> | ||
| <h3 className="font-semibold">Brand Details</h3> | ||
| <ul className="text-sm"> | ||
| <li><b>Name:</b> {brandData.brand_name}</li> | ||
| <li><b>Website:</b> {brandData.website_url}</li> | ||
| <li><b>Industry:</b> {brandData.industry}</li> | ||
| <li><b>Company Size:</b> {brandData.company_size}</li> | ||
| <li><b>Location:</b> {brandData.location}</li> | ||
| <li><b>Description:</b> {brandData.description}</li> | ||
| </ul> | ||
| </section> | ||
|
|
||
| {/* Contact Info */} | ||
| <section> | ||
| <h3 className="text-lg font-semibold text-purple-500 mb-3">Contact Information</h3> | ||
| <div className="grid grid-cols-1 sm:grid-cols-2 gap-4"> | ||
| <ReadOnlyField label="Contact Person" value={brandData.contact_person} /> | ||
| <ReadOnlyField label="Email" value={brandData.contact_email} /> | ||
| <ReadOnlyField label="Phone" value={brandData.contact_phone} /> | ||
| <ReadOnlyField label="Role" value={brandData.role} /> | ||
| </div> | ||
| <div className="mb-4"> | ||
| <h3 className="font-semibold">Contact Information</h3> | ||
| <ul className="text-sm"> | ||
| <li><b>Contact Person:</b> {brandData.contact_person}</li> | ||
| <li><b>Email:</b> {brandData.contact_email}</li> | ||
| <li><b>Phone:</b> {brandData.contact_phone}</li> | ||
| <li><b>Role:</b> {brandData.role}</li> | ||
| </ul> | ||
| </section> | ||
|
|
||
| {/* Platforms */} | ||
| <section> | ||
| <h3 className="text-lg font-semibold text-purple-500 mb-3">Platforms & Social Links</h3> | ||
| <div className="grid grid-cols-1 sm:grid-cols-2 gap-4"> | ||
| {brandData.platforms.map(platform => { | ||
| const key = allBrandPlatforms.find(p => p.name === platform)?.key; | ||
| return ( | ||
| <ReadOnlyField | ||
| key={platform} | ||
| label={platform} | ||
| value={key ? brandData.social_links[key] : ""} | ||
| /> | ||
| ); | ||
| })} | ||
| </div> | ||
| <div className="mb-4"> | ||
| <h3 className="font-semibold">Platforms & Social Links</h3> | ||
| <ul className="text-sm"> | ||
| {brandData.platforms.map(platform => { | ||
| const key = allBrandPlatforms.find(p => p.name === platform)?.key; | ||
| return ( | ||
| <li key={platform}><b>{platform}:</b> {key ? brandData.social_links[key] : ""}</li> | ||
| ); | ||
| })} | ||
| </ul> | ||
| </section> | ||
|
|
||
| {/* Collaboration Preferences */} | ||
| <section> | ||
| <h3 className="text-lg font-semibold text-purple-500 mb-3">Collaboration Preferences</h3> | ||
| <div className="grid grid-cols-1 sm:grid-cols-2 gap-4"> | ||
| <ReadOnlyField | ||
| label="Collaboration Types" | ||
| value={brandData.collaboration_types.join(", ")} | ||
| /> | ||
| <ReadOnlyField | ||
| label="Preferred Creator Categories" | ||
| value={brandData.preferred_creator_categories.join(", ")} | ||
| /> | ||
| <ReadOnlyField label="Brand Values" value={brandData.brand_values.join(", ")} /> | ||
| <ReadOnlyField label="Preferred Tone" value={brandData.preferred_tone.join(", ")} /> | ||
| </div> | ||
| <div className="mb-4"> | ||
| <h3 className="font-semibold">Collaboration Preferences</h3> | ||
| <ul className="text-sm"> | ||
| <li><b>Collaboration Types:</b> {brandData.collaboration_types.join(", ")}</li> | ||
| <li><b>Preferred Creator Categories:</b> {brandData.preferred_creator_categories.join(", ")}</li> | ||
| <li><b>Brand Values:</b> {brandData.brand_values.join(", ")}</li> | ||
| <li><b>Preferred Tone:</b> {brandData.preferred_tone.join(", ")}</li> | ||
| </ul> | ||
| </section> | ||
|
|
There was a problem hiding this comment.
Fix logo preview crash when onboarding resumes
Restoring brandData from localStorage gives you a plain object for logo (Files aren’t JSON‑serializable). After this change the review step now does URL.createObjectURL(brandData.logo) and later brandData.logo.name.split(...), so if the user reloads mid-onboarding the first render throws a TypeError and handleBrandSubmit will also explode when it hits .name. Please guard every File-specific operation with instanceof File, and don’t persist the raw File in brandData (omit it or store a serializable preview URL before calling localStorage.setItem). Without those changes brand onboarding becomes unrecoverable after a page refresh.
|
@gamersprogrammer Great work...but as communicated, kindly create an issue first. |
I will next time |
There was a problem hiding this comment.
Pull request overview
This PR refreshes the Brand onboarding “Review & Submit” UI in the Onboarding flow to present brand details in a more structured, app-like layout with improved styling and status feedback.
Changes:
- Replaced the plain brand review list with sectioned, grid-based “read-only field” blocks and updated logo/submit button styling.
- Enhanced submit success/error messages with bordered, colored containers.
- Added a new root-level
package-lock.jsonand introduced minor whitespace-only changes inFrontend/index.html.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
package-lock.json |
Introduces a new root lockfile (currently empty/minimal) which may impact repo-level tooling. |
Frontend/src/components/Onboarding.tsx |
Updates Brand review step UI and adds a reusable ReadOnlyField renderer. |
Frontend/index.html |
Whitespace-only formatting changes around the root mount point. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // custom inputs for the displayed details | ||
| const ReadOnlyField: React.FC<Readonlyfield> = ({ label, value }) => ( | ||
| <div className="flex flex-col"> | ||
| <label className="text-sm font-medium text-gray-600 mb-1">{label}</label> | ||
| <div className="bg-gray-50 border border-gray-200 rounded-lg px-4 py-2 text-gray-800 text-sm hover:border-purple-600"> | ||
| {value && value.length > 0 ? value : <span className="text-gray-400">—</span>} |
There was a problem hiding this comment.
ReadOnlyField is typed as React.FC<...> but this file doesn't import React, so TypeScript will error with Cannot find name 'React' (new JSX transform doesn't provide the React namespace). Import the FC type from react (or import React) and update the annotation accordingly.
| { name: "TikTok", icon: "/tiktok.png" }, | ||
| ]; | ||
|
|
||
| type Readonlyfield = { |
There was a problem hiding this comment.
The props type name Readonlyfield is inconsistently cased and doesn't follow typical TS/React naming conventions, which makes it harder to scan (especially next to the ReadOnlyField component). Consider renaming it to something like ReadOnlyFieldProps (PascalCase) for clarity.
| type Readonlyfield = { | |
| type ReadOnlyFieldProps = { |
| <div className="flex flex-col"> | ||
| <label className="text-sm font-medium text-gray-600 mb-1">{label}</label> | ||
| <div className="bg-gray-50 border border-gray-200 rounded-lg px-4 py-2 text-gray-800 text-sm hover:border-purple-600"> | ||
| {value && value.length > 0 ? value : <span className="text-gray-400">—</span>} | ||
| </div> |
There was a problem hiding this comment.
<label> is being used to title a non-form-control element (the value is rendered in a <div>). This is semantically incorrect and can confuse screen readers. Use a non-label element (e.g., <div>/<span>) for the text, or render an actual form control with a matching htmlFor/id pairing.
| <label className="block text-sm font-semibold text-gray-600 mb-2">Logo</label> | ||
| {(brandLogoPreview || brandData.logo) ? ( | ||
| <img | ||
| src={brandLogoPreview || (brandData.logo ? URL.createObjectURL(brandData.logo) : undefined)} |
There was a problem hiding this comment.
URL.createObjectURL(brandData.logo) is called during render, which can create a new object URL on every re-render and leak memory if not revoked. Prefer deriving the preview URL once when brandData.logo changes (and revoke it in cleanup), or rely solely on brandLogoPreview for the image src.
| src={brandLogoPreview || (brandData.logo ? URL.createObjectURL(brandData.logo) : undefined)} | |
| src={brandLogoPreview || undefined} |
| <body> | ||
|
|
||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> | ||
|
|
||
| </html> No newline at end of file |
There was a problem hiding this comment.
This change introduces whitespace-only lines in the HTML (e.g., inside <body> and before </html>), which tends to create noisy diffs and can violate format/lint rules if enforced. Consider removing the extra blank/space-only lines.
|
Thanks for the brand review layout update. I am closing this. Layout polish is not in this pass. The brand onboarding bug stays tracked on its own. See #315. |
Closes #
📝 Description
The UI for rendering brand review was too basic and looked nothing like an AI powered web application, so, I decided to update the UI.
🔧 Changes Made
I added a custom input-like Ui with better flex layouts
I added a hover effect on the inputs with a purple color to match AI vibes
I added a purple border to the empty logo
I changed the color of the heading texts to purple too
🤝 Collaboratiom
No. All by myself
✅ Checklist
Summary by CodeRabbit
New Features
Style