Skip to content

Commit

Permalink
fix: APP-459 open data post on terrasos in new tab (#2540)
Browse files Browse the repository at this point in the history
  • Loading branch information
flagrede authored Nov 12, 2024
1 parent f3388e8 commit b29f85f
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import copyTextToClipboard from 'web-components/src/utils/copy';
import { bannerTextAtom } from 'lib/atoms/banner.atoms';
import { selectedLanguageAtom } from 'lib/atoms/languageSwitcher.atoms';
import { COPY_SUCCESS } from 'lib/constants/shared.constants';
import { IS_REGEN, LINK_PREFIX, MARKETPLACE_APP_URL } from 'lib/env';
import { LINK_PREFIX } from 'lib/env';
import { Post } from 'lib/queries/react-query/registry-server/getPostQuery/getPostQuery.types';
import { getAccountByIdQuery } from 'lib/queries/react-query/registry-server/graphql/getAccountByIdQuery/getAccountByIdQuery';

Expand Down Expand Up @@ -199,7 +199,11 @@ export const DataStreamPost = ({
{post.contents && (post.privacy !== 'private' || isAdmin) && (
<PostCard
draftLabel={!post.published ? _(DRAFT) : undefined}
onClick={() => post.published && navigate(`/post/${post.iri}`)}
onClick={() =>
post.published && LINK_PREFIX
? window.open(`${LINK_PREFIX}/post/${post.iri}`)
: navigate(`/post/${post.iri}`)
}
title={post.contents.title || _(UNTITLED)}
comment={post.contents.comment}
privacyLabel={
Expand All @@ -224,7 +228,9 @@ export const DataStreamPost = ({
isAdmin={isAdmin}
sharePublicLink={() => {
copyTextToClipboard(
`${window.location.origin}/post/${post.iri}`,
LINK_PREFIX
? `${LINK_PREFIX}/post/${post.iri}`
: `${window.location.origin}/post/${post.iri}`,
);
setBannerText(_(COPY_SUCCESS));
}}
Expand Down

0 comments on commit b29f85f

Please sign in to comment.