Skip to content

chore(animated-header): Handling of loading and disabled states #588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

IronZDev
Copy link
Contributor

@IronZDev IronZDev commented May 8, 2025

Significant refactor of Animated Header. I grouped and cleaned up some props.
I added handling for full component loading state + tasks or selectors loading states.

Changelog

New

  • Global Animated Header loading state handling
  • Handling of loadings/disabled states for individual tasks
  • Handling of loading state for task controller
  • Handling of loading state for workspace selector

Changed

  • Significant props logic refactor
  • Storybook controls is updated to reflect new schema
  • Props description update
  • MD breakpoint overflow fix

Testing / Reviewing

Screen.Recording.2025-05-08.at.23.07.50.mov

@IronZDev IronZDev requested a review from glapadre May 8, 2025 21:09
Copy link

netlify bot commented May 8, 2025

Deploy Preview for carbon-labs-web-components failed. Why did it fail? →

Name Link
🔨 Latest commit 59fa051
🔍 Latest deploy log https://app.netlify.com/projects/carbon-labs-web-components/deploys/684fffe30e4f8500085867d4

Copy link

netlify bot commented May 8, 2025

Deploy Preview for carbon-labs-react ready!

Name Link
🔨 Latest commit 59fa051
🔍 Latest deploy log https://app.netlify.com/projects/carbon-labs-react/deploys/684fffe3c86ddb00088822a7
😎 Deploy Preview https://deploy-preview-588--carbon-labs-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@IronZDev IronZDev marked this pull request as ready for review May 25, 2025 21:14
@IronZDev IronZDev requested review from a team as code owners May 25, 2025 21:14
@IronZDev IronZDev requested review from makafsal and amal-k-joy and removed request for a team May 25, 2025 21:14
Copy link
Contributor

@amal-k-joy amal-k-joy left a comment

Choose a reason for hiding this comment

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

Looks good. Added 2 minor comments.

Points to consider later:

  • Usage of Lottie-web animation is not recomended on component level. Many issues was reported on inflated bundle size and issue in next js application.
  • Currently you have followed an approach where whole capabilities are passed via single configuration. I think this would make the usage bit complicated. Instead you can think of a composite approach or composite approach with compound component pattern in react.

Current
<AnimatedHeader {...argsWithSelectors} />
Proposed

<AnimatedHeader {...config}  heading ... >
    <AnimatedHeaderTaskController description>
        <TaskControllerButton></TaskControllerButton>
        or
        <TaskControllerDropDown></TaskControllerDropDown>
    </AnimatedHeaderTaskController>
    <AnimatedHeaderWorkspaceSelector isLoading config />
    <AnimatedHeaderMainContent>
        <AnimatedHeaderTile></AnimatedHeaderTile>
        <AnimatedHeaderTile></AnimatedHeaderTile>
        <AnimatedHeaderAIChat></AnimatedHeaderTile>
    </AnimatedHeaderMainContent>
</AnimatedHeader>


@@ -226,6 +226,18 @@ body {
max-inline-size: fit-content;
}

.#{$prefix}__task-controller-skeleton {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you use carbon tokens for spacings across the style file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! done

}

if (tasksControllerConfig?.type === 'dropdown' && dropdownProps) {
console.log(dropdownProps);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove logs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@IronZDev
Copy link
Contributor Author

IronZDev commented Jun 6, 2025

Looks good. Added 2 minor comments.

Points to consider later:

  • Usage of Lottie-web animation is not recomended on component level. Many issues was reported on inflated bundle size and issue in next js application.
  • Currently you have followed an approach where whole capabilities are passed via single configuration. I think this would make the usage bit complicated. Instead you can think of a composite approach or composite approach with compound component pattern in react.

Current <AnimatedHeader {...argsWithSelectors} /> Proposed

<AnimatedHeader {...config}  heading ... >
    <AnimatedHeaderTaskController description>
        <TaskControllerButton></TaskControllerButton>
        or
        <TaskControllerDropDown></TaskControllerDropDown>
    </AnimatedHeaderTaskController>
    <AnimatedHeaderWorkspaceSelector isLoading config />
    <AnimatedHeaderMainContent>
        <AnimatedHeaderTile></AnimatedHeaderTile>
        <AnimatedHeaderTile></AnimatedHeaderTile>
        <AnimatedHeaderAIChat></AnimatedHeaderTile>
    </AnimatedHeaderMainContent>
</AnimatedHeader>

Thanks for the comments!
As of lottie-web, you are right. This is definitely on my radar, since it also makes the component incompatible with SSR apps.
Regarding the composite approach indeed it might be the way to go, @glapadre what do you think?

@IronZDev IronZDev requested a review from amal-k-joy June 16, 2025 11:28
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