mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
Merge branches 'develop' and 'develop' of github.com:makeplane/plane into develop
This commit is contained in:
commit
a77ceb636f
@ -40,6 +40,7 @@ class CycleSerializer(BaseSerializer):
|
|||||||
started_estimates = serializers.IntegerField(read_only=True)
|
started_estimates = serializers.IntegerField(read_only=True)
|
||||||
workspace_detail = WorkspaceLiteSerializer(read_only=True, source="workspace")
|
workspace_detail = WorkspaceLiteSerializer(read_only=True, source="workspace")
|
||||||
project_detail = ProjectLiteSerializer(read_only=True, source="project")
|
project_detail = ProjectLiteSerializer(read_only=True, source="project")
|
||||||
|
status = serializers.CharField(read_only=True)
|
||||||
|
|
||||||
def validate(self, data):
|
def validate(self, data):
|
||||||
if (
|
if (
|
||||||
|
@ -11,6 +11,10 @@ from django.db.models import (
|
|||||||
Count,
|
Count,
|
||||||
Prefetch,
|
Prefetch,
|
||||||
Sum,
|
Sum,
|
||||||
|
Case,
|
||||||
|
When,
|
||||||
|
Value,
|
||||||
|
CharField
|
||||||
)
|
)
|
||||||
from django.core import serializers
|
from django.core import serializers
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
@ -157,6 +161,28 @@ class CycleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
.annotate(
|
||||||
|
status=Case(
|
||||||
|
When(
|
||||||
|
Q(start_date__lte=timezone.now()) & Q(end_date__gte=timezone.now()),
|
||||||
|
then=Value("CURRENT")
|
||||||
|
),
|
||||||
|
When(
|
||||||
|
start_date__gt=timezone.now(),
|
||||||
|
then=Value("UPCOMING")
|
||||||
|
),
|
||||||
|
When(
|
||||||
|
end_date__lt=timezone.now(),
|
||||||
|
then=Value("COMPLETED")
|
||||||
|
),
|
||||||
|
When(
|
||||||
|
Q(start_date__isnull=True) & Q(end_date__isnull=True),
|
||||||
|
then=Value("DRAFT")
|
||||||
|
),
|
||||||
|
default=Value("DRAFT"),
|
||||||
|
output_field=CharField(),
|
||||||
|
)
|
||||||
|
)
|
||||||
.prefetch_related(
|
.prefetch_related(
|
||||||
Prefetch(
|
Prefetch(
|
||||||
"issue_cycle__issue__assignees",
|
"issue_cycle__issue__assignees",
|
||||||
@ -177,7 +203,7 @@ class CycleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
queryset = self.get_queryset()
|
queryset = self.get_queryset()
|
||||||
cycle_view = request.GET.get("cycle_view", "all")
|
cycle_view = request.GET.get("cycle_view", "all")
|
||||||
|
|
||||||
queryset = queryset.order_by("-is_favorite","-created_at")
|
queryset = queryset.order_by("-is_favorite", "-created_at")
|
||||||
|
|
||||||
# Current Cycle
|
# Current Cycle
|
||||||
if cycle_view == "current":
|
if cycle_view == "current":
|
||||||
@ -575,7 +601,9 @@ class CycleIssueViewSet(WebhookMixin, BaseViewSet):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
issues = IssueStateSerializer(issues, many=True, fields=fields if fields else None).data
|
issues = IssueStateSerializer(
|
||||||
|
issues, many=True, fields=fields if fields else None
|
||||||
|
).data
|
||||||
issue_dict = {str(issue["id"]): issue for issue in issues}
|
issue_dict = {str(issue["id"]): issue for issue in issues}
|
||||||
return Response(issue_dict, status=status.HTTP_200_OK)
|
return Response(issue_dict, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
@ -805,4 +833,4 @@ class TransferCycleIssueEndpoint(BaseAPIView):
|
|||||||
updated_cycles, ["cycle_id"], batch_size=100
|
updated_cycles, ["cycle_id"], batch_size=100
|
||||||
)
|
)
|
||||||
|
|
||||||
return Response({"message": "Success"}, status=status.HTTP_200_OK)
|
return Response({"message": "Success"}, status=status.HTTP_200_OK)
|
||||||
|
@ -18,7 +18,8 @@ type Props = {
|
|||||||
|
|
||||||
export const NotAuthorizedView: React.FC<Props> = ({ actionButton, type }) => {
|
export const NotAuthorizedView: React.FC<Props> = ({ actionButton, type }) => {
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
const { asPath: currentPath } = useRouter();
|
const { query } = useRouter();
|
||||||
|
const { next_path } = query;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DefaultLayout>
|
<DefaultLayout>
|
||||||
@ -37,7 +38,7 @@ export const NotAuthorizedView: React.FC<Props> = ({ actionButton, type }) => {
|
|||||||
{user ? (
|
{user ? (
|
||||||
<p>
|
<p>
|
||||||
You have signed in as {user.email}. <br />
|
You have signed in as {user.email}. <br />
|
||||||
<Link href={`/?next=${currentPath}`}>
|
<Link href={`/?next_path=${next_path}`}>
|
||||||
<span className="font-medium text-custom-text-100">Sign in</span>
|
<span className="font-medium text-custom-text-100">Sign in</span>
|
||||||
</Link>{" "}
|
</Link>{" "}
|
||||||
with different account that has access to this page.
|
with different account that has access to this page.
|
||||||
@ -45,7 +46,7 @@ export const NotAuthorizedView: React.FC<Props> = ({ actionButton, type }) => {
|
|||||||
) : (
|
) : (
|
||||||
<p>
|
<p>
|
||||||
You need to{" "}
|
You need to{" "}
|
||||||
<Link href={`/?next=${currentPath}`}>
|
<Link href={`/?next_path=${next_path}`}>
|
||||||
<span className="font-medium text-custom-text-100">Sign in</span>
|
<span className="font-medium text-custom-text-100">Sign in</span>
|
||||||
</Link>{" "}
|
</Link>{" "}
|
||||||
with an account that has access to this page.
|
with an account that has access to this page.
|
||||||
|
@ -11,7 +11,6 @@ import {
|
|||||||
CopyPlus,
|
CopyPlus,
|
||||||
Calendar,
|
Calendar,
|
||||||
Link2Icon,
|
Link2Icon,
|
||||||
RocketIcon,
|
|
||||||
Users2Icon,
|
Users2Icon,
|
||||||
ArchiveIcon,
|
ArchiveIcon,
|
||||||
PaperclipIcon,
|
PaperclipIcon,
|
||||||
@ -48,8 +47,8 @@ const IssueLink = ({ activity }: { activity: IIssueActivity }) => {
|
|||||||
rel={activity.issue === null ? "" : "noopener noreferrer"}
|
rel={activity.issue === null ? "" : "noopener noreferrer"}
|
||||||
className="inline-flex items-center gap-1 font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 font-medium text-custom-text-100 hover:underline"
|
||||||
>
|
>
|
||||||
{activity.issue_detail ? `${activity.project_detail.identifier}-${activity.issue_detail.sequence_id}` : "Issue"}
|
{activity.issue_detail ? `${activity.project_detail.identifier}-${activity.issue_detail.sequence_id}` : "Issue"}{" "}
|
||||||
<RocketIcon size={12} color="#6b7280" className="flex-shrink-0" />
|
<span className="font-normal">{activity.issue_detail?.name}</span>
|
||||||
</a>
|
</a>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
@ -163,7 +162,6 @@ const activityDetails: {
|
|||||||
className="inline-flex items-center gap-1 font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 font-medium text-custom-text-100 hover:underline"
|
||||||
>
|
>
|
||||||
attachment
|
attachment
|
||||||
<RocketIcon size={12} color="#6b7280" />
|
|
||||||
</a>
|
</a>
|
||||||
{showIssue && (
|
{showIssue && (
|
||||||
<>
|
<>
|
||||||
@ -239,7 +237,6 @@ const activityDetails: {
|
|||||||
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
||||||
>
|
>
|
||||||
<span className="truncate">{activity.new_value}</span>
|
<span className="truncate">{activity.new_value}</span>
|
||||||
<RocketIcon size={12} color="#6b7280" className="flex-shrink-0" />
|
|
||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -254,7 +251,6 @@ const activityDetails: {
|
|||||||
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
||||||
>
|
>
|
||||||
<span className="truncate">{activity.new_value}</span>
|
<span className="truncate">{activity.new_value}</span>
|
||||||
<RocketIcon size={12} color="#6b7280" className="flex-shrink-0" />
|
|
||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -269,7 +265,6 @@ const activityDetails: {
|
|||||||
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
||||||
>
|
>
|
||||||
<span className="truncate">{activity.old_value}</span>
|
<span className="truncate">{activity.old_value}</span>
|
||||||
<RocketIcon size={12} color="#6b7280" className="flex-shrink-0" />
|
|
||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -398,7 +393,6 @@ const activityDetails: {
|
|||||||
className="inline-flex items-center gap-1 font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 font-medium text-custom-text-100 hover:underline"
|
||||||
>
|
>
|
||||||
link
|
link
|
||||||
<RocketIcon size={12} color="#6b7280" />
|
|
||||||
</a>
|
</a>
|
||||||
{showIssue && (
|
{showIssue && (
|
||||||
<>
|
<>
|
||||||
@ -420,7 +414,6 @@ const activityDetails: {
|
|||||||
className="inline-flex items-center gap-1 font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 font-medium text-custom-text-100 hover:underline"
|
||||||
>
|
>
|
||||||
link
|
link
|
||||||
<RocketIcon size={12} color="#6b7280" />
|
|
||||||
</a>
|
</a>
|
||||||
{showIssue && (
|
{showIssue && (
|
||||||
<>
|
<>
|
||||||
@ -442,7 +435,6 @@ const activityDetails: {
|
|||||||
className="inline-flex items-center gap-1 font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 font-medium text-custom-text-100 hover:underline"
|
||||||
>
|
>
|
||||||
link
|
link
|
||||||
<RocketIcon size={12} color="#6b7280" />
|
|
||||||
</a>
|
</a>
|
||||||
{showIssue && (
|
{showIssue && (
|
||||||
<>
|
<>
|
||||||
@ -469,7 +461,6 @@ const activityDetails: {
|
|||||||
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
||||||
>
|
>
|
||||||
<span className="truncate">{activity.new_value}</span>
|
<span className="truncate">{activity.new_value}</span>
|
||||||
<RocketIcon size={12} color="#6b7280" className="flex-shrink-0" />
|
|
||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -484,7 +475,6 @@ const activityDetails: {
|
|||||||
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
||||||
>
|
>
|
||||||
<span className="truncate">{activity.new_value}</span>
|
<span className="truncate">{activity.new_value}</span>
|
||||||
<RocketIcon size={12} color="#6b7280" className="flex-shrink-0" />
|
|
||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -499,7 +489,6 @@ const activityDetails: {
|
|||||||
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 truncate font-medium text-custom-text-100 hover:underline"
|
||||||
>
|
>
|
||||||
<span className="truncate">{activity.old_value}</span>
|
<span className="truncate">{activity.old_value}</span>
|
||||||
<RocketIcon size={12} color="#6b7280" className="flex-shrink-0" />
|
|
||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -28,7 +28,7 @@ import { ViewIssueLabel } from "components/issues";
|
|||||||
// icons
|
// icons
|
||||||
import { AlarmClock, AlertTriangle, ArrowRight, CalendarDays, Star, Target } from "lucide-react";
|
import { AlarmClock, AlertTriangle, ArrowRight, CalendarDays, Star, Target } from "lucide-react";
|
||||||
// helpers
|
// helpers
|
||||||
import { getDateRangeStatus, renderShortDateWithYearFormat, findHowManyDaysLeft } from "helpers/date-time.helper";
|
import { renderShortDateWithYearFormat, findHowManyDaysLeft } from "helpers/date-time.helper";
|
||||||
import { truncateText } from "helpers/string.helper";
|
import { truncateText } from "helpers/string.helper";
|
||||||
// types
|
// types
|
||||||
import { ICycle } from "types";
|
import { ICycle } from "types";
|
||||||
@ -137,7 +137,7 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = observer((props
|
|||||||
cancelled: cycle.cancelled_issues,
|
cancelled: cycle.cancelled_issues,
|
||||||
};
|
};
|
||||||
|
|
||||||
const cycleStatus = getDateRangeStatus(cycle.start_date, cycle.end_date);
|
const cycleStatus = cycle.status.toLocaleLowerCase();
|
||||||
|
|
||||||
const handleAddToFavorites = (e: MouseEvent<HTMLButtonElement>) => {
|
const handleAddToFavorites = (e: MouseEvent<HTMLButtonElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -10,15 +10,10 @@ import { Avatar, AvatarGroup, CustomMenu, Tooltip, LayersIcon, CycleGroupIcon }
|
|||||||
// icons
|
// icons
|
||||||
import { Info, LinkIcon, Pencil, Star, Trash2 } from "lucide-react";
|
import { Info, LinkIcon, Pencil, Star, Trash2 } from "lucide-react";
|
||||||
// helpers
|
// helpers
|
||||||
import {
|
import { findHowManyDaysLeft, renderShortDate, renderShortMonthDate } from "helpers/date-time.helper";
|
||||||
getDateRangeStatus,
|
|
||||||
findHowManyDaysLeft,
|
|
||||||
renderShortDate,
|
|
||||||
renderShortMonthDate,
|
|
||||||
} from "helpers/date-time.helper";
|
|
||||||
import { copyTextToClipboard } from "helpers/string.helper";
|
import { copyTextToClipboard } from "helpers/string.helper";
|
||||||
// types
|
// types
|
||||||
import { ICycle } from "types";
|
import { ICycle, TCycleGroups } from "types";
|
||||||
// store
|
// store
|
||||||
import { useMobxStore } from "lib/mobx/store-provider";
|
import { useMobxStore } from "lib/mobx/store-provider";
|
||||||
// constants
|
// constants
|
||||||
@ -45,7 +40,7 @@ export const CyclesBoardCard: FC<ICyclesBoardCard> = (props) => {
|
|||||||
const [updateModal, setUpdateModal] = useState(false);
|
const [updateModal, setUpdateModal] = useState(false);
|
||||||
const [deleteModal, setDeleteModal] = useState(false);
|
const [deleteModal, setDeleteModal] = useState(false);
|
||||||
// computed
|
// computed
|
||||||
const cycleStatus = getDateRangeStatus(cycle.start_date, cycle.end_date);
|
const cycleStatus = cycle.status.toLocaleLowerCase() as TCycleGroups;
|
||||||
const isCompleted = cycleStatus === "completed";
|
const isCompleted = cycleStatus === "completed";
|
||||||
const endDate = new Date(cycle.end_date ?? "");
|
const endDate = new Date(cycle.end_date ?? "");
|
||||||
const startDate = new Date(cycle.start_date ?? "");
|
const startDate = new Date(cycle.start_date ?? "");
|
||||||
|
@ -13,15 +13,10 @@ import { CustomMenu, Tooltip, CircularProgressIndicator, CycleGroupIcon, AvatarG
|
|||||||
// icons
|
// icons
|
||||||
import { Check, Info, LinkIcon, Pencil, Star, Trash2, User2 } from "lucide-react";
|
import { Check, Info, LinkIcon, Pencil, Star, Trash2, User2 } from "lucide-react";
|
||||||
// helpers
|
// helpers
|
||||||
import {
|
import { findHowManyDaysLeft, renderShortDate, renderShortMonthDate } from "helpers/date-time.helper";
|
||||||
getDateRangeStatus,
|
|
||||||
findHowManyDaysLeft,
|
|
||||||
renderShortDate,
|
|
||||||
renderShortMonthDate,
|
|
||||||
} from "helpers/date-time.helper";
|
|
||||||
import { copyTextToClipboard } from "helpers/string.helper";
|
import { copyTextToClipboard } from "helpers/string.helper";
|
||||||
// types
|
// types
|
||||||
import { ICycle } from "types";
|
import { ICycle, TCycleGroups } from "types";
|
||||||
// constants
|
// constants
|
||||||
import { CYCLE_STATUS } from "constants/cycle";
|
import { CYCLE_STATUS } from "constants/cycle";
|
||||||
import { EUserWorkspaceRoles } from "constants/workspace";
|
import { EUserWorkspaceRoles } from "constants/workspace";
|
||||||
@ -50,7 +45,7 @@ export const CyclesListItem: FC<TCyclesListItem> = (props) => {
|
|||||||
const [updateModal, setUpdateModal] = useState(false);
|
const [updateModal, setUpdateModal] = useState(false);
|
||||||
const [deleteModal, setDeleteModal] = useState(false);
|
const [deleteModal, setDeleteModal] = useState(false);
|
||||||
// computed
|
// computed
|
||||||
const cycleStatus = getDateRangeStatus(cycle.start_date, cycle.end_date);
|
const cycleStatus = cycle.status.toLocaleLowerCase() as TCycleGroups;
|
||||||
const isCompleted = cycleStatus === "completed";
|
const isCompleted = cycleStatus === "completed";
|
||||||
const endDate = new Date(cycle.end_date ?? "");
|
const endDate = new Date(cycle.end_date ?? "");
|
||||||
const startDate = new Date(cycle.start_date ?? "");
|
const startDate = new Date(cycle.start_date ?? "");
|
||||||
|
@ -3,7 +3,7 @@ import { useRouter } from "next/router";
|
|||||||
// ui
|
// ui
|
||||||
import { Tooltip, ContrastIcon } from "@plane/ui";
|
import { Tooltip, ContrastIcon } from "@plane/ui";
|
||||||
// helpers
|
// helpers
|
||||||
import { getDateRangeStatus, renderShortDate } from "helpers/date-time.helper";
|
import { renderShortDate } from "helpers/date-time.helper";
|
||||||
// types
|
// types
|
||||||
import { ICycle } from "types";
|
import { ICycle } from "types";
|
||||||
|
|
||||||
@ -11,8 +11,7 @@ export const CycleGanttBlock = ({ data }: { data: ICycle }) => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
|
|
||||||
const cycleStatus = getDateRangeStatus(data?.start_date, data?.end_date);
|
const cycleStatus = data.status.toLocaleLowerCase();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="relative flex h-full w-full items-center rounded"
|
className="relative flex h-full w-full items-center rounded"
|
||||||
@ -21,12 +20,12 @@ export const CycleGanttBlock = ({ data }: { data: ICycle }) => {
|
|||||||
cycleStatus === "current"
|
cycleStatus === "current"
|
||||||
? "#09a953"
|
? "#09a953"
|
||||||
: cycleStatus === "upcoming"
|
: cycleStatus === "upcoming"
|
||||||
? "#f7ae59"
|
? "#f7ae59"
|
||||||
: cycleStatus === "completed"
|
: cycleStatus === "completed"
|
||||||
? "#3f76ff"
|
? "#3f76ff"
|
||||||
: cycleStatus === "draft"
|
: cycleStatus === "draft"
|
||||||
? "rgb(var(--color-text-200))"
|
? "rgb(var(--color-text-200))"
|
||||||
: "",
|
: "",
|
||||||
}}
|
}}
|
||||||
onClick={() => router.push(`/${workspaceSlug}/projects/${data?.project}/cycles/${data?.id}`)}
|
onClick={() => router.push(`/${workspaceSlug}/projects/${data?.project}/cycles/${data?.id}`)}
|
||||||
>
|
>
|
||||||
@ -52,7 +51,7 @@ export const CycleGanttSidebarBlock = ({ data }: { data: ICycle }) => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
|
|
||||||
const cycleStatus = getDateRangeStatus(data?.start_date, data?.end_date);
|
const cycleStatus = data.status.toLocaleLowerCase();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -65,12 +64,12 @@ export const CycleGanttSidebarBlock = ({ data }: { data: ICycle }) => {
|
|||||||
cycleStatus === "current"
|
cycleStatus === "current"
|
||||||
? "#09a953"
|
? "#09a953"
|
||||||
: cycleStatus === "upcoming"
|
: cycleStatus === "upcoming"
|
||||||
? "#f7ae59"
|
? "#f7ae59"
|
||||||
: cycleStatus === "completed"
|
: cycleStatus === "completed"
|
||||||
? "#3f76ff"
|
? "#3f76ff"
|
||||||
: cycleStatus === "draft"
|
: cycleStatus === "draft"
|
||||||
? "rgb(var(--color-text-200))"
|
? "rgb(var(--color-text-200))"
|
||||||
: ""
|
: ""
|
||||||
}`}
|
}`}
|
||||||
/>
|
/>
|
||||||
<h6 className="flex-grow truncate text-sm font-medium">{data?.name}</h6>
|
<h6 className="flex-grow truncate text-sm font-medium">{data?.name}</h6>
|
||||||
|
@ -31,7 +31,6 @@ import {
|
|||||||
import { copyUrlToClipboard } from "helpers/string.helper";
|
import { copyUrlToClipboard } from "helpers/string.helper";
|
||||||
import {
|
import {
|
||||||
findHowManyDaysLeft,
|
findHowManyDaysLeft,
|
||||||
getDateRangeStatus,
|
|
||||||
isDateGreaterThanToday,
|
isDateGreaterThanToday,
|
||||||
renderDateFormat,
|
renderDateFormat,
|
||||||
renderShortDate,
|
renderShortDate,
|
||||||
@ -275,10 +274,7 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
[workspaceSlug, projectId, cycleId, issueFilters, updateFilters]
|
[workspaceSlug, projectId, cycleId, issueFilters, updateFilters]
|
||||||
);
|
);
|
||||||
|
|
||||||
const cycleStatus =
|
const cycleStatus = cycleDetails.status.toLocaleLowerCase();
|
||||||
cycleDetails?.start_date && cycleDetails?.end_date
|
|
||||||
? getDateRangeStatus(cycleDetails?.start_date, cycleDetails?.end_date)
|
|
||||||
: "draft";
|
|
||||||
const isCompleted = cycleStatus === "completed";
|
const isCompleted = cycleStatus === "completed";
|
||||||
|
|
||||||
const isStartValid = new Date(`${cycleDetails?.start_date}`) <= new Date();
|
const isStartValid = new Date(`${cycleDetails?.start_date}`) <= new Date();
|
||||||
|
@ -15,8 +15,6 @@ import { AlertCircle, Search, X } from "lucide-react";
|
|||||||
import { INCOMPLETE_CYCLES_LIST } from "constants/fetch-keys";
|
import { INCOMPLETE_CYCLES_LIST } from "constants/fetch-keys";
|
||||||
// types
|
// types
|
||||||
import { ICycle } from "types";
|
import { ICycle } from "types";
|
||||||
//helper
|
|
||||||
import { getDateRangeStatus } from "helpers/date-time.helper";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@ -138,7 +136,7 @@ export const TransferIssuesModal: React.FC<Props> = observer(({ isOpen, handleCl
|
|||||||
<div className="flex w-full justify-between">
|
<div className="flex w-full justify-between">
|
||||||
<span>{option?.name}</span>
|
<span>{option?.name}</span>
|
||||||
<span className=" flex items-center rounded-full bg-custom-background-80 px-2 capitalize">
|
<span className=" flex items-center rounded-full bg-custom-background-80 px-2 capitalize">
|
||||||
{getDateRangeStatus(option?.start_date, option?.end_date)}
|
{option.status}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
@ -95,7 +95,7 @@ export const GlobalIssuesHeader: React.FC<Props> = observer((props) => {
|
|||||||
<PhotoFilterIcon className="h-4 w-4 text-custom-text-300" />
|
<PhotoFilterIcon className="h-4 w-4 text-custom-text-300" />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
label={`Workspace ${activeLayout === "spreadsheet" ? "Issues" : "Views"}`}
|
label={`All ${activeLayout === "spreadsheet" ? "Issues" : "Views"}`}
|
||||||
/>
|
/>
|
||||||
</Breadcrumbs>
|
</Breadcrumbs>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,7 +23,7 @@ export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
|
|||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
const handleCopyIssueLink = () => {
|
const handleCopyIssueLink = () => {
|
||||||
copyUrlToClipboard(`/${workspaceSlug}/projects/${issue.project}/archived-issues/${issue.id}`).then(() =>
|
copyUrlToClipboard(`${workspaceSlug}/projects/${issue.project}/archived-issues/${issue.id}`).then(() =>
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "success",
|
type: "success",
|
||||||
title: "Link copied",
|
title: "Link copied",
|
||||||
|
@ -27,7 +27,7 @@ export const CycleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
|||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
const handleCopyIssueLink = () => {
|
const handleCopyIssueLink = () => {
|
||||||
copyUrlToClipboard(`/${workspaceSlug}/projects/${issue.project}/issues/${issue.id}`).then(() =>
|
copyUrlToClipboard(`${workspaceSlug}/projects/${issue.project}/issues/${issue.id}`).then(() =>
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "success",
|
type: "success",
|
||||||
title: "Link copied",
|
title: "Link copied",
|
||||||
|
@ -27,7 +27,7 @@ export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
|
|||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
const handleCopyIssueLink = () => {
|
const handleCopyIssueLink = () => {
|
||||||
copyUrlToClipboard(`/${workspaceSlug}/projects/${issue.project}/issues/${issue.id}`).then(() =>
|
copyUrlToClipboard(`${workspaceSlug}/projects/${issue.project}/issues/${issue.id}`).then(() =>
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "success",
|
type: "success",
|
||||||
title: "Link copied",
|
title: "Link copied",
|
||||||
|
@ -37,7 +37,7 @@ export const ProjectIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
|
|||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
const handleCopyIssueLink = () => {
|
const handleCopyIssueLink = () => {
|
||||||
copyUrlToClipboard(`/${workspaceSlug}/projects/${issue.project}/issues/${issue.id}`).then(() =>
|
copyUrlToClipboard(`${workspaceSlug}/projects/${issue.project}/issues/${issue.id}`).then(() =>
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "success",
|
type: "success",
|
||||||
title: "Link copied",
|
title: "Link copied",
|
||||||
|
@ -17,8 +17,6 @@ import {
|
|||||||
import { TransferIssues, TransferIssuesModal } from "components/cycles";
|
import { TransferIssues, TransferIssuesModal } from "components/cycles";
|
||||||
// ui
|
// ui
|
||||||
import { Spinner } from "@plane/ui";
|
import { Spinner } from "@plane/ui";
|
||||||
// helpers
|
|
||||||
import { getDateRangeStatus } from "helpers/date-time.helper";
|
|
||||||
|
|
||||||
export const CycleLayoutRoot: React.FC = observer(() => {
|
export const CycleLayoutRoot: React.FC = observer(() => {
|
||||||
const [transferIssuesModal, setTransferIssuesModal] = useState(false);
|
const [transferIssuesModal, setTransferIssuesModal] = useState(false);
|
||||||
@ -50,10 +48,7 @@ export const CycleLayoutRoot: React.FC = observer(() => {
|
|||||||
const activeLayout = issueFilters?.displayFilters?.layout;
|
const activeLayout = issueFilters?.displayFilters?.layout;
|
||||||
|
|
||||||
const cycleDetails = cycleId ? cycleStore.cycle_details[cycleId.toString()] : undefined;
|
const cycleDetails = cycleId ? cycleStore.cycle_details[cycleId.toString()] : undefined;
|
||||||
const cycleStatus =
|
const cycleStatus = cycleDetails?.status.toLocaleLowerCase() ?? "draft";
|
||||||
cycleDetails?.start_date && cycleDetails?.end_date
|
|
||||||
? getDateRangeStatus(cycleDetails?.start_date, cycleDetails?.end_date)
|
|
||||||
: "draft";
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -88,7 +88,7 @@ export const IssueActivityCard: FC<IIssueActivityCard> = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="min-w-0 flex-1 py-3">
|
<div className="min-w-0 flex-1 py-3">
|
||||||
<div className="break-words text-xs text-custom-text-200">
|
<div className="flex gap-1 break-words text-xs text-custom-text-200">
|
||||||
{activityItem.field === "archived_at" && activityItem.new_value !== "restore" ? (
|
{activityItem.field === "archived_at" && activityItem.new_value !== "restore" ? (
|
||||||
<span className="text-gray font-medium">Plane</span>
|
<span className="text-gray font-medium">Plane</span>
|
||||||
) : activityItem.actor_detail.is_bot ? (
|
) : activityItem.actor_detail.is_bot ? (
|
||||||
@ -101,8 +101,8 @@ export const IssueActivityCard: FC<IIssueActivityCard> = (props) => {
|
|||||||
: activityItem.actor_detail.display_name}
|
: activityItem.actor_detail.display_name}
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
)}{" "}
|
)}
|
||||||
{message}{" "}
|
{message}
|
||||||
<Tooltip
|
<Tooltip
|
||||||
tooltipContent={`${renderLongDateFormat(activityItem.created_at)}, ${render24HourFormatTime(
|
tooltipContent={`${renderLongDateFormat(activityItem.created_at)}, ${render24HourFormatTime(
|
||||||
activityItem.created_at
|
activityItem.created_at
|
||||||
|
@ -35,31 +35,34 @@ export const SidebarParentSelect: React.FC<Props> = ({ onChange, issueDetails, p
|
|||||||
issueId={issueId as string}
|
issueId={issueId as string}
|
||||||
projectId={projectId as string}
|
projectId={projectId as string}
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
<button
|
className={`flex items-center gap-2 rounded bg-custom-background-80 px-2.5 py-0.5 text-xs w-max max-w-max" ${
|
||||||
type="button"
|
|
||||||
className={`flex items-center gap-2 rounded bg-custom-background-80 px-2.5 py-0.5 text-xs max-w-max" ${
|
|
||||||
disabled ? "cursor-not-allowed" : "cursor-pointer "
|
disabled ? "cursor-not-allowed" : "cursor-pointer "
|
||||||
}`}
|
}`}
|
||||||
onClick={() => {
|
|
||||||
if (issueDetails?.parent) {
|
|
||||||
onChange("");
|
|
||||||
setSelectedParentIssue(null);
|
|
||||||
} else {
|
|
||||||
setIsParentModalOpen(true);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
disabled={disabled}
|
|
||||||
>
|
>
|
||||||
{selectedParentIssue && issueDetails?.parent ? (
|
<button type="button" className="flex-shrink-0" onClick={() => setIsParentModalOpen(true)} disabled={disabled}>
|
||||||
`${selectedParentIssue.project__identifier}-${selectedParentIssue.sequence_id}`
|
{selectedParentIssue && issueDetails?.parent ? (
|
||||||
) : !selectedParentIssue && issueDetails?.parent ? (
|
`${selectedParentIssue.project__identifier}-${selectedParentIssue.sequence_id}`
|
||||||
`${issueDetails.parent_detail?.project_detail.identifier}-${issueDetails.parent_detail?.sequence_id}`
|
) : !selectedParentIssue && issueDetails?.parent ? (
|
||||||
) : (
|
`${issueDetails.parent_detail?.project_detail.identifier}-${issueDetails.parent_detail?.sequence_id}`
|
||||||
<span className="text-custom-text-200">Select issue</span>
|
) : (
|
||||||
|
<span className="text-custom-text-200">Select issue</span>
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{issueDetails?.parent && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="flex-shrink-0"
|
||||||
|
onClick={() => {
|
||||||
|
onChange("");
|
||||||
|
setSelectedParentIssue(null);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<X className="h-2.5 w-2.5" />
|
||||||
|
</button>
|
||||||
)}
|
)}
|
||||||
{issueDetails?.parent && <X className="h-2.5 w-2.5" />}
|
</div>
|
||||||
</button>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
|
||||||
// services
|
// services
|
||||||
import { UserService } from "services/user.service";
|
import { UserService } from "services/user.service";
|
||||||
// components
|
// components
|
||||||
@ -9,7 +7,6 @@ import { ActivityMessage } from "components/core";
|
|||||||
// ui
|
// ui
|
||||||
import { ProfileEmptyState } from "components/ui";
|
import { ProfileEmptyState } from "components/ui";
|
||||||
import { Loader } from "@plane/ui";
|
import { Loader } from "@plane/ui";
|
||||||
import { Rocket } from "lucide-react";
|
|
||||||
// image
|
// image
|
||||||
import recentActivityEmptyState from "public/empty-state/recent_activity.svg";
|
import recentActivityEmptyState from "public/empty-state/recent_activity.svg";
|
||||||
// helpers
|
// helpers
|
||||||
@ -67,10 +64,9 @@ export const ProfileActivity = () => {
|
|||||||
href={`/${workspaceSlug}/projects/${activity.project}/issues/${activity.issue}`}
|
href={`/${workspaceSlug}/projects/${activity.project}/issues/${activity.issue}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="inline-flex items-center gap-1 font-medium text-custom-text-100 hover:underline"
|
className="inline-flex items-center gap-1 font-medium text-custom-text-200 hover:underline"
|
||||||
>
|
>
|
||||||
Issue
|
Issue.
|
||||||
<Rocket className="h-3 w-3" />
|
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
@ -170,18 +170,6 @@ export const formatLongDateDistance = (date: string | Date) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDateRangeStatus = (startDate: string | null | undefined, endDate: string | null | undefined) => {
|
|
||||||
if (!startDate || !endDate) return "draft";
|
|
||||||
|
|
||||||
const now = new Date();
|
|
||||||
const start = new Date(startDate);
|
|
||||||
const end = new Date(endDate);
|
|
||||||
|
|
||||||
if (start <= now && end >= now) return "current";
|
|
||||||
else if (start > now) return "upcoming";
|
|
||||||
else return "completed";
|
|
||||||
};
|
|
||||||
|
|
||||||
export const renderShortDateWithYearFormat = (date: string | Date, placeholder?: string) => {
|
export const renderShortDateWithYearFormat = (date: string | Date, placeholder?: string) => {
|
||||||
if (!date || date === "") return null;
|
if (!date || date === "") return null;
|
||||||
|
|
||||||
|
@ -17,36 +17,54 @@ const useSignInRedirection = (): UseSignInRedirectionProps => {
|
|||||||
const [error, setError] = useState<any | null>(null);
|
const [error, setError] = useState<any | null>(null);
|
||||||
// router
|
// router
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { next_url } = router.query;
|
const { next_path } = router.query;
|
||||||
// mobx store
|
// mobx store
|
||||||
const {
|
const {
|
||||||
user: { fetchCurrentUser, fetchCurrentUserSettings },
|
user: { fetchCurrentUser, fetchCurrentUserSettings },
|
||||||
} = useMobxStore();
|
} = useMobxStore();
|
||||||
|
|
||||||
|
const isValidURL = (url: string): boolean => {
|
||||||
|
const disallowedSchemes = /^(https?|ftp):\/\//i;
|
||||||
|
return !disallowedSchemes.test(url);
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("next_path", next_path);
|
||||||
|
|
||||||
const handleSignInRedirection = useCallback(
|
const handleSignInRedirection = useCallback(
|
||||||
async (user: IUser) => {
|
async (user: IUser) => {
|
||||||
// if the user is not onboarded, redirect them to the onboarding page
|
try {
|
||||||
if (!user.is_onboarded) {
|
// if the user is not onboarded, redirect them to the onboarding page
|
||||||
router.push("/onboarding");
|
if (!user.is_onboarded) {
|
||||||
return;
|
router.push("/onboarding");
|
||||||
}
|
return;
|
||||||
// if next_url is provided, redirect the user to that url
|
}
|
||||||
if (next_url) {
|
// if next_path is provided, redirect the user to that url
|
||||||
router.push(next_url.toString());
|
if (next_path) {
|
||||||
return;
|
if (isValidURL(next_path.toString())) {
|
||||||
}
|
router.push(next_path.toString());
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
router.push("/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if the user is onboarded, fetch their last workspace details
|
// Fetch the current user settings
|
||||||
await fetchCurrentUserSettings()
|
const userSettings: IUserSettings = await fetchCurrentUserSettings();
|
||||||
.then((userSettings: IUserSettings) => {
|
|
||||||
const workspaceSlug =
|
// Extract workspace details
|
||||||
userSettings?.workspace?.last_workspace_slug || userSettings?.workspace?.fallback_workspace_slug;
|
const workspaceSlug =
|
||||||
if (workspaceSlug) router.push(`/${workspaceSlug}`);
|
userSettings?.workspace?.last_workspace_slug || userSettings?.workspace?.fallback_workspace_slug;
|
||||||
else router.push("/profile");
|
|
||||||
})
|
// Redirect based on workspace details or to profile if not available
|
||||||
.catch((err) => setError(err));
|
if (workspaceSlug) router.push(`/${workspaceSlug}`);
|
||||||
|
else router.push("/profile");
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error in handleSignInRedirection:", error);
|
||||||
|
setError(error);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[fetchCurrentUserSettings, router, next_url]
|
[fetchCurrentUserSettings, router, next_path]
|
||||||
);
|
);
|
||||||
|
|
||||||
const updateUserInfo = useCallback(async () => {
|
const updateUserInfo = useCallback(async () => {
|
||||||
|
@ -12,7 +12,7 @@ const workspaceService = new WorkspaceService();
|
|||||||
|
|
||||||
const useUserAuth = (routeAuth: "sign-in" | "onboarding" | "admin" | null = "admin") => {
|
const useUserAuth = (routeAuth: "sign-in" | "onboarding" | "admin" | null = "admin") => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { next_url } = router.query;
|
const { next_path } = router.query;
|
||||||
|
|
||||||
const [isRouteAccess, setIsRouteAccess] = useState(true);
|
const [isRouteAccess, setIsRouteAccess] = useState(true);
|
||||||
const {
|
const {
|
||||||
@ -29,6 +29,11 @@ const useUserAuth = (routeAuth: "sign-in" | "onboarding" | "admin" | null = "adm
|
|||||||
shouldRetryOnError: false,
|
shouldRetryOnError: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const isValidURL = (url: string): boolean => {
|
||||||
|
const disallowedSchemes = /^(https?|ftp):\/\//i;
|
||||||
|
return !disallowedSchemes.test(url);
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleWorkSpaceRedirection = async () => {
|
const handleWorkSpaceRedirection = async () => {
|
||||||
workspaceService.userWorkspaces().then(async (userWorkspaces) => {
|
workspaceService.userWorkspaces().then(async (userWorkspaces) => {
|
||||||
@ -84,8 +89,15 @@ const useUserAuth = (routeAuth: "sign-in" | "onboarding" | "admin" | null = "adm
|
|||||||
if (!isLoading) {
|
if (!isLoading) {
|
||||||
setIsRouteAccess(() => true);
|
setIsRouteAccess(() => true);
|
||||||
if (user) {
|
if (user) {
|
||||||
if (next_url) router.push(next_url.toString());
|
if (next_path) {
|
||||||
else handleUserRouteAuthentication();
|
if (isValidURL(next_path.toString())) {
|
||||||
|
router.push(next_path.toString());
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
router.push("/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else handleUserRouteAuthentication();
|
||||||
} else {
|
} else {
|
||||||
if (routeAuth === "sign-in") {
|
if (routeAuth === "sign-in") {
|
||||||
setIsRouteAccess(() => false);
|
setIsRouteAccess(() => false);
|
||||||
@ -97,7 +109,7 @@ const useUserAuth = (routeAuth: "sign-in" | "onboarding" | "admin" | null = "adm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [user, isLoading, routeAuth, router, next_url]);
|
}, [user, isLoading, routeAuth, router, next_path]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isLoading: isRouteAccess,
|
isLoading: isRouteAccess,
|
||||||
|
@ -31,7 +31,7 @@ export default function useUser({ redirectTo = "", redirectIfFound = false, opti
|
|||||||
) {
|
) {
|
||||||
router.push(redirectTo);
|
router.push(redirectTo);
|
||||||
return;
|
return;
|
||||||
// const nextLocation = router.asPath.split("?next=")[1];
|
// const nextLocation = router.asPath.split("?next_path=")[1];
|
||||||
// if (nextLocation) {
|
// if (nextLocation) {
|
||||||
// router.push(nextLocation as string);
|
// router.push(nextLocation as string);
|
||||||
// return;
|
// return;
|
||||||
|
@ -56,7 +56,7 @@ export const UserAuthWrapper: FC<IUserAuthWrapper> = observer((props) => {
|
|||||||
|
|
||||||
if (currentUserError) {
|
if (currentUserError) {
|
||||||
const redirectTo = router.asPath;
|
const redirectTo = router.asPath;
|
||||||
router.push(`/?next=${redirectTo}`);
|
router.push(`/?next_path=${redirectTo}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@ import { Controller, useForm } from "react-hook-form";
|
|||||||
import { useMobxStore } from "lib/mobx/store-provider";
|
import { useMobxStore } from "lib/mobx/store-provider";
|
||||||
// services
|
// services
|
||||||
import { WorkspaceService } from "services/workspace.service";
|
import { WorkspaceService } from "services/workspace.service";
|
||||||
// hooks
|
|
||||||
import useUserAuth from "hooks/use-user-auth";
|
|
||||||
// layouts
|
// layouts
|
||||||
import DefaultLayout from "layouts/default-layout";
|
import DefaultLayout from "layouts/default-layout";
|
||||||
import { UserAuthWrapper } from "layouts/auth-layout";
|
import { UserAuthWrapper } from "layouts/auth-layout";
|
||||||
@ -45,8 +43,6 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
|
|||||||
|
|
||||||
const { setTheme } = useTheme();
|
const { setTheme } = useTheme();
|
||||||
|
|
||||||
const {} = useUserAuth("onboarding");
|
|
||||||
|
|
||||||
const { control, setValue } = useForm<{ full_name: string }>({
|
const { control, setValue } = useForm<{ full_name: string }>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
full_name: "",
|
full_name: "",
|
||||||
@ -158,8 +154,8 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
|
|||||||
currentUser?.first_name
|
currentUser?.first_name
|
||||||
? `${currentUser?.first_name} ${currentUser?.last_name ?? ""}`
|
? `${currentUser?.first_name} ${currentUser?.last_name ?? ""}`
|
||||||
: value.length > 0
|
: value.length > 0
|
||||||
? value
|
? value
|
||||||
: currentUser?.email
|
: currentUser?.email
|
||||||
}
|
}
|
||||||
src={currentUser?.avatar}
|
src={currentUser?.avatar}
|
||||||
size={35}
|
size={35}
|
||||||
@ -174,8 +170,8 @@ const OnboardingPage: NextPageWithLayout = observer(() => {
|
|||||||
{currentUser?.first_name
|
{currentUser?.first_name
|
||||||
? `${currentUser?.first_name} ${currentUser?.last_name ?? ""}`
|
? `${currentUser?.first_name} ${currentUser?.last_name ?? ""}`
|
||||||
: value.length > 0
|
: value.length > 0
|
||||||
? value
|
? value
|
||||||
: null}
|
: null}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import { RootStore } from "../root";
|
|||||||
import { ProjectService } from "services/project";
|
import { ProjectService } from "services/project";
|
||||||
import { IssueService } from "services/issue";
|
import { IssueService } from "services/issue";
|
||||||
import { CycleService } from "services/cycle.service";
|
import { CycleService } from "services/cycle.service";
|
||||||
import { getDateRangeStatus } from "helpers/date-time.helper";
|
|
||||||
|
|
||||||
export interface ICycleStore {
|
export interface ICycleStore {
|
||||||
loader: boolean;
|
loader: boolean;
|
||||||
@ -318,7 +317,7 @@ export class CycleStore implements ICycleStore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
addCycleToFavorites = async (workspaceSlug: string, projectId: string, cycle: ICycle) => {
|
addCycleToFavorites = async (workspaceSlug: string, projectId: string, cycle: ICycle) => {
|
||||||
const cycleStatus = getDateRangeStatus(cycle.start_date, cycle.end_date);
|
const cycleStatus = cycle.status;
|
||||||
|
|
||||||
const statusCyclesList = this.cycles[projectId]?.[cycleStatus] ?? [];
|
const statusCyclesList = this.cycles[projectId]?.[cycleStatus] ?? [];
|
||||||
const allCyclesList = this.projectCycles ?? [];
|
const allCyclesList = this.projectCycles ?? [];
|
||||||
@ -379,7 +378,7 @@ export class CycleStore implements ICycleStore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
removeCycleFromFavorites = async (workspaceSlug: string, projectId: string, cycle: ICycle) => {
|
removeCycleFromFavorites = async (workspaceSlug: string, projectId: string, cycle: ICycle) => {
|
||||||
const cycleStatus = getDateRangeStatus(cycle.start_date, cycle.end_date);
|
const cycleStatus = cycle.status;
|
||||||
|
|
||||||
const statusCyclesList = this.cycles[projectId]?.[cycleStatus] ?? [];
|
const statusCyclesList = this.cycles[projectId]?.[cycleStatus] ?? [];
|
||||||
const allCyclesList = this.projectCycles ?? [];
|
const allCyclesList = this.projectCycles ?? [];
|
||||||
|
3
web/types/cycles.d.ts
vendored
3
web/types/cycles.d.ts
vendored
@ -2,6 +2,8 @@ import type { IUser, IIssue, IProjectLite, IWorkspaceLite, IIssueFilterOptions,
|
|||||||
|
|
||||||
export type TCycleView = "all" | "active" | "upcoming" | "completed" | "draft";
|
export type TCycleView = "all" | "active" | "upcoming" | "completed" | "draft";
|
||||||
|
|
||||||
|
export type TCycleGroups = "current" | "upcoming" | "completed" | "draft";
|
||||||
|
|
||||||
export type TCycleLayout = "list" | "board" | "gantt";
|
export type TCycleLayout = "list" | "board" | "gantt";
|
||||||
|
|
||||||
export interface ICycle {
|
export interface ICycle {
|
||||||
@ -24,6 +26,7 @@ export interface ICycle {
|
|||||||
owned_by: IUser;
|
owned_by: IUser;
|
||||||
project: string;
|
project: string;
|
||||||
project_detail: IProjectLite;
|
project_detail: IProjectLite;
|
||||||
|
status: TCycleGroups;
|
||||||
sort_order: number;
|
sort_order: number;
|
||||||
start_date: string | null;
|
start_date: string | null;
|
||||||
started_issues: number;
|
started_issues: number;
|
||||||
|
Loading…
Reference in New Issue
Block a user