From 459999e8c9b7b99183b823868b9f64d402eb5375 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 29 Sep 2023 12:36:38 +0530 Subject: [PATCH] chore: global issues ui improvement and bug fixes (#2300) --- .../issue-column/issue-column.tsx | 4 +- .../spreadsheet-view/spreadsheet-view.tsx | 4 +- .../workspace-views/workpace-view-issues.tsx | 8 +- .../workspace-views/workspace-all-issue.tsx | 8 +- web/components/views/single-view-item.tsx | 2 +- web/components/workspace/sidebar-menu.tsx | 2 +- web/components/workspace/views/modal.tsx | 4 +- .../views/workpace-view-navigation.tsx | 41 ++++++--- web/contexts/workspace-view-context.tsx | 22 ++--- web/pages/[workspaceSlug]/settings/index.tsx | 87 ++++++++++--------- .../{[workspaceViewId].tsx => issues.tsx} | 0 11 files changed, 99 insertions(+), 83 deletions(-) rename web/pages/[workspaceSlug]/workspace-views/{[workspaceViewId].tsx => issues.tsx} (100%) diff --git a/web/components/core/views/spreadsheet-view/issue-column/issue-column.tsx b/web/components/core/views/spreadsheet-view/issue-column/issue-column.tsx index 1afcda5e1..d75df7343 100644 --- a/web/components/core/views/spreadsheet-view/issue-column/issue-column.tsx +++ b/web/components/core/views/spreadsheet-view/issue-column/issue-column.tsx @@ -82,7 +82,7 @@ export const IssueColumn: React.FC = ({ const isNotAllowed = userAuth.isGuest || userAuth.isViewer; return ( -
+
= ({ onInteraction={(nextOpenState) => setIsOpen(nextOpenState)} content={
))} + {workspaceViews && workspaceViews.length > 0 && workspaceViews?.map((view) => ( ))} -
); diff --git a/web/contexts/workspace-view-context.tsx b/web/contexts/workspace-view-context.tsx index 2918a94f7..3fc3dfa86 100644 --- a/web/contexts/workspace-view-context.tsx +++ b/web/contexts/workspace-view-context.tsx @@ -67,19 +67,19 @@ export const initialState: IWorkspaceGlobalViewProps = { const saveViewFilters = async ( workspaceSlug: string, - workspaceViewId: string, + viewId: string, state: IWorkspaceGlobalViewProps ) => { - await workspaceService.updateView(workspaceSlug, workspaceViewId, { + await workspaceService.updateView(workspaceSlug, viewId, { query_data: state, }); }; export const WorkspaceViewProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => { const router = useRouter(); - const { workspaceSlug, workspaceViewId } = router.query as { + const { workspaceSlug, viewId } = router.query as { workspaceSlug: string; - workspaceViewId: string; + viewId: string; }; const [filters, setFilters] = useState(initialState); @@ -98,7 +98,7 @@ export const WorkspaceViewProvider: React.FC<{ children: React.ReactNode }> = ({ }; setFilters(() => updatedFilterPayload); - if (saveFiltersToServer) saveViewFilters(workspaceSlug, workspaceViewId, updatedFilterPayload); + if (saveFiltersToServer) saveViewFilters(workspaceSlug, viewId, updatedFilterPayload); }; const computedFilter = (filters: any) => { @@ -151,9 +151,9 @@ export const WorkspaceViewProvider: React.FC<{ children: React.ReactNode }> = ({ }; const { data: view, isLoading: viewLoading } = useSWR( - workspaceSlug && workspaceViewId ? WORKSPACE_VIEW_DETAILS(workspaceViewId.toString()) : null, - workspaceSlug && workspaceViewId - ? () => workspaceService.getViewDetails(workspaceSlug.toString(), workspaceViewId.toString()) + workspaceSlug && viewId ? WORKSPACE_VIEW_DETAILS(viewId.toString()) : null, + workspaceSlug && viewId + ? () => workspaceService.getViewDetails(workspaceSlug.toString(), viewId.toString()) : null ); @@ -162,10 +162,10 @@ export const WorkspaceViewProvider: React.FC<{ children: React.ReactNode }> = ({ mutate: mutateViewIssues, isLoading: viewIssueLoading, } = useSWR( - workspaceSlug && view && workspaceViewId && filters - ? WORKSPACE_VIEW_ISSUES(workspaceViewId.toString(), params) + workspaceSlug && view && viewId && filters + ? WORKSPACE_VIEW_ISSUES(viewId.toString(), params) : null, - workspaceSlug && view && workspaceViewId + workspaceSlug && view && viewId ? () => workspaceService.getViewIssues( workspaceSlug.toString(), diff --git a/web/pages/[workspaceSlug]/settings/index.tsx b/web/pages/[workspaceSlug]/settings/index.tsx index 7d0d8b1b6..4a2986dfa 100644 --- a/web/pages/[workspaceSlug]/settings/index.tsx +++ b/web/pages/[workspaceSlug]/settings/index.tsx @@ -312,51 +312,52 @@ const WorkspaceSettings: NextPage = () => {
+ {isAdmin && ( + + {({ open }) => ( +
+ + Delete Workspace + + - - {({ open }) => ( -
- - Delete Workspace - - - - - -
- - The danger zone of the workspace delete page is a critical area that - requires careful consideration and attention. When deleting a workspace, - all of the data and resources within that workspace will be permanently - removed and cannot be recovered. - -
- setIsOpen(true)} - className="!text-sm" - outline - > - Delete my workspace - + + +
+ + The danger zone of the workspace delete page is a critical area that + requires careful consideration and attention. When deleting a workspace, + all of the data and resources within that workspace will be permanently + removed and cannot be recovered. + +
+ setIsOpen(true)} + className="!text-sm" + outline + > + Delete my workspace + +
-
- - -
- )} - +
+
+
+ )} +
+ )}
) : (
diff --git a/web/pages/[workspaceSlug]/workspace-views/[workspaceViewId].tsx b/web/pages/[workspaceSlug]/workspace-views/issues.tsx similarity index 100% rename from web/pages/[workspaceSlug]/workspace-views/[workspaceViewId].tsx rename to web/pages/[workspaceSlug]/workspace-views/issues.tsx