Skip to content

Commit

Permalink
Replace direkt link with contextual link
Browse files Browse the repository at this point in the history
  • Loading branch information
owi92 committed Sep 11, 2023
1 parent d224706 commit 7111f65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions frontend/src/ui/Blocks/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import { Title } from "..";
import { Card } from "../Card";
import { useTranslation } from "react-i18next";
import { isSynced, keyOfId } from "../../util";
import { FiChevronRight } from "react-icons/fi";
import { FiArrowRightCircle } from "react-icons/fi";
import { LinkButton } from "../Button";
import { COLORS } from "../../color";


type Props = {
fragRef: VideoBlockData$key;
basePath: string;
};

export const VideoBlock: React.FC<Props> = ({ fragRef }) => {
export const VideoBlock: React.FC<Props> = ({ fragRef, basePath }) => {
const { t } = useTranslation();
const { event, showTitle, showLink } = useFragment(graphql`
fragment VideoBlockData on VideoBlock {
Expand Down Expand Up @@ -61,15 +61,11 @@ export const VideoBlock: React.FC<Props> = ({ fragRef }) => {
? <InlinePlayer event={event} css={{ maxWidth: 800 }} />
: <Card kind="info">{t("video.not-ready.title")}</Card>}
{showLink && <LinkButton
to={`/!v/${keyOfId(event.id)}`}
css={{
"&:not([disabled])": { color: COLORS.primary0 },
marginTop: 8,
gap: 4,
}}
to={`${basePath}/${keyOfId(event.id)}`}
css={{ marginTop: 8 }}
>
{t("video.link")}
<FiChevronRight css={{ marginTop: 2 }} />
<FiArrowRightCircle />
</LinkButton>}
</>;
};
2 changes: 1 addition & 1 deletion frontend/src/ui/Blocks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const Block: React.FC<BlockProps> = ({ block: blockRef, realm }) => {
"TitleBlock": () => <TitleBlock fragRef={block} />,
"TextBlock": () => <TextBlockByQuery fragRef={block} />,
"SeriesBlock": () => <SeriesBlockFromBlock fragRef={block} basePath={basePath} />,
"VideoBlock": () => <VideoBlock fragRef={block} />,
"VideoBlock": () => <VideoBlock fragRef={block} basePath={basePath} />,
})}
</div>;
};

0 comments on commit 7111f65

Please sign in to comment.