@@ -15,18 +20,18 @@ const FinancialPreview: FunctionalComponent = ({ project
Prévisionnel financier |
- Temps |
+ Temps |
Coût |
- Maximum |
- |
+ Maximum |
+ ~ {maxCost} € |
- Minimum |
- |
+ Minimum |
+ ~ {minCost} € |
diff --git a/src/routes/project/index.tsx b/src/routes/project/index.tsx
index 58d57c8..3462284 100644
--- a/src/routes/project/index.tsx
+++ b/src/routes/project/index.tsx
@@ -2,14 +2,12 @@ import { FunctionalComponent, h } from "preact";
import { useEffect } from "preact/hooks";
import * as style from "./style.css";
import { newProject } from "../../models/project";
-import TaskTable from "./tasks-table";
-import TimePreview from "./time-preview";
-import FinancialPreview from "./financial-preview";
-import { useProjectReducer, addTask, updateTaskEstimation, removeTask, updateProjectLabel, updateTaskLabel } from "../../hooks/use-project-reducer";
-import { Task, TaskID, EstimationConfidence } from "../../models/task";
+import { useProjectReducer, updateProjectLabel } from "../../hooks/use-project-reducer";
import { getProjectStorageKey } from "../../util/storage";
import { useLocalStorage } from "../../hooks/use-local-storage";
import EditableText from "../../components/editable-text";
+import Tabs from "../../components/tabs";
+import EstimationTab from "./estimation-tab";
export interface ProjectProps {
projectId: string
@@ -20,22 +18,6 @@ const Project: FunctionalComponent
= ({ projectId }) => {
const [ storedProject, storeProject ] = useLocalStorage(projectStorageKey, newProject(projectId));
const [ project, dispatch ] = useProjectReducer(storedProject);
- const onTaskAdd = (task: Task) => {
- dispatch(addTask(task));
- };
-
- const onTaskRemove = (taskId: TaskID) => {
- dispatch(removeTask(taskId));
- }
-
- const onTaskLabelUpdate = (taskId: TaskID, label: string) => {
- dispatch(updateTaskLabel(taskId, label));
- }
-
- const onEstimationChange = (taskId: TaskID, confidence: EstimationConfidence, value: number) => {
- dispatch(updateTaskEstimation(taskId, confidence, value));
- };
-
const onProjectLabelChange = (projectLabel: string) => {
dispatch(updateProjectLabel(projectLabel));
};
@@ -49,38 +31,28 @@ const Project: FunctionalComponent = ({ projectId }) => {
({value}
)}
+ render={(value) => ({value}
)}
onChange={onProjectLabelChange}
value={project.label ? project.label : "Projet sans nom"} />
-
-
-
-
-
-
-
-
-
+
+
+ },
+ {
+ label: 'Paramètres',
+ icon: '⚙️',
+ render: () => null
+ },
+ {
+ label: 'Exporter',
+ icon: '↗️',
+ render: () => null
+ }
+ ]}
+ />
);
diff --git a/src/routes/project/style.css b/src/routes/project/style.css
index abeef8a..2dd0933 100644
--- a/src/routes/project/style.css
+++ b/src/routes/project/style.css
@@ -13,4 +13,12 @@
.mainColumn {
width: 100%;
+}
+
+.middleTable td {
+ vertical-align: middle;
+}
+
+.tabContainer {
+ padding-top: 1em;
}
\ No newline at end of file
diff --git a/src/routes/project/style.css.d.ts b/src/routes/project/style.css.d.ts
index 7d96d80..802e901 100644
--- a/src/routes/project/style.css.d.ts
+++ b/src/routes/project/style.css.d.ts
@@ -3,3 +3,5 @@ export const estimation: string;
export const noTasks: string;
export const noBorder: string;
export const mainColumn: string;
+export const middleTable: string;
+export const tabContainer: string;
diff --git a/src/routes/project/tasks-table.tsx b/src/routes/project/tasks-table.tsx
index 0d200f1..bc88264 100644
--- a/src/routes/project/tasks-table.tsx
+++ b/src/routes/project/tasks-table.tsx
@@ -4,8 +4,7 @@ import * as style from "./style.css";
import { Project } from "../../models/project";
import { newTask, Task, TaskID, EstimationConfidence } from "../../models/task";
import EditableText from "../../components/editable-text";
-
-
+import { usePrintMediaQuery } from "../../hooks/use-media-query";
export interface TaskTableProps {
project: Project
@@ -27,6 +26,8 @@ const TaskTable: FunctionalComponent = ({ project, onTaskAdd, on
[EstimationConfidence.Pessimistic]: 0,
} as EstimationTotals);
+ const isPrint = usePrintMediaQuery();
+
useEffect(() => {
let optimistic = 0;
let likely = 0;
@@ -76,10 +77,10 @@ const TaskTable: FunctionalComponent = ({ project, onTaskAdd, on
return (
-
+
- |
+ |
Tâche |
Catégorie |
Estimation |
@@ -97,7 +98,7 @@ const TaskTable: FunctionalComponent = ({ project, onTaskAdd, on
const categoryLabel = category ? category.label : '???';
return (
-
+ |
|
{ categoryLabel } |
-
+ {
+ isPrint ?
+ {t.estimations.optimistic} :
+
+ }
|
-
+ {
+ isPrint ?
+ {t.estimations.likely} :
+
+ }
|
-
+ {
+ isPrint ?
+ {t.estimations.pessimistic} :
+
+ }
|
)
@@ -133,7 +146,7 @@ const TaskTable: FunctionalComponent = ({ project, onTaskAdd, on
{
Object.keys(project.tasks).length === 0 ?
- |
+ |
Aucune tâche pour l'instant. |
:
null
@@ -141,9 +154,9 @@ const TaskTable: FunctionalComponent = ({ project, onTaskAdd, on
- |
-
- |
- |
+ |
{totals.optimistic} |
{totals.likely} |
{totals.pessimistic} |
diff --git a/src/routes/project/time-preview.tsx b/src/routes/project/time-preview.tsx
index 3c41384..fbceb0c 100644
--- a/src/routes/project/time-preview.tsx
+++ b/src/routes/project/time-preview.tsx
@@ -1,29 +1,13 @@
import { FunctionalComponent, h } from "preact";
import { Project } from "../../models/project";
-import { Task } from "../../models/task";
-import { useState, useEffect } from "preact/hooks";
-import { getProjectWeightedMean, getProjectStandardDeviation } from "../../util/stat";
+import { useProjectEstimations } from "../../hooks/use-project-estimations";
export interface TimePreviewProps {
project: Project
}
const TimePreview: FunctionalComponent = ({ project }) => {
- const [ estimations, setEstimations ] = useState({
- p99: { e: '0', sd: '0' },
- p90: { e: '0', sd: '0' },
- p68: { e: '0', sd: '0' },
- });
-
- useEffect(() => {
- const projectWeightedMean = getProjectWeightedMean(project).toFixed(2);
- const projectStandardDeviation = getProjectStandardDeviation(project);
- setEstimations({
- p99: { e: projectWeightedMean, sd: (projectStandardDeviation * 3).toFixed(2) },
- p90: { e: projectWeightedMean, sd: (projectStandardDeviation * 1.645).toFixed(2) },
- p68: { e: projectWeightedMean, sd: (projectStandardDeviation).toFixed(2) },
- })
- }, [project.tasks]);
+ const estimations = useProjectEstimations(project);
return (
@@ -33,25 +17,25 @@ const TimePreview: FunctionalComponent = ({ project }) => {
Prévisionnel temps |
- Niveau de confiance |
+ Confiance |
Estimation |
- >= 99.7% |
- {`${estimations.p99.e} ± ${estimations.p99.sd} j/h`} |
+ >= 99.7% |
+ {`${estimations.p99.e.toPrecision(2)} ± ${estimations.p99.sd.toPrecision(2)} j/h`} |
- >= 90% |
- {`${estimations.p90.e} ± ${estimations.p90.sd} j/h`} |
+ >= 90% |
+ {`${estimations.p90.e.toPrecision(2)} ± ${estimations.p90.sd.toPrecision(2)} j/h`} |
- >= 68% |
- {`${estimations.p68.e} ± ${estimations.p68.sd} j/h`} |
+ >= 68% |
+ {`${estimations.p68.e.toPrecision(2)} ± ${estimations.p68.sd.toPrecision(2)} j/h`} |
-
+
❓ Estimation à 3 points
diff --git a/src/style/index.css b/src/style/index.css
index 5698bbb..487d773 100644
--- a/src/style/index.css
+++ b/src/style/index.css
@@ -1,3 +1,10 @@
#app {
display: inherit;
+}
+
+@media print
+{
+ .noPrint, .noPrint * {
+ display: none !important;
+ }
}
\ No newline at end of file
diff --git a/src/style/index.css.d.ts b/src/style/index.css.d.ts
index 53d4f03..6868c03 100644
--- a/src/style/index.css.d.ts
+++ b/src/style/index.css.d.ts
@@ -1,2 +1 @@
-// This file is automatically generated from your CSS. Any edits will be overwritten.
-export const app: string;
+export const app: string;
\ No newline at end of file
|