fix(activities): return to the same group after opening a card
The back link dropped the board from the address, so the desk reopened on the default group. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -27,6 +27,26 @@ import { brand } from '@mento/shared';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const ACTIVITY_LIST_QUERY = ['board', 'view', 'desk', 'filter', 'stage', 'q', 'typeDefId', 'status', 'assigneeId'] as const;
|
||||
|
||||
function activitiesListLocation() {
|
||||
const query: Record<string, string> = {};
|
||||
for (const key of ACTIVITY_LIST_QUERY) {
|
||||
const value = route.query[key];
|
||||
if (typeof value === 'string' && value) query[key] = value;
|
||||
}
|
||||
return { name: 'activities' as const, query };
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
const back = (window.history.state as { back?: string | null } | null)?.back ?? '';
|
||||
if (back.split('?')[0] === '/activities') {
|
||||
router.back();
|
||||
return;
|
||||
}
|
||||
void router.push(activitiesListLocation());
|
||||
}
|
||||
const auth = useAuthStore();
|
||||
const id = computed(() => (typeof route.params.id === 'string' ? route.params.id : ''));
|
||||
const canReassign = computed(() => canReassignRecords(auth.user?.role));
|
||||
@@ -314,9 +334,9 @@ onMounted(() => {
|
||||
<template>
|
||||
<section class="page" @click="moreOpen = false">
|
||||
<header class="nav">
|
||||
<RouterLink class="icon-btn back" :to="{ name: 'activities' }" aria-label="بازگشت">
|
||||
<a class="icon-btn back" href="/activities" aria-label="بازگشت" @click.prevent="goBack">
|
||||
<UiIcon name="chevron" :size="18" />
|
||||
</RouterLink>
|
||||
</a>
|
||||
<span class="brand">{{ brand.name }}</span>
|
||||
<div class="more" @click.stop>
|
||||
<button class="icon-btn" type="button" aria-label="منوی بیشتر" @click="moreOpen = !moreOpen">
|
||||
|
||||
Reference in New Issue
Block a user