Skip to content

Commit

Permalink
Access slug from usePageDetails for getLinkToComment
Browse files Browse the repository at this point in the history
  • Loading branch information
weeklies authored and essential-randomness committed Jul 2, 2024
1 parent 3aea307 commit 187646d
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/components/options/useCommentOptions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { CommentType, RealmPermissions } from "types/Types";
import { ThreadPageDetails, usePageDetails } from "lib/router";
import { faArrowRight, faLink } from "@fortawesome/free-solid-svg-icons";
import {
useCurrentRealmBoardId,
useRealmPermissions,
} from "contexts/RealmContext";

import { DropdownProps } from "@bobaboard/ui-components/dist/common/DropdownListMenu";
import React from "react";
Expand All @@ -13,10 +9,10 @@ import { faComment } from "@fortawesome/free-regular-svg-icons";
import { getCommentsChain } from "components/thread/CommentsThread";
import { isNotNull } from "lib/typescript";
import { toast } from "@bobaboard/ui-components";
import { useBoardMetadata } from "lib/api/hooks/board";
import { useCachedLinks } from "components/hooks/useCachedLinks";
import { useDebugOptions } from "./comment/useDebugOptions";
import { useEditorsState } from "components/core/editors/EditorsContext";
import { useRealmPermissions } from "contexts/RealmContext";
import { useThreadContext } from "components/thread/ThreadContext";
import { useThreadEditors } from "components/core/editors/withEditors";

Expand All @@ -43,18 +39,14 @@ export const useCommentOptions = ({
const { commentId, parentPostId } = comment;
const { getLinkToComment } = useCachedLinks();
const { slug, threadId } = usePageDetails<ThreadPageDetails>();
const boardId = useCurrentRealmBoardId({
boardSlug: slug,
});
const { boardMetadata } = useBoardMetadata({ boardId });
const realmPermissions = useRealmPermissions();
const { postCommentsMap } = useThreadContext();
const { parentChainMap } = postCommentsMap.get(parentPostId)!;
const { onNewComment } = useThreadEditors();
const editorState = useEditorsState();

const linkToComment = getLinkToComment({
slug: boardMetadata!.slug,
slug: slug,
commentId: commentId,
threadId: threadId,
});
Expand Down

0 comments on commit 187646d

Please sign in to comment.