Skip to content
Snippets Groups Projects
Commit 7c10e2a8 authored by Lukas's avatar Lukas Committed by mcfarhat
Browse files

Update comment permlink search result to navigate to comment page with...

Update comment permlink search result to navigate to comment page with selected params when permlink is clicked
parent 2431a63e
No related branches found
No related tags found
1 merge request!499#392_part2_simplify_URL_route_build
import usePermlinkSearch from "@/hooks/api/common/usePermlinkSearch";
import CommentPermlinkResultTable from "../CommentPermlinkResultTable";
import { useSearchesContext } from "@/contexts/SearchesContext";
import { getCommentPageLink } from "../utils/commentSearchHelpers";
const COMMENT_TYPES = ["all", "post", "comment"];
......@@ -10,7 +11,7 @@ const CommentPermlinkSearchResults = () => {
commentType,
setCommentType,
setPermlinkSearchProps,
lastSearchKey,
searchRanges,
} = useSearchesContext();
const { permlinkSearchData } = usePermlinkSearch(permlinkSearchProps);
......@@ -31,6 +32,15 @@ const CommentPermlinkSearchResults = () => {
});
};
const buildLink = (accountName: string, permlink: string) => {
return getCommentPageLink({
...permlinkSearchProps,
...searchRanges,
accountName,
permlink,
});
};
if (!permlinkSearchData) return;
return (
......@@ -56,6 +66,7 @@ const CommentPermlinkSearchResults = () => {
<div className="flex flex-wrap">
<CommentPermlinkResultTable
buildLink={buildLink}
data={permlinkSearchData.permlinks_result}
accountName={accountName}
/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment