Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions web/components/cycles/active-cycle-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = (props) => {

const { setToastAlert } = useToast();

const { isLoading } = useSWR(
useSWR(
workspaceSlug && projectId ? `ACTIVE_CYCLE_ISSUE_${projectId}_CURRENT` : null,
workspaceSlug && projectId ? () => cycleStore.fetchCycles(workspaceSlug, projectId, "current") : null
);

const activeCycle = cycleStore.cycles?.[projectId] || null;
const activeCycle = cycleStore.cycles?.[projectId]?.active || null;
const cycle = activeCycle ? activeCycle[0] : null;
const issues = (cycleStore?.active_cycle_issues as any) || null;

Expand All @@ -93,7 +93,7 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = (props) => {
// : null
// ) as { data: IIssue[] | undefined };

if (isLoading)
if (!cycle)
return (
<Loader>
<Loader.Item height="250px" />
Expand Down Expand Up @@ -147,7 +147,7 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = (props) => {
e.preventDefault();
if (!workspaceSlug || !projectId) return;

cycleStore.addCycleToFavorites(workspaceSlug?.toString(), projectId.toString(), cycle.id).catch(() => {
cycleStore.addCycleToFavorites(workspaceSlug?.toString(), projectId.toString(), cycle).catch(() => {
setToastAlert({
type: "error",
title: "Error!",
Expand All @@ -160,7 +160,7 @@ export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = (props) => {
e.preventDefault();
if (!workspaceSlug || !projectId) return;

cycleStore.removeCycleFromFavorites(workspaceSlug?.toString(), projectId.toString(), cycle.id).catch(() => {
cycleStore.removeCycleFromFavorites(workspaceSlug?.toString(), projectId.toString(), cycle).catch(() => {
setToastAlert({
type: "error",
title: "Error!",
Expand Down
4 changes: 2 additions & 2 deletions web/components/cycles/cycles-board-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const CyclesBoardCard: FC<ICyclesBoardCard> = (props) => {
e.preventDefault();
if (!workspaceSlug || !projectId) return;

cycleStore.addCycleToFavorites(workspaceSlug?.toString(), projectId.toString(), cycle.id).catch(() => {
cycleStore.addCycleToFavorites(workspaceSlug?.toString(), projectId.toString(), cycle).catch(() => {
setToastAlert({
type: "error",
title: "Error!",
Expand All @@ -100,7 +100,7 @@ export const CyclesBoardCard: FC<ICyclesBoardCard> = (props) => {
e.preventDefault();
if (!workspaceSlug || !projectId) return;

cycleStore.removeCycleFromFavorites(workspaceSlug?.toString(), projectId.toString(), cycle.id).catch(() => {
cycleStore.removeCycleFromFavorites(workspaceSlug?.toString(), projectId.toString(), cycle).catch(() => {
setToastAlert({
type: "error",
title: "Error!",
Expand Down
2 changes: 1 addition & 1 deletion web/components/cycles/cycles-board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface ICyclesBoard {
filter: string;
workspaceSlug: string;
projectId: string;
peekCycle: string;
peekCycle: string | undefined;
}

export const CyclesBoard: FC<ICyclesBoard> = (props) => {
Expand Down
1 change: 0 additions & 1 deletion web/components/cycles/cycles-gantt.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions web/components/cycles/cycles-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const CyclesListItem: FC<TCyclesListItem> = (props) => {
e.preventDefault();
if (!workspaceSlug || !projectId) return;

cycleStore.addCycleToFavorites(workspaceSlug?.toString(), projectId.toString(), cycle.id).catch(() => {
cycleStore.addCycleToFavorites(workspaceSlug?.toString(), projectId.toString(), cycle).catch(() => {
setToastAlert({
type: "error",
title: "Error!",
Expand All @@ -100,7 +100,7 @@ export const CyclesListItem: FC<TCyclesListItem> = (props) => {
e.preventDefault();
if (!workspaceSlug || !projectId) return;

cycleStore.removeCycleFromFavorites(workspaceSlug?.toString(), projectId.toString(), cycle.id).catch(() => {
cycleStore.removeCycleFromFavorites(workspaceSlug?.toString(), projectId.toString(), cycle).catch(() => {
setToastAlert({
type: "error",
title: "Error!",
Expand Down
11 changes: 9 additions & 2 deletions web/components/cycles/cycles-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface ICyclesView {
layout: TCycleLayout;
workspaceSlug: string;
projectId: string;
peekCycle: string;
peekCycle: string | undefined;
}

export const CyclesView: FC<ICyclesView> = observer((props) => {
Expand All @@ -30,7 +30,14 @@ export const CyclesView: FC<ICyclesView> = observer((props) => {
workspaceSlug && projectId && filter ? () => cycleStore.fetchCycles(workspaceSlug, projectId, filter) : null
);

const cyclesList = cycleStore.cycles?.[projectId];
const cyclesList =
filter === "completed"
? cycleStore.projectCompletedCycles
: filter === "draft"
? cycleStore.projectDraftCycles
: filter === "upcoming"
? cycleStore.projectUpcomingCycles
: cycleStore.projectCycles;

return (
<>
Expand Down
2 changes: 0 additions & 2 deletions web/components/cycles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ export * from "./gantt-chart";
export * from "./cycles-view";
export * from "./form";
export * from "./modal";
export * from "./select";
export * from "./sidebar";
export * from "./transfer-issues-modal";
export * from "./transfer-issues";
export * from "./cycles-list";
export * from "./cycles-list-item";
export * from "./cycles-board";
export * from "./cycles-board-card";
export * from "./cycles-gantt";
export * from "./delete-modal";
export * from "./cycle-peek-overview";
export * from "./cycles-list-item";
2 changes: 1 addition & 1 deletion web/components/cycles/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const CycleCreateUpdateModal: React.FC<CycleModalProps> = (props) => {

const updateCycle = async (cycleId: string, payload: Partial<ICycle>) =>
cycleStore
.updateCycle(workspaceSlug, projectId, cycleId, payload)
.patchCycle(workspaceSlug, projectId, cycleId, payload)
.then(() => {
setToastAlert({
type: "success",
Expand Down
122 changes: 0 additions & 122 deletions web/components/cycles/select.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions web/components/cycles/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
</div>
<div className="relative h-40 w-80">
<ProgressChart
distribution={cycleDetails.distribution.completion_chart}
distribution={cycleDetails.distribution?.completion_chart ?? {}}
startDate={cycleDetails.start_date ?? ""}
endDate={cycleDetails.end_date ?? ""}
totalIssues={cycleDetails.total_issues}
Expand All @@ -512,7 +512,7 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
) : (
""
)}
{cycleDetails.total_issues > 0 && (
{cycleDetails.total_issues > 0 && cycleDetails.distribution && (
<div className="h-full w-full pt-5 border-t border-custom-border-200">
<SidebarProgressStats
distribution={cycleDetails.distribution}
Expand Down
2 changes: 1 addition & 1 deletion web/components/headers/cycle-issues.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const CycleIssuesHeader: React.FC = observer(() => {
[issueFilterStore, projectId, workspaceSlug]
);

const cyclesList = projectId ? cycleStore.cycles[projectId.toString()] : undefined;
const cyclesList = cycleStore.projectCycles;
const cycleDetails = cycleId ? cycleStore.getCycleById(cycleId.toString()) : undefined;

return (
Expand Down
2 changes: 1 addition & 1 deletion web/components/issues/select/cycle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const IssueCycleSelect: React.FC<IssueCycleSelectProps> = observer((props
if (workspaceSlug && projectId) cycleStore.fetchCycles(workspaceSlug, projectId, "all");
};

const cycles = projectId ? cycleStore.cycles[projectId] : undefined;
const cycles = cycleStore.projectCycles;

const selectedCycle = cycles ? cycles?.find((i) => i.id === value) : undefined;

Expand Down
12 changes: 5 additions & 7 deletions web/components/views/view-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ import React, { useState } from "react";
import Link from "next/link";
import { useRouter } from "next/router";
import { observer } from "mobx-react-lite";

import { PencilIcon, StarIcon, TrashIcon } from "lucide-react";
// mobx store
import { useMobxStore } from "lib/mobx/store-provider";
// components
import { CreateUpdateProjectViewModal, DeleteProjectViewModal } from "components/views";
// ui
import { CustomMenu } from "@plane/ui";
// icons
import { PencilIcon, Sparkles, StarIcon, TrashIcon } from "lucide-react";
// types
import { IProjectView } from "types";
import { CustomMenu, PhotoFilterIcon } from "@plane/ui";
// helpers
import { truncateText } from "helpers/string.helper";
import { calculateTotalFilters } from "helpers/filter.helper";
// types
import { IProjectView } from "types";

type Props = {
view: IProjectView;
Expand Down Expand Up @@ -64,7 +62,7 @@ export const ProjectViewListItem: React.FC<Props> = observer((props) => {
<div className="flex items-center justify-between w-full">
<div className="flex items-center gap-4">
<div className="grid place-items-center h-10 w-10 rounded bg-custom-background-90 group-hover:bg-custom-background-100">
<Sparkles size={14} strokeWidth={2} />
<PhotoFilterIcon className="h-3.5 w-3.5" />
</div>
<div className="flex flex-col">
<p className="truncate text-sm leading-4 font-medium">{truncateText(view.name, 75)}</p>
Expand Down
10 changes: 4 additions & 6 deletions web/components/workspace/views/view-list-item.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { useState } from "react";
import { useRouter } from "next/router";
import Link from "next/link";
import { observer } from "mobx-react-lite";
import { useState } from "react";

import { Pencil, Trash2 } from "lucide-react";
// components
import { CreateUpdateWorkspaceViewModal, DeleteGlobalViewModal } from "components/workspace";
// ui
import { CustomMenu } from "@plane/ui";
// icons
import { Pencil, Sparkles, Trash2 } from "lucide-react";
import { CustomMenu, PhotoFilterIcon } from "@plane/ui";
// helpers
import { truncateText } from "helpers/string.helper";
import { calculateTotalFilters } from "helpers/filter.helper";
Expand Down Expand Up @@ -38,7 +36,7 @@ export const GlobalViewListItem: React.FC<Props> = observer((props) => {
<div className="flex items-center justify-between w-full">
<div className="flex items-center gap-4">
<div className="grid place-items-center h-10 w-10 rounded bg-custom-background-90 group-hover:bg-custom-background-100">
<Sparkles size={14} strokeWidth={2} />
<PhotoFilterIcon className="h-3.5 w-3.5" />
</div>
<div className="flex flex-col">
<p className="truncate text-sm leading-4 font-medium">{truncateText(view.name, 75)}</p>
Expand Down
13 changes: 4 additions & 9 deletions web/helpers/date-time.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,13 @@ export const formatDateDistance = (date: string | Date) => {
export const getDateRangeStatus = (startDate: string | null | undefined, endDate: string | null | undefined) => {
if (!startDate || !endDate) return "draft";

const today = renderDateFormat(new Date());
const now = new Date(today);
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";
}
if (start <= now && end >= now) return "current";
else if (start > now) return "upcoming";
else return "completed";
};

export const renderShortDateWithYearFormat = (date: string | Date, placeholder?: string) => {
Expand Down
Loading