Skip to content

Commit

Permalink
fix: guard against inactive tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgraeme committed Jan 27, 2025
1 parent 23b2f2e commit 0dd8d95
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/components/organisms/BadgeTile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type BadgeTileProps = {
* This component renders a badge tile with optional media, status, title, description, and date earned.
*/
const BadgeTileRoot = ({ tile }: BadgeTileProps): JSX.Element | null => {
if (!tile || tile.tileHeight !== TileHeight.Full) return null;
if (!tile || tile.tileHeight !== TileHeight.Full || !tile.active) return null;

return (
<BaseTile tile={tile}>
Expand Down
2 changes: 1 addition & 1 deletion lib/components/organisms/BannerTile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const isArtworkOnly = (configuration: BannerTileConfig): boolean => {
* This component renders a banner tile with optional media, title, description, and CTA.
*/
const BannerTileRoot = ({ tile }: BannerTileProps): JSX.Element | null => {
if (!tile) return null;
if (!tile || !tile.active) return null;

const { configuration } = tile as { configuration: BannerTileConfig };

Expand Down
2 changes: 1 addition & 1 deletion lib/components/organisms/ContentTile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type ContentTileProps = {
* @param tile - The tile data to render.
*/
const ContentTileRoot = ({ tile }: ContentTileProps): JSX.Element | null => {
if (!tile) return null;
if (!tile || !tile.active) return null;

return (
<BaseTile tile={tile}>
Expand Down
2 changes: 1 addition & 1 deletion lib/components/organisms/PointsTile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type PointsTileProps = {
* @param tile - The tile data to render.
*/
const PointsTileRoot = ({ tile }: PointsTileProps): JSX.Element | null => {
if (!tile) return null;
if (!tile || !tile.active) return null;

const { isFullSize } = useTileSize(tile);
const styles = usePointsTileStyles(isFullSize);
Expand Down
2 changes: 1 addition & 1 deletion lib/components/organisms/RewardCategoryTile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type RewardCategoryTileProps = {
const RewardCategoryTileRoot = ({
tile,
}: RewardCategoryTileProps): JSX.Element | null => {
if (!tile) return null;
if (!tile || !tile.active) return null;

return (
<BaseTile tile={tile}>
Expand Down
2 changes: 1 addition & 1 deletion lib/components/organisms/RewardTile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const isArtworkOnly = (configuration: RewardTileConfig): boolean => {
*/
const RewardTileRoot = ({ tile }: RewardTileProps): JSX.Element | null => {
const styles = useRewardTileStyles();
if (!tile || tile.tileHeight !== TileHeight.Full) return null;
if (!tile || tile.tileHeight !== TileHeight.Full || !tile.active) return null;

const { configuration } = tile as { configuration: RewardTileConfig };

Expand Down

0 comments on commit 0dd8d95

Please sign in to comment.