Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add href properties to thread view change buttons #143

Merged
merged 3 commits into from
Jul 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/components/thread/ThreadSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { UNCATEGORIZED_LABEL } from "utils/thread-utils";
import classnames from "classnames";
import { formatDistanceToNow } from "date-fns";
import { useFilterableContext } from "components/core/feeds/FilterableContext";
import { useCachedLinks } from 'components/hooks/useCachedLinks';
import { useForceHideIdentity } from "components/hooks/useForceHideIdentity";
import { useThreadContext } from "components/thread/ThreadContext";

Expand All @@ -25,7 +26,16 @@ export interface ThreadSidebarProps {

const ThreadSidebar: React.FC<ThreadSidebarProps> = (props) => {
const { forceHideIdentity } = useForceHideIdentity();
const { threadRoot, categories, contentNotices } = useThreadContext();
const { threadRoot, categories, contentNotices, parentBoardSlug, threadId } = useThreadContext();
const { getLinkToThread } = useCachedLinks();

const linkToThread = getLinkToThread({
// @ts-ignore
riazaia marked this conversation as resolved.
Show resolved Hide resolved
slug: parentBoardSlug,
// @ts-ignore
threadId: threadId,
});

const {
activeCategories,
setActiveCategories,
Expand Down Expand Up @@ -57,24 +67,24 @@ const ThreadSidebar: React.FC<ThreadSidebarProps> = (props) => {
id: THREAD_VIEW_MODE.THREAD,
label: "Thread",
link: {
// TODO: add href here
onClick: () => props.onViewChange(THREAD_VIEW_MODE.THREAD),
href: `${linkToThread.href}?thread`
riazaia marked this conversation as resolved.
Show resolved Hide resolved
},
},
{
id: THREAD_VIEW_MODE.MASONRY,
label: "Gallery",
link: {
// TODO: add href here
onClick: () => props.onViewChange(THREAD_VIEW_MODE.MASONRY),
href: `${linkToThread.href}?all&gallery`
},
},
{
id: THREAD_VIEW_MODE.TIMELINE,
label: "Timeline",
link: {
// TODO: add href here
onClick: () => props.onViewChange(THREAD_VIEW_MODE.TIMELINE),
href: `${linkToThread.href}?all&timeline`
},
},
]}
Expand Down