Skip to content
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

[LLD] - [LIVE-10488] - Add Portfolio Content Card #6032

Merged
merged 11 commits into from
Feb 6, 2024
Merged

Conversation

sshmaxime
Copy link
Contributor

@sshmaxime sshmaxime commented Jan 29, 2024

📝 Description

  • Remove old Carousel and use the new one
  • Remove extra unused files
  • Add Action Content Card
  • Add LLD portfolio carousel feature flags
  • Add usePortfolioCards hooks

NOTE:

We currently have some limitations on LLD (due to the fact that each variant has to be displayed in 2 different part of the DOM) that forced me to create a single component displayable in two different place for each variant, VariantA and VariantB.

❓ Context

✅ Checklist

Pull Requests must pass the CI and be code reviewed. Set as Draft if the PR is not ready.

  • npx changeset was attached.
  • Covered by automatic tests.
  • [ ] Impact of the changes:


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

@sshmaxime sshmaxime requested a review from a team as a code owner January 29, 2024 08:36
Copy link

vercel bot commented Jan 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-ui-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 6, 2024 2:38pm
web-tools ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 6, 2024 2:38pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-docs ⬜️ Ignored (Inspect) Visit Preview Feb 6, 2024 2:38pm
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Feb 6, 2024 2:38pm
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Feb 6, 2024 2:38pm

@live-github-bot live-github-bot bot added desktop Has changes in LLD common Has changes in live-common ledgerjs Has changes in the ledgerjs open source libs labels Jan 29, 2024
@sshmaxime sshmaxime marked this pull request as draft January 29, 2024 09:57
@live-github-bot live-github-bot bot added the mobile Has changes in LLM label Jan 30, 2024
Base automatically changed from feat/LIVE-10489 to develop January 30, 2024 16:14
@sshmaxime sshmaxime marked this pull request as ready for review February 1, 2024 10:08
Comment on lines 37 to 40
// For some reason braze won't log the click event if the card url is empty
// Setting it as the card id just to have a dummy non empty value
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Copy link
Member

Choose a reason for hiding this comment

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

We need to ban // @ts-ignore OR any from our TS usage with new features.
Lately, we had an issue on production with a TS error that we ignored. We need to find why For some reason braze won't log the click or extend the type.

Copy link
Contributor Author

@sshmaxime sshmaxime Feb 1, 2024

Choose a reason for hiding this comment

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

I 100% agree with you, there are a lot of "hidden" issues. This part of code isn't new, it's re-used code from the legacy piece of code that was handling braze before on LLD and left it as is.
I just dug a little and after few tests, all of the cards I receive from Braze have their url field set. So I'm just removing this part of code but again, I cannot fully know what will be the consequences of this code removal, hence the reason why I kept it in the first place.

FYI, on top that, the SDK we are using is almost 1 year old. We might need some time to get it up to date as well ..

Comment on lines 10 to 16
const [cachedContentCards, setCachedContentCards] = useState<braze.Card[]>([]);
const portfolioCards = useSelector(portfolioContentCardSelector);

useEffect(() => {
const cards = braze.getCachedContentCards().cards;
setCachedContentCards(cards);
}, []);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why we don't initiate cachedContentCards with braze.getCachedContentCards().cards?
This would allow us to remove a useEffect

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I re-used part of the old code and that was how it was done and I didn't give it a second thought. Agreed, nice catch, updating it right now.

<Description>{description}</Description>
</Body>
<Actions>
<Link size="small" onClick={() => actions.dismiss.action()}>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<Link size="small" onClick={() => actions.dismiss.action()}>
<Link size="small" onClick={actions.dismiss.action}>

Copy link
Contributor Author

@sshmaxime sshmaxime Feb 1, 2024

Choose a reason for hiding this comment

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

It's not the same type so I rather keep it that way. But we definitely should have a convention for this kind of things. Another thing to have in mind when re-thinking LLD or else.

</Link>

{actions.primary.label && (
<ButtonV3 big variant="main" onClick={() => actions.primary.action()}>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<ButtonV3 big variant="main" onClick={() => actions.primary.action()}>
<ButtonV3 big variant="main" onClick={ actions.primary.action}>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above.

@KVNLS
Copy link
Member

KVNLS commented Feb 1, 2024

Can you provide a way to test it, please?
A mock of portfolioCards or Braze setup with a campaign we can use in test.

@cgrellard-ledger
Copy link
Contributor

Nice job Maxime ! 💪

Copy link
Member

@KVNLS KVNLS left a comment

Choose a reason for hiding this comment

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

When I have only one card in the Carousel I should not have the bottom bar:
image

Figma:
https://www.figma.com/file/nEFjjnCjeYCDwSENXf5RdY/Braze?type=design&node-id=4209-8820&mode=design&t=iTUtAeZw0QGrGH4g-4

KVNLS
KVNLS previously approved these changes Feb 5, 2024
Copy link
Member

@KVNLS KVNLS left a comment

Choose a reason for hiding this comment

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

Works well!
Please cleanup your commits if you create a merge commit, otherwise it's all good!

@sshmaxime sshmaxime merged commit 5c46443 into develop Feb 6, 2024
60 of 61 checks passed
@sshmaxime sshmaxime deleted the feat/LIVE-10488 branch February 6, 2024 15:58
jdabbech-ledger pushed a commit that referenced this pull request Feb 19, 2024
[LLD] - [LIVE-10488] - Add Portfolio Content Card
jdabbech-ledger pushed a commit that referenced this pull request Feb 19, 2024
[LLD] - [LIVE-10488] - Add Portfolio Content Card
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Has changes in live-common desktop Has changes in LLD ledgerjs Has changes in the ledgerjs open source libs mobile Has changes in LLM ui Has changes in the design system library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants