Skip to content

Commit

Permalink
Add Card wrapper around Carousel VariantA + remove custom checks when…
Browse files Browse the repository at this point in the history
… click on card
  • Loading branch information
sshmaxime committed Feb 1, 2024
1 parent 1dd7bd7 commit 2ff6a08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@ import { setPortfolioCards } from "~/renderer/actions/dynamicContent";

const usePortfolioCards = () => {
const dispatch = useDispatch();
const [cachedContentCards, setCachedContentCards] = useState<braze.Card[]>([]);
const [cachedContentCards, setCachedContentCards] = useState(braze.getCachedContentCards().cards);
const portfolioCards = useSelector(portfolioContentCardSelector);

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

const findCard = (cardId: string) => cachedContentCards.find(card => card.id === cardId);

const onImpression = (cardId: string) => {
Expand All @@ -36,11 +31,6 @@ const usePortfolioCards = () => {
const currentCard = findCard(cardId);

if (currentCard) {
// 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
currentCard.url = currentCard.id;
braze.logContentCardClick(currentCard);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import React, { PropsWithChildren } from "react";
import { useSelector } from "react-redux";
import styled from "styled-components";
import { useRefreshAccountsOrderingEffect } from "~/renderer/actions/general";
import { Card } from "~/renderer/components/Box";
import usePortfolioCards from "~/renderer/hooks/usePortfolioCards";
import { accountsSelector } from "~/renderer/reducers/accounts";
import { hasInstalledAppsSelector } from "~/renderer/reducers/settings";

const PortfolioVariantA = styled.div`
const PortfolioVariantA = styled(Card)`
background-color: ${p => p.theme.colors.opacityPurple.c10};
`;

Expand Down

0 comments on commit 2ff6a08

Please sign in to comment.