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}`,
undefined,
{ {
shallow: true, pathname: router.pathname,
query: {
...router.query,
workspaceSlug,
boardSlug: [boardSlug],
}, },
},
undefined,
{ shallow: true },
); );
} catch (error) {
console.error(error);
}
}, 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,10 +173,18 @@ 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) => {
return (
<Link <Link
key={card.publicId} key={card.publicId}
href={`/${data.workspace.slug}/${data.slug}/${card.publicId}`} href={{
pathname: router.pathname,
query: {
...router.query,
workspaceSlug: data.workspace.slug,
boardSlug: [data.slug, card.publicId],
},
}}
className={`mb-2 flex !cursor-pointer flex-col`} className={`mb-2 flex !cursor-pointer flex-col`}
shallow={true} shallow={true}
onClick={() => { onClick={() => {
@@ -192,7 +201,8 @@ export default function PublicBoardView() {
attachments={card.attachments} attachments={card.attachments}
/> />
</Link> </Link>
))} );
})}
</div> </div>
</div> </div>
))} ))}