diff --git a/apps/web/ee/components/initiatives/common/update-status.tsx b/apps/web/ee/components/initiatives/common/update-status.tsx index aa2bcc6fdf..9b73d01951 100644 --- a/apps/web/ee/components/initiatives/common/update-status.tsx +++ b/apps/web/ee/components/initiatives/common/update-status.tsx @@ -54,6 +54,8 @@ export const UpdateStatusPills = (props: TStatusPills) => { [EUpdateStatus.AT_RISK]: analytics?.at_risk_updates ?? 0, [EUpdateStatus.OFF_TRACK]: analytics?.off_track_updates ?? 0, }; + + const getStatusText = (status: string): string => capitalizeFirstLetter(status.replaceAll("-", " ").toLowerCase()); // react-popper derived values const { styles, attributes } = usePopper(referenceElement, popperElement, { placement: "bottom", @@ -79,9 +81,11 @@ export const UpdateStatusPills = (props: TStatusPills) => { onClick={(e) => e.stopPropagation()} > - diff --git a/apps/web/ee/components/initiatives/components/initiative-date-range-dropdown.tsx b/apps/web/ee/components/initiatives/components/initiative-date-range-dropdown.tsx new file mode 100644 index 0000000000..291402bab9 --- /dev/null +++ b/apps/web/ee/components/initiatives/components/initiative-date-range-dropdown.tsx @@ -0,0 +1,55 @@ +"use client"; + +import type { FC } from "react"; +import { differenceInCalendarDays } from "date-fns"; +import { observer } from "mobx-react"; +// plane imports +import type { DateRange } from "@plane/propel/calendar"; +import { getDate, renderFormattedPayloadDate } from "@plane/utils"; +// core components +import { DateRangeDropdown } from "@/components/dropdowns/date-range"; +// plane Web +import { useInitiatives } from "@/plane-web/hooks/store/use-initiatives"; +import type { TInitiative } from "@/plane-web/types/initiative"; + +type TInitiativeDateRangeDropdownProps = { + initiative: TInitiative; + workspaceSlug: string; +}; + +export const InitiativeDateRangeDropdown: FC = observer((props) => { + const { initiative, workspaceSlug } = props; + const { + initiative: { updateInitiative }, + } = useInitiatives(); + + const handleDateChange = (range: DateRange | undefined) => { + updateInitiative?.(workspaceSlug, initiative.id, { + start_date: range?.from ? renderFormattedPayloadDate(range.from) : null, + end_date: range?.to ? renderFormattedPayloadDate(range.to) : null, + }); + }; + + const endDate = getDate(initiative.end_date); + const shouldHighlightEndDate = endDate && differenceInCalendarDays(endDate, new Date()) <= 0; + + return ( + + ); +}); diff --git a/apps/web/ee/components/initiatives/components/initiatives-block-properties.tsx b/apps/web/ee/components/initiatives/components/initiatives-block-properties.tsx index cb5e4e4f89..9dbf974114 100644 --- a/apps/web/ee/components/initiatives/components/initiatives-block-properties.tsx +++ b/apps/web/ee/components/initiatives/components/initiatives-block-properties.tsx @@ -3,11 +3,8 @@ import { observer } from "mobx-react"; // plane imports import { getRandomLabelColor } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; -import type { DateRange } from "@plane/propel/calendar"; import { setToast, TOAST_TYPE } from "@plane/propel/toast"; -import { getDate, renderFormattedPayloadDate } from "@plane/utils"; // core components -import { DateRangeDropdown } from "@/components/dropdowns/date-range"; import { MemberDropdown } from "@/components/dropdowns/member/dropdown"; import { ProjectDropdown } from "@/components/dropdowns/project/dropdown"; // plane Web @@ -16,6 +13,7 @@ import type { TInitiative } from "@/plane-web/types/initiative"; // ee components import { EpicsDropdown } from "../../dropdowns/epics"; // local components +import { InitiativeDateRangeDropdown } from "./initiative-date-range-dropdown"; import { InitiativeLabelDropdown } from "./labels/initiative-label-dropdown"; import { PropertyBlockWrapper } from "./property-block-wrapper"; import { InitiativeStateDropdown } from "./states/initiative-state-dropdown"; @@ -91,13 +89,6 @@ export const InitiativesBlockProperties = observer((props: Props) => { } }; - const handleDateChange = (range: DateRange | undefined) => { - updateInitiative?.(workspaceSlug, initiative.id, { - start_date: range?.from ? renderFormattedPayloadDate(range.from) : null, - end_date: range?.to ? renderFormattedPayloadDate(range.to) : null, - }); - }; - return (
{ > {/* dates */} - + {/* projects */} diff --git a/apps/web/ee/components/initiatives/components/labels/initiative-label-dropdown.tsx b/apps/web/ee/components/initiatives/components/labels/initiative-label-dropdown.tsx index 09dc2d987c..59304eee69 100644 --- a/apps/web/ee/components/initiatives/components/labels/initiative-label-dropdown.tsx +++ b/apps/web/ee/components/initiatives/components/labels/initiative-label-dropdown.tsx @@ -21,13 +21,6 @@ export type TInitiativeLabelDropdownProps = { value: string[]; onChange?: (value: string[]) => void; disabled?: boolean; - buttonVariant?: - | "border-with-text" - | "border-without-text" - | "background-with-text" - | "background-without-text" - | "transparent-with-text" - | "transparent-without-text"; buttonClassName?: string; className?: string; tabIndex?: number; diff --git a/apps/web/ee/components/initiatives/components/states/initiative-state-dropdown.tsx b/apps/web/ee/components/initiatives/components/states/initiative-state-dropdown.tsx index 732693f7b8..4b05ffc3a9 100644 --- a/apps/web/ee/components/initiatives/components/states/initiative-state-dropdown.tsx +++ b/apps/web/ee/components/initiatives/components/states/initiative-state-dropdown.tsx @@ -16,13 +16,6 @@ export type TInitiativeStateDropdownProps = { value: TInitiativeStates; onChange?: (value: TInitiativeStates) => void; disabled?: boolean; - buttonVariant?: - | "border-with-text" - | "border-without-text" - | "background-with-text" - | "background-without-text" - | "transparent-with-text" - | "transparent-without-text"; buttonClassName?: string; className?: string; tabIndex?: number; diff --git a/apps/web/ee/components/initiatives/details/main/root.tsx b/apps/web/ee/components/initiatives/details/main/root.tsx index e34bc7e5c6..28409ec9b7 100644 --- a/apps/web/ee/components/initiatives/details/main/root.tsx +++ b/apps/web/ee/components/initiatives/details/main/root.tsx @@ -35,6 +35,7 @@ export const InitiativeMainContentRoot: FC = observer((props) => { toggleProjectModal={toggleProjectModal} toggleEpicModal={toggleEpicModal} /> + = observer((props) => { toggleEpicModal={toggleEpicModal} disabled={disabled} /> - { return ( -
+
{type}s
{count}
{data ? ( -
-
-
Progress
+
+
- - {progress}% + + {progress}%
-
-
Updates
+
{
) : ( - - - +
+
+
+ + + + + + +
+
+
+ + + +
+
)} ); @@ -132,10 +144,10 @@ export const ScopeBreakdown = observer((props: Props) => {
{t("initiatives.scope.breakdown")}
{/* button */} -
+
{t("initiatives.scope.view_scope")} @@ -143,7 +155,15 @@ export const ScopeBreakdown = observer((props: Props) => { disabled={disabled} workspaceSlug={workspaceSlug} initiativeId={initiativeId} - customButton={} + customButton={ + + } />
@@ -158,7 +178,7 @@ export const ScopeBreakdown = observer((props: Props) => { } /> ) : ( -
+
{/* Projects */} {shouldShowProjectsCard && (