Skip to content

Commit

Permalink
fix: only show messages on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Apr 3, 2024
1 parent 28a1dfb commit c47802e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/features/hiro-messages/in-app-messages.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import { useLocation } from 'react-router-dom';

import { Flex, FlexProps } from 'leather-styles/jsx';

import { RouteUrls } from '@shared/route-urls';

import { useRemoteLeatherMessages } from '@app/query/common/remote-config/remote-config.query';
import { useCurrentNetworkState } from '@app/store/networks/networks.hooks';
import { useDismissMessage } from '@app/store/settings/settings.actions';
import { useDismissedMessageIds } from '@app/store/settings/settings.selectors';

import { HiroMessageItem } from './components/in-app-message-item';

// See wallet-config.md for instructions on testing InAppMessages
export function InAppMessages(props: FlexProps) {
const location = useLocation();
const messages = useRemoteLeatherMessages();

const { mode } = useCurrentNetworkState();
const dismissMessage = useDismissMessage();
const dismissedIds = useDismissedMessageIds();

if (messages.length === 0) return null;
if (location.pathname !== RouteUrls.Home || messages.length === 0) return null;

const firstMessage = messages.filter(msg => !dismissedIds.includes(msg.id))[0];

Expand Down

0 comments on commit c47802e

Please sign in to comment.