Skip to content

Commit

Permalink
chore: implemented assigned profiles issues and filters and updated w…
Browse files Browse the repository at this point in the history
…orkflow in list layout (#2462)
  • Loading branch information
gurusainath authored Oct 17, 2023
1 parent 4bd7363 commit 123634f
Show file tree
Hide file tree
Showing 45 changed files with 2,774 additions and 1,144 deletions.
85 changes: 85 additions & 0 deletions web/components/issues/issue-layouts/kanban/profile-issues-root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import React from "react";
// react beautiful dnd
import { DragDropContext } from "@hello-pangea/dnd";
// mobx
import { observer } from "mobx-react-lite";
// components
import { KanBanSwimLanes } from "./swimlanes";
import { KanBan } from "./default";
// store
import { useMobxStore } from "lib/mobx/store-provider";
import { RootStore } from "store/root";

export interface IProfileIssuesKanBanLayout {}

export const ProfileIssuesKanBanLayout: React.FC = observer(() => {
const {
profileIssues: profileIssuesStore,
profileIssueFilters: profileIssueFiltersStore,
issueKanBanView: issueKanBanViewStore,
}: RootStore = useMobxStore();

const issues = profileIssuesStore?.getIssues;

const sub_group_by: string | null = profileIssueFiltersStore?.userDisplayFilters?.sub_group_by || null;

const group_by: string | null = profileIssueFiltersStore?.userDisplayFilters?.group_by || null;

const display_properties = profileIssueFiltersStore?.userDisplayProperties || null;

const currentKanBanView: "swimlanes" | "default" = profileIssueFiltersStore?.userDisplayFilters?.sub_group_by
? "swimlanes"
: "default";

const onDragEnd = (result: any) => {
if (!result) return;

if (
result.destination &&
result.source &&
result.destination.droppableId === result.source.droppableId &&
result.destination.index === result.source.index
)
return;

currentKanBanView === "default"
? issueKanBanViewStore?.handleDragDrop(result.source, result.destination)
: issueKanBanViewStore?.handleSwimlaneDragDrop(result.source, result.destination);
};

const updateIssue = (sub_group_by: string | null, group_by: string | null, issue: any) => {
profileIssuesStore.updateIssueStructure(group_by, sub_group_by, issue);
};

const handleKanBanToggle = (toggle: "groupByHeaderMinMax" | "subgroupByIssuesVisibility", value: string) => {
issueKanBanViewStore.handleKanBanToggle(toggle, value);
};

return (
<div className={`relative min-w-full w-max min-h-full h-max bg-custom-background-90 px-3`}>
<DragDropContext onDragEnd={onDragEnd}>
{currentKanBanView === "default" ? (
<KanBan
issues={issues}
sub_group_by={sub_group_by}
group_by={group_by}
handleIssues={updateIssue}
display_properties={display_properties}
kanBanToggle={issueKanBanViewStore?.kanBanToggle}
handleKanBanToggle={handleKanBanToggle}
/>
) : (
<KanBanSwimLanes
issues={issues}
sub_group_by={sub_group_by}
group_by={group_by}
handleIssues={updateIssue}
display_properties={display_properties}
kanBanToggle={issueKanBanViewStore?.kanBanToggle}
handleKanBanToggle={handleKanBanToggle}
/>
)}
</DragDropContext>
</div>
);
});
6 changes: 3 additions & 3 deletions web/components/issues/issue-layouts/kanban/properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { IssuePropertyPriority } from "../properties/priority";
import { IssuePropertyLabels } from "../properties/labels";
import { IssuePropertyAssignee } from "../properties/assignee";
import { IssuePropertyEstimates } from "../properties/estimates";
import { IssuePropertyStartDate } from "../properties/date";
import { IssuePropertyDate } from "../properties/date";
import { Tooltip } from "@plane/ui";

export interface IKanBanProperties {
Expand Down Expand Up @@ -129,7 +129,7 @@ export const KanBanProperties: React.FC<IKanBanProperties> = observer(

{/* start date */}
{display_properties && display_properties?.start_date && (
<IssuePropertyStartDate
<IssuePropertyDate
value={issue?.start_date || null}
onChange={(date: string) => handleStartDate(date)}
disabled={false}
Expand All @@ -138,7 +138,7 @@ export const KanBanProperties: React.FC<IKanBanProperties> = observer(

{/* target/due date */}
{display_properties && display_properties?.due_date && (
<IssuePropertyStartDate
<IssuePropertyDate
value={issue?.target_date || null}
onChange={(date: string) => handleTargetDate(date)}
disabled={false}
Expand Down
31 changes: 27 additions & 4 deletions web/components/issues/issue-layouts/kanban/root.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import React from "react";
// react beautiful dnd
import { FC } from "react";
import { DragDropContext } from "@hello-pangea/dnd";
// mobx
import { observer } from "mobx-react-lite";
// components
import { KanBanSwimLanes } from "./swimlanes";
import { KanBan } from "./default";
// store
import { useMobxStore } from "lib/mobx/store-provider";
import { RootStore } from "store/root";
// constants
import { ISSUE_STATE_GROUPS, ISSUE_PRIORITIES } from "constants/issue";

export interface IKanBanLayout {}

export const KanBanLayout: React.FC = observer(() => {
export const KanBanLayout: FC = observer(() => {
const {
project: projectStore,
issue: issueStore,
issueFilter: issueFilterStore,
issueKanBanView: issueKanBanViewStore,
Expand Down Expand Up @@ -55,6 +56,14 @@ export const KanBanLayout: React.FC = observer(() => {
issueKanBanViewStore.handleKanBanToggle(toggle, value);
};

const states = projectStore?.projectStates || null;
const priorities = ISSUE_PRIORITIES || null;
const labels = projectStore?.projectLabels || null;
const members = projectStore?.projectMembers || null;
const stateGroups = ISSUE_STATE_GROUPS || null;
const projects = projectStore?.projectStates || null;
const estimates = null;

return (
<div className={`relative min-w-full w-max min-h-full h-max bg-custom-background-90 px-3`}>
<DragDropContext onDragEnd={onDragEnd}>
Expand All @@ -67,6 +76,13 @@ export const KanBanLayout: React.FC = observer(() => {
display_properties={display_properties}
kanBanToggle={issueKanBanViewStore?.kanBanToggle}
handleKanBanToggle={handleKanBanToggle}
// states={states}
// stateGroups={stateGroups}
// priorities={priorities}
// labels={labels}
// members={members}
// projects={projects}
// estimates={estimates}
/>
) : (
<KanBanSwimLanes
Expand All @@ -77,6 +93,13 @@ export const KanBanLayout: React.FC = observer(() => {
display_properties={display_properties}
kanBanToggle={issueKanBanViewStore?.kanBanToggle}
handleKanBanToggle={handleKanBanToggle}
// states={states}
// stateGroups={stateGroups}
// priorities={priorities}
// labels={labels}
// members={members}
// projects={projects}
// estimates={estimates}
/>
)}
</DragDropContext>
Expand Down
41 changes: 26 additions & 15 deletions web/components/issues/issue-layouts/list/block.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,52 @@
import { FC } from "react";
// components
import { KanBanProperties } from "./properties";
// ui
import { Tooltip } from "@plane/ui";

interface IssueBlockProps {
columnId: string;
issues: any;
handleIssues?: (group_by: string | null, issue: any) => void;
display_properties: any;
states: any;
labels: any;
members: any;
priorities: any;
}

export const IssueBlock = ({ columnId, issues, handleIssues, display_properties }: IssueBlockProps) => (
<>
{issues && issues.length > 0 ? (
<>
{issues.map((issue: any, index: any) => (
export const IssueBlock: FC<IssueBlockProps> = (props) => {
const { columnId, issues, handleIssues, display_properties, states, labels, members, priorities } = props;

return (
<>
{issues &&
issues?.length > 0 &&
issues.map((issue: any, index: any) => (
<div
key={index}
className={`text-sm p-3 shadow-custom-shadow-2xs transition-all bg-custom-background-100 flex items-center flex-wrap gap-3 border-b border-custom-border-200`}
className={`text-sm p-3 shadow-custom-shadow-2xs transition-all bg-custom-background-100 flex items-center gap-3 border-b border-custom-border-200`}
>
{display_properties && display_properties?.key && (
<div className="flex-shrink-0 text-xs text-custom-text-300">ONE-{issue.sequence_id}</div>
)}
<div className="line-clamp-1 text-sm font-medium text-custom-text-100">{issue.name}</div>
<Tooltip tooltipHeading="Title" tooltipContent={issue.name}>
<div className="line-clamp-1 text-sm font-medium text-custom-text-100">{issue.name}</div>
</Tooltip>
<div className="ml-auto flex-shrink-0">
<KanBanProperties
columnId={columnId}
issue={issue}
handleIssues={handleIssues}
display_properties={display_properties}
states={states}
labels={labels}
members={members}
priorities={priorities}
/>
</div>
</div>
))}
</>
) : (
<div className="absolute top-0 left-0 w-full h-full flex items-center justify-center">
No issues are available
</div>
)}
</>
);
</>
);
};
31 changes: 28 additions & 3 deletions web/components/issues/issue-layouts/list/cycle-root.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import React from "react";
// mobx
import { observer } from "mobx-react-lite";
// components
import { List } from "./default";
// store
import { useMobxStore } from "lib/mobx/store-provider";
import { RootStore } from "store/root";
// constants
import { ISSUE_STATE_GROUPS, ISSUE_PRIORITIES } from "constants/issue";

export interface ICycleListLayout {}

export const CycleListLayout: React.FC = observer(() => {
const { issueFilter: issueFilterStore, cycleIssue: cycleIssueStore }: RootStore = useMobxStore();
const {
project: projectStore,
issueFilter: issueFilterStore,
cycleIssue: cycleIssueStore,
}: RootStore = useMobxStore();

const issues = cycleIssueStore?.getIssues;

Expand All @@ -22,9 +27,29 @@ export const CycleListLayout: React.FC = observer(() => {
cycleIssueStore.updateIssueStructure(group_by, null, issue);
};

const states = projectStore?.projectStates || null;
const priorities = ISSUE_PRIORITIES || null;
const labels = projectStore?.projectLabels || null;
const members = projectStore?.projectMembers || null;
const stateGroups = ISSUE_STATE_GROUPS || null;
const projects = projectStore?.projectStates || null;
const estimates = null;

return (
<div className={`relative w-full h-full bg-custom-background-90`}>
<List issues={issues} group_by={group_by} handleIssues={updateIssue} display_properties={display_properties} />
<List
issues={issues}
group_by={group_by}
handleIssues={updateIssue}
display_properties={display_properties}
states={states}
stateGroups={stateGroups}
priorities={priorities}
labels={labels}
members={members}
projects={projects}
estimates={estimates}
/>
</div>
);
});
Loading

0 comments on commit 123634f

Please sign in to comment.