Compare commits

...

1 Commits

Author SHA1 Message Date
Henry
bcb28a3429 fix: persist filters when opening card modal 2025-11-30 22:31:47 +00:00
2 changed files with 45 additions and 34 deletions

View File

@@ -67,22 +67,23 @@ export function CardModal({
<div className="flex w-full items-center justify-between"> <div className="flex w-full items-center justify-between">
<button <button
className="absolute right-[2rem] top-[2rem] rounded p-1 hover:bg-light-300 focus:outline-none dark:hover:bg-dark-300" className="absolute right-[2rem] top-[2rem] rounded p-1 hover:bg-light-300 focus:outline-none dark:hover:bg-dark-300"
onClick={async (e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
closeModal(); closeModal();
setTimeout(async () => { setTimeout(() => {
try { void router.replace(
await router.replace( {
`/${workspaceSlug}/${boardSlug}`, pathname: router.pathname,
undefined, query: {
{ ...router.query,
shallow: true, workspaceSlug,
boardSlug: [boardSlug],
}, },
); },
} catch (error) { undefined,
console.error(error); { shallow: true },
} );
}, 400); }, 400);
}} }}
> >

View File

@@ -76,7 +76,8 @@ export default function PublicBoardView() {
); );
}; };
const splitPath = router.asPath.split("/"); const pathWithoutQuery = router.asPath.split("?")[0];
const splitPath = pathWithoutQuery.split("/");
const cardPublicId = splitPath.length > 3 ? splitPath[3] : null; const cardPublicId = splitPath.length > 3 ? splitPath[3] : null;
useEffect(() => { useEffect(() => {
@@ -172,27 +173,36 @@ export default function PublicBoardView() {
</span> </span>
</div> </div>
<div className="scrollbar-track-rounded-[4px] scrollbar-thumb-rounded-[4px] scrollbar-w-[8px] z-10 h-full max-h-[calc(100vh-265px)] min-h-[2rem] overflow-y-auto pr-1 scrollbar dark:scrollbar-track-dark-100 dark:scrollbar-thumb-dark-600"> <div className="scrollbar-track-rounded-[4px] scrollbar-thumb-rounded-[4px] scrollbar-w-[8px] z-10 h-full max-h-[calc(100vh-265px)] min-h-[2rem] overflow-y-auto pr-1 scrollbar dark:scrollbar-track-dark-100 dark:scrollbar-thumb-dark-600">
{list.cards.map((card) => ( {list.cards.map((card) => {
<Link return (
key={card.publicId} <Link
href={`/${data.workspace.slug}/${data.slug}/${card.publicId}`} key={card.publicId}
className={`mb-2 flex !cursor-pointer flex-col`} href={{
shallow={true} pathname: router.pathname,
onClick={() => { query: {
openModal("CARD"); ...router.query,
}} workspaceSlug: data.workspace.slug,
> boardSlug: [data.slug, card.publicId],
<Card },
title={card.title} }}
labels={card.labels} className={`mb-2 flex !cursor-pointer flex-col`}
checklists={card.checklists ?? []} shallow={true}
members={[]} onClick={() => {
description={card.description} openModal("CARD");
comments={card.comments ?? []} }}
attachments={card.attachments} >
/> <Card
</Link> title={card.title}
))} labels={card.labels}
checklists={card.checklists ?? []}
members={[]}
description={card.description}
comments={card.comments ?? []}
attachments={card.attachments}
/>
</Link>
);
})}
</div> </div>
</div> </div>
))} ))}