Initial commit: Plane
Some checks failed
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Admin Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Codespell / Check for spelling errors (push) Has been cancelled
Sync Repositories / sync_changes (push) Has been cancelled
Some checks failed
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Admin Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Codespell / Check for spelling errors (push) Has been cancelled
Sync Repositories / sync_changes (push) Has been cancelled
Synced from upstream: 8853637e981ed7d8a6cff32bd98e7afe20f54362
This commit is contained in:
1
apps/web/core/components/estimates/inputs/index.ts
Normal file
1
apps/web/core/components/estimates/inputs/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./root";
|
||||
24
apps/web/core/components/estimates/inputs/number-input.tsx
Normal file
24
apps/web/core/components/estimates/inputs/number-input.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { FC } from "react";
|
||||
import { useTranslation } from "@plane/i18n";
|
||||
type TEstimateNumberInputProps = {
|
||||
value?: number;
|
||||
handleEstimateInputValue: (value: string) => void;
|
||||
};
|
||||
|
||||
export const EstimateNumberInput: FC<TEstimateNumberInputProps> = (props) => {
|
||||
const { value, handleEstimateInputValue } = props;
|
||||
|
||||
// i18n
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<input
|
||||
value={value}
|
||||
onChange={(e) => handleEstimateInputValue(e.target.value)}
|
||||
className="border-none focus:ring-0 focus:border-0 focus:outline-none px-2 py-2 w-full bg-transparent text-sm"
|
||||
placeholder={t("project_settings.estimates.create.enter_estimate_point")}
|
||||
autoFocus
|
||||
type="number"
|
||||
/>
|
||||
);
|
||||
};
|
||||
40
apps/web/core/components/estimates/inputs/root.tsx
Normal file
40
apps/web/core/components/estimates/inputs/root.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import type { FC } from "react";
|
||||
// plane imports
|
||||
import type { TEstimateSystemKeys } from "@plane/types";
|
||||
import { EEstimateSystem } from "@plane/types";
|
||||
// plane web imports
|
||||
import { EstimateTimeInput } from "@/plane-web/components/estimates/inputs";
|
||||
// local imports
|
||||
import { EstimateNumberInput } from "./number-input";
|
||||
import { EstimateTextInput } from "./text-input";
|
||||
|
||||
type TEstimateInputRootProps = {
|
||||
estimateType: TEstimateSystemKeys;
|
||||
handleEstimateInputValue: (value: string) => void;
|
||||
value?: string;
|
||||
};
|
||||
|
||||
export const EstimateInputRoot: FC<TEstimateInputRootProps> = (props) => {
|
||||
const { estimateType, handleEstimateInputValue, value } = props;
|
||||
|
||||
switch (estimateType) {
|
||||
case EEstimateSystem.POINTS:
|
||||
return (
|
||||
<EstimateNumberInput
|
||||
value={value ? parseInt(value) : undefined}
|
||||
handleEstimateInputValue={handleEstimateInputValue}
|
||||
/>
|
||||
);
|
||||
case EEstimateSystem.CATEGORIES:
|
||||
return <EstimateTextInput value={value} handleEstimateInputValue={handleEstimateInputValue} />;
|
||||
case EEstimateSystem.TIME:
|
||||
return (
|
||||
<EstimateTimeInput
|
||||
value={value ? parseInt(value) : undefined}
|
||||
handleEstimateInputValue={handleEstimateInputValue}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
24
apps/web/core/components/estimates/inputs/text-input.tsx
Normal file
24
apps/web/core/components/estimates/inputs/text-input.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { FC } from "react";
|
||||
import { useTranslation } from "@plane/i18n";
|
||||
type TEstimateTextInputProps = {
|
||||
value?: string;
|
||||
handleEstimateInputValue: (value: string) => void;
|
||||
};
|
||||
|
||||
export const EstimateTextInput: FC<TEstimateTextInputProps> = (props) => {
|
||||
const { value, handleEstimateInputValue } = props;
|
||||
|
||||
// i18n
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<input
|
||||
value={value}
|
||||
onChange={(e) => handleEstimateInputValue(e.target.value)}
|
||||
className="border-none focus:ring-0 focus:border-0 focus:outline-none px-3 py-2 w-full bg-transparent text-sm"
|
||||
placeholder={t("project_settings.estimates.create.enter_estimate_point")}
|
||||
autoFocus
|
||||
type="text"
|
||||
/>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user