[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:
Ketan Sharma 2024-08-30 19:08:35 +05:30 committed by GitHub
parent c1d3da0cab
commit 2e890e4d6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 18 deletions

View file

@ -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>

View file

@ -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 */}

View file

@ -177,7 +177,7 @@ export const ProjectsBaseHeader = observer(() => {
/> />
</FiltersDropdown> </FiltersDropdown>
</div> </div>
{isAuthorizedUser && ( {isAuthorizedUser && !isArchived && (
<Button <Button
size="sm" size="sm"
onClick={() => { onClick={() => {

View file

@ -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}