Merge branch 'develop' of https://github.com/makeplane/plane into feat/custom_attributes

This commit is contained in:
Aaryan Khandelwal 2023-09-12 22:51:26 +05:30
commit 1d57f686e2
7 changed files with 41 additions and 42 deletions

View File

@ -88,7 +88,7 @@ export const ProfileIssuesViewOptions: React.FC = () => {
<button <button
type="button" type="button"
className={`grid h-7 w-7 place-items-center rounded p-1 outline-none hover:bg-custom-sidebar-background-80 duration-300 ${ className={`grid h-7 w-7 place-items-center rounded p-1 outline-none hover:bg-custom-sidebar-background-80 duration-300 ${
displayFilters.layout === option.type displayFilters?.layout === option.type
? "bg-custom-sidebar-background-80" ? "bg-custom-sidebar-background-80"
: "text-custom-sidebar-text-200" : "text-custom-sidebar-text-200"
}`} }`}
@ -159,25 +159,25 @@ export const ProfileIssuesViewOptions: React.FC = () => {
<Popover.Panel className="absolute right-0 z-30 mt-1 w-screen max-w-xs transform rounded-lg border border-custom-border-200 bg-custom-background-90 p-3 shadow-lg"> <Popover.Panel className="absolute right-0 z-30 mt-1 w-screen max-w-xs transform rounded-lg border border-custom-border-200 bg-custom-background-90 p-3 shadow-lg">
<div className="relative divide-y-2 divide-custom-border-200"> <div className="relative divide-y-2 divide-custom-border-200">
<div className="space-y-4 pb-3 text-xs"> <div className="space-y-4 pb-3 text-xs">
{displayFilters.layout !== "calendar" && {displayFilters?.layout !== "calendar" &&
displayFilters.layout !== "spreadsheet" && ( displayFilters?.layout !== "spreadsheet" && (
<> <>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<h4 className="text-custom-text-200">Group by</h4> <h4 className="text-custom-text-200">Group by</h4>
<div className="w-28"> <div className="w-28">
<CustomMenu <CustomMenu
label={ label={
displayFilters.group_by === "project" displayFilters?.group_by === "project"
? "Project" ? "Project"
: GROUP_BY_OPTIONS.find( : GROUP_BY_OPTIONS.find(
(option) => option.key === displayFilters.group_by (option) => option.key === displayFilters?.group_by
)?.name ?? "Select" )?.name ?? "Select"
} }
className="!w-full" className="!w-full"
buttonClassName="w-full" buttonClassName="w-full"
> >
{GROUP_BY_OPTIONS.map((option) => { {GROUP_BY_OPTIONS.map((option) => {
if (displayFilters.layout === "kanban" && option.key === null) if (displayFilters?.layout === "kanban" && option.key === null)
return null; return null;
if ( if (
option.key === "state" || option.key === "state" ||
@ -204,7 +204,7 @@ export const ProfileIssuesViewOptions: React.FC = () => {
<CustomMenu <CustomMenu
label={ label={
ORDER_BY_OPTIONS.find( ORDER_BY_OPTIONS.find(
(option) => option.key === displayFilters.order_by (option) => option.key === displayFilters?.order_by
)?.name ?? "Select" )?.name ?? "Select"
} }
className="!w-full" className="!w-full"
@ -212,7 +212,7 @@ export const ProfileIssuesViewOptions: React.FC = () => {
> >
{ORDER_BY_OPTIONS.map((option) => { {ORDER_BY_OPTIONS.map((option) => {
if ( if (
displayFilters.group_by === "priority" && displayFilters?.group_by === "priority" &&
option.key === "priority" option.key === "priority"
) )
return null; return null;
@ -262,17 +262,17 @@ export const ProfileIssuesViewOptions: React.FC = () => {
</div> </div>
</div> </div>
{displayFilters.layout !== "calendar" && {displayFilters?.layout !== "calendar" &&
displayFilters.layout !== "spreadsheet" && ( displayFilters?.layout !== "spreadsheet" && (
<> <>
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<h4 className="text-custom-text-200">Show empty states</h4> <h4 className="text-custom-text-200">Show empty states</h4>
<div className="w-28"> <div className="w-28">
<ToggleSwitch <ToggleSwitch
value={displayFilters.show_empty_groups ?? true} value={displayFilters?.show_empty_groups ?? true}
onChange={() => onChange={() =>
setDisplayFilters({ setDisplayFilters({
show_empty_groups: !displayFilters.show_empty_groups, show_empty_groups: !displayFilters?.show_empty_groups,
}) })
} }
/> />
@ -289,7 +289,7 @@ export const ProfileIssuesViewOptions: React.FC = () => {
if (key === "estimate" && !isEstimateActive) return null; if (key === "estimate" && !isEstimateActive) return null;
if ( if (
displayFilters.layout === "spreadsheet" && displayFilters?.layout === "spreadsheet" &&
(key === "attachment_count" || (key === "attachment_count" ||
key === "link" || key === "link" ||
key === "sub_issue_count") key === "sub_issue_count")
@ -297,7 +297,7 @@ export const ProfileIssuesViewOptions: React.FC = () => {
return null; return null;
if ( if (
displayFilters.layout !== "spreadsheet" && displayFilters?.layout !== "spreadsheet" &&
(key === "created_on" || key === "updated_on") (key === "created_on" || key === "updated_on")
) )
return null; return null;

View File

@ -94,7 +94,7 @@ export const ProfileIssuesView = () => {
!result.destination || !result.destination ||
!workspaceSlug || !workspaceSlug ||
!groupedIssues || !groupedIssues ||
displayFilters.group_by !== "priority" displayFilters?.group_by !== "priority"
) )
return; return;
@ -155,19 +155,19 @@ export const ProfileIssuesView = () => {
let preloadedValue: string | string[] = groupTitle; let preloadedValue: string | string[] = groupTitle;
if (displayFilters.group_by === "labels") { if (displayFilters?.group_by === "labels") {
if (groupTitle === "None") preloadedValue = []; if (groupTitle === "None") preloadedValue = [];
else preloadedValue = [groupTitle]; else preloadedValue = [groupTitle];
} }
if (displayFilters.group_by) if (displayFilters?.group_by)
setPreloadedData({ setPreloadedData({
[displayFilters.group_by]: preloadedValue, [displayFilters?.group_by]: preloadedValue,
actionType: "createIssue", actionType: "createIssue",
}); });
else setPreloadedData({ actionType: "createIssue" }); else setPreloadedData({ actionType: "createIssue" });
}, },
[setCreateIssueModal, setPreloadedData, displayFilters.group_by] [setCreateIssueModal, setPreloadedData, displayFilters?.group_by]
); );
const addIssueToDate = useCallback( const addIssueToDate = useCallback(
@ -286,7 +286,7 @@ export const ProfileIssuesView = () => {
addIssueToDate={addIssueToDate} addIssueToDate={addIssueToDate}
addIssueToGroup={addIssueToGroup} addIssueToGroup={addIssueToGroup}
disableUserActions={false} disableUserActions={false}
dragDisabled={displayFilters.group_by !== "priority"} dragDisabled={displayFilters?.group_by !== "priority"}
emptyState={{ emptyState={{
title: router.pathname.includes("assigned") title: router.pathname.includes("assigned")
? `Issues assigned to ${profileData?.user_data.display_name} will appear here` ? `Issues assigned to ${profileData?.user_data.display_name} will appear here`

View File

@ -501,7 +501,6 @@ export const IssueViewContextProvider: React.FC<{ children: React.ReactNode }> =
}, [projectId, workspaceSlug, myViewProps]); }, [projectId, workspaceSlug, myViewProps]);
useEffect(() => { useEffect(() => {
console.log("running");
dispatch({ dispatch({
type: "REHYDRATE_THEME", type: "REHYDRATE_THEME",
payload: { payload: {

View File

@ -138,7 +138,7 @@ export const ProfileIssuesContextProvider: React.FC<{ children: React.ReactNode
if ( if (
displayFilter.layout && displayFilter.layout &&
displayFilter.layout === "kanban" && displayFilter.layout === "kanban" &&
state.display_filters.group_by === null state.display_filters?.group_by === null
) { ) {
dispatch({ dispatch({
type: "SET_DISPLAY_FILTERS", type: "SET_DISPLAY_FILTERS",

View File

@ -91,7 +91,7 @@ const useMyIssuesFilters = (workspaceSlug: string | undefined) => {
[myWorkspace, workspaceSlug] [myWorkspace, workspaceSlug]
); );
const groupBy = (myWorkspace?.view_props ?? initialValues).display_filters.group_by; const groupBy = (myWorkspace?.view_props ?? initialValues).display_filters?.group_by;
const filters = (myWorkspace?.view_props ?? initialValues).filters; const filters = (myWorkspace?.view_props ?? initialValues).filters;
const setDisplayFilters = useCallback( const setDisplayFilters = useCallback(
@ -155,19 +155,19 @@ const useMyIssuesFilters = (workspaceSlug: string | undefined) => {
}, [myWorkspace, workspaceSlug]); }, [myWorkspace, workspaceSlug]);
const newProperties: Properties = { const newProperties: Properties = {
assignee: myWorkspace?.view_props.display_properties.assignee ?? true, assignee: myWorkspace?.view_props.display_properties?.assignee ?? true,
start_date: myWorkspace?.view_props.display_properties.start_date ?? true, start_date: myWorkspace?.view_props.display_properties?.start_date ?? true,
due_date: myWorkspace?.view_props.display_properties.due_date ?? true, due_date: myWorkspace?.view_props.display_properties?.due_date ?? true,
key: myWorkspace?.view_props.display_properties.key ?? true, key: myWorkspace?.view_props.display_properties?.key ?? true,
labels: myWorkspace?.view_props.display_properties.labels ?? true, labels: myWorkspace?.view_props.display_properties?.labels ?? true,
priority: myWorkspace?.view_props.display_properties.priority ?? true, priority: myWorkspace?.view_props.display_properties?.priority ?? true,
state: myWorkspace?.view_props.display_properties.state ?? true, state: myWorkspace?.view_props.display_properties?.state ?? true,
sub_issue_count: myWorkspace?.view_props.display_properties.sub_issue_count ?? true, sub_issue_count: myWorkspace?.view_props.display_properties?.sub_issue_count ?? true,
attachment_count: myWorkspace?.view_props.display_properties.attachment_count ?? true, attachment_count: myWorkspace?.view_props.display_properties?.attachment_count ?? true,
link: myWorkspace?.view_props.display_properties.link ?? true, link: myWorkspace?.view_props.display_properties?.link ?? true,
estimate: myWorkspace?.view_props.display_properties.estimate ?? true, estimate: myWorkspace?.view_props.display_properties?.estimate ?? true,
created_on: myWorkspace?.view_props.display_properties.created_on ?? true, created_on: myWorkspace?.view_props.display_properties?.created_on ?? true,
updated_on: myWorkspace?.view_props.display_properties.updated_on ?? true, updated_on: myWorkspace?.view_props.display_properties?.updated_on ?? true,
}; };
return { return {

View File

@ -31,9 +31,9 @@ const useProfileIssues = (workspaceSlug: string | undefined, userId: string | un
const params: any = { const params: any = {
assignees: filters?.assignees ? filters?.assignees.join(",") : undefined, assignees: filters?.assignees ? filters?.assignees.join(",") : undefined,
created_by: filters?.created_by ? filters?.created_by.join(",") : undefined, created_by: filters?.created_by ? filters?.created_by.join(",") : undefined,
group_by: displayFilters.group_by, group_by: displayFilters?.group_by,
labels: filters?.labels ? filters?.labels.join(",") : undefined, labels: filters?.labels ? filters?.labels.join(",") : undefined,
order_by: displayFilters.order_by, order_by: displayFilters?.order_by,
priority: filters?.priority ? filters?.priority.join(",") : undefined, priority: filters?.priority ? filters?.priority.join(",") : undefined,
state_group: filters?.state_group ? filters?.state_group.join(",") : undefined, state_group: filters?.state_group ? filters?.state_group.join(",") : undefined,
start_date: filters?.start_date ? filters?.start_date.join(",") : undefined, start_date: filters?.start_date ? filters?.start_date.join(",") : undefined,
@ -63,7 +63,7 @@ const useProfileIssues = (workspaceSlug: string | undefined, userId: string | un
allIssues: userProfileIssues, allIssues: userProfileIssues,
}; };
if (displayFilters.group_by === "state_detail.group") { if (displayFilters?.group_by === "state_detail.group") {
return userProfileIssues return userProfileIssues
? Object.assign( ? Object.assign(
{ {
@ -79,7 +79,7 @@ const useProfileIssues = (workspaceSlug: string | undefined, userId: string | un
} }
return userProfileIssues; return userProfileIssues;
}, [displayFilters.group_by, userProfileIssues]); }, [displayFilters?.group_by, userProfileIssues]);
useEffect(() => { useEffect(() => {
if (!userId || !filters) return; if (!userId || !filters) return;

View File

@ -57,7 +57,7 @@ export interface IProjectViewProps {
} }
export interface IWorkspaceViewProps { export interface IWorkspaceViewProps {
display_filters: IIssueDisplayFilterOptions; display_filters: IIssueDisplayFilterOptions | undefined;
display_properties: Properties; display_properties: Properties | undefined;
filters: IIssueFilterOptions; filters: IIssueFilterOptions;
} }