From 23c468786d0e016e02baedcb60b52b5240001c73 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Thu, 16 Mar 2023 18:14:07 +0530 Subject: [PATCH] style: filter issues dropdown (#466) --- .../components/core/issues-view-filter.tsx | 36 ++++++--- apps/app/components/core/issues-view.tsx | 16 ++-- .../app/components/issues/select/priority.tsx | 2 +- .../project/single-sidebar-project.tsx | 8 +- .../components/ui/multi-level-dropdown.tsx | 76 ++++++++++--------- .../[projectId]/settings/features.tsx | 35 ++++++++- apps/app/types/projects.d.ts | 1 + 7 files changed, 115 insertions(+), 59 deletions(-) diff --git a/apps/app/components/core/issues-view-filter.tsx b/apps/app/components/core/issues-view-filter.tsx index d449d6e67..ecb7b5680 100644 --- a/apps/app/components/core/issues-view-filter.tsx +++ b/apps/app/components/core/issues-view-filter.tsx @@ -13,21 +13,24 @@ import useIssuesProperties from "hooks/use-issue-properties"; import useIssuesView from "hooks/use-issues-view"; // headless ui import { Popover, Transition } from "@headlessui/react"; +// components +import { PRIORITIES } from "constants/project"; // ui -import { CustomMenu, MultiLevelDropdown } from "components/ui"; +import { Avatar, CustomMenu, MultiLevelDropdown } from "components/ui"; // icons import { ChevronDownIcon, ListBulletIcon } from "@heroicons/react/24/outline"; import { Squares2X2Icon } from "@heroicons/react/20/solid"; +import { getStateGroupIcon } from "components/icons"; +import { getPriorityIcon } from "components/icons/priority-icon"; // helpers import { replaceUnderscoreIfSnakeCase } from "helpers/string.helper"; import { getStatesList } from "helpers/state.helper"; // types -import { IIssue, IIssueLabels, Properties } from "types"; +import { IIssueLabels, Properties } from "types"; // fetch-keys import { PROJECT_ISSUE_LABELS, PROJECT_MEMBERS, STATE_LIST } from "constants/fetch-keys"; // constants import { GROUP_BY_OPTIONS, ORDER_BY_OPTIONS, FILTER_ISSUE_OPTIONS } from "constants/issue"; -import { PRIORITIES } from "constants/project"; export const IssuesFilterView: React.FC = () => { const router = useRouter(); @@ -97,7 +100,7 @@ export const IssuesFilterView: React.FC = () => { { setFilters({ ...filters, @@ -116,7 +119,11 @@ export const IssuesFilterView: React.FC = () => { children: [ ...PRIORITIES.map((priority) => ({ id: priority ?? "none", - label: priority ?? "None", + label: ( +
+ {getPriorityIcon(priority)} {priority ?? "None"} +
+ ), value: { key: "priority", value: priority, @@ -132,7 +139,11 @@ export const IssuesFilterView: React.FC = () => { children: [ ...statesList.map((state) => ({ id: state.id, - label: state.name, + label: ( +
+ {getStateGroupIcon(state.group, "16", "16", state.color)} {state.name} +
+ ), value: { key: "state", value: state.id, @@ -148,7 +159,14 @@ export const IssuesFilterView: React.FC = () => { children: [ ...(members?.map((member) => ({ id: member.member.id, - label: member.member.first_name, + label: ( +
+ + {member.member.first_name && member.member.first_name !== "" + ? member.member.first_name + : member.member.email} +
+ ), value: { key: "assignee", value: member.member.id, @@ -163,12 +181,12 @@ export const IssuesFilterView: React.FC = () => { {({ open }) => ( <> View - = ({ type = "issue", openIssuesListModa })} -
- -
+ + Save view + + )} diff --git a/apps/app/components/issues/select/priority.tsx b/apps/app/components/issues/select/priority.tsx index d184ad0e5..f912b31c0 100644 --- a/apps/app/components/issues/select/priority.tsx +++ b/apps/app/components/issues/select/priority.tsx @@ -18,7 +18,7 @@ export const IssuePrioritySelect: React.FC = ({ value, onChange }) => ( label={
- {getPriorityIcon(value, `${value ? "text-xs" : "text-xs text-gray-500"}`)} + {getPriorityIcon(value, `text-xs ${value ? "" : "text-gray-500"}`)} {value ?? "Priority"} diff --git a/apps/app/components/project/single-sidebar-project.tsx b/apps/app/components/project/single-sidebar-project.tsx index a24956bac..ab5940fe3 100644 --- a/apps/app/components/project/single-sidebar-project.tsx +++ b/apps/app/components/project/single-sidebar-project.tsx @@ -136,8 +136,12 @@ export const SingleSidebarProject: React.FC = ({ className={`${sidebarCollapse ? "" : "ml-[2.25rem]"} flex flex-col gap-y-1`} > {navigation(workspaceSlug as string, project?.id).map((item) => { - if (item.name === "Cycles" && !project.cycle_view) return; - if (item.name === "Modules" && !project.module_view) return; + if ( + (item.name === "Cycles" && !project.cycle_view) || + (item.name === "Modules" && !project.module_view) || + (item.name === "Views" && !project.issue_views_view) + ) + return; return ( diff --git a/apps/app/components/ui/multi-level-dropdown.tsx b/apps/app/components/ui/multi-level-dropdown.tsx index b7e437a54..8e24cb3a5 100644 --- a/apps/app/components/ui/multi-level-dropdown.tsx +++ b/apps/app/components/ui/multi-level-dropdown.tsx @@ -1,6 +1,7 @@ import { Menu, Transition } from "@headlessui/react"; import { Fragment, useState } from "react"; -import { ChevronDownIcon, ChevronRightIcon, ChevronLeftIcon } from "@heroicons/react/20/solid"; +import { ChevronRightIcon, ChevronLeftIcon } from "@heroicons/react/20/solid"; +import { ChevronDownIcon } from "@heroicons/react/24/outline"; type MultiLevelDropdownProps = { label: string; @@ -11,7 +12,7 @@ type MultiLevelDropdownProps = { selected?: boolean; children?: { id: string; - label: string; + label: string | JSX.Element; value: any; selected?: boolean; }[]; @@ -20,26 +21,27 @@ type MultiLevelDropdownProps = { direction?: "left" | "right"; }; -export const MultiLevelDropdown: React.FC = (props) => { - const { label, options, onSelect, direction = "right" } = props; - +export const MultiLevelDropdown: React.FC = ({ + label, + options, + onSelect, + direction = "right", +}) => { const [openChildFor, setOpenChildFor] = useState(null); return ( - + {({ open }) => ( <>
{ - setOpenChildFor(null); - }} - className={`group flex items-center gap-2 rounded-md border bg-transparent p-2 text-xs font-medium hover:bg-gray-100 hover:text-gray-900 focus:outline-none ${ + onClick={() => setOpenChildFor(null)} + className={`group flex items-center justify-between gap-2 rounded-md border px-3 py-1.5 text-xs shadow-sm duration-300 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 ${ open ? "bg-gray-100 text-gray-900" : "text-gray-500" }`} > {label} -
= (props) => > {options.map((option) => ( -
+
{ @@ -81,7 +83,9 @@ export const MultiLevelDropdown: React.FC = (props) =>
{direction === "left" && option.children && (
diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/features.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/features.tsx index 6111aa3c7..8548c17b2 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/features.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/features.tsx @@ -20,7 +20,7 @@ import { IProject, UserAuth } from "types"; import type { NextPage, GetServerSidePropsContext } from "next"; // fetch-keys import { PROJECTS_LIST, PROJECT_DETAILS } from "constants/fetch-keys"; -import { ContrastIcon, PeopleGroupIcon } from "components/icons"; +import { ContrastIcon, PeopleGroupIcon, ViewListIcon } from "components/icons"; const FeaturesSettings: NextPage = (props) => { const router = useRouter(); @@ -93,7 +93,7 @@ const FeaturesSettings: NextPage = (props) => {

Features

-
+
@@ -122,7 +122,7 @@ const FeaturesSettings: NextPage = (props) => { />
-
+
@@ -151,6 +151,35 @@ const FeaturesSettings: NextPage = (props) => { />
+
+
+ +
+

Views

+

+ Modules are enabled for all the projects in this workspace. Access it from the + navigation bar. +

+
+
+ +