Project parameters edition

This commit is contained in:
2020-04-21 20:45:47 +02:00
parent 69867b113f
commit b0339d2ce0
15 changed files with 327 additions and 22 deletions

View File

@ -8,7 +8,7 @@ export interface EditableTextProps {
class?: string
editIconClass?: string
onChange?: (value: string) => void
render: (value: string) => ComponentChild
render?: (value: string) => ComponentChild
}
const EditableText: FunctionalComponent<EditableTextProps> = ({ onChange, value, render, ...props }) => {
@ -45,7 +45,7 @@ const EditableText: FunctionalComponent<EditableTextProps> = ({ onChange, value,
</div>
</div> :
<Fragment>
{ render(internalValue) }
{ render ? render(internalValue) : <span>{internalValue}</span> }
<i class={`${style.editIcon} icon ${props.editIconClass ? props.editIconClass : ''}`} onClick={onEditIconClick}>🖋</i>
</Fragment>
}

View File

@ -1,5 +1,5 @@
.editableText {
display: inherit;
display: inline-block;
}
.editableText > * {

View File

@ -9,13 +9,17 @@ export interface EstimationRangeProps {
export const EstimationRange: FunctionalComponent<EstimationRangeProps> = ({ project, estimation, sdFactor }) => {
const roundUp = getRoundUpEstimations(project);
const e = roundUp ? Math.ceil(estimation.e) : estimation.e;
const sd = roundUp ? Math.ceil(estimation.sd * sdFactor) : (estimation.sd * sdFactor);
let e = roundUp ? Math.ceil(estimation.e) : estimation.e;
let sd = roundUp ? Math.ceil(estimation.sd * sdFactor) : (estimation.sd * sdFactor);
const max = e+sd;
const min = Math.max(e-sd, 0);
if (!roundUp) {
sd = sd.toFixed(2);
e = e.toFixed(2);
}
return (
<Fragment>
<abbr title={`max: ${max}, min: ${min}`}>{`${e} ± ${sd}`}</abbr>&nbsp;<ProjectTimeUnit project={project} />
<abbr title={`max: ${max.toFixed(2)}, min: ${min.toFixed(2)}`}>{`${e} ± ${sd}`}</abbr>&nbsp;<ProjectTimeUnit project={project} />
</Fragment>
);