Skip to content

Commit

Permalink
add option to open board
Browse files Browse the repository at this point in the history
  • Loading branch information
Essential Randomness committed Oct 31, 2023
1 parent 0be0b93 commit 56d1b3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/hooks/useBoardOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
faCommentSlash,
faEdit,
faLink,
faReply,
faThumbtack,
faVolumeMute,
faVolumeUp,
Expand All @@ -28,6 +29,7 @@ export enum BoardOptions {
EDIT = "EDIT",
MUTE = "MUTE",
COPY_LINK = "COPY_LINK",
GO_TO_BOARD = "GO_TO_BOARD",
}

type OptionType = NonNullable<DropdownProps["options"]>[number];
Expand Down Expand Up @@ -151,6 +153,15 @@ const useBoardOptions = ({
return null;
}
return getCopyLinkOption(getLinkToBoard(boardMetadata.slug).href);
case BoardOptions.GO_TO_BOARD:
if (!boardMetadata) {
return null;
}
return {
icon: faReply,
name: "Go to board",
link: getLinkToBoard(boardMetadata.slug),
};
}
};
return options.map(getOption).filter((option) => option != null);
Expand Down
1 change: 1 addition & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const BoardListItemWithOptions = (
) => {
const boardOptions = useBoardOptions({
options: [
BoardOptions.GO_TO_BOARD,
BoardOptions.COPY_LINK,
BoardOptions.MUTE,
BoardOptions.PIN,
Expand Down

0 comments on commit 56d1b3a

Please sign in to comment.