clean-up: removed labels in the filters and handled redirection issue from peek overview and ui changes (#3002)

This commit is contained in:
guru_sainath 2023-12-06 16:27:33 +05:30 committed by Aaryan Khandelwal
parent 9b8a8722c5
commit 6ded663af1
8 changed files with 56 additions and 38 deletions

View File

@ -18,17 +18,25 @@ export const IssueKanBanBlock = observer(({ issue }: { issue: IIssue }) => {
// router // router
const router = useRouter(); const router = useRouter();
const { workspace_slug, project_slug, board } = router.query; const { workspace_slug, project_slug, board, priorities, states, labels } = router.query as {
workspace_slug: string;
project_slug: string;
board: string;
priorities: string;
states: string;
labels: string;
};
const handleBlockClick = () => { const handleBlockClick = () => {
issueDetailStore.setPeekId(issue.id); issueDetailStore.setPeekId(issue.id);
const params: any = { board: board, peekId: issue.id };
if (states && states.length > 0) params.states = states;
if (priorities && priorities.length > 0) params.priorities = priorities;
if (labels && labels.length > 0) params.labels = labels;
router.push( router.push(
{ {
pathname: `/${workspace_slug?.toString()}/${project_slug}`, pathname: `/${workspace_slug}/${project_slug}`,
query: { query: { ...params },
board: board?.toString(),
peekId: issue.id,
},
}, },
undefined, undefined,
{ shallow: true } { shallow: true }

View File

@ -19,17 +19,25 @@ export const IssueListBlock: FC<{ issue: IIssue }> = observer((props) => {
const { project: projectStore, issueDetails: issueDetailStore }: RootStore = useMobxStore(); const { project: projectStore, issueDetails: issueDetailStore }: RootStore = useMobxStore();
// router // router
const router = useRouter(); const router = useRouter();
const { workspace_slug, project_slug, board } = router.query; const { workspace_slug, project_slug, board, priorities, states, labels } = router.query as {
workspace_slug: string;
project_slug: string;
board: string;
priorities: string;
states: string;
labels: string;
};
const handleBlockClick = () => { const handleBlockClick = () => {
issueDetailStore.setPeekId(issue.id); issueDetailStore.setPeekId(issue.id);
const params: any = { board: board, peekId: issue.id };
if (states && states.length > 0) params.states = states;
if (priorities && priorities.length > 0) params.priorities = priorities;
if (labels && labels.length > 0) params.labels = labels;
router.push( router.push(
{ {
pathname: `/${workspace_slug?.toString()}/${project_slug}`, pathname: `/${workspace_slug}/${project_slug}`,
query: { query: { ...params },
board: board?.toString(),
peekId: issue.id,
},
}, },
undefined, undefined,
{ shallow: true } { shallow: true }

View File

@ -40,13 +40,13 @@ export const AppliedFiltersList: React.FC<Props> = (props) => {
<AppliedPriorityFilters handleRemove={(val) => handleRemoveFilter("priority", val)} values={value} /> <AppliedPriorityFilters handleRemove={(val) => handleRemoveFilter("priority", val)} values={value} />
)} )}
{filterKey === "labels" && labels && ( {/* {filterKey === "labels" && labels && (
<AppliedLabelsFilters <AppliedLabelsFilters
handleRemove={(val) => handleRemoveFilter("labels", val)} handleRemove={(val) => handleRemoveFilter("labels", val)}
labels={labels} labels={labels}
values={value} values={value}
/> />
)} )} */}
{filterKey === "state" && states && ( {filterKey === "state" && states && (
<AppliedStateFilters <AppliedStateFilters

View File

@ -31,14 +31,7 @@ export const FiltersDropdown: React.FC<Props> = (props) => {
return ( return (
<> <>
<Popover.Button as={React.Fragment}> <Popover.Button as={React.Fragment}>
<Button <Button ref={setReferenceElement} variant="neutral-primary" size="sm">
ref={setReferenceElement}
variant="neutral-primary"
size="sm"
appendIcon={
<ChevronUp className={`transition-all ${open ? "" : "rotate-180"}`} size={14} strokeWidth={2} />
}
>
<div className={`${open ? "text-custom-text-100" : "text-custom-text-200"}`}> <div className={`${open ? "text-custom-text-100" : "text-custom-text-200"}`}>
<span>{title}</span> <span>{title}</span>
</div> </div>

View File

@ -62,7 +62,7 @@ export const IssueFiltersDropdown: FC = observer(() => {
); );
return ( return (
<div className="w-full h-full flex flex-col z-50"> <div className="w-full h-full flex flex-col z-10">
<FiltersDropdown title="Filters" placement="bottom-end"> <FiltersDropdown title="Filters" placement="bottom-end">
<FilterSelection <FilterSelection
filters={issueFilters?.filters ?? {}} filters={issueFilters?.filters ?? {}}

View File

@ -70,7 +70,7 @@ export const FilterSelection: React.FC<Props> = observer((props) => {
)} )}
{/* labels */} {/* labels */}
{isFilterEnabled("labels") && ( {/* {isFilterEnabled("labels") && (
<div className="py-2"> <div className="py-2">
<FilterLabels <FilterLabels
appliedFilters={filters.labels ?? null} appliedFilters={filters.labels ?? null}
@ -79,7 +79,7 @@ export const FilterSelection: React.FC<Props> = observer((props) => {
searchQuery={filtersSearchQuery} searchQuery={filtersSearchQuery}
/> />
</div> </div>
)} )} */}
</div> </div>
</div> </div>
); );

View File

@ -39,9 +39,10 @@ const IssueNavbar = observer(() => {
}: RootStore = useMobxStore(); }: RootStore = useMobxStore();
// router // router
const router = useRouter(); const router = useRouter();
const { workspace_slug, project_slug, board, states, priorities, labels } = router.query as { const { workspace_slug, project_slug, board, peekId, states, priorities, labels } = router.query as {
workspace_slug: string; workspace_slug: string;
project_slug: string; project_slug: string;
peekId: string;
board: string; board: string;
states: string; states: string;
priorities: string; priorities: string;
@ -84,6 +85,7 @@ const IssueNavbar = observer(() => {
if (currentBoard) { if (currentBoard) {
if (projectStore?.activeBoard === null || projectStore?.activeBoard !== currentBoard) { if (projectStore?.activeBoard === null || projectStore?.activeBoard !== currentBoard) {
let params: any = { board: currentBoard }; let params: any = { board: currentBoard };
if (peekId && peekId.length > 0) params = { ...params, peekId: peekId };
if (priorities && priorities.length > 0) params = { ...params, priorities: priorities }; if (priorities && priorities.length > 0) params = { ...params, priorities: priorities };
if (states && states.length > 0) params = { ...params, states: states }; if (states && states.length > 0) params = { ...params, states: states };
if (labels && labels.length > 0) params = { ...params, labels: labels }; if (labels && labels.length > 0) params = { ...params, labels: labels };

View File

@ -19,7 +19,15 @@ export const IssuePeekOverview: React.FC<Props> = observer(() => {
const [isModalPeekOpen, setIsModalPeekOpen] = useState(false); const [isModalPeekOpen, setIsModalPeekOpen] = useState(false);
// router // router
const router = useRouter(); const router = useRouter();
const { workspace_slug, project_slug, peekId, board } = router.query; const { workspace_slug, project_slug, peekId, board, priorities, states, labels } = router.query as {
workspace_slug: string;
project_slug: string;
peekId: string;
board: string;
priorities: string;
states: string;
labels: string;
};
// store // store
const { issueDetails: issueDetailStore, issue: issueStore } = useMobxStore(); const { issueDetails: issueDetailStore, issue: issueStore } = useMobxStore();
const issueDetails = issueDetailStore.peekId && peekId ? issueDetailStore.details[peekId.toString()] : undefined; const issueDetails = issueDetailStore.peekId && peekId ? issueDetailStore.details[peekId.toString()] : undefined;
@ -34,16 +42,15 @@ export const IssuePeekOverview: React.FC<Props> = observer(() => {
const handleClose = () => { const handleClose = () => {
issueDetailStore.setPeekId(null); issueDetailStore.setPeekId(null);
router.replace(
{ const params: any = { board: board };
pathname: `/${workspace_slug?.toString()}/${project_slug}`, if (states && states.length > 0) params.states = states;
query: { if (priorities && priorities.length > 0) params.priorities = priorities;
board, if (labels && labels.length > 0) params.labels = labels;
},
}, router.replace({ pathname: `/${workspace_slug?.toString()}/${project_slug}`, query: { ...params } }, undefined, {
undefined, shallow: true,
{ shallow: true } });
);
}; };
useEffect(() => { useEffect(() => {
@ -91,7 +98,7 @@ export const IssuePeekOverview: React.FC<Props> = observer(() => {
leaveFrom="opacity-100" leaveFrom="opacity-100"
leaveTo="opacity-0" leaveTo="opacity-0"
> >
<div className="fixed inset-0 bg-custom-backdrop bg-opacity-50 transition-opacity" /> <div className="fixed inset-0 bg-custom-backdrop bg-opacity-50 transition-opacity z-20" />
</Transition.Child> </Transition.Child>
<Transition.Child <Transition.Child
as={React.Fragment} as={React.Fragment}