[WEB-2294] fix: remove 'Add Project' button from archives route and remove it from the dropdown in header (#5469)
* fix: remove 'Add Project' button from archives route and remove it from the dropdown in header * Improved Code Logic * Fixed Clear All Button and UI Fixes
This commit is contained in:
parent
c1d3da0cab
commit
2e890e4d6f
4 changed files with 14 additions and 18 deletions
|
|
@ -45,7 +45,7 @@ export const ProjectCardList = observer(() => {
|
||||||
<p className="whitespace-pre-line text-base text-custom-text-400">
|
<p className="whitespace-pre-line text-base text-custom-text-400">
|
||||||
{searchQuery.trim() === ""
|
{searchQuery.trim() === ""
|
||||||
? "Remove the filters to see all projects"
|
? "Remove the filters to see all projects"
|
||||||
: "No projects detected with the matching\ncriteria. Create a new project instead"}
|
: "No projects detected with the matching criteria.\nCreate a new project instead"}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -51,15 +51,6 @@ export const ProjectFiltersSelection: React.FC<Props> = observer((props) => {
|
||||||
}
|
}
|
||||||
title="My projects"
|
title="My projects"
|
||||||
/>
|
/>
|
||||||
<FilterOption
|
|
||||||
isChecked={!!displayFilters.archived_projects}
|
|
||||||
onClick={() =>
|
|
||||||
handleDisplayFiltersUpdate({
|
|
||||||
archived_projects: !displayFilters.archived_projects,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
title="Archived"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* access */}
|
{/* access */}
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ export const ProjectsBaseHeader = observer(() => {
|
||||||
/>
|
/>
|
||||||
</FiltersDropdown>
|
</FiltersDropdown>
|
||||||
</div>
|
</div>
|
||||||
{isAuthorizedUser && (
|
{isAuthorizedUser && !isArchived && (
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,12 @@ const Root = observer(() => {
|
||||||
// derived values
|
// derived values
|
||||||
const pageTitle = currentWorkspace?.name ? `${currentWorkspace?.name} - Projects` : undefined;
|
const pageTitle = currentWorkspace?.name ? `${currentWorkspace?.name} - Projects` : undefined;
|
||||||
|
|
||||||
|
const isArchived = pathname.includes("/archives");
|
||||||
|
|
||||||
|
const allowedDisplayFilters = currentWorkspaceAppliedDisplayFilters?.filter(
|
||||||
|
(filter) => filter !== "archived_projects"
|
||||||
|
) ?? [];
|
||||||
|
|
||||||
const handleRemoveFilter = useCallback(
|
const handleRemoveFilter = useCallback(
|
||||||
(key: keyof TProjectFilters, value: string | null) => {
|
(key: keyof TProjectFilters, value: string | null) => {
|
||||||
if (!workspaceSlug) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
@ -55,25 +61,24 @@ const Root = observer(() => {
|
||||||
if (!workspaceSlug) return;
|
if (!workspaceSlug) return;
|
||||||
clearAllFilters(workspaceSlug.toString());
|
clearAllFilters(workspaceSlug.toString());
|
||||||
clearAllAppliedDisplayFilters(workspaceSlug.toString());
|
clearAllAppliedDisplayFilters(workspaceSlug.toString());
|
||||||
|
if (isArchived) updateDisplayFilters(workspaceSlug.toString(), { archived_projects: true });
|
||||||
}, [clearAllFilters, clearAllAppliedDisplayFilters, workspaceSlug]);
|
}, [clearAllFilters, clearAllAppliedDisplayFilters, workspaceSlug]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (pathname.includes("/archives")) {
|
isArchived ? updateDisplayFilters(workspaceSlug.toString(), { archived_projects: true }) :
|
||||||
updateDisplayFilters(workspaceSlug.toString(), { archived_projects: true });
|
updateDisplayFilters(workspaceSlug.toString(), { archived_projects: false });
|
||||||
} else {
|
|
||||||
updateDisplayFilters(workspaceSlug.toString(), { archived_projects: false });
|
|
||||||
}
|
|
||||||
}, [pathname]);
|
}, [pathname]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageHead title={pageTitle} />
|
<PageHead title={pageTitle} />
|
||||||
<div className="flex h-full w-full flex-col">
|
<div className="flex h-full w-full flex-col">
|
||||||
{(calculateTotalFilters(currentWorkspaceFilters ?? {}) !== 0 ||
|
{(calculateTotalFilters(currentWorkspaceFilters ?? {}) !== 0 ||
|
||||||
currentWorkspaceAppliedDisplayFilters?.length !== 0) && (
|
(allowedDisplayFilters.length>0)) && (
|
||||||
<div className="border-b border-custom-border-200 px-5 py-3">
|
<div className="border-b border-custom-border-200 px-5 py-3">
|
||||||
<ProjectAppliedFiltersList
|
<ProjectAppliedFiltersList
|
||||||
appliedFilters={currentWorkspaceFilters ?? {}}
|
appliedFilters={currentWorkspaceFilters ?? {}}
|
||||||
appliedDisplayFilters={currentWorkspaceAppliedDisplayFilters ?? []}
|
appliedDisplayFilters={allowedDisplayFilters}
|
||||||
handleClearAllFilters={handleClearAllFilters}
|
handleClearAllFilters={handleClearAllFilters}
|
||||||
handleRemoveFilter={handleRemoveFilter}
|
handleRemoveFilter={handleRemoveFilter}
|
||||||
handleRemoveDisplayFilter={handleRemoveDisplayFilter}
|
handleRemoveDisplayFilter={handleRemoveDisplayFilter}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue