Skip to content

Commit

Permalink
Add workaround for FNNDSC#1072
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Feb 28, 2024
1 parent 7b78e5c commit 3a829a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/components/NiivueDatasetViewer/components/FeedButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ import { Button, Tooltip } from "@patternfly/react-core";
import MdCallSplit from "@patternfly/react-icons/dist/esm/icons/code-branch-icon";
import React from "react";
import { useNavigate } from "react-router";
import { Feed } from "@fnndsc/chrisapi";

/**
* Link to a feed.
*/
const FeedButton: React.FC<{ feedId: number }> = ({ feedId }) => {
const FeedButton: React.FC<{ feed: Feed }> = ({ feed }) => {
const navigate = useNavigate();
return (
<Tooltip content={<>Go to feed</>}>
<Button
variant="link"
onClick={() => {
navigate(`/feeds/${feedId}`);
// must specify feed as type=private or type=public
// see https://github.com/FNNDSC/ChRIS_ui/issues/1072
navigate(
`/feeds/${feed.data.id}?type=${
feed.data.public ? "public" : "private"
}`,
);
}}
>
<MdCallSplit />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TextContent,
TextVariants,
} from "@patternfly/react-core";
import FeedButton from "../components/FeedButton.tsx";
import FeedButton from "../components/FeedButton";
import React from "react";
import { Feed } from "@fnndsc/chrisapi";

Expand All @@ -21,7 +21,7 @@ const DatasetDescriptionText: React.FC<{
{feed === null || (
<Text component={TextVariants.h2}>
{feed.data.name}
<FeedButton feedId={feed.data.id} />
<FeedButton feed={feed} />
</Text>
)}
{readme === null || <Text component={TextVariants.p}>{readme}</Text>}
Expand Down

0 comments on commit 3a829a0

Please sign in to comment.