-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[WEB-5608] chore: Hide "Pro" Features in Community Edition #8288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| import type { FC } from "react"; | ||
| import { Info } from "lucide-react"; | ||
| // plane imports | ||
| import { EEstimateSystem, ESTIMATE_SYSTEMS } from "@plane/constants"; | ||
|
|
@@ -32,29 +31,32 @@ export function EstimateCreateStageOne(props: TEstimateCreateStageOne) { | |
| <div className="space-y-6"> | ||
| <div className="sm:flex sm:items-center sm:space-x-10 sm:space-y-0 gap-2 mb-2"> | ||
| <RadioInput | ||
| options={Object.keys(ESTIMATE_SYSTEMS).map((system) => { | ||
| const currentSystem = system as TEstimateSystemKeys; | ||
| const isEnabled = isEstimateSystemEnabled(currentSystem); | ||
| return { | ||
| label: !ESTIMATE_SYSTEMS[currentSystem]?.is_available ? ( | ||
| <div className="relative flex items-center gap-2 cursor-no-drop text-custom-text-300"> | ||
| {t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)} | ||
| <Tooltip tooltipContent={t("common.coming_soon")}> | ||
| <Info size={12} /> | ||
| </Tooltip> | ||
| </div> | ||
| ) : !isEnabled ? ( | ||
| <div className="relative flex items-center gap-2 cursor-no-drop text-custom-text-300"> | ||
| {t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)} | ||
| <UpgradeBadge /> | ||
| </div> | ||
| ) : ( | ||
| <div>{t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)}</div> | ||
| ), | ||
| value: system, | ||
| disabled: !isEnabled, | ||
| }; | ||
| })} | ||
| options={Object.keys(ESTIMATE_SYSTEMS) | ||
| .map((system) => { | ||
| const currentSystem = system as TEstimateSystemKeys; | ||
| const isEnabled = isEstimateSystemEnabled(currentSystem); | ||
| if (!isEnabled) return null; | ||
| return { | ||
| label: !ESTIMATE_SYSTEMS[currentSystem]?.is_available ? ( | ||
| <div className="relative flex items-center gap-2 cursor-no-drop text-custom-text-300"> | ||
| {t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)} | ||
| <Tooltip tooltipContent={t("common.coming_soon")}> | ||
| <Info size={12} /> | ||
| </Tooltip> | ||
| </div> | ||
| ) : !isEnabled ? ( | ||
| <div className="relative flex items-center gap-2 cursor-no-drop text-custom-text-300"> | ||
| {t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)} | ||
| <UpgradeBadge /> | ||
| </div> | ||
| ) : ( | ||
| <div>{t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)}</div> | ||
| ), | ||
| value: system, | ||
| disabled: !isEnabled, | ||
| }; | ||
| }) | ||
| .filter((option) => option !== null)} | ||
| name="estimate-radio-input" | ||
| label={t("project_settings.estimates.create.choose_estimate_system")} | ||
| labelClassName="text-sm font-medium text-custom-text-200 mb-1.5" | ||
|
|
@@ -99,7 +101,7 @@ export function EstimateCreateStageOne(props: TEstimateCreateStageOne) { | |
| <p className="text-xs text-custom-text-300"> | ||
| {currentEstimateSystem.templates[name]?.values | ||
| ?.map((template) => | ||
| estimateSystem === EEstimateSystem.TIME | ||
| estimateSystem === (EEstimateSystem.TIME as TEstimateSystemKeys) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find the EEstimateSystem enum definition
echo "=== EEstimateSystem enum definition ==="
rg -n "enum EEstimateSystem" -A 15
# Find the TEstimateSystemKeys type definition
echo -e "\n=== TEstimateSystemKeys type definition ==="
rg -n "type TEstimateSystemKeys" -A 10
# Find other usages of EEstimateSystem.TIME
echo -e "\n=== Other usages of EEstimateSystem.TIME ==="
rg -n "EEstimateSystem\.TIME" -C 3Repository: makeplane/plane Length of output: 13521 🏁 Script executed: #!/bin/bash
# Check the estimateSystem variable declaration and type in stage-one.tsx
echo "=== estimateSystem variable in stage-one.tsx ==="
rg -n "estimateSystem" apps/web/core/components/estimates/create/stage-one.tsx -B 3 -A 3 | head -50Repository: makeplane/plane Length of output: 1728 Remove the unnecessary type cast in the enum comparison. The cast 🤖 Prompt for AI Agents |
||
| ? convertMinutesToHoursMinutesString(Number(template.value)).trim() | ||
| : template.value | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Remove unreachable code after early return.
Lines 47-51 and the
disabledproperty on line 56 contain dead code. Since line 38 returnsnullwhen!isEnabled, the subsequent check for!isEnabledon line 47 will never be true, anddisabled: !isEnabledwill always evaluate tofalse.Apply this diff to remove the unreachable code:
options={Object.keys(ESTIMATE_SYSTEMS) .map((system) => { const currentSystem = system as TEstimateSystemKeys; const isEnabled = isEstimateSystemEnabled(currentSystem); if (!isEnabled) return null; return { label: !ESTIMATE_SYSTEMS[currentSystem]?.is_available ? ( <div className="relative flex items-center gap-2 cursor-no-drop text-custom-text-300"> {t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)} <Tooltip tooltipContent={t("common.coming_soon")}> <Info size={12} /> </Tooltip> </div> - ) : !isEnabled ? ( - <div className="relative flex items-center gap-2 cursor-no-drop text-custom-text-300"> - {t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)} - <UpgradeBadge /> - </div> ) : ( <div>{t(ESTIMATE_SYSTEMS[currentSystem]?.i18n_name)}</div> ), value: system, - disabled: !isEnabled, + disabled: false, }; }) .filter((option) => option !== null)}📝 Committable suggestion
🤖 Prompt for AI Agents