From 0c880bbbc8992ef8df701d26c206db00aa138b84 Mon Sep 17 00:00:00 2001 From: Lakhan Baheti <94619783+1akhanBaheti@users.noreply.github.com> Date: Mon, 29 Apr 2024 00:54:35 +0530 Subject: [PATCH] [WEB-704] fix: inbox responsiveness (#4275) * chore: inbox responsiveness * fix: sidebar in full view * style: border theme * condition update --- .../inbox/content/inbox-issue-header.tsx | 29 ++- .../content/inbox-issue-mobile-header.tsx | 170 ++++++++++++++++++ web/components/inbox/content/index.ts | 1 + web/components/inbox/content/root.tsx | 6 +- web/components/inbox/root.tsx | 57 ++++-- .../inbox/sidebar/inbox-list-item.tsx | 4 +- web/components/inbox/sidebar/inbox-list.tsx | 4 +- web/components/inbox/sidebar/root.tsx | 10 +- .../filters/header/helpers/dropdown.tsx | 2 +- 9 files changed, 258 insertions(+), 25 deletions(-) create mode 100644 web/components/inbox/content/inbox-issue-mobile-header.tsx diff --git a/web/components/inbox/content/inbox-issue-header.tsx b/web/components/inbox/content/inbox-issue-header.tsx index 2e4c1afdd..4fbc4ccbf 100644 --- a/web/components/inbox/content/inbox-issue-header.tsx +++ b/web/components/inbox/content/inbox-issue-header.tsx @@ -17,6 +17,7 @@ import { Button, ControlLink, CustomMenu, TOAST_TYPE, setToast } from "@plane/ui import { DeclineIssueModal, DeleteInboxIssueModal, + InboxIssueActionsMobileHeader, InboxIssueCreateEditModalRoot, InboxIssueSnoozeModal, InboxIssueStatus, @@ -38,10 +39,12 @@ type TInboxIssueActionsHeader = { projectId: string; inboxIssue: IInboxIssueStore | undefined; isSubmitting: "submitting" | "submitted" | "saved"; + toggleMobileSidebar: boolean; + setToggleMobileSidebar: (value: boolean) => void; }; export const InboxIssueActionsHeader: FC = observer((props) => { - const { workspaceSlug, projectId, inboxIssue, isSubmitting } = props; + const { workspaceSlug, projectId, inboxIssue, isSubmitting, toggleMobileSidebar, setToggleMobileSidebar } = props; // states const [isSnoozeDateModalOpen, setIsSnoozeDateModalOpen] = useState(false); const [selectDuplicateIssue, setSelectDuplicateIssue] = useState(false); @@ -207,7 +210,7 @@ export const InboxIssueActionsHeader: FC = observer((p /> -
+
{issue?.project_id && issue.sequence_id && (

@@ -319,6 +322,28 @@ export const InboxIssueActionsHeader: FC = observer((p

+ +
+ +
); }); diff --git a/web/components/inbox/content/inbox-issue-mobile-header.tsx b/web/components/inbox/content/inbox-issue-mobile-header.tsx new file mode 100644 index 000000000..f817657f3 --- /dev/null +++ b/web/components/inbox/content/inbox-issue-mobile-header.tsx @@ -0,0 +1,170 @@ +import React from "react"; +import { observer } from "mobx-react"; +import { useRouter } from "next/router"; +import { + CircleCheck, + CircleX, + ChevronDown, + ChevronUp, + Clock, + ExternalLink, + FileStack, + Link, + Trash2, + PanelLeft, +} from "lucide-react"; +import { CustomMenu } from "@plane/ui"; +// components +import { InboxIssueStatus } from "@/components/inbox"; +import { IssueUpdateStatus } from "@/components/issues"; +// helpers +import { cn } from "@/helpers/common.helper"; +// store types +import type { IInboxIssueStore } from "@/store/inbox/inbox-issue.store"; + +type Props = { + workspaceSlug: string; + inboxIssue: IInboxIssueStore | undefined; + isSubmitting: "submitting" | "submitted" | "saved"; + handleInboxIssueNavigation: (direction: "next" | "prev") => void; + canMarkAsAccepted: boolean; + canMarkAsDeclined: boolean; + isAcceptedOrDeclined: boolean | undefined; + canMarkAsDuplicate: boolean; + canDelete: boolean; + setAcceptIssueModal: (value: boolean) => void; + setDeclineIssueModal: (value: boolean) => void; + setDeleteIssueModal: (value: boolean) => void; + setIsSnoozeDateModalOpen: (value: boolean) => void; + setSelectDuplicateIssue: (value: boolean) => void; + handleCopyIssueLink: () => void; + toggleMobileSidebar: boolean; + setToggleMobileSidebar: (value: boolean) => void; +}; + +export const InboxIssueActionsMobileHeader: React.FC = observer((props) => { + const { + inboxIssue, + isSubmitting, + handleInboxIssueNavigation, + canMarkAsAccepted, + canMarkAsDeclined, + canDelete, + canMarkAsDuplicate, + isAcceptedOrDeclined, + workspaceSlug, + setAcceptIssueModal, + setDeclineIssueModal, + setDeleteIssueModal, + setIsSnoozeDateModalOpen, + setSelectDuplicateIssue, + handleCopyIssueLink, + toggleMobileSidebar, + setToggleMobileSidebar, + } = props; + const router = useRouter(); + const issue = inboxIssue?.issue; + const currentInboxIssueId = issue?.id; + + if (!issue || !inboxIssue) return null; + + return ( +
+ setToggleMobileSidebar(!toggleMobileSidebar)} + className={cn( + "w-4 h-4 flex-shrink-0 mr-2", + toggleMobileSidebar ? "text-custom-primary-100" : "text-custom-text-200" + )} + /> +
+
+ + +
+
+ +
+ +
+
+
+ + {isAcceptedOrDeclined && ( + +
+ + Copy issue link +
+
+ )} + {isAcceptedOrDeclined && ( + + router.push(`/${workspaceSlug}/projects/${issue?.project_id}/issues/${currentInboxIssueId}`) + } + > +
+ + Open issue +
+
+ )} + {canMarkAsAccepted && !isAcceptedOrDeclined && ( + setIsSnoozeDateModalOpen(true)}> +
+ + Snooze +
+
+ )} + {canMarkAsDuplicate && !isAcceptedOrDeclined && ( + setSelectDuplicateIssue(true)}> +
+ + Mark as duplicate +
+
+ )} + {canMarkAsAccepted && ( + setAcceptIssueModal(true)}> +
+ + Accept +
+
+ )} + {canMarkAsDeclined && ( + setDeclineIssueModal(true)}> +
+ + Decline +
+
+ )} + {canDelete && !isAcceptedOrDeclined && ( + setDeleteIssueModal(true)}> +
+ + Delete +
+
+ )} +
+
+
+
+ ); +}); diff --git a/web/components/inbox/content/index.ts b/web/components/inbox/content/index.ts index 029365f7a..b499a3ea1 100644 --- a/web/components/inbox/content/index.ts +++ b/web/components/inbox/content/index.ts @@ -1,4 +1,5 @@ export * from "./root"; export * from "./inbox-issue-header"; +export * from "./inbox-issue-mobile-header"; export * from "./issue-properties"; export * from "./issue-root"; diff --git a/web/components/inbox/content/root.tsx b/web/components/inbox/content/root.tsx index 9af3da0bc..b3c97c11a 100644 --- a/web/components/inbox/content/root.tsx +++ b/web/components/inbox/content/root.tsx @@ -9,10 +9,12 @@ type TInboxContentRoot = { workspaceSlug: string; projectId: string; inboxIssueId: string; + toggleMobileSidebar: boolean; + setToggleMobileSidebar: (value: boolean) => void; }; export const InboxContentRoot: FC = observer((props) => { - const { workspaceSlug, projectId, inboxIssueId } = props; + const { workspaceSlug, projectId, inboxIssueId, toggleMobileSidebar, setToggleMobileSidebar } = props; // states const [isSubmitting, setIsSubmitting] = useState<"submitting" | "submitted" | "saved">("saved"); // hooks @@ -43,6 +45,8 @@ export const InboxContentRoot: FC = observer((props) => {
= observer((props) => { const { workspaceSlug, projectId, inboxIssueId, inboxAccessible } = props; + // states + const [toggleMobileSidebar, setToggleMobileSidebar] = useState(false); // hooks const { loader, error, fetchInboxIssues } = useProjectInbox(); @@ -52,20 +56,43 @@ export const InboxIssueRoot: FC = observer((props) => { ); return ( -
- - - {inboxIssueId ? ( - - ) : ( -
- + <> + {!inboxIssueId && ( +
+ setToggleMobileSidebar(!toggleMobileSidebar)} + className={cn("w-4 h-4 ", toggleMobileSidebar ? "text-custom-primary-100" : " text-custom-text-200")} + />
)} -
+
+
+ +
+ + {inboxIssueId ? ( + + ) : ( +
+ +
+ )} +
+ ); }); diff --git a/web/components/inbox/sidebar/inbox-list-item.tsx b/web/components/inbox/sidebar/inbox-list-item.tsx index e407f0b3c..89b6a8f8a 100644 --- a/web/components/inbox/sidebar/inbox-list-item.tsx +++ b/web/components/inbox/sidebar/inbox-list-item.tsx @@ -19,10 +19,11 @@ type InboxIssueListItemProps = { projectId: string; projectIdentifier?: string; inboxIssue: IInboxIssueStore; + setToggleMobileSidebar: (value: boolean) => void; }; export const InboxIssueListItem: FC = observer((props) => { - const { workspaceSlug, projectId, inboxIssue, projectIdentifier } = props; + const { workspaceSlug, projectId, inboxIssue, projectIdentifier,setToggleMobileSidebar } = props; // router const router = useRouter(); const { inboxIssueId } = router.query; @@ -34,6 +35,7 @@ export const InboxIssueListItem: FC = observer((props) const handleIssueRedirection = (event: MouseEvent, currentIssueId: string | undefined) => { if (inboxIssueId === currentIssueId) event.preventDefault(); + setToggleMobileSidebar(false); }; if (!issue) return <>; diff --git a/web/components/inbox/sidebar/inbox-list.tsx b/web/components/inbox/sidebar/inbox-list.tsx index 4bde1c43e..a7a19eff1 100644 --- a/web/components/inbox/sidebar/inbox-list.tsx +++ b/web/components/inbox/sidebar/inbox-list.tsx @@ -10,16 +10,18 @@ export type InboxIssueListProps = { projectId: string; projectIdentifier?: string; inboxIssues: IInboxIssueStore[]; + setToggleMobileSidebar: (value: boolean) => void; }; export const InboxIssueList: FC = observer((props) => { - const { workspaceSlug, projectId, projectIdentifier, inboxIssues } = props; + const { workspaceSlug, projectId, projectIdentifier, inboxIssues, setToggleMobileSidebar } = props; return ( <> {inboxIssues.map((inboxIssue) => ( void; }; const tabNavigationOptions: { key: TInboxIssueCurrentTab; label: string }[] = [ @@ -33,7 +34,7 @@ const tabNavigationOptions: { key: TInboxIssueCurrentTab; label: string }[] = [ ]; export const InboxSidebar: FC = observer((props) => { - const { workspaceSlug, projectId } = props; + const { workspaceSlug, projectId, setToggleMobileSidebar } = props; // ref const containerRef = useRef(null); const elementRef = useRef(null); @@ -64,7 +65,7 @@ export const InboxSidebar: FC = observer((props) => { }); return ( -
+
{tabNavigationOptions.map((option) => ( @@ -109,6 +110,7 @@ export const InboxSidebar: FC = observer((props) => { > {inboxIssuesArray.length > 0 ? ( = observer((props) => { getAppliedFiltersCount > 0 ? EmptyStateType.INBOX_SIDEBAR_FILTER_EMPTY_STATE : currentTab === EInboxIssueCurrentTab.OPEN - ? EmptyStateType.INBOX_SIDEBAR_OPEN_TAB - : EmptyStateType.INBOX_SIDEBAR_CLOSED_TAB + ? EmptyStateType.INBOX_SIDEBAR_OPEN_TAB + : EmptyStateType.INBOX_SIDEBAR_CLOSED_TAB } layout="screen-simple" /> diff --git a/web/components/issues/issue-layouts/filters/header/helpers/dropdown.tsx b/web/components/issues/issue-layouts/filters/header/helpers/dropdown.tsx index be4e5e9a9..c250c3657 100644 --- a/web/components/issues/issue-layouts/filters/header/helpers/dropdown.tsx +++ b/web/components/issues/issue-layouts/filters/header/helpers/dropdown.tsx @@ -73,7 +73,7 @@ export const FiltersDropdown: React.FC = (props) => { style={styles.popper} {...attributes.popper} > -
{children}
+
{children}