Skip to content

Commit

Permalink
Update the journals not found data preview alert (#1424)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiahna-tucker authored Jan 21, 2025
1 parent e679c93 commit 2715060
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { authenticatedRoutes } from 'app/routes';
import MessageWithButton from 'components/content/MessageWithButton';
import { useNavigate } from 'react-router';

export default function NoCollectionJournalsAlert() {
const navigate = useNavigate();

return (
<MessageWithButton
messageId="collectionsPreview.notFound.message"
clickHandler={() => {
navigate(authenticatedRoutes.captures.fullPath);
}}
/>
);
}
12 changes: 11 additions & 1 deletion src/components/collection/DataPreview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useEditorStore_specs } from 'components/editor/Store/hooks';
import JournalAlerts from 'components/journals/Alerts';
import AlertBox from 'components/shared/AlertBox';
import CardWrapper from 'components/shared/CardWrapper';
import useIsCollectionDerivation from 'components/shared/Entity/Details/useIsCollectionDerivation';
import Error from 'components/shared/Error';
import {
useJournalData,
Expand All @@ -18,6 +19,7 @@ import { FormattedMessage } from 'react-intl';
import { BASE_ERROR } from 'services/supabase';
import { hasLength } from 'utils/misc-utils';
import ListViewSkeleton from './ListViewSkeleton';
import NoCollectionJournalsAlert from './NoCollectionJournalsAlert';

interface Props {
collectionName: string;
Expand All @@ -37,6 +39,8 @@ export function DataPreview({ collectionName }: Props) {
// setPreviewMode(newValue);
// };

const isDerivation = useIsCollectionDerivation();

const { error: tenantHidesError, hide } =
useTenantHidesDataPreview(collectionName);

Expand Down Expand Up @@ -132,7 +136,13 @@ export function DataPreview({ collectionName }: Props) {
<JournalAlerts
journalData={journalData}
journalsData={journalsData}
notFoundTitleMessage="collectionsPreview.notFound.message"
notFoundTitleMessage={
isDerivation ? (
'collectionsPreview.notFound.message.derivation'
) : (
<NoCollectionJournalsAlert />
)
}
/>
) : null}

Expand Down
6 changes: 5 additions & 1 deletion src/lang/en-US/Collections.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { CommonMessages } from './CommonMessages';
import { Details } from './Details';
import { RouteTitles } from './RouteTitles';

export const Collections: Record<string, string> = {
'collectionsTable.title': `Collections`,
'collectionsTable.cta.new': `New ${CommonMessages['terms.transformation']}`,
'collectionsTable.detailsCTA': `Details`,
'collectionsTable.filterLabel': `Filter collections`,
'collectionsPreview.notFound.message': `We were unable to find any data which could mean the capture has not ingested data yet or is not running. Check the status on the Captures page to make sure it is running.`,
'collectionsPreview.notFound.message': `We were unable to find any data which could mean the capture has not ingested data yet or is not running. Check the status on the {button} to make sure it is running.`,
'collectionsPreview.notFound.message.button': `${RouteTitles['routeTitle.captures']} page`,
'collectionsPreview.notFound.message.derivation': `We were unable to find any data which could mean the derivation has not ingested data yet or is not running. Check the status in the ${Details['detailsPanel.shardDetails.title']} section to make sure it is running.`,
};

0 comments on commit 2715060

Please sign in to comment.