Skip to content

Commit 7124e8e

Browse files
[WEB-5608] chore: Hide "Pro" Features in Community Edition (#8288)
* chore: Hide "Pro" Features in Community Edition * refactor: remove time tracking feature and simplify project features list
1 parent 639a2aa commit 7124e8e

File tree

4 files changed

+31
-78
lines changed

4 files changed

+31
-78
lines changed

apps/web/ce/components/estimates/estimate-list-item-buttons.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import type { FC } from "react";
21
import { observer } from "mobx-react";
3-
import { Pen, Trash } from "lucide-react";
2+
import { Trash } from "lucide-react";
43
import { PROJECT_SETTINGS_TRACKER_ELEMENTS } from "@plane/constants";
5-
import { Tooltip } from "@plane/propel/tooltip";
6-
// components
7-
import { ProIcon } from "@/components/common/pro-icon";
84

95
type TEstimateListItem = {
106
estimateId: string;
@@ -21,22 +17,6 @@ export const EstimateListItemButtons = observer(function EstimateListItemButtons
2117
if (!isAdmin || !isEditable) return <></>;
2218
return (
2319
<div className="relative flex items-center gap-1">
24-
<Tooltip
25-
tooltipContent={
26-
<div className="relative flex items-center gap-2">
27-
<div>Upgrade</div>
28-
<ProIcon className="w-3 h-3" />
29-
</div>
30-
}
31-
position="top"
32-
>
33-
<button
34-
className="relative flex-shrink-0 w-6 h-6 flex justify-center items-center rounded cursor-pointer transition-colors overflow-hidden hover:bg-custom-background-80"
35-
data-ph-element={PROJECT_SETTINGS_TRACKER_ELEMENTS.ESTIMATES_LIST_ITEM}
36-
>
37-
<Pen size={12} />
38-
</button>
39-
</Tooltip>
4020
<button
4121
className="relative flex-shrink-0 w-6 h-6 flex justify-center items-center rounded cursor-pointer transition-colors overflow-hidden hover:bg-custom-background-80"
4222
onClick={() => onDeleteClick && onDeleteClick(estimateId)}

apps/web/ce/constants/project/settings/features.tsx

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { ReactNode } from "react";
2-
import { Timer } from "lucide-react";
32
// plane imports
43
import { CycleIcon, IntakeIcon, ModuleIcon, PageIcon, ViewsIcon } from "@plane/propel/icons";
54
import type { IProject } from "@plane/types";
@@ -17,7 +16,6 @@ export type TProperties = {
1716
};
1817

1918
type TProjectBaseFeatureKeys = "cycles" | "modules" | "views" | "pages" | "inbox";
20-
type TProjectOtherFeatureKeys = "is_time_tracking_enabled";
2119

2220
type TBaseFeatureList = {
2321
[key in TProjectBaseFeatureKeys]: TProperties;
@@ -71,35 +69,13 @@ export const PROJECT_BASE_FEATURES_LIST: TBaseFeatureList = {
7169
},
7270
};
7371

74-
type TOtherFeatureList = {
75-
[key in TProjectOtherFeatureKeys]: TProperties;
76-
};
77-
78-
export const PROJECT_OTHER_FEATURES_LIST: TOtherFeatureList = {
79-
is_time_tracking_enabled: {
80-
key: "time_tracking",
81-
property: "is_time_tracking_enabled",
82-
title: "Time Tracking",
83-
description: "Log time, see timesheets, and download full CSVs for your entire workspace.",
84-
icon: <Timer className="h-5 w-5 flex-shrink-0 text-custom-text-300" />,
85-
isPro: true,
86-
isEnabled: false,
87-
},
88-
};
89-
9072
type TProjectFeatures = {
9173
project_features: {
9274
key: string;
9375
title: string;
9476
description: string;
9577
featureList: TBaseFeatureList;
9678
};
97-
project_others: {
98-
key: string;
99-
title: string;
100-
description: string;
101-
featureList: TOtherFeatureList;
102-
};
10379
};
10480

10581
export const PROJECT_FEATURES_LIST: TProjectFeatures = {
@@ -109,10 +85,4 @@ export const PROJECT_FEATURES_LIST: TProjectFeatures = {
10985
description: "Toggle these on or off this project.",
11086
featureList: PROJECT_BASE_FEATURES_LIST,
11187
},
112-
project_others: {
113-
key: "work_management",
114-
title: "Work management",
115-
description: "Available only on some plans as indicated by the label next to the feature below.",
116-
featureList: PROJECT_OTHER_FEATURES_LIST,
117-
},
11888
};

apps/web/core/components/estimates/create/stage-one.tsx

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { FC } from "react";
21
import { Info } from "lucide-react";
32
// plane imports
43
import { EEstimateSystem, ESTIMATE_SYSTEMS } from "@plane/constants";
@@ -32,29 +31,32 @@ export function EstimateCreateStageOne(props: TEstimateCreateStageOne) {
3231
<div className="space-y-6">
3332
<div className="sm:flex sm:items-center sm:space-x-10 sm:space-y-0 gap-2 mb-2">
3433
<RadioInput
35-
options={Object.keys(ESTIMATE_SYSTEMS).map((system) => {
36-
const currentSystem = system as TEstimateSystemKeys;
37-
const isEnabled = isEstimateSystemEnabled(currentSystem);
38-
return {
39-
label: !ESTIMATE_SYSTEMS[currentSystem]?.is_available ? (
40-
<div className="relative flex items-center gap-2 cursor-no-drop text-custom-text-300">
41-
{t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)}
42-
<Tooltip tooltipContent={t("common.coming_soon")}>
43-
<Info size={12} />
44-
</Tooltip>
45-
</div>
46-
) : !isEnabled ? (
47-
<div className="relative flex items-center gap-2 cursor-no-drop text-custom-text-300">
48-
{t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)}
49-
<UpgradeBadge />
50-
</div>
51-
) : (
52-
<div>{t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)}</div>
53-
),
54-
value: system,
55-
disabled: !isEnabled,
56-
};
57-
})}
34+
options={Object.keys(ESTIMATE_SYSTEMS)
35+
.map((system) => {
36+
const currentSystem = system as TEstimateSystemKeys;
37+
const isEnabled = isEstimateSystemEnabled(currentSystem);
38+
if (!isEnabled) return null;
39+
return {
40+
label: !ESTIMATE_SYSTEMS[currentSystem]?.is_available ? (
41+
<div className="relative flex items-center gap-2 cursor-no-drop text-custom-text-300">
42+
{t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)}
43+
<Tooltip tooltipContent={t("common.coming_soon")}>
44+
<Info size={12} />
45+
</Tooltip>
46+
</div>
47+
) : !isEnabled ? (
48+
<div className="relative flex items-center gap-2 cursor-no-drop text-custom-text-300">
49+
{t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)}
50+
<UpgradeBadge />
51+
</div>
52+
) : (
53+
<div>{t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)}</div>
54+
),
55+
value: system,
56+
disabled: !isEnabled,
57+
};
58+
})
59+
.filter((option) => option !== null)}
5860
name="estimate-radio-input"
5961
label={t("project_settings.estimates.create.choose_estimate_system")}
6062
labelClassName="text-sm font-medium text-custom-text-200 mb-1.5"
@@ -99,7 +101,7 @@ export function EstimateCreateStageOne(props: TEstimateCreateStageOne) {
99101
<p className="text-xs text-custom-text-300">
100102
{currentEstimateSystem.templates[name]?.values
101103
?.map((template) =>
102-
estimateSystem === EEstimateSystem.TIME
104+
estimateSystem === (EEstimateSystem.TIME as TEstimateSystemKeys)
103105
? convertMinutesToHoursMinutesString(Number(template.value)).trim()
104106
: template.value
105107
)

apps/web/core/components/project/settings/features-list.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const ProjectFeaturesList = observer(function ProjectFeaturesList(props:
3232
// derived values
3333
const currentProjectDetails = getProjectById(projectId);
3434

35-
const handleSubmit = async (featureKey: string, featureProperty: string) => {
35+
const handleSubmit = (featureKey: string, featureProperty: string) => {
3636
if (!workspaceSlug || !projectId || !currentProjectDetails) return;
3737

3838
// making the request to update the project feature
@@ -52,13 +52,14 @@ export const ProjectFeaturesList = observer(function ProjectFeaturesList(props:
5252
message: () => "Something went wrong while updating project feature. Please try again.",
5353
},
5454
});
55-
updateProjectPromise.then(() => {
55+
void updateProjectPromise.then(() => {
5656
captureSuccess({
5757
eventName: PROJECT_TRACKER_EVENTS.feature_toggled,
5858
payload: {
5959
feature_key: featureKey,
6060
},
6161
});
62+
return undefined;
6263
});
6364
};
6465

0 commit comments

Comments
 (0)