[WEB-2462] [WEB-2461] fix: project intake filters (#5645)

* chore: intake order by options updated

* fix: intake filters icon and spacing

* chore: code refactor
This commit is contained in:
Anmol Singh Bhatia 2024-09-18 18:10:30 +05:30 committed by GitHub
parent 5e83da9ca1
commit 3a9f01b9eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 39 additions and 42 deletions

View file

@ -5,29 +5,24 @@ import { cn } from "@plane/editor";
import { getButtonStyling } from "@plane/ui"; import { getButtonStyling } from "@plane/ui";
import { InboxIssueFilterSelection, InboxIssueOrderByDropdown } from "@/components/inbox/inbox-filter"; import { InboxIssueFilterSelection, InboxIssueOrderByDropdown } from "@/components/inbox/inbox-filter";
import { FiltersDropdown } from "@/components/issues"; import { FiltersDropdown } from "@/components/issues";
import useSize from "@/hooks/use-window-size";
const smallButton = <ListFilter className="size-3 " />;
const smallButton = <ListFilter className="h-3 " />;
const largeButton = ( const largeButton = (
<div className={cn(getButtonStyling("neutral-primary", "sm"), "text-custom-text-300")}> <div className={cn(getButtonStyling("neutral-primary", "sm"), "px-2 text-custom-text-300")}>
<ListFilter className="h-3 " /> <ListFilter className="size-3 " />
<span className="hidden xl:flex">Filters</span> <span>Filters</span>
<ChevronDown className="size-3" strokeWidth={2} />
<ChevronDown className="h-3 w-3" strokeWidth={2} />
</div> </div>
); );
export const FiltersRoot: FC = () => ( export const FiltersRoot: FC = () => {
const windowSize = useSize();
return (
<div className="relative flex items-center gap-2"> <div className="relative flex items-center gap-2">
<div> <div>
<FiltersDropdown <FiltersDropdown menuButton={windowSize[0] > 1280 ? largeButton : smallButton} title="" placement="bottom-end">
menuButton={
<>
<div className="hidden xl:flex">{largeButton}</div>
<div className="flex xl:hidden">{smallButton}</div>
</>
}
title=""
placement="bottom-end"
>
<InboxIssueFilterSelection /> <InboxIssueFilterSelection />
</FiltersDropdown> </FiltersDropdown>
</div> </div>
@ -36,3 +31,4 @@ export const FiltersRoot: FC = () => (
</div> </div>
</div> </div>
); );
};

View file

@ -10,34 +10,35 @@ import { INBOX_ISSUE_ORDER_BY_OPTIONS, INBOX_ISSUE_SORT_BY_OPTIONS } from "@/con
import { cn } from "@/helpers/common.helper"; import { cn } from "@/helpers/common.helper";
// hooks // hooks
import { useProjectInbox } from "@/hooks/store"; import { useProjectInbox } from "@/hooks/store";
import useSize from "@/hooks/use-window-size";
export const InboxIssueOrderByDropdown: FC = observer(() => { export const InboxIssueOrderByDropdown: FC = observer(() => {
// hooks // hooks
const windowSize = useSize();
const { inboxSorting, handleInboxIssueSorting } = useProjectInbox(); const { inboxSorting, handleInboxIssueSorting } = useProjectInbox();
const orderByDetails = const orderByDetails =
INBOX_ISSUE_ORDER_BY_OPTIONS.find((option) => inboxSorting?.order_by?.includes(option.key)) || undefined; INBOX_ISSUE_ORDER_BY_OPTIONS.find((option) => inboxSorting?.order_by?.includes(option.key)) || undefined;
const smallButton = const smallButton =
inboxSorting?.sort_by === "asc" ? <ArrowUpWideNarrow className="h-3 " /> : <ArrowDownWideNarrow className="h-3 " />; inboxSorting?.sort_by === "asc" ? (
const largeButton = ( <ArrowUpWideNarrow className="size-3 " />
<div className={cn(getButtonStyling("neutral-primary", "sm"), "text-custom-text-300")}>
{inboxSorting?.sort_by === "asc" ? (
<ArrowUpWideNarrow className="h-3 " />
) : ( ) : (
<ArrowDownWideNarrow className="h-3 " /> <ArrowDownWideNarrow className="size-3 " />
);
const largeButton = (
<div className={cn(getButtonStyling("neutral-primary", "sm"), "px-2 text-custom-text-300")}>
{inboxSorting?.sort_by === "asc" ? (
<ArrowUpWideNarrow className="size-3 " />
) : (
<ArrowDownWideNarrow className="size-3 " />
)} )}
{orderByDetails?.label || "Order By"} {orderByDetails?.label || "Order By"}
<ChevronDown className="h-3 w-3" strokeWidth={2} /> <ChevronDown className="size-3" strokeWidth={2} />
</div> </div>
); );
return ( return (
<CustomMenu <CustomMenu
customButton={ customButton={windowSize[0] > 1280 ? largeButton : smallButton}
<>
<div className="hidden xl:flex">{largeButton}</div>
<div className="flex xl:hidden">{smallButton}</div>
</>
}
placement="bottom-end" placement="bottom-end"
maxHeight="lg" maxHeight="lg"
closeOnSelect closeOnSelect
@ -49,7 +50,7 @@ export const InboxIssueOrderByDropdown: FC = observer(() => {
onClick={() => handleInboxIssueSorting("order_by", option.key)} onClick={() => handleInboxIssueSorting("order_by", option.key)}
> >
{option.label} {option.label}
{inboxSorting?.order_by?.includes(option.key) && <Check className="h-3 w-3" />} {inboxSorting?.order_by?.includes(option.key) && <Check className="size-3" />}
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
))} ))}
<hr className="my-2 border-custom-border-200" /> <hr className="my-2 border-custom-border-200" />
@ -60,7 +61,7 @@ export const InboxIssueOrderByDropdown: FC = observer(() => {
onClick={() => handleInboxIssueSorting("sort_by", option.key)} onClick={() => handleInboxIssueSorting("sort_by", option.key)}
> >
{option.label} {option.label}
{inboxSorting?.sort_by?.includes(option.key) && <Check className="h-3 w-3" />} {inboxSorting?.sort_by?.includes(option.key) && <Check className="size-3" />}
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
))} ))}
</CustomMenu> </CustomMenu>

View file

@ -67,11 +67,11 @@ export const INBOX_ISSUE_SOURCE = "in-app";
export const INBOX_ISSUE_ORDER_BY_OPTIONS: { key: TInboxIssueSortingOrderByKeys; label: string }[] = [ export const INBOX_ISSUE_ORDER_BY_OPTIONS: { key: TInboxIssueSortingOrderByKeys; label: string }[] = [
{ {
key: "issue__created_at", key: "issue__created_at",
label: "Date created", label: "Created at",
}, },
{ {
key: "issue__updated_at", key: "issue__updated_at",
label: "Date updated", label: "Updated at",
}, },
{ {
key: "issue__sequence_id", key: "issue__sequence_id",