mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
Merge branch 'develop' of gurusainath:makeplane/plane into feat/mobx-global-views
This commit is contained in:
commit
bc694bb742
@ -262,7 +262,7 @@ class CycleAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Cycle with the same external id and external source already exists",
|
"error": "Cycle with the same external id and external source already exists",
|
||||||
"cycle": str(cycle.id),
|
"id": str(cycle.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
@ -325,7 +325,7 @@ class CycleAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Cycle with the same external id and external source already exists",
|
"error": "Cycle with the same external id and external source already exists",
|
||||||
"cycle_id": str(cycle.id),
|
"id": str(cycle.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
|
@ -239,7 +239,7 @@ class IssueAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Issue with the same external id and external source already exists",
|
"error": "Issue with the same external id and external source already exists",
|
||||||
"issue_id": str(issue.id),
|
"id": str(issue.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
@ -286,14 +286,16 @@ class IssueAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
and Issue.objects.filter(
|
and Issue.objects.filter(
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
workspace__slug=slug,
|
workspace__slug=slug,
|
||||||
external_source=request.data.get("external_source", issue.external_source),
|
external_source=request.data.get(
|
||||||
|
"external_source", issue.external_source
|
||||||
|
),
|
||||||
external_id=request.data.get("external_id"),
|
external_id=request.data.get("external_id"),
|
||||||
).exists()
|
).exists()
|
||||||
):
|
):
|
||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Issue with the same external id and external source already exists",
|
"error": "Issue with the same external id and external source already exists",
|
||||||
"issue_id": str(issue.id),
|
"id": str(issue.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
@ -362,6 +364,30 @@ class LabelAPIEndpoint(BaseAPIView):
|
|||||||
try:
|
try:
|
||||||
serializer = LabelSerializer(data=request.data)
|
serializer = LabelSerializer(data=request.data)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
|
if (
|
||||||
|
request.data.get("external_id")
|
||||||
|
and request.data.get("external_source")
|
||||||
|
and Label.objects.filter(
|
||||||
|
project_id=project_id,
|
||||||
|
workspace__slug=slug,
|
||||||
|
external_source=request.data.get("external_source"),
|
||||||
|
external_id=request.data.get("external_id"),
|
||||||
|
).exists()
|
||||||
|
):
|
||||||
|
label = Label.objects.filter(
|
||||||
|
workspace__slug=slug,
|
||||||
|
project_id=project_id,
|
||||||
|
external_id=request.data.get("external_id"),
|
||||||
|
external_source=request.data.get("external_source"),
|
||||||
|
).first()
|
||||||
|
return Response(
|
||||||
|
{
|
||||||
|
"error": "Label with the same external id and external source already exists",
|
||||||
|
"id": str(label.id),
|
||||||
|
},
|
||||||
|
status=status.HTTP_409_CONFLICT,
|
||||||
|
)
|
||||||
|
|
||||||
serializer.save(project_id=project_id)
|
serializer.save(project_id=project_id)
|
||||||
return Response(
|
return Response(
|
||||||
serializer.data, status=status.HTTP_201_CREATED
|
serializer.data, status=status.HTTP_201_CREATED
|
||||||
@ -370,11 +396,17 @@ class LabelAPIEndpoint(BaseAPIView):
|
|||||||
serializer.errors, status=status.HTTP_400_BAD_REQUEST
|
serializer.errors, status=status.HTTP_400_BAD_REQUEST
|
||||||
)
|
)
|
||||||
except IntegrityError:
|
except IntegrityError:
|
||||||
|
label = Label.objects.filter(
|
||||||
|
workspace__slug=slug,
|
||||||
|
project_id=project_id,
|
||||||
|
name=request.data.get("name"),
|
||||||
|
).first()
|
||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Label with the same name already exists in the project"
|
"error": "Label with the same name already exists in the project",
|
||||||
|
"id": str(label.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_400_BAD_REQUEST,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get(self, request, slug, project_id, pk=None):
|
def get(self, request, slug, project_id, pk=None):
|
||||||
@ -401,6 +433,25 @@ class LabelAPIEndpoint(BaseAPIView):
|
|||||||
label = self.get_queryset().get(pk=pk)
|
label = self.get_queryset().get(pk=pk)
|
||||||
serializer = LabelSerializer(label, data=request.data, partial=True)
|
serializer = LabelSerializer(label, data=request.data, partial=True)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
|
if (
|
||||||
|
str(request.data.get("external_id"))
|
||||||
|
and (label.external_id != str(request.data.get("external_id")))
|
||||||
|
and Issue.objects.filter(
|
||||||
|
project_id=project_id,
|
||||||
|
workspace__slug=slug,
|
||||||
|
external_source=request.data.get(
|
||||||
|
"external_source", label.external_source
|
||||||
|
),
|
||||||
|
external_id=request.data.get("external_id"),
|
||||||
|
).exists()
|
||||||
|
):
|
||||||
|
return Response(
|
||||||
|
{
|
||||||
|
"error": "Label with the same external id and external source already exists",
|
||||||
|
"id": str(label.id),
|
||||||
|
},
|
||||||
|
status=status.HTTP_409_CONFLICT,
|
||||||
|
)
|
||||||
serializer.save()
|
serializer.save()
|
||||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
@ -151,7 +151,7 @@ class ModuleAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Module with the same external id and external source already exists",
|
"error": "Module with the same external id and external source already exists",
|
||||||
"module_id": str(module.id),
|
"id": str(module.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
@ -185,7 +185,7 @@ class ModuleAPIEndpoint(WebhookMixin, BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "Module with the same external id and external source already exists",
|
"error": "Module with the same external id and external source already exists",
|
||||||
"module_id": str(module.id),
|
"id": str(module.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
|
@ -57,7 +57,7 @@ class StateAPIEndpoint(BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "State with the same external id and external source already exists",
|
"error": "State with the same external id and external source already exists",
|
||||||
"state_id": str(state.id),
|
"id": str(state.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
@ -128,7 +128,7 @@ class StateAPIEndpoint(BaseAPIView):
|
|||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"error": "State with the same external id and external source already exists",
|
"error": "State with the same external id and external source already exists",
|
||||||
"state_id": str(state.id),
|
"id": str(state.id),
|
||||||
},
|
},
|
||||||
status=status.HTTP_409_CONFLICT,
|
status=status.HTTP_409_CONFLICT,
|
||||||
)
|
)
|
||||||
|
@ -145,6 +145,23 @@ def dashboard_assigned_issues(self, request, slug):
|
|||||||
)
|
)
|
||||||
).order_by("priority_order")
|
).order_by("priority_order")
|
||||||
|
|
||||||
|
if issue_type == "pending":
|
||||||
|
pending_issues_count = assigned_issues.filter(
|
||||||
|
state__group__in=["backlog", "started", "unstarted"]
|
||||||
|
).count()
|
||||||
|
pending_issues = assigned_issues.filter(
|
||||||
|
state__group__in=["backlog", "started", "unstarted"]
|
||||||
|
)[:5]
|
||||||
|
return Response(
|
||||||
|
{
|
||||||
|
"issues": IssueSerializer(
|
||||||
|
pending_issues, many=True, expand=self.expand
|
||||||
|
).data,
|
||||||
|
"count": pending_issues_count,
|
||||||
|
},
|
||||||
|
status=status.HTTP_200_OK,
|
||||||
|
)
|
||||||
|
|
||||||
if issue_type == "completed":
|
if issue_type == "completed":
|
||||||
completed_issues_count = assigned_issues.filter(
|
completed_issues_count = assigned_issues.filter(
|
||||||
state__group__in=["completed"]
|
state__group__in=["completed"]
|
||||||
@ -257,6 +274,23 @@ def dashboard_created_issues(self, request, slug):
|
|||||||
)
|
)
|
||||||
).order_by("priority_order")
|
).order_by("priority_order")
|
||||||
|
|
||||||
|
if issue_type == "pending":
|
||||||
|
pending_issues_count = created_issues.filter(
|
||||||
|
state__group__in=["backlog", "started", "unstarted"]
|
||||||
|
).count()
|
||||||
|
pending_issues = created_issues.filter(
|
||||||
|
state__group__in=["backlog", "started", "unstarted"]
|
||||||
|
)[:5]
|
||||||
|
return Response(
|
||||||
|
{
|
||||||
|
"issues": IssueSerializer(
|
||||||
|
pending_issues, many=True, expand=self.expand
|
||||||
|
).data,
|
||||||
|
"count": pending_issues_count,
|
||||||
|
},
|
||||||
|
status=status.HTTP_200_OK,
|
||||||
|
)
|
||||||
|
|
||||||
if issue_type == "completed":
|
if issue_type == "completed":
|
||||||
completed_issues_count = created_issues.filter(
|
completed_issues_count = created_issues.filter(
|
||||||
state__group__in=["completed"]
|
state__group__in=["completed"]
|
||||||
|
@ -353,13 +353,18 @@ def track_assignees(
|
|||||||
issue_activities,
|
issue_activities,
|
||||||
epoch,
|
epoch,
|
||||||
):
|
):
|
||||||
requested_assignees = set(
|
requested_assignees = (
|
||||||
[str(asg) for asg in requested_data.get("assignee_ids", [])]
|
set([str(asg) for asg in requested_data.get("assignee_ids", [])])
|
||||||
|
if requested_data is not None
|
||||||
|
else set()
|
||||||
)
|
)
|
||||||
current_assignees = set(
|
current_assignees = (
|
||||||
[str(asg) for asg in current_instance.get("assignee_ids", [])]
|
set([str(asg) for asg in current_instance.get("assignee_ids", [])])
|
||||||
|
if current_instance is not None
|
||||||
|
else set()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
added_assignees = requested_assignees - current_assignees
|
added_assignees = requested_assignees - current_assignees
|
||||||
dropped_assginees = current_assignees - requested_assignees
|
dropped_assginees = current_assignees - requested_assignees
|
||||||
|
|
||||||
@ -547,6 +552,20 @@ def create_issue_activity(
|
|||||||
epoch=epoch,
|
epoch=epoch,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
requested_data = (
|
||||||
|
json.loads(requested_data) if requested_data is not None else None
|
||||||
|
)
|
||||||
|
if requested_data.get("assignee_ids") is not None:
|
||||||
|
track_assignees(
|
||||||
|
requested_data,
|
||||||
|
current_instance,
|
||||||
|
issue_id,
|
||||||
|
project_id,
|
||||||
|
workspace_id,
|
||||||
|
actor_id,
|
||||||
|
issue_activities,
|
||||||
|
epoch,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def update_issue_activity(
|
def update_issue_activity(
|
||||||
|
@ -172,4 +172,9 @@ def create_user_notification(sender, instance, created, **kwargs):
|
|||||||
from plane.db.models import UserNotificationPreference
|
from plane.db.models import UserNotificationPreference
|
||||||
UserNotificationPreference.objects.create(
|
UserNotificationPreference.objects.create(
|
||||||
user=instance,
|
user=instance,
|
||||||
|
property_change=False,
|
||||||
|
state_change=False,
|
||||||
|
comment=False,
|
||||||
|
mention=False,
|
||||||
|
issue_completed=False,
|
||||||
)
|
)
|
||||||
|
@ -49,7 +49,7 @@ function buildLocalImage() {
|
|||||||
cd $PLANE_TEMP_CODE_DIR
|
cd $PLANE_TEMP_CODE_DIR
|
||||||
if [ "$BRANCH" == "master" ];
|
if [ "$BRANCH" == "master" ];
|
||||||
then
|
then
|
||||||
APP_RELEASE=latest
|
export APP_RELEASE=latest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker compose -f build.yml build --no-cache >&2
|
docker compose -f build.yml build --no-cache >&2
|
||||||
@ -205,6 +205,11 @@ else
|
|||||||
PULL_POLICY=never
|
PULL_POLICY=never
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$BRANCH" == "master" ];
|
||||||
|
then
|
||||||
|
export APP_RELEASE=latest
|
||||||
|
fi
|
||||||
|
|
||||||
# REMOVE SPECIAL CHARACTERS FROM BRANCH NAME
|
# REMOVE SPECIAL CHARACTERS FROM BRANCH NAME
|
||||||
if [ "$BRANCH" != "master" ];
|
if [ "$BRANCH" != "master" ];
|
||||||
then
|
then
|
||||||
|
3
packages/types/src/dashboard.d.ts
vendored
3
packages/types/src/dashboard.d.ts
vendored
@ -13,9 +13,10 @@ export type TWidgetKeys =
|
|||||||
| "recent_projects"
|
| "recent_projects"
|
||||||
| "recent_collaborators";
|
| "recent_collaborators";
|
||||||
|
|
||||||
export type TIssuesListTypes = "upcoming" | "overdue" | "completed";
|
export type TIssuesListTypes = "pending" | "upcoming" | "overdue" | "completed";
|
||||||
|
|
||||||
export type TDurationFilterOptions =
|
export type TDurationFilterOptions =
|
||||||
|
| "none"
|
||||||
| "today"
|
| "today"
|
||||||
| "this_week"
|
| "this_week"
|
||||||
| "this_month"
|
| "this_month"
|
||||||
|
@ -125,7 +125,7 @@ export const SidebarProgressStats: React.FC<Props> = ({
|
|||||||
</Tab>
|
</Tab>
|
||||||
</Tab.List>
|
</Tab.List>
|
||||||
<Tab.Panels className="flex w-full items-center justify-between text-custom-text-200">
|
<Tab.Panels className="flex w-full items-center justify-between text-custom-text-200">
|
||||||
<Tab.Panel as="div" className="flex h-44 w-full flex-col gap-1.5 overflow-y-auto pt-3.5">
|
<Tab.Panel as="div" className="flex min-h-44 w-full flex-col gap-1.5 overflow-y-auto pt-3.5">
|
||||||
{distribution?.assignees.length > 0 ? (
|
{distribution?.assignees.length > 0 ? (
|
||||||
distribution.assignees.map((assignee, index) => {
|
distribution.assignees.map((assignee, index) => {
|
||||||
if (assignee.assignee_id)
|
if (assignee.assignee_id)
|
||||||
|
@ -17,7 +17,7 @@ import { getCustomDates, getRedirectionFilters } from "helpers/dashboard.helper"
|
|||||||
// types
|
// types
|
||||||
import { TAssignedIssuesWidgetFilters, TAssignedIssuesWidgetResponse } from "@plane/types";
|
import { TAssignedIssuesWidgetFilters, TAssignedIssuesWidgetResponse } from "@plane/types";
|
||||||
// constants
|
// constants
|
||||||
import { ISSUES_TABS_LIST } from "constants/dashboard";
|
import { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard";
|
||||||
|
|
||||||
const WIDGET_KEY = "assigned_issues";
|
const WIDGET_KEY = "assigned_issues";
|
||||||
|
|
||||||
@ -30,6 +30,8 @@ export const AssignedIssuesWidget: React.FC<WidgetProps> = observer((props) => {
|
|||||||
// derived values
|
// derived values
|
||||||
const widgetDetails = getWidgetDetails(workspaceSlug, dashboardId, WIDGET_KEY);
|
const widgetDetails = getWidgetDetails(workspaceSlug, dashboardId, WIDGET_KEY);
|
||||||
const widgetStats = getWidgetStats<TAssignedIssuesWidgetResponse>(workspaceSlug, dashboardId, WIDGET_KEY);
|
const widgetStats = getWidgetStats<TAssignedIssuesWidgetResponse>(workspaceSlug, dashboardId, WIDGET_KEY);
|
||||||
|
const selectedTab = widgetDetails?.widget_filters.tab ?? "pending";
|
||||||
|
const selectedDurationFilter = widgetDetails?.widget_filters.target_date ?? "none";
|
||||||
|
|
||||||
const handleUpdateFilters = async (filters: Partial<TAssignedIssuesWidgetFilters>) => {
|
const handleUpdateFilters = async (filters: Partial<TAssignedIssuesWidgetFilters>) => {
|
||||||
if (!widgetDetails) return;
|
if (!widgetDetails) return;
|
||||||
@ -41,68 +43,79 @@ export const AssignedIssuesWidget: React.FC<WidgetProps> = observer((props) => {
|
|||||||
filters,
|
filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const filterDates = getCustomDates(filters.target_date ?? selectedDurationFilter);
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
issue_type: filters.tab ?? widgetDetails.widget_filters.tab ?? "upcoming",
|
issue_type: filters.tab ?? selectedTab,
|
||||||
target_date: getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "this_week"),
|
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
||||||
expand: "issue_relation",
|
expand: "issue_relation",
|
||||||
}).finally(() => setFetching(false));
|
}).finally(() => setFetching(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const filterDates = getCustomDates(widgetDetails?.widget_filters.target_date ?? "this_week");
|
const filterDates = getCustomDates(selectedDurationFilter);
|
||||||
|
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
issue_type: widgetDetails?.widget_filters.tab ?? "upcoming",
|
issue_type: selectedTab,
|
||||||
target_date: filterDates,
|
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
||||||
expand: "issue_relation",
|
expand: "issue_relation",
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const filterParams = getRedirectionFilters(widgetDetails?.widget_filters.tab ?? "upcoming");
|
const filterParams = getRedirectionFilters(selectedTab);
|
||||||
|
const tabsList = selectedDurationFilter === "none" ? UNFILTERED_ISSUES_TABS_LIST : FILTERED_ISSUES_TABS_LIST;
|
||||||
|
|
||||||
if (!widgetDetails || !widgetStats) return <WidgetLoader widgetKey={WIDGET_KEY} />;
|
if (!widgetDetails || !widgetStats) return <WidgetLoader widgetKey={WIDGET_KEY} />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full hover:shadow-custom-shadow-4xl duration-300 flex flex-col min-h-96">
|
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full hover:shadow-custom-shadow-4xl duration-300 flex flex-col min-h-96">
|
||||||
<div className="flex items-start justify-between gap-2 p-6 pl-7">
|
<div className="flex items-center justify-between gap-2 p-6 pl-7">
|
||||||
<div>
|
|
||||||
<Link
|
<Link
|
||||||
href={`/${workspaceSlug}/workspace-views/assigned/${filterParams}`}
|
href={`/${workspaceSlug}/workspace-views/assigned/${filterParams}`}
|
||||||
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
||||||
>
|
>
|
||||||
Assigned to you
|
Assigned to you
|
||||||
</Link>
|
</Link>
|
||||||
<p className="mt-3 text-xs font-medium text-custom-text-300">
|
|
||||||
Filtered by{" "}
|
|
||||||
<span className="border-[0.5px] border-custom-border-300 rounded py-1 px-2 ml-0.5">Due date</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<DurationFilterDropdown
|
<DurationFilterDropdown
|
||||||
value={widgetDetails.widget_filters.target_date ?? "this_week"}
|
value={selectedDurationFilter}
|
||||||
onChange={(val) =>
|
onChange={(val) => {
|
||||||
|
if (val === selectedDurationFilter) return;
|
||||||
|
|
||||||
|
// switch to pending tab if target date is changed to none
|
||||||
|
if (val === "none" && selectedTab !== "completed") {
|
||||||
|
handleUpdateFilters({ target_date: val, tab: "pending" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// switch to upcoming tab if target date is changed to other than none
|
||||||
|
if (val !== "none" && selectedDurationFilter === "none" && selectedTab !== "completed") {
|
||||||
handleUpdateFilters({
|
handleUpdateFilters({
|
||||||
target_date: val,
|
target_date: val,
|
||||||
})
|
tab: "upcoming",
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleUpdateFilters({ target_date: val });
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Tab.Group
|
<Tab.Group
|
||||||
as="div"
|
as="div"
|
||||||
defaultIndex={ISSUES_TABS_LIST.findIndex((t) => t.key === widgetDetails.widget_filters.tab ?? "upcoming")}
|
selectedIndex={tabsList.findIndex((tab) => tab.key === selectedTab)}
|
||||||
onChange={(i) => {
|
onChange={(i) => {
|
||||||
const selectedTab = ISSUES_TABS_LIST[i];
|
const selectedTab = tabsList[i];
|
||||||
handleUpdateFilters({ tab: selectedTab.key ?? "upcoming" });
|
handleUpdateFilters({ tab: selectedTab?.key ?? "pending" });
|
||||||
}}
|
}}
|
||||||
className="h-full flex flex-col"
|
className="h-full flex flex-col"
|
||||||
>
|
>
|
||||||
<div className="px-6">
|
<div className="px-6">
|
||||||
<TabsList />
|
<TabsList durationFilter={selectedDurationFilter} selectedTab={selectedTab} />
|
||||||
</div>
|
</div>
|
||||||
<Tab.Panels as="div" className="h-full">
|
<Tab.Panels as="div" className="h-full">
|
||||||
{ISSUES_TABS_LIST.map((tab) => (
|
{tabsList.map((tab) => (
|
||||||
<Tab.Panel key={tab.key} as="div" className="h-full flex flex-col">
|
<Tab.Panel key={tab.key} as="div" className="h-full flex flex-col">
|
||||||
<WidgetIssuesList
|
<WidgetIssuesList
|
||||||
issues={widgetStats.issues}
|
issues={widgetStats.issues}
|
||||||
|
@ -17,7 +17,7 @@ import { getCustomDates, getRedirectionFilters } from "helpers/dashboard.helper"
|
|||||||
// types
|
// types
|
||||||
import { TCreatedIssuesWidgetFilters, TCreatedIssuesWidgetResponse } from "@plane/types";
|
import { TCreatedIssuesWidgetFilters, TCreatedIssuesWidgetResponse } from "@plane/types";
|
||||||
// constants
|
// constants
|
||||||
import { ISSUES_TABS_LIST } from "constants/dashboard";
|
import { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard";
|
||||||
|
|
||||||
const WIDGET_KEY = "created_issues";
|
const WIDGET_KEY = "created_issues";
|
||||||
|
|
||||||
@ -30,6 +30,8 @@ export const CreatedIssuesWidget: React.FC<WidgetProps> = observer((props) => {
|
|||||||
// derived values
|
// derived values
|
||||||
const widgetDetails = getWidgetDetails(workspaceSlug, dashboardId, WIDGET_KEY);
|
const widgetDetails = getWidgetDetails(workspaceSlug, dashboardId, WIDGET_KEY);
|
||||||
const widgetStats = getWidgetStats<TCreatedIssuesWidgetResponse>(workspaceSlug, dashboardId, WIDGET_KEY);
|
const widgetStats = getWidgetStats<TCreatedIssuesWidgetResponse>(workspaceSlug, dashboardId, WIDGET_KEY);
|
||||||
|
const selectedTab = widgetDetails?.widget_filters.tab ?? "pending";
|
||||||
|
const selectedDurationFilter = widgetDetails?.widget_filters.target_date ?? "none";
|
||||||
|
|
||||||
const handleUpdateFilters = async (filters: Partial<TCreatedIssuesWidgetFilters>) => {
|
const handleUpdateFilters = async (filters: Partial<TCreatedIssuesWidgetFilters>) => {
|
||||||
if (!widgetDetails) return;
|
if (!widgetDetails) return;
|
||||||
@ -41,64 +43,76 @@ export const CreatedIssuesWidget: React.FC<WidgetProps> = observer((props) => {
|
|||||||
filters,
|
filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const filterDates = getCustomDates(filters.target_date ?? selectedDurationFilter);
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
issue_type: filters.tab ?? widgetDetails.widget_filters.tab ?? "upcoming",
|
issue_type: filters.tab ?? selectedTab,
|
||||||
target_date: getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "this_week"),
|
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
||||||
}).finally(() => setFetching(false));
|
}).finally(() => setFetching(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const filterDates = getCustomDates(selectedDurationFilter);
|
||||||
|
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
issue_type: widgetDetails?.widget_filters.tab ?? "upcoming",
|
issue_type: selectedTab,
|
||||||
target_date: getCustomDates(widgetDetails?.widget_filters.target_date ?? "this_week"),
|
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const filterParams = getRedirectionFilters(widgetDetails?.widget_filters.tab ?? "upcoming");
|
const filterParams = getRedirectionFilters(selectedTab);
|
||||||
|
const tabsList = selectedDurationFilter === "none" ? UNFILTERED_ISSUES_TABS_LIST : FILTERED_ISSUES_TABS_LIST;
|
||||||
|
|
||||||
if (!widgetDetails || !widgetStats) return <WidgetLoader widgetKey={WIDGET_KEY} />;
|
if (!widgetDetails || !widgetStats) return <WidgetLoader widgetKey={WIDGET_KEY} />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full hover:shadow-custom-shadow-4xl duration-300 flex flex-col min-h-96">
|
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full hover:shadow-custom-shadow-4xl duration-300 flex flex-col min-h-96">
|
||||||
<div className="flex items-start justify-between gap-2 p-6 pl-7">
|
<div className="flex items-center justify-between gap-2 p-6 pl-7">
|
||||||
<div>
|
|
||||||
<Link
|
<Link
|
||||||
href={`/${workspaceSlug}/workspace-views/created/${filterParams}`}
|
href={`/${workspaceSlug}/workspace-views/created/${filterParams}`}
|
||||||
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
||||||
>
|
>
|
||||||
Created by you
|
Created by you
|
||||||
</Link>
|
</Link>
|
||||||
<p className="mt-3 text-xs font-medium text-custom-text-300">
|
|
||||||
Filtered by{" "}
|
|
||||||
<span className="border-[0.5px] border-custom-border-300 rounded py-1 px-2 ml-0.5">Due date</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<DurationFilterDropdown
|
<DurationFilterDropdown
|
||||||
value={widgetDetails.widget_filters.target_date ?? "this_week"}
|
value={selectedDurationFilter}
|
||||||
onChange={(val) =>
|
onChange={(val) => {
|
||||||
|
if (val === selectedDurationFilter) return;
|
||||||
|
|
||||||
|
// switch to pending tab if target date is changed to none
|
||||||
|
if (val === "none" && selectedTab !== "completed") {
|
||||||
|
handleUpdateFilters({ target_date: val, tab: "pending" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// switch to upcoming tab if target date is changed to other than none
|
||||||
|
if (val !== "none" && selectedDurationFilter === "none" && selectedTab !== "completed") {
|
||||||
handleUpdateFilters({
|
handleUpdateFilters({
|
||||||
target_date: val,
|
target_date: val,
|
||||||
})
|
tab: "upcoming",
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleUpdateFilters({ target_date: val });
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Tab.Group
|
<Tab.Group
|
||||||
as="div"
|
as="div"
|
||||||
defaultIndex={ISSUES_TABS_LIST.findIndex((t) => t.key === widgetDetails.widget_filters.tab ?? "upcoming")}
|
selectedIndex={tabsList.findIndex((tab) => tab.key === selectedTab)}
|
||||||
onChange={(i) => {
|
onChange={(i) => {
|
||||||
const selectedTab = ISSUES_TABS_LIST[i];
|
const selectedTab = tabsList[i];
|
||||||
handleUpdateFilters({ tab: selectedTab.key ?? "upcoming" });
|
handleUpdateFilters({ tab: selectedTab.key ?? "pending" });
|
||||||
}}
|
}}
|
||||||
className="h-full flex flex-col"
|
className="h-full flex flex-col"
|
||||||
>
|
>
|
||||||
<div className="px-6">
|
<div className="px-6">
|
||||||
<TabsList />
|
<TabsList durationFilter={selectedDurationFilter} selectedTab={selectedTab} />
|
||||||
</div>
|
</div>
|
||||||
<Tab.Panels as="div" className="h-full">
|
<Tab.Panels as="div" className="h-full">
|
||||||
{ISSUES_TABS_LIST.map((tab) => (
|
{tabsList.map((tab) => (
|
||||||
<Tab.Panel key={tab.key} as="div" className="h-full flex flex-col">
|
<Tab.Panel key={tab.key} as="div" className="h-full flex flex-col">
|
||||||
<WidgetIssuesList
|
<WidgetIssuesList
|
||||||
issues={widgetStats.issues}
|
issues={widgetStats.issues}
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
IssueListItemProps,
|
IssueListItemProps,
|
||||||
} from "components/dashboard/widgets";
|
} from "components/dashboard/widgets";
|
||||||
// ui
|
// ui
|
||||||
import { Loader, getButtonStyling } from "@plane/ui";
|
import { getButtonStyling } from "@plane/ui";
|
||||||
// helpers
|
// helpers
|
||||||
import { cn } from "helpers/common.helper";
|
import { cn } from "helpers/common.helper";
|
||||||
import { getRedirectionFilters } from "helpers/dashboard.helper";
|
import { getRedirectionFilters } from "helpers/dashboard.helper";
|
||||||
@ -41,16 +41,18 @@ export const WidgetIssuesList: React.FC<WidgetIssuesListProps> = (props) => {
|
|||||||
const filterParams = getRedirectionFilters(tab);
|
const filterParams = getRedirectionFilters(tab);
|
||||||
|
|
||||||
const ISSUE_LIST_ITEM: {
|
const ISSUE_LIST_ITEM: {
|
||||||
[key in string]: {
|
[key: string]: {
|
||||||
[key in TIssuesListTypes]: React.FC<IssueListItemProps>;
|
[key in TIssuesListTypes]: React.FC<IssueListItemProps>;
|
||||||
};
|
};
|
||||||
} = {
|
} = {
|
||||||
assigned: {
|
assigned: {
|
||||||
|
pending: AssignedUpcomingIssueListItem,
|
||||||
upcoming: AssignedUpcomingIssueListItem,
|
upcoming: AssignedUpcomingIssueListItem,
|
||||||
overdue: AssignedOverdueIssueListItem,
|
overdue: AssignedOverdueIssueListItem,
|
||||||
completed: AssignedCompletedIssueListItem,
|
completed: AssignedCompletedIssueListItem,
|
||||||
},
|
},
|
||||||
created: {
|
created: {
|
||||||
|
pending: CreatedUpcomingIssueListItem,
|
||||||
upcoming: CreatedUpcomingIssueListItem,
|
upcoming: CreatedUpcomingIssueListItem,
|
||||||
overdue: CreatedOverdueIssueListItem,
|
overdue: CreatedOverdueIssueListItem,
|
||||||
completed: CreatedCompletedIssueListItem,
|
completed: CreatedCompletedIssueListItem,
|
||||||
@ -61,12 +63,7 @@ export const WidgetIssuesList: React.FC<WidgetIssuesListProps> = (props) => {
|
|||||||
<>
|
<>
|
||||||
<div className="h-full">
|
<div className="h-full">
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<Loader className="mt-7 mx-6 space-y-4">
|
<></>
|
||||||
<Loader.Item height="25px" />
|
|
||||||
<Loader.Item height="25px" />
|
|
||||||
<Loader.Item height="25px" />
|
|
||||||
<Loader.Item height="25px" />
|
|
||||||
</Loader>
|
|
||||||
) : issues.length > 0 ? (
|
) : issues.length > 0 ? (
|
||||||
<>
|
<>
|
||||||
<div className="mt-7 mx-6 border-b-[0.5px] border-custom-border-200 grid grid-cols-6 gap-1 text-xs text-custom-text-300 pb-1">
|
<div className="mt-7 mx-6 border-b-[0.5px] border-custom-border-200 grid grid-cols-6 gap-1 text-xs text-custom-text-300 pb-1">
|
||||||
@ -81,7 +78,7 @@ export const WidgetIssuesList: React.FC<WidgetIssuesListProps> = (props) => {
|
|||||||
{totalIssues}
|
{totalIssues}
|
||||||
</span>
|
</span>
|
||||||
</h6>
|
</h6>
|
||||||
{tab === "upcoming" && <h6 className="text-center">Due date</h6>}
|
{["upcoming", "pending"].includes(tab) && <h6 className="text-center">Due date</h6>}
|
||||||
{tab === "overdue" && <h6 className="text-center">Due by</h6>}
|
{tab === "overdue" && <h6 className="text-center">Due by</h6>}
|
||||||
{type === "assigned" && tab !== "completed" && <h6 className="text-center">Blocked by</h6>}
|
{type === "assigned" && tab !== "completed" && <h6 className="text-center">Blocked by</h6>}
|
||||||
{type === "created" && <h6 className="text-center">Assigned to</h6>}
|
{type === "created" && <h6 className="text-center">Assigned to</h6>}
|
||||||
|
@ -1,26 +1,63 @@
|
|||||||
|
import { observer } from "mobx-react";
|
||||||
import { Tab } from "@headlessui/react";
|
import { Tab } from "@headlessui/react";
|
||||||
// helpers
|
// helpers
|
||||||
import { cn } from "helpers/common.helper";
|
import { cn } from "helpers/common.helper";
|
||||||
|
// types
|
||||||
|
import { TDurationFilterOptions, TIssuesListTypes } from "@plane/types";
|
||||||
// constants
|
// constants
|
||||||
import { ISSUES_TABS_LIST } from "constants/dashboard";
|
import { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard";
|
||||||
|
|
||||||
export const TabsList = () => (
|
type Props = {
|
||||||
|
durationFilter: TDurationFilterOptions;
|
||||||
|
selectedTab: TIssuesListTypes;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const TabsList: React.FC<Props> = observer((props) => {
|
||||||
|
const { durationFilter, selectedTab } = props;
|
||||||
|
|
||||||
|
const tabsList = durationFilter === "none" ? UNFILTERED_ISSUES_TABS_LIST : FILTERED_ISSUES_TABS_LIST;
|
||||||
|
const selectedTabIndex = tabsList.findIndex((tab) => tab.key === (selectedTab ?? "pending"));
|
||||||
|
|
||||||
|
return (
|
||||||
<Tab.List
|
<Tab.List
|
||||||
as="div"
|
as="div"
|
||||||
className="border-[0.5px] border-custom-border-200 rounded grid grid-cols-3 bg-custom-background-80"
|
className="relative border-[0.5px] border-custom-border-200 rounded bg-custom-background-80 grid"
|
||||||
|
style={{
|
||||||
|
gridTemplateColumns: `repeat(${tabsList.length}, 1fr)`,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{ISSUES_TABS_LIST.map((tab) => (
|
<div
|
||||||
|
className={cn("absolute bg-custom-background-100 rounded transition-all duration-500 ease-in-out", {
|
||||||
|
// right shadow
|
||||||
|
"shadow-[2px_0_8px_rgba(167,169,174,0.15)]": selectedTabIndex !== tabsList.length - 1,
|
||||||
|
// left shadow
|
||||||
|
"shadow-[-2px_0_8px_rgba(167,169,174,0.15)]": selectedTabIndex !== 0,
|
||||||
|
})}
|
||||||
|
style={{
|
||||||
|
height: "calc(100% - 1px)",
|
||||||
|
width: `${100 / tabsList.length}%`,
|
||||||
|
transform: `translateX(${selectedTabIndex * 100}%)`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{tabsList.map((tab) => (
|
||||||
<Tab
|
<Tab
|
||||||
key={tab.key}
|
key={tab.key}
|
||||||
className={({ selected }) =>
|
className={cn(
|
||||||
cn("font-semibold text-xs rounded py-1.5 focus:outline-none", {
|
"relative z-[1] font-semibold text-xs rounded py-1.5 text-custom-text-400 focus:outline-none",
|
||||||
"bg-custom-background-100 text-custom-text-300 shadow-[2px_0_8px_rgba(167,169,174,0.15)]": selected,
|
"transition duration-500",
|
||||||
"text-custom-text-400": !selected,
|
{
|
||||||
})
|
"text-custom-text-100 bg-custom-background-100": selectedTab === tab.key,
|
||||||
|
"hover:text-custom-text-300": selectedTab !== tab.key,
|
||||||
|
// // right shadow
|
||||||
|
// "shadow-[2px_0_8px_rgba(167,169,174,0.15)]": selectedTabIndex !== tabsList.length - 1,
|
||||||
|
// // left shadow
|
||||||
|
// "shadow-[-2px_0_8px_rgba(167,169,174,0.15)]": selectedTabIndex !== 0,
|
||||||
}
|
}
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{tab.label}
|
<span className="scale-110">{tab.label}</span>
|
||||||
</Tab>
|
</Tab>
|
||||||
))}
|
))}
|
||||||
</Tab.List>
|
</Tab.List>
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
@ -84,16 +84,18 @@ export const IssuesByPriorityWidget: React.FC<WidgetProps> = observer((props) =>
|
|||||||
filters,
|
filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const filterDates = getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "none");
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
target_date: getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "this_week"),
|
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const filterDates = getCustomDates(widgetDetails?.widget_filters.target_date ?? "none");
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
target_date: getCustomDates(widgetDetails?.widget_filters.target_date ?? "this_week"),
|
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
@ -129,21 +131,15 @@ export const IssuesByPriorityWidget: React.FC<WidgetProps> = observer((props) =>
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full py-6 hover:shadow-custom-shadow-4xl duration-300 overflow-hidden min-h-96 flex flex-col">
|
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full py-6 hover:shadow-custom-shadow-4xl duration-300 overflow-hidden min-h-96 flex flex-col">
|
||||||
<div className="flex items-start justify-between gap-2 pl-7 pr-6">
|
<div className="flex items-center justify-between gap-2 pl-7 pr-6">
|
||||||
<div>
|
|
||||||
<Link
|
<Link
|
||||||
href={`/${workspaceSlug}/workspace-views/assigned`}
|
href={`/${workspaceSlug}/workspace-views/assigned`}
|
||||||
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
||||||
>
|
>
|
||||||
Assigned by priority
|
Assigned by priority
|
||||||
</Link>
|
</Link>
|
||||||
<p className="mt-3 text-xs font-medium text-custom-text-300">
|
|
||||||
Filtered by{" "}
|
|
||||||
<span className="border-[0.5px] border-custom-border-300 rounded py-1 px-2 ml-0.5">Due date</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<DurationFilterDropdown
|
<DurationFilterDropdown
|
||||||
value={widgetDetails.widget_filters.target_date ?? "this_week"}
|
value={widgetDetails.widget_filters.target_date ?? "none"}
|
||||||
onChange={(val) =>
|
onChange={(val) =>
|
||||||
handleUpdateFilters({
|
handleUpdateFilters({
|
||||||
target_date: val,
|
target_date: val,
|
||||||
|
@ -43,17 +43,19 @@ export const IssuesByStateGroupWidget: React.FC<WidgetProps> = observer((props)
|
|||||||
filters,
|
filters,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const filterDates = getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "none");
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
target_date: getCustomDates(filters.target_date ?? widgetDetails.widget_filters.target_date ?? "this_week"),
|
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// fetch widget stats
|
// fetch widget stats
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const filterDates = getCustomDates(widgetDetails?.widget_filters.target_date ?? "none");
|
||||||
fetchWidgetStats(workspaceSlug, dashboardId, {
|
fetchWidgetStats(workspaceSlug, dashboardId, {
|
||||||
widget_key: WIDGET_KEY,
|
widget_key: WIDGET_KEY,
|
||||||
target_date: getCustomDates(widgetDetails?.widget_filters.target_date ?? "this_week"),
|
...(filterDates.trim() !== "" ? { target_date: filterDates } : {}),
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
@ -128,21 +130,15 @@ export const IssuesByStateGroupWidget: React.FC<WidgetProps> = observer((props)
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full py-6 hover:shadow-custom-shadow-4xl duration-300 overflow-hidden min-h-96 flex flex-col">
|
<div className="bg-custom-background-100 rounded-xl border-[0.5px] border-custom-border-200 w-full py-6 hover:shadow-custom-shadow-4xl duration-300 overflow-hidden min-h-96 flex flex-col">
|
||||||
<div className="flex items-start justify-between gap-2 pl-7 pr-6">
|
<div className="flex items-center justify-between gap-2 pl-7 pr-6">
|
||||||
<div>
|
|
||||||
<Link
|
<Link
|
||||||
href={`/${workspaceSlug}/workspace-views/assigned`}
|
href={`/${workspaceSlug}/workspace-views/assigned`}
|
||||||
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
className="text-lg font-semibold text-custom-text-300 hover:underline"
|
||||||
>
|
>
|
||||||
Assigned by state
|
Assigned by state
|
||||||
</Link>
|
</Link>
|
||||||
<p className="mt-3 text-xs font-medium text-custom-text-300">
|
|
||||||
Filtered by{" "}
|
|
||||||
<span className="border-[0.5px] border-custom-border-300 rounded py-1 px-2 ml-0.5">Due date</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<DurationFilterDropdown
|
<DurationFilterDropdown
|
||||||
value={widgetDetails.widget_filters.target_date ?? "this_week"}
|
value={widgetDetails.widget_filters.target_date ?? "none"}
|
||||||
onChange={(val) =>
|
onChange={(val) =>
|
||||||
handleUpdateFilters({
|
handleUpdateFilters({
|
||||||
target_date: val,
|
target_date: val,
|
||||||
|
@ -105,6 +105,7 @@ export const DateDropdown: React.FC<Props> = (props) => {
|
|||||||
tabIndex={tabIndex}
|
tabIndex={tabIndex}
|
||||||
className={cn("h-full", className)}
|
className={cn("h-full", className)}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
<Combobox.Button as={React.Fragment}>
|
<Combobox.Button as={React.Fragment}>
|
||||||
<button
|
<button
|
||||||
|
@ -11,11 +11,12 @@ import { TGroupedIssues, TIssue } from "@plane/types";
|
|||||||
import { IQuickActionProps } from "../list/list-view-types";
|
import { IQuickActionProps } from "../list/list-view-types";
|
||||||
import { EIssueActions } from "../types";
|
import { EIssueActions } from "../types";
|
||||||
import { handleDragDrop } from "./utils";
|
import { handleDragDrop } from "./utils";
|
||||||
import { useIssues } from "hooks/store";
|
import { useIssues, useUser } from "hooks/store";
|
||||||
import { ICycleIssues, ICycleIssuesFilter } from "store/issue/cycle";
|
import { ICycleIssues, ICycleIssuesFilter } from "store/issue/cycle";
|
||||||
import { IModuleIssues, IModuleIssuesFilter } from "store/issue/module";
|
import { IModuleIssues, IModuleIssuesFilter } from "store/issue/module";
|
||||||
import { IProjectIssues, IProjectIssuesFilter } from "store/issue/project";
|
import { IProjectIssues, IProjectIssuesFilter } from "store/issue/project";
|
||||||
import { IProjectViewIssues, IProjectViewIssuesFilter } from "store/issue/project-views";
|
import { IProjectViewIssues, IProjectViewIssuesFilter } from "store/issue/project-views";
|
||||||
|
import { EUserProjectRoles } from "constants/project";
|
||||||
|
|
||||||
interface IBaseCalendarRoot {
|
interface IBaseCalendarRoot {
|
||||||
issueStore: IProjectIssues | IModuleIssues | ICycleIssues | IProjectViewIssues;
|
issueStore: IProjectIssues | IModuleIssues | ICycleIssues | IProjectViewIssues;
|
||||||
@ -27,10 +28,11 @@ interface IBaseCalendarRoot {
|
|||||||
[EIssueActions.REMOVE]?: (issue: TIssue) => Promise<void>;
|
[EIssueActions.REMOVE]?: (issue: TIssue) => Promise<void>;
|
||||||
};
|
};
|
||||||
viewId?: string;
|
viewId?: string;
|
||||||
|
isCompletedCycle?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
|
export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
|
||||||
const { issueStore, issuesFilterStore, QuickActions, issueActions, viewId } = props;
|
const { issueStore, issuesFilterStore, QuickActions, issueActions, viewId, isCompletedCycle = false } = props;
|
||||||
|
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -39,6 +41,11 @@ export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
|
|||||||
// hooks
|
// hooks
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
const { issueMap } = useIssues();
|
const { issueMap } = useIssues();
|
||||||
|
const {
|
||||||
|
membership: { currentProjectRole },
|
||||||
|
} = useUser();
|
||||||
|
|
||||||
|
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
||||||
|
|
||||||
const displayFilters = issuesFilterStore.issueFilters?.displayFilters;
|
const displayFilters = issuesFilterStore.issueFilters?.displayFilters;
|
||||||
|
|
||||||
@ -107,10 +114,12 @@ export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
|
|||||||
? async () => handleIssues(issue.target_date ?? "", issue, EIssueActions.REMOVE)
|
? async () => handleIssues(issue.target_date ?? "", issue, EIssueActions.REMOVE)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
|
readOnly={!isEditingAllowed || isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
quickAddCallback={issueStore.quickAddIssue}
|
quickAddCallback={issueStore.quickAddIssue}
|
||||||
viewId={viewId}
|
viewId={viewId}
|
||||||
|
readOnly={!isEditingAllowed || isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
</DragDropContext>
|
</DragDropContext>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,11 +31,21 @@ type Props = {
|
|||||||
viewId?: string
|
viewId?: string
|
||||||
) => Promise<TIssue | undefined>;
|
) => Promise<TIssue | undefined>;
|
||||||
viewId?: string;
|
viewId?: string;
|
||||||
|
readOnly?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CalendarChart: React.FC<Props> = observer((props) => {
|
export const CalendarChart: React.FC<Props> = observer((props) => {
|
||||||
const { issuesFilterStore, issues, groupedIssueIds, layout, showWeekends, quickActions, quickAddCallback, viewId } =
|
const {
|
||||||
props;
|
issuesFilterStore,
|
||||||
|
issues,
|
||||||
|
groupedIssueIds,
|
||||||
|
layout,
|
||||||
|
showWeekends,
|
||||||
|
quickActions,
|
||||||
|
quickAddCallback,
|
||||||
|
viewId,
|
||||||
|
readOnly = false,
|
||||||
|
} = props;
|
||||||
// store hooks
|
// store hooks
|
||||||
const {
|
const {
|
||||||
issues: { viewFlags },
|
issues: { viewFlags },
|
||||||
@ -80,6 +90,7 @@ export const CalendarChart: React.FC<Props> = observer((props) => {
|
|||||||
quickActions={quickActions}
|
quickActions={quickActions}
|
||||||
quickAddCallback={quickAddCallback}
|
quickAddCallback={quickAddCallback}
|
||||||
viewId={viewId}
|
viewId={viewId}
|
||||||
|
readOnly={readOnly}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@ -95,6 +106,7 @@ export const CalendarChart: React.FC<Props> = observer((props) => {
|
|||||||
quickActions={quickActions}
|
quickActions={quickActions}
|
||||||
quickAddCallback={quickAddCallback}
|
quickAddCallback={quickAddCallback}
|
||||||
viewId={viewId}
|
viewId={viewId}
|
||||||
|
readOnly={readOnly}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,6 +28,7 @@ type Props = {
|
|||||||
viewId?: string
|
viewId?: string
|
||||||
) => Promise<TIssue | undefined>;
|
) => Promise<TIssue | undefined>;
|
||||||
viewId?: string;
|
viewId?: string;
|
||||||
|
readOnly?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
||||||
@ -41,6 +42,7 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
|||||||
disableIssueCreation,
|
disableIssueCreation,
|
||||||
quickAddCallback,
|
quickAddCallback,
|
||||||
viewId,
|
viewId,
|
||||||
|
readOnly = false,
|
||||||
} = props;
|
} = props;
|
||||||
const [showAllIssues, setShowAllIssues] = useState(false);
|
const [showAllIssues, setShowAllIssues] = useState(false);
|
||||||
const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month";
|
const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month";
|
||||||
@ -73,7 +75,7 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
|||||||
|
|
||||||
{/* content */}
|
{/* content */}
|
||||||
<div className="h-full w-full">
|
<div className="h-full w-full">
|
||||||
<Droppable droppableId={formattedDatePayload} isDropDisabled={false}>
|
<Droppable droppableId={formattedDatePayload} isDropDisabled={readOnly}>
|
||||||
{(provided, snapshot) => (
|
{(provided, snapshot) => (
|
||||||
<div
|
<div
|
||||||
className={`h-full w-full select-none overflow-y-auto ${
|
className={`h-full w-full select-none overflow-y-auto ${
|
||||||
@ -89,9 +91,10 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
|||||||
issueIdList={issueIdList}
|
issueIdList={issueIdList}
|
||||||
quickActions={quickActions}
|
quickActions={quickActions}
|
||||||
showAllIssues={showAllIssues}
|
showAllIssues={showAllIssues}
|
||||||
|
isDragDisabled={readOnly}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{enableQuickIssueCreate && !disableIssueCreation && (
|
{enableQuickIssueCreate && !disableIssueCreation && !readOnly && (
|
||||||
<div className="px-2 py-1">
|
<div className="px-2 py-1">
|
||||||
<CalendarQuickAddIssueForm
|
<CalendarQuickAddIssueForm
|
||||||
formKey="target_date"
|
formKey="target_date"
|
||||||
|
@ -17,10 +17,11 @@ type Props = {
|
|||||||
issueIdList: string[] | null;
|
issueIdList: string[] | null;
|
||||||
quickActions: (issue: TIssue, customActionButton?: React.ReactElement) => React.ReactNode;
|
quickActions: (issue: TIssue, customActionButton?: React.ReactElement) => React.ReactNode;
|
||||||
showAllIssues?: boolean;
|
showAllIssues?: boolean;
|
||||||
|
isDragDisabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CalendarIssueBlocks: React.FC<Props> = observer((props) => {
|
export const CalendarIssueBlocks: React.FC<Props> = observer((props) => {
|
||||||
const { issues, issueIdList, quickActions, showAllIssues = false } = props;
|
const { issues, issueIdList, quickActions, showAllIssues = false, isDragDisabled = false } = props;
|
||||||
// hooks
|
// hooks
|
||||||
const {
|
const {
|
||||||
router: { workspaceSlug, projectId },
|
router: { workspaceSlug, projectId },
|
||||||
@ -65,7 +66,7 @@ export const CalendarIssueBlocks: React.FC<Props> = observer((props) => {
|
|||||||
getProjectStates(issue?.project_id)?.find((state) => state?.id == issue?.state_id)?.color || "";
|
getProjectStates(issue?.project_id)?.find((state) => state?.id == issue?.state_id)?.color || "";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Draggable key={issue.id} draggableId={issue.id} index={index}>
|
<Draggable key={issue.id} draggableId={issue.id} index={index} isDragDisabled={isDragDisabled}>
|
||||||
{(provided, snapshot) => (
|
{(provided, snapshot) => (
|
||||||
<div
|
<div
|
||||||
className="relative cursor-pointer p-1 px-2"
|
className="relative cursor-pointer p-1 px-2"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
//hooks
|
//hooks
|
||||||
import { useIssues } from "hooks/store";
|
import { useCycle, useIssues } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { CycleIssueQuickActions } from "components/issues";
|
import { CycleIssueQuickActions } from "components/issues";
|
||||||
// types
|
// types
|
||||||
@ -13,6 +13,7 @@ import { useMemo } from "react";
|
|||||||
|
|
||||||
export const CycleCalendarLayout: React.FC = observer(() => {
|
export const CycleCalendarLayout: React.FC = observer(() => {
|
||||||
const { issues, issuesFilter } = useIssues(EIssuesStoreType.CYCLE);
|
const { issues, issuesFilter } = useIssues(EIssuesStoreType.CYCLE);
|
||||||
|
const { currentProjectCompletedCycleIds } = useCycle();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId, cycleId } = router.query;
|
const { workspaceSlug, projectId, cycleId } = router.query;
|
||||||
@ -38,6 +39,9 @@ export const CycleCalendarLayout: React.FC = observer(() => {
|
|||||||
|
|
||||||
if (!cycleId) return null;
|
if (!cycleId) return null;
|
||||||
|
|
||||||
|
const isCompletedCycle =
|
||||||
|
cycleId && currentProjectCompletedCycleIds ? currentProjectCompletedCycleIds.includes(cycleId.toString()) : false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseCalendarRoot
|
<BaseCalendarRoot
|
||||||
issueStore={issues}
|
issueStore={issues}
|
||||||
@ -45,6 +49,7 @@ export const CycleCalendarLayout: React.FC = observer(() => {
|
|||||||
QuickActions={CycleIssueQuickActions}
|
QuickActions={CycleIssueQuickActions}
|
||||||
issueActions={issueActions}
|
issueActions={issueActions}
|
||||||
viewId={cycleId.toString()}
|
viewId={cycleId.toString()}
|
||||||
|
isCompletedCycle={isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -26,6 +26,7 @@ type Props = {
|
|||||||
viewId?: string
|
viewId?: string
|
||||||
) => Promise<TIssue | undefined>;
|
) => Promise<TIssue | undefined>;
|
||||||
viewId?: string;
|
viewId?: string;
|
||||||
|
readOnly?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CalendarWeekDays: React.FC<Props> = observer((props) => {
|
export const CalendarWeekDays: React.FC<Props> = observer((props) => {
|
||||||
@ -39,6 +40,7 @@ export const CalendarWeekDays: React.FC<Props> = observer((props) => {
|
|||||||
disableIssueCreation,
|
disableIssueCreation,
|
||||||
quickAddCallback,
|
quickAddCallback,
|
||||||
viewId,
|
viewId,
|
||||||
|
readOnly = false,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month";
|
const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month";
|
||||||
@ -67,6 +69,7 @@ export const CalendarWeekDays: React.FC<Props> = observer((props) => {
|
|||||||
disableIssueCreation={disableIssueCreation}
|
disableIssueCreation={disableIssueCreation}
|
||||||
quickAddCallback={quickAddCallback}
|
quickAddCallback={quickAddCallback}
|
||||||
viewId={viewId}
|
viewId={viewId}
|
||||||
|
readOnly={readOnly}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
@ -46,6 +46,7 @@ export interface IBaseKanBanLayout {
|
|||||||
storeType?: TCreateModalStoreTypes;
|
storeType?: TCreateModalStoreTypes;
|
||||||
addIssuesToView?: (issueIds: string[]) => Promise<any>;
|
addIssuesToView?: (issueIds: string[]) => Promise<any>;
|
||||||
canEditPropertiesBasedOnProject?: (projectId: string) => boolean;
|
canEditPropertiesBasedOnProject?: (projectId: string) => boolean;
|
||||||
|
isCompletedCycle?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
type KanbanDragState = {
|
type KanbanDragState = {
|
||||||
@ -65,6 +66,7 @@ export const BaseKanBanRoot: React.FC<IBaseKanBanLayout> = observer((props: IBas
|
|||||||
storeType,
|
storeType,
|
||||||
addIssuesToView,
|
addIssuesToView,
|
||||||
canEditPropertiesBasedOnProject,
|
canEditPropertiesBasedOnProject,
|
||||||
|
isCompletedCycle = false,
|
||||||
} = props;
|
} = props;
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -183,6 +185,7 @@ export const BaseKanBanRoot: React.FC<IBaseKanBanLayout> = observer((props: IBas
|
|||||||
handleRemoveFromView={
|
handleRemoveFromView={
|
||||||
issueActions[EIssueActions.REMOVE] ? async () => handleIssues(issue, EIssueActions.REMOVE) : undefined
|
issueActions[EIssueActions.REMOVE] ? async () => handleIssues(issue, EIssueActions.REMOVE) : undefined
|
||||||
}
|
}
|
||||||
|
readOnly={!isEditingAllowed || isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
@ -282,7 +285,7 @@ export const BaseKanBanRoot: React.FC<IBaseKanBanLayout> = observer((props: IBas
|
|||||||
showEmptyGroup={userDisplayFilters?.show_empty_groups || true}
|
showEmptyGroup={userDisplayFilters?.show_empty_groups || true}
|
||||||
quickAddCallback={issues?.quickAddIssue}
|
quickAddCallback={issues?.quickAddIssue}
|
||||||
viewId={viewId}
|
viewId={viewId}
|
||||||
disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
|
disableIssueCreation={!enableIssueCreation || !isEditingAllowed || isCompletedCycle}
|
||||||
canEditProperties={canEditProperties}
|
canEditProperties={canEditProperties}
|
||||||
storeType={storeType}
|
storeType={storeType}
|
||||||
addIssuesToView={addIssuesToView}
|
addIssuesToView={addIssuesToView}
|
||||||
|
@ -2,7 +2,7 @@ import React, { useMemo } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
// hooks
|
// hooks
|
||||||
import { useIssues } from "hooks/store";
|
import { useCycle, useIssues } from "hooks/store";
|
||||||
// ui
|
// ui
|
||||||
import { CycleIssueQuickActions } from "components/issues";
|
import { CycleIssueQuickActions } from "components/issues";
|
||||||
// types
|
// types
|
||||||
@ -20,6 +20,7 @@ export const CycleKanBanLayout: React.FC = observer(() => {
|
|||||||
|
|
||||||
// store
|
// store
|
||||||
const { issues, issuesFilter } = useIssues(EIssuesStoreType.CYCLE);
|
const { issues, issuesFilter } = useIssues(EIssuesStoreType.CYCLE);
|
||||||
|
const { currentProjectCompletedCycleIds } = useCycle();
|
||||||
|
|
||||||
const issueActions = useMemo(
|
const issueActions = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
@ -42,6 +43,11 @@ export const CycleKanBanLayout: React.FC = observer(() => {
|
|||||||
[issues, workspaceSlug, cycleId]
|
[issues, workspaceSlug, cycleId]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isCompletedCycle =
|
||||||
|
cycleId && currentProjectCompletedCycleIds ? currentProjectCompletedCycleIds.includes(cycleId.toString()) : false;
|
||||||
|
|
||||||
|
const canEditIssueProperties = () => !isCompletedCycle;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseKanBanRoot
|
<BaseKanBanRoot
|
||||||
issueActions={issueActions}
|
issueActions={issueActions}
|
||||||
@ -55,6 +61,8 @@ export const CycleKanBanLayout: React.FC = observer(() => {
|
|||||||
if (!workspaceSlug || !projectId || !cycleId) throw new Error();
|
if (!workspaceSlug || !projectId || !cycleId) throw new Error();
|
||||||
return issues.addIssueToCycle(workspaceSlug.toString(), projectId.toString(), cycleId.toString(), issueIds);
|
return issues.addIssueToCycle(workspaceSlug.toString(), projectId.toString(), cycleId.toString(), issueIds);
|
||||||
}}
|
}}
|
||||||
|
canEditPropertiesBasedOnProject={canEditIssueProperties}
|
||||||
|
isCompletedCycle={isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -51,6 +51,7 @@ interface IBaseListRoot {
|
|||||||
storeType: TCreateModalStoreTypes;
|
storeType: TCreateModalStoreTypes;
|
||||||
addIssuesToView?: (issueIds: string[]) => Promise<any>;
|
addIssuesToView?: (issueIds: string[]) => Promise<any>;
|
||||||
canEditPropertiesBasedOnProject?: (projectId: string) => boolean;
|
canEditPropertiesBasedOnProject?: (projectId: string) => boolean;
|
||||||
|
isCompletedCycle?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BaseListRoot = observer((props: IBaseListRoot) => {
|
export const BaseListRoot = observer((props: IBaseListRoot) => {
|
||||||
@ -63,6 +64,7 @@ export const BaseListRoot = observer((props: IBaseListRoot) => {
|
|||||||
storeType,
|
storeType,
|
||||||
addIssuesToView,
|
addIssuesToView,
|
||||||
canEditPropertiesBasedOnProject,
|
canEditPropertiesBasedOnProject,
|
||||||
|
isCompletedCycle = false,
|
||||||
} = props;
|
} = props;
|
||||||
// mobx store
|
// mobx store
|
||||||
const {
|
const {
|
||||||
@ -112,6 +114,7 @@ export const BaseListRoot = observer((props: IBaseListRoot) => {
|
|||||||
handleRemoveFromView={
|
handleRemoveFromView={
|
||||||
issueActions[EIssueActions.REMOVE] ? async () => handleIssues(issue, EIssueActions.REMOVE) : undefined
|
issueActions[EIssueActions.REMOVE] ? async () => handleIssues(issue, EIssueActions.REMOVE) : undefined
|
||||||
}
|
}
|
||||||
|
readOnly={!isEditingAllowed || isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
@ -136,6 +139,7 @@ export const BaseListRoot = observer((props: IBaseListRoot) => {
|
|||||||
disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
|
disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
|
||||||
storeType={storeType}
|
storeType={storeType}
|
||||||
addIssuesToView={addIssuesToView}
|
addIssuesToView={addIssuesToView}
|
||||||
|
isCompletedCycle={isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
@ -37,6 +37,7 @@ export interface IGroupByList {
|
|||||||
storeType: TCreateModalStoreTypes;
|
storeType: TCreateModalStoreTypes;
|
||||||
addIssuesToView?: (issueIds: string[]) => Promise<TIssue>;
|
addIssuesToView?: (issueIds: string[]) => Promise<TIssue>;
|
||||||
viewId?: string;
|
viewId?: string;
|
||||||
|
isCompletedCycle?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GroupByList: React.FC<IGroupByList> = (props) => {
|
const GroupByList: React.FC<IGroupByList> = (props) => {
|
||||||
@ -55,6 +56,7 @@ const GroupByList: React.FC<IGroupByList> = (props) => {
|
|||||||
disableIssueCreation,
|
disableIssueCreation,
|
||||||
storeType,
|
storeType,
|
||||||
addIssuesToView,
|
addIssuesToView,
|
||||||
|
isCompletedCycle = false,
|
||||||
} = props;
|
} = props;
|
||||||
// store hooks
|
// store hooks
|
||||||
const member = useMember();
|
const member = useMember();
|
||||||
@ -115,7 +117,7 @@ const GroupByList: React.FC<IGroupByList> = (props) => {
|
|||||||
title={_list.name || ""}
|
title={_list.name || ""}
|
||||||
count={is_list ? issueIds?.length || 0 : issueIds?.[_list.id]?.length || 0}
|
count={is_list ? issueIds?.length || 0 : issueIds?.[_list.id]?.length || 0}
|
||||||
issuePayload={_list.payload}
|
issuePayload={_list.payload}
|
||||||
disableIssueCreation={disableIssueCreation || isGroupByCreatedBy}
|
disableIssueCreation={disableIssueCreation || isGroupByCreatedBy || isCompletedCycle}
|
||||||
storeType={storeType}
|
storeType={storeType}
|
||||||
addIssuesToView={addIssuesToView}
|
addIssuesToView={addIssuesToView}
|
||||||
/>
|
/>
|
||||||
@ -132,7 +134,7 @@ const GroupByList: React.FC<IGroupByList> = (props) => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{enableIssueQuickAdd && !disableIssueCreation && !isGroupByCreatedBy && (
|
{enableIssueQuickAdd && !disableIssueCreation && !isGroupByCreatedBy && !isCompletedCycle && (
|
||||||
<div className="sticky bottom-0 z-[1] w-full flex-shrink-0">
|
<div className="sticky bottom-0 z-[1] w-full flex-shrink-0">
|
||||||
<ListQuickAddIssueForm
|
<ListQuickAddIssueForm
|
||||||
prePopulatedData={prePopulateQuickAddData(group_by, _list.id)}
|
prePopulatedData={prePopulateQuickAddData(group_by, _list.id)}
|
||||||
@ -168,6 +170,7 @@ export interface IList {
|
|||||||
disableIssueCreation?: boolean;
|
disableIssueCreation?: boolean;
|
||||||
storeType: TCreateModalStoreTypes;
|
storeType: TCreateModalStoreTypes;
|
||||||
addIssuesToView?: (issueIds: string[]) => Promise<TIssue>;
|
addIssuesToView?: (issueIds: string[]) => Promise<TIssue>;
|
||||||
|
isCompletedCycle?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const List: React.FC<IList> = (props) => {
|
export const List: React.FC<IList> = (props) => {
|
||||||
@ -186,6 +189,7 @@ export const List: React.FC<IList> = (props) => {
|
|||||||
disableIssueCreation,
|
disableIssueCreation,
|
||||||
storeType,
|
storeType,
|
||||||
addIssuesToView,
|
addIssuesToView,
|
||||||
|
isCompletedCycle = false,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -205,6 +209,7 @@ export const List: React.FC<IList> = (props) => {
|
|||||||
disableIssueCreation={disableIssueCreation}
|
disableIssueCreation={disableIssueCreation}
|
||||||
storeType={storeType}
|
storeType={storeType}
|
||||||
addIssuesToView={addIssuesToView}
|
addIssuesToView={addIssuesToView}
|
||||||
|
isCompletedCycle={isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -5,4 +5,5 @@ export interface IQuickActionProps {
|
|||||||
handleRemoveFromView?: () => Promise<void>;
|
handleRemoveFromView?: () => Promise<void>;
|
||||||
customActionButton?: React.ReactElement;
|
customActionButton?: React.ReactElement;
|
||||||
portalElement?: HTMLDivElement | null;
|
portalElement?: HTMLDivElement | null;
|
||||||
|
readOnly?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import React, { useMemo } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
// hooks
|
// hooks
|
||||||
import { useIssues } from "hooks/store";
|
import { useCycle, useIssues } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { CycleIssueQuickActions } from "components/issues";
|
import { CycleIssueQuickActions } from "components/issues";
|
||||||
// types
|
// types
|
||||||
@ -19,6 +19,7 @@ export const CycleListLayout: React.FC = observer(() => {
|
|||||||
const { workspaceSlug, projectId, cycleId } = router.query;
|
const { workspaceSlug, projectId, cycleId } = router.query;
|
||||||
// store
|
// store
|
||||||
const { issues, issuesFilter } = useIssues(EIssuesStoreType.CYCLE);
|
const { issues, issuesFilter } = useIssues(EIssuesStoreType.CYCLE);
|
||||||
|
const { currentProjectCompletedCycleIds } = useCycle();
|
||||||
|
|
||||||
const issueActions = useMemo(
|
const issueActions = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
@ -40,6 +41,10 @@ export const CycleListLayout: React.FC = observer(() => {
|
|||||||
}),
|
}),
|
||||||
[issues, workspaceSlug, cycleId]
|
[issues, workspaceSlug, cycleId]
|
||||||
);
|
);
|
||||||
|
const isCompletedCycle =
|
||||||
|
cycleId && currentProjectCompletedCycleIds ? currentProjectCompletedCycleIds.includes(cycleId.toString()) : false;
|
||||||
|
|
||||||
|
const canEditIssueProperties = () => !isCompletedCycle;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseListRoot
|
<BaseListRoot
|
||||||
@ -53,6 +58,8 @@ export const CycleListLayout: React.FC = observer(() => {
|
|||||||
if (!workspaceSlug || !projectId || !cycleId) throw new Error();
|
if (!workspaceSlug || !projectId || !cycleId) throw new Error();
|
||||||
return issues.addIssueToCycle(workspaceSlug.toString(), projectId.toString(), cycleId.toString(), issueIds);
|
return issues.addIssueToCycle(workspaceSlug.toString(), projectId.toString(), cycleId.toString(), issueIds);
|
||||||
}}
|
}}
|
||||||
|
canEditPropertiesBasedOnProject={canEditIssueProperties}
|
||||||
|
isCompletedCycle={isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -16,7 +16,7 @@ import { IQuickActionProps } from "../list/list-view-types";
|
|||||||
import { EIssuesStoreType } from "constants/issue";
|
import { EIssuesStoreType } from "constants/issue";
|
||||||
|
|
||||||
export const AllIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
export const AllIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
||||||
const { issue, handleDelete, handleUpdate, customActionButton, portalElement } = props;
|
const { issue, handleDelete, handleUpdate, customActionButton, portalElement, readOnly = false } = props;
|
||||||
// states
|
// states
|
||||||
const [createUpdateIssueModal, setCreateUpdateIssueModal] = useState(false);
|
const [createUpdateIssueModal, setCreateUpdateIssueModal] = useState(false);
|
||||||
const [issueToEdit, setIssueToEdit] = useState<TIssue | undefined>(undefined);
|
const [issueToEdit, setIssueToEdit] = useState<TIssue | undefined>(undefined);
|
||||||
@ -82,6 +82,8 @@ export const AllIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
|||||||
Copy link
|
Copy link
|
||||||
</div>
|
</div>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
|
{!readOnly && (
|
||||||
|
<>
|
||||||
<CustomMenu.MenuItem
|
<CustomMenu.MenuItem
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setTrackElement("Global issues");
|
setTrackElement("Global issues");
|
||||||
@ -116,6 +118,8 @@ export const AllIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
|||||||
Delete issue
|
Delete issue
|
||||||
</div>
|
</div>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</CustomMenu>
|
</CustomMenu>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -4,18 +4,18 @@ import { CustomMenu } from "@plane/ui";
|
|||||||
import { Link, Trash2 } from "lucide-react";
|
import { Link, Trash2 } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
import { useEventTracker, useIssues } from "hooks/store";
|
import { useEventTracker, useIssues ,useUser} from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { DeleteArchivedIssueModal } from "components/issues";
|
import { DeleteArchivedIssueModal } from "components/issues";
|
||||||
// helpers
|
// helpers
|
||||||
import { copyUrlToClipboard } from "helpers/string.helper";
|
import { copyUrlToClipboard } from "helpers/string.helper";
|
||||||
// types
|
// types
|
||||||
import { IQuickActionProps } from "../list/list-view-types";
|
import { IQuickActionProps } from "../list/list-view-types";
|
||||||
// constants
|
import { EUserProjectRoles } from "constants/project";
|
||||||
import { EIssuesStoreType } from "constants/issue";
|
import { EIssuesStoreType } from "constants/issue";
|
||||||
|
|
||||||
export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
||||||
const { issue, handleDelete, customActionButton, portalElement } = props;
|
const { issue, handleDelete, customActionButton, portalElement, readOnly = false } = props;
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
@ -23,6 +23,13 @@ export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
|
|||||||
const [deleteIssueModal, setDeleteIssueModal] = useState(false);
|
const [deleteIssueModal, setDeleteIssueModal] = useState(false);
|
||||||
// toast alert
|
// toast alert
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
|
// store hooks
|
||||||
|
const {
|
||||||
|
membership: { currentProjectRole },
|
||||||
|
} = useUser();
|
||||||
|
|
||||||
|
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
||||||
// store hooks
|
// store hooks
|
||||||
const { setTrackElement } = useEventTracker();
|
const { setTrackElement } = useEventTracker();
|
||||||
const { issuesFilter } = useIssues(EIssuesStoreType.ARCHIVED);
|
const { issuesFilter } = useIssues(EIssuesStoreType.ARCHIVED);
|
||||||
@ -64,6 +71,7 @@ export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
|
|||||||
Copy link
|
Copy link
|
||||||
</div>
|
</div>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
|
{isEditingAllowed && !readOnly && (
|
||||||
<CustomMenu.MenuItem
|
<CustomMenu.MenuItem
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setTrackElement(activeLayout);
|
setTrackElement(activeLayout);
|
||||||
@ -75,6 +83,7 @@ export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
|
|||||||
Delete issue
|
Delete issue
|
||||||
</div>
|
</div>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
|
)}
|
||||||
</CustomMenu>
|
</CustomMenu>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -4,7 +4,7 @@ import { CustomMenu } from "@plane/ui";
|
|||||||
import { Copy, Link, Pencil, Trash2, XCircle } from "lucide-react";
|
import { Copy, Link, Pencil, Trash2, XCircle } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
import { useEventTracker, useIssues } from "hooks/store";
|
import { useEventTracker, useIssues,useUser } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { CreateUpdateIssueModal, DeleteIssueModal } from "components/issues";
|
import { CreateUpdateIssueModal, DeleteIssueModal } from "components/issues";
|
||||||
// helpers
|
// helpers
|
||||||
@ -14,9 +14,18 @@ import { TIssue } from "@plane/types";
|
|||||||
import { IQuickActionProps } from "../list/list-view-types";
|
import { IQuickActionProps } from "../list/list-view-types";
|
||||||
// constants
|
// constants
|
||||||
import { EIssuesStoreType } from "constants/issue";
|
import { EIssuesStoreType } from "constants/issue";
|
||||||
|
import { EUserProjectRoles } from "constants/project";
|
||||||
|
|
||||||
export const CycleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
export const CycleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
||||||
const { issue, handleDelete, handleUpdate, handleRemoveFromView, customActionButton, portalElement } = props;
|
const {
|
||||||
|
issue,
|
||||||
|
handleDelete,
|
||||||
|
handleUpdate,
|
||||||
|
handleRemoveFromView,
|
||||||
|
customActionButton,
|
||||||
|
portalElement,
|
||||||
|
readOnly = false,
|
||||||
|
} = props;
|
||||||
// states
|
// states
|
||||||
const [createUpdateIssueModal, setCreateUpdateIssueModal] = useState(false);
|
const [createUpdateIssueModal, setCreateUpdateIssueModal] = useState(false);
|
||||||
const [issueToEdit, setIssueToEdit] = useState<TIssue | undefined>(undefined);
|
const [issueToEdit, setIssueToEdit] = useState<TIssue | undefined>(undefined);
|
||||||
@ -30,6 +39,13 @@ export const CycleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
|||||||
// toast alert
|
// toast alert
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
|
// store hooks
|
||||||
|
const {
|
||||||
|
membership: { currentProjectRole },
|
||||||
|
} = useUser();
|
||||||
|
|
||||||
|
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
||||||
|
|
||||||
const activeLayout = `${issuesFilter.issueFilters?.displayFilters?.layout} layout`;
|
const activeLayout = `${issuesFilter.issueFilters?.displayFilters?.layout} layout`;
|
||||||
|
|
||||||
const handleCopyIssueLink = () => {
|
const handleCopyIssueLink = () => {
|
||||||
@ -85,6 +101,8 @@ export const CycleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
|||||||
Copy link
|
Copy link
|
||||||
</div>
|
</div>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
|
{isEditingAllowed && !readOnly && (
|
||||||
|
<>
|
||||||
<CustomMenu.MenuItem
|
<CustomMenu.MenuItem
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIssueToEdit({
|
setIssueToEdit({
|
||||||
@ -132,6 +150,8 @@ export const CycleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
|||||||
Delete issue
|
Delete issue
|
||||||
</div>
|
</div>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</CustomMenu>
|
</CustomMenu>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -4,7 +4,7 @@ import { CustomMenu } from "@plane/ui";
|
|||||||
import { Copy, Link, Pencil, Trash2, XCircle } from "lucide-react";
|
import { Copy, Link, Pencil, Trash2, XCircle } from "lucide-react";
|
||||||
// hooks
|
// hooks
|
||||||
import useToast from "hooks/use-toast";
|
import useToast from "hooks/use-toast";
|
||||||
import { useIssues, useEventTracker } from "hooks/store";
|
import { useIssues, useEventTracker ,useUser } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { CreateUpdateIssueModal, DeleteIssueModal } from "components/issues";
|
import { CreateUpdateIssueModal, DeleteIssueModal } from "components/issues";
|
||||||
// helpers
|
// helpers
|
||||||
@ -14,9 +14,18 @@ import { TIssue } from "@plane/types";
|
|||||||
import { IQuickActionProps } from "../list/list-view-types";
|
import { IQuickActionProps } from "../list/list-view-types";
|
||||||
// constants
|
// constants
|
||||||
import { EIssuesStoreType } from "constants/issue";
|
import { EIssuesStoreType } from "constants/issue";
|
||||||
|
import { EUserProjectRoles } from "constants/project";
|
||||||
|
|
||||||
export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
||||||
const { issue, handleDelete, handleUpdate, handleRemoveFromView, customActionButton, portalElement } = props;
|
const {
|
||||||
|
issue,
|
||||||
|
handleDelete,
|
||||||
|
handleUpdate,
|
||||||
|
handleRemoveFromView,
|
||||||
|
customActionButton,
|
||||||
|
portalElement,
|
||||||
|
readOnly = false,
|
||||||
|
} = props;
|
||||||
// states
|
// states
|
||||||
const [createUpdateIssueModal, setCreateUpdateIssueModal] = useState(false);
|
const [createUpdateIssueModal, setCreateUpdateIssueModal] = useState(false);
|
||||||
const [issueToEdit, setIssueToEdit] = useState<TIssue | undefined>(undefined);
|
const [issueToEdit, setIssueToEdit] = useState<TIssue | undefined>(undefined);
|
||||||
@ -30,6 +39,13 @@ export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
|||||||
// toast alert
|
// toast alert
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
|
// store hooks
|
||||||
|
const {
|
||||||
|
membership: { currentProjectRole },
|
||||||
|
} = useUser();
|
||||||
|
|
||||||
|
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
||||||
|
|
||||||
const activeLayout = `${issuesFilter.issueFilters?.displayFilters?.layout} layout`;
|
const activeLayout = `${issuesFilter.issueFilters?.displayFilters?.layout} layout`;
|
||||||
|
|
||||||
const handleCopyIssueLink = () => {
|
const handleCopyIssueLink = () => {
|
||||||
@ -85,6 +101,8 @@ export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
|||||||
Copy link
|
Copy link
|
||||||
</div>
|
</div>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
|
{isEditingAllowed && !readOnly && (
|
||||||
|
<>
|
||||||
<CustomMenu.MenuItem
|
<CustomMenu.MenuItem
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIssueToEdit({ ...issue, module: moduleId?.toString() ?? null });
|
setIssueToEdit({ ...issue, module: moduleId?.toString() ?? null });
|
||||||
@ -131,6 +149,8 @@ export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
|||||||
Delete issue
|
Delete issue
|
||||||
</div>
|
</div>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</CustomMenu>
|
</CustomMenu>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -17,7 +17,7 @@ import { EUserProjectRoles } from "constants/project";
|
|||||||
import { EIssuesStoreType } from "constants/issue";
|
import { EIssuesStoreType } from "constants/issue";
|
||||||
|
|
||||||
export const ProjectIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
export const ProjectIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
||||||
const { issue, handleDelete, handleUpdate, customActionButton, portalElement } = props;
|
const { issue, handleDelete, handleUpdate, customActionButton, portalElement, readOnly = false } = props;
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
@ -91,7 +91,7 @@ export const ProjectIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
|
|||||||
Copy link
|
Copy link
|
||||||
</div>
|
</div>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
{isEditingAllowed && (
|
{isEditingAllowed && !readOnly && (
|
||||||
<>
|
<>
|
||||||
<CustomMenu.MenuItem
|
<CustomMenu.MenuItem
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -28,10 +28,19 @@ interface IBaseSpreadsheetRoot {
|
|||||||
[EIssueActions.REMOVE]?: (issue: TIssue) => void;
|
[EIssueActions.REMOVE]?: (issue: TIssue) => void;
|
||||||
};
|
};
|
||||||
canEditPropertiesBasedOnProject?: (projectId: string) => boolean;
|
canEditPropertiesBasedOnProject?: (projectId: string) => boolean;
|
||||||
|
isCompletedCycle?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BaseSpreadsheetRoot = observer((props: IBaseSpreadsheetRoot) => {
|
export const BaseSpreadsheetRoot = observer((props: IBaseSpreadsheetRoot) => {
|
||||||
const { issueFiltersStore, issueStore, viewId, QuickActions, issueActions, canEditPropertiesBasedOnProject } = props;
|
const {
|
||||||
|
issueFiltersStore,
|
||||||
|
issueStore,
|
||||||
|
viewId,
|
||||||
|
QuickActions,
|
||||||
|
issueActions,
|
||||||
|
canEditPropertiesBasedOnProject,
|
||||||
|
isCompletedCycle = false,
|
||||||
|
} = props;
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug, projectId } = router.query as { workspaceSlug: string; projectId: string };
|
const { workspaceSlug, projectId } = router.query as { workspaceSlug: string; projectId: string };
|
||||||
@ -95,6 +104,7 @@ export const BaseSpreadsheetRoot = observer((props: IBaseSpreadsheetRoot) => {
|
|||||||
issueActions[EIssueActions.REMOVE] ? async () => handleIssues(issue, EIssueActions.REMOVE) : undefined
|
issueActions[EIssueActions.REMOVE] ? async () => handleIssues(issue, EIssueActions.REMOVE) : undefined
|
||||||
}
|
}
|
||||||
portalElement={portalElement}
|
portalElement={portalElement}
|
||||||
|
readOnly={!isEditingAllowed || isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
@ -113,7 +123,7 @@ export const BaseSpreadsheetRoot = observer((props: IBaseSpreadsheetRoot) => {
|
|||||||
quickAddCallback={issueStore.quickAddIssue}
|
quickAddCallback={issueStore.quickAddIssue}
|
||||||
viewId={viewId}
|
viewId={viewId}
|
||||||
enableQuickCreateIssue={enableQuickAdd}
|
enableQuickCreateIssue={enableQuickAdd}
|
||||||
disableIssueCreation={!enableIssueCreation || !isEditingAllowed}
|
disableIssueCreation={!enableIssueCreation || !isEditingAllowed || isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@ import React, { useMemo } from "react";
|
|||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
// mobx store
|
// mobx store
|
||||||
import { useIssues } from "hooks/store";
|
import { useCycle, useIssues } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { BaseSpreadsheetRoot } from "../base-spreadsheet-root";
|
import { BaseSpreadsheetRoot } from "../base-spreadsheet-root";
|
||||||
import { EIssueActions } from "../../types";
|
import { EIssueActions } from "../../types";
|
||||||
@ -15,6 +15,7 @@ export const CycleSpreadsheetLayout: React.FC = observer(() => {
|
|||||||
const { workspaceSlug, cycleId } = router.query as { workspaceSlug: string; cycleId: string };
|
const { workspaceSlug, cycleId } = router.query as { workspaceSlug: string; cycleId: string };
|
||||||
|
|
||||||
const { issues, issuesFilter } = useIssues(EIssuesStoreType.CYCLE);
|
const { issues, issuesFilter } = useIssues(EIssuesStoreType.CYCLE);
|
||||||
|
const { currentProjectCompletedCycleIds } = useCycle();
|
||||||
|
|
||||||
const issueActions = useMemo(
|
const issueActions = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
@ -35,6 +36,11 @@ export const CycleSpreadsheetLayout: React.FC = observer(() => {
|
|||||||
[issues, workspaceSlug, cycleId]
|
[issues, workspaceSlug, cycleId]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isCompletedCycle =
|
||||||
|
cycleId && currentProjectCompletedCycleIds ? currentProjectCompletedCycleIds.includes(cycleId.toString()) : false;
|
||||||
|
|
||||||
|
const canEditIssueProperties = () => !isCompletedCycle;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseSpreadsheetRoot
|
<BaseSpreadsheetRoot
|
||||||
issueStore={issues}
|
issueStore={issues}
|
||||||
@ -42,6 +48,8 @@ export const CycleSpreadsheetLayout: React.FC = observer(() => {
|
|||||||
viewId={cycleId}
|
viewId={cycleId}
|
||||||
issueActions={issueActions}
|
issueActions={issueActions}
|
||||||
QuickActions={CycleIssueQuickActions}
|
QuickActions={CycleIssueQuickActions}
|
||||||
|
canEditPropertiesBasedOnProject={canEditIssueProperties}
|
||||||
|
isCompletedCycle={isCompletedCycle}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -70,7 +70,7 @@ export const ModuleForm: React.FC<Props> = ({
|
|||||||
const startDate = watch("start_date");
|
const startDate = watch("start_date");
|
||||||
const targetDate = watch("target_date");
|
const targetDate = watch("target_date");
|
||||||
|
|
||||||
const minDate = startDate ? new Date(startDate) : new Date();
|
const minDate = startDate ? new Date(startDate) : null;
|
||||||
minDate?.setDate(minDate.getDate());
|
minDate?.setDate(minDate.getDate());
|
||||||
|
|
||||||
const maxDate = targetDate ? new Date(targetDate) : null;
|
const maxDate = targetDate ? new Date(targetDate) : null;
|
||||||
@ -159,7 +159,6 @@ export const ModuleForm: React.FC<Props> = ({
|
|||||||
onChange={(date) => onChange(date ? renderFormattedPayloadDate(date) : null)}
|
onChange={(date) => onChange(date ? renderFormattedPayloadDate(date) : null)}
|
||||||
buttonVariant="border-with-text"
|
buttonVariant="border-with-text"
|
||||||
placeholder="Start date"
|
placeholder="Start date"
|
||||||
minDate={new Date()}
|
|
||||||
maxDate={maxDate ?? undefined}
|
maxDate={maxDate ?? undefined}
|
||||||
tabIndex={3}
|
tabIndex={3}
|
||||||
/>
|
/>
|
||||||
|
@ -168,18 +168,6 @@ export const ModuleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
if (!watch("target_date") || watch("target_date") === "") endDateButtonRef.current?.click();
|
if (!watch("target_date") || watch("target_date") === "") endDateButtonRef.current?.click();
|
||||||
|
|
||||||
if (watch("start_date") && watch("target_date") && watch("start_date") !== "" && watch("start_date") !== "") {
|
if (watch("start_date") && watch("target_date") && watch("start_date") !== "" && watch("start_date") !== "") {
|
||||||
if (!isDateGreaterThanToday(`${watch("target_date")}`)) {
|
|
||||||
setToastAlert({
|
|
||||||
type: "error",
|
|
||||||
title: "Error!",
|
|
||||||
message: "Unable to create module in past date. Please enter a valid date.",
|
|
||||||
});
|
|
||||||
reset({
|
|
||||||
...moduleDetails,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
submitChanges({
|
submitChanges({
|
||||||
start_date: renderFormattedPayloadDate(`${watch("start_date")}`),
|
start_date: renderFormattedPayloadDate(`${watch("start_date")}`),
|
||||||
target_date: renderFormattedPayloadDate(`${watch("target_date")}`),
|
target_date: renderFormattedPayloadDate(`${watch("target_date")}`),
|
||||||
@ -198,18 +186,6 @@ export const ModuleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
if (!watch("start_date") || watch("start_date") === "") endDateButtonRef.current?.click();
|
if (!watch("start_date") || watch("start_date") === "") endDateButtonRef.current?.click();
|
||||||
|
|
||||||
if (watch("start_date") && watch("target_date") && watch("start_date") !== "" && watch("start_date") !== "") {
|
if (watch("start_date") && watch("target_date") && watch("start_date") !== "" && watch("start_date") !== "") {
|
||||||
if (!isDateGreaterThanToday(`${watch("target_date")}`)) {
|
|
||||||
setToastAlert({
|
|
||||||
type: "error",
|
|
||||||
title: "Error!",
|
|
||||||
message: "Unable to create module in past date. Please enter a valid date.",
|
|
||||||
});
|
|
||||||
reset({
|
|
||||||
...moduleDetails,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
submitChanges({
|
submitChanges({
|
||||||
start_date: renderFormattedPayloadDate(`${watch("start_date")}`),
|
start_date: renderFormattedPayloadDate(`${watch("start_date")}`),
|
||||||
target_date: renderFormattedPayloadDate(`${watch("target_date")}`),
|
target_date: renderFormattedPayloadDate(`${watch("target_date")}`),
|
||||||
|
@ -62,8 +62,9 @@ export const WorkspaceDashboardView = observer(() => {
|
|||||||
{homeDashboardId && joinedProjectIds ? (
|
{homeDashboardId && joinedProjectIds ? (
|
||||||
<>
|
<>
|
||||||
{joinedProjectIds.length > 0 ? (
|
{joinedProjectIds.length > 0 ? (
|
||||||
<div className="flex h-full w-full flex-col space-y-7 overflow-y-auto bg-custom-background-90 p-7">
|
<>
|
||||||
<IssuePeekOverview />
|
<IssuePeekOverview />
|
||||||
|
<div className="space-y-7 p-7 bg-custom-background-90 h-full w-full flex flex-col overflow-y-auto">
|
||||||
{currentUser && <UserGreetingsView user={currentUser} />}
|
{currentUser && <UserGreetingsView user={currentUser} />}
|
||||||
{currentUser && !currentUser.is_tour_completed && (
|
{currentUser && !currentUser.is_tour_completed && (
|
||||||
<div className="fixed left-0 top-0 z-20 grid h-full w-full place-items-center bg-custom-backdrop bg-opacity-50 transition-opacity">
|
<div className="fixed left-0 top-0 z-20 grid h-full w-full place-items-center bg-custom-backdrop bg-opacity-50 transition-opacity">
|
||||||
@ -72,6 +73,7 @@ export const WorkspaceDashboardView = observer(() => {
|
|||||||
)}
|
)}
|
||||||
<DashboardWidgets />
|
<DashboardWidgets />
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<EmptyState
|
<EmptyState
|
||||||
image={emptyStateImage}
|
image={emptyStateImage}
|
||||||
|
@ -121,21 +121,25 @@ export const DURATION_FILTER_OPTIONS: {
|
|||||||
key: TDurationFilterOptions;
|
key: TDurationFilterOptions;
|
||||||
label: string;
|
label: string;
|
||||||
}[] = [
|
}[] = [
|
||||||
|
{
|
||||||
|
key: "none",
|
||||||
|
label: "None",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: "today",
|
key: "today",
|
||||||
label: "Today",
|
label: "Due today",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "this_week",
|
key: "this_week",
|
||||||
label: "This week",
|
label: " Due this week",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "this_month",
|
key: "this_month",
|
||||||
label: "This month",
|
label: "Due this month",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "this_year",
|
key: "this_year",
|
||||||
label: "This year",
|
label: "Due this year",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -152,7 +156,7 @@ export const PROJECT_BACKGROUND_COLORS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
// assigned and created issues widgets tabs list
|
// assigned and created issues widgets tabs list
|
||||||
export const ISSUES_TABS_LIST: {
|
export const FILTERED_ISSUES_TABS_LIST: {
|
||||||
key: TIssuesListTypes;
|
key: TIssuesListTypes;
|
||||||
label: string;
|
label: string;
|
||||||
}[] = [
|
}[] = [
|
||||||
@ -170,7 +174,27 @@ export const ISSUES_TABS_LIST: {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// assigned and created issues widgets tabs list
|
||||||
|
export const UNFILTERED_ISSUES_TABS_LIST: {
|
||||||
|
key: TIssuesListTypes;
|
||||||
|
label: string;
|
||||||
|
}[] = [
|
||||||
|
{
|
||||||
|
key: "pending",
|
||||||
|
label: "Pending",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "completed",
|
||||||
|
label: "Marked completed",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
export const ASSIGNED_ISSUES_EMPTY_STATES = {
|
export const ASSIGNED_ISSUES_EMPTY_STATES = {
|
||||||
|
pending: {
|
||||||
|
title: "Issues assigned to you that are pending\nwill show up here.",
|
||||||
|
darkImage: UpcomingIssuesDark,
|
||||||
|
lightImage: UpcomingIssuesLight,
|
||||||
|
},
|
||||||
upcoming: {
|
upcoming: {
|
||||||
title: "Upcoming issues assigned to\nyou will show up here.",
|
title: "Upcoming issues assigned to\nyou will show up here.",
|
||||||
darkImage: UpcomingIssuesDark,
|
darkImage: UpcomingIssuesDark,
|
||||||
@ -189,6 +213,11 @@ export const ASSIGNED_ISSUES_EMPTY_STATES = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const CREATED_ISSUES_EMPTY_STATES = {
|
export const CREATED_ISSUES_EMPTY_STATES = {
|
||||||
|
pending: {
|
||||||
|
title: "Issues created by you that are pending\nwill show up here.",
|
||||||
|
darkImage: UpcomingIssuesDark,
|
||||||
|
lightImage: UpcomingIssuesLight,
|
||||||
|
},
|
||||||
upcoming: {
|
upcoming: {
|
||||||
title: "Upcoming issues you created\nwill show up here.",
|
title: "Upcoming issues you created\nwill show up here.",
|
||||||
darkImage: UpcomingIssuesDark,
|
darkImage: UpcomingIssuesDark,
|
||||||
|
@ -9,6 +9,8 @@ export const getCustomDates = (duration: TDurationFilterOptions): string => {
|
|||||||
let firstDay, lastDay;
|
let firstDay, lastDay;
|
||||||
|
|
||||||
switch (duration) {
|
switch (duration) {
|
||||||
|
case "none":
|
||||||
|
return "";
|
||||||
case "today":
|
case "today":
|
||||||
firstDay = renderFormattedPayloadDate(today);
|
firstDay = renderFormattedPayloadDate(today);
|
||||||
lastDay = renderFormattedPayloadDate(today);
|
lastDay = renderFormattedPayloadDate(today);
|
||||||
@ -32,7 +34,9 @@ export const getRedirectionFilters = (type: TIssuesListTypes): string => {
|
|||||||
const today = renderFormattedPayloadDate(new Date());
|
const today = renderFormattedPayloadDate(new Date());
|
||||||
|
|
||||||
const filterParams =
|
const filterParams =
|
||||||
type === "upcoming"
|
type === "pending"
|
||||||
|
? "?state_group=backlog,unstarted,started"
|
||||||
|
: type === "upcoming"
|
||||||
? `?target_date=${today};after`
|
? `?target_date=${today};after`
|
||||||
: type === "overdue"
|
: type === "overdue"
|
||||||
? `?target_date=${today};before`
|
? `?target_date=${today};before`
|
||||||
|
Loading…
Reference in New Issue
Block a user