Skip to content

Thulasizwe/f/3711#3882

Merged
James-Baloyi merged 4 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/f/3711
Sep 26, 2025
Merged

Thulasizwe/f/3711#3882
James-Baloyi merged 4 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/f/3711

Conversation

@czwe-01
Copy link
Copy Markdown
Collaborator

@czwe-01 czwe-01 commented Sep 25, 2025

#3711

Summary by CodeRabbit

  • New Features

    • Panel headers now support background-size, background-position, and background-repeat (also applied to collapsed headers) for finer background control.
  • Style

    • File upload area defaults to left text alignment; upload button and thumbnail text now use shared text styling for consistent appearance.
    • File name entries are now rendered as clickable links.
    • List-type "text" displays reduced/compact styling where applicable.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 25, 2025

Walkthrough

Replaces span wrappers with anchors for file name blocks, adds header background size/position/repeat properties to panel styles, adjusts FileUpload style defaults and button/text styles, and broadens designer fileUpload finalStyle to also use reduced styles when listType === 'text'.

Changes

Cohort / File(s) Summary
File item wrapper change
shesha-reactjs/src/components/fileUpload/index.tsx
Replaced outer <span> wrappers around file name blocks with <a> anchors in two locations; rendering and event handling preserved.
FileUpload styling updates
shesha-reactjs/src/components/fileUpload/styles/styles.ts
Default text alignment changed from center to left; upload container width logic updated for layout/thumbnail modes; button and thumbnail text styles consolidated to use commonTextStyles.
Designer FileUpload style selection
shesha-reactjs/src/designer-components/fileUpload/index.tsx
finalStyle logic expanded: reduced styles are now chosen when (enableStyleOnReadonly is false && readOnly) OR when listType === 'text'.
Panel header background props
shesha-reactjs/src/components/panel/styles/styles.ts
Added headerBackgroundSize, headerBackgroundPosition, headerBackgroundRepeat and wired them into background-size, background-position, and background-repeat for header and collapsed header.

Sequence Diagram(s)

sequenceDiagram
  participant Designer as Designer component
  participant Props as Props (readOnly, enableStyleOnReadonly, listType)
  participant StyleCalc as finalStyle calculation

  Note over Designer,Props: On render, Designer asks for style mode
  Designer->>Props: provide readOnly, enableStyleOnReadonly, listType
  Props->>StyleCalc: evaluate conditions
  alt (enableStyleOnReadonly == false AND readOnly == true) OR (listType == 'text')
    StyleCalc-->>Designer: return reducedStyle
  else
    StyleCalc-->>Designer: return fullStyle
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

Possibly related PRs

Suggested reviewers

  • James-Baloyi
  • AlexStepantsov

Poem

A rabbit hopped in, quick and spry,
Replaced a span with anchor's tie.
I nudged styles left, tweaked header's repeat,
Made text behave and buttons neat.
Hop—merge this patch, then cake we'll eat. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The title “Thulasizwe/f/3711” is simply a branch identifier and does not describe any of the actual changes, making it vague and non-informative. It fails to convey the primary modifications such as updating fileUpload components, adding header background style properties, or adjusting style logic. Without a descriptive summary, reviewers cannot quickly grasp the intent of the pull request. Please update the pull request title to a concise sentence that summarizes the main change, for example “Use anchor tags for file name items and add header background style properties,” so that reviewers immediately understand the core purpose of the update.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6893d2d and aa54866.

📒 Files selected for processing (3)
  • shesha-reactjs/src/components/fileUpload/index.tsx (2 hunks)
  • shesha-reactjs/src/components/fileUpload/styles/styles.ts (3 hunks)
  • shesha-reactjs/src/designer-components/fileUpload/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • shesha-reactjs/src/components/fileUpload/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-attempt
🔇 Additional comments (4)
shesha-reactjs/src/designer-components/fileUpload/index.tsx (1)

50-53: Good call on extending the condensed style branch.

Treating the text list type like the readonly path keeps the minimalist styling consistent with the renderer changes. Looks solid.

shesha-reactjs/src/components/fileUpload/styles/styles.ts (3)

41-71: Left-aligning the default text works nicely.

This lines up the text experience with the new anchor markup. 👍


185-189: Width tweak matches the thumbnail layout.

Binding the upload slot to the computed thumbnail vars prevents the awkward stretching we saw before. Nice one.


203-209: Great reuse of commonTextStyles.

Centralizing the typography styling (and cascading it to descendants) keeps the text and button states in sync with designer config.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b42f4d1 and 6893d2d.

📒 Files selected for processing (2)
  • shesha-reactjs/src/components/fileUpload/index.tsx (1 hunks)
  • shesha-reactjs/src/components/panel/styles/styles.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: teboho
PR: shesha-io/shesha-framework#3312
File: shesha-reactjs/src/hooks/formComponentHooks.ts:183-192
Timestamp: 2025-05-28T07:55:21.036Z
Learning: In shesha-reactjs formComponentHooks.ts, the background style initialization deliberately sets valid values from properties panel immediately to provide better UX, rather than waiting for the useDeepCompareEffect to run. This intentional pattern prevents a flash of no background and shows the background image immediately when the component renders.
📚 Learning: 2025-05-28T07:55:21.036Z
Learnt from: teboho
PR: shesha-io/shesha-framework#3312
File: shesha-reactjs/src/hooks/formComponentHooks.ts:183-192
Timestamp: 2025-05-28T07:55:21.036Z
Learning: In shesha-reactjs formComponentHooks.ts, the background style initialization deliberately sets valid values from properties panel immediately to provide better UX, rather than waiting for the useDeepCompareEffect to run. This intentional pattern prevents a flash of no background and shows the background image immediately when the component renders.

Applied to files:

  • shesha-reactjs/src/components/panel/styles/styles.ts
📚 Learning: 2025-06-26T19:59:22.872Z
Learnt from: teboho
PR: shesha-io/shesha-framework#3461
File: shesha-reactjs/src/designer-components/charts/settingsFormIndividual.ts:1280-1280
Timestamp: 2025-06-26T19:59:22.872Z
Learning: In shesha-reactjs chart settings forms, the styling panels (border, shadow, background) should not include buttonType-based hidden conditions since charts are not button components. The border configuration should follow the standard component pattern without button-specific restrictions.

Applied to files:

  • shesha-reactjs/src/components/panel/styles/styles.ts
🔇 Additional comments (1)
shesha-reactjs/src/components/panel/styles/styles.ts (1)

61-66: Header background sizing update looks good

Thanks for mirroring the background sizing/position/repeat options onto the panel header—this keeps the header styling in sync with the body customization knobs without introducing any regressions.

Also applies to: 164-166

type="link"
disabled={!showUploadButton}
style={{width: '100%', height: '100%'}}
style={{width: '100%', height: '100%', justifyContent: props?.style?.textAlign || 'left'}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix the invalid flex alignment value

Button renders an inline-flex container, but justify-content doesn’t accept 'left'. Passing 'left' (the default when textAlign is missing) results in an invalid declaration, so the button remains center-aligned instead of honoring the provided alignment. Please translate the common text-align values to their flex equivalents (left/start → flex-start, right/end → flex-end, etc.) before assigning them.

Apply something along these lines:

+  const alignMap: Record<string, React.CSSProperties['justifyContent']> = {
+    left: 'flex-start',
+    start: 'flex-start',
+    center: 'center',
+    right: 'flex-end',
+    end: 'flex-end',
+  };
+  const uploadButtonJustify = props?.style?.textAlign
+    ? alignMap[props.style.textAlign] ?? 'flex-start'
+    : 'flex-start';
+
   const uploadButton = (
     allowUpload && <Button
       icon={!fileInfo ? <UploadOutlined /> : <PictureOutlined />}
       type="link"
       disabled={!showUploadButton}
-      style={{width: '100%', height: '100%', justifyContent: props?.style?.textAlign || 'left'}}
+      style={{ width: '100%', height: '100%', justifyContent: uploadButtonJustify }}
     >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
style={{width: '100%', height: '100%', justifyContent: props?.style?.textAlign || 'left'}}
// Map common textAlign values to valid flex justifyContent values
const alignMap: Record<string, React.CSSProperties['justifyContent']> = {
left: 'flex-start',
start: 'flex-start',
center: 'center',
right: 'flex-end',
end: 'flex-end',
};
// Compute the actual justifyContent value, defaulting to 'flex-start'
const uploadButtonJustify = props?.style?.textAlign
? alignMap[props.style.textAlign] ?? 'flex-start'
: 'flex-start';
const uploadButton = (
allowUpload && (
<Button
icon={!fileInfo ? <UploadOutlined /> : <PictureOutlined />}
type="link"
disabled={!showUploadButton}
style={{
width: '100%',
height: '100%',
justifyContent: uploadButtonJustify,
}}
>
{/* button children */}
</Button>
)
);
🤖 Prompt for AI Agents
In shesha-reactjs/src/components/fileUpload/index.tsx around line 247, the
inline style sets justifyContent to props?.style?.textAlign || 'left', but
'left' is not a valid flex value; translate common text-align values to their
flex equivalents before assigning: map 'left' or 'start' → 'flex-start', 'right'
or 'end' → 'flex-end', 'center' → 'center', 'justify' → 'space-between' (or
another desired flex justify), and default to 'flex-start'; implement a small
helper or inline conditional that reads props?.style?.textAlign, normalizes it
(toLowerCase), maps to the correct justifyContent value, and use that mapped
value in the style object.

@James-Baloyi James-Baloyi merged commit 0784e55 into shesha-io:main Sep 26, 2025
2 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