1- import { RequirementEvaluation } from '@idea2app/data-server' ;
1+ import { RequirementEvaluation , UserRole } from '@idea2app/data-server' ;
22import { Box , Typography } from '@mui/material' ;
3+ import { observer } from 'mobx-react' ;
34import { FC , useContext } from 'react' ;
45
56import { I18nContext } from '../../models/Translation' ;
7+ import userStore from '../../models/User' ;
68
7- export const EvaluationDisplay : FC < RequirementEvaluation > = ( {
8- title,
9- description,
10- scopes = [ ] ,
11- developerCount,
12- designerCount,
13- workload,
14- monthPeriod,
15- budget,
16- factor,
17- } ) => {
18- const { t } = useContext ( I18nContext ) ;
9+ export const EvaluationDisplay : FC < RequirementEvaluation > = observer (
10+ ( {
11+ title,
12+ scopes = [ ] ,
13+ developerCount,
14+ designerCount,
15+ workload,
16+ monthPeriod,
17+ budget,
18+ factor,
19+ } ) => {
20+ const { t } = useContext ( I18nContext ) ,
21+ { roles } = userStore . session || { } ;
1922
20- return (
21- < Box sx = { {
22- '& .evaluation-item' : {
23- marginBottom : 1 ,
24- fontSize : '0.875rem' ,
25- padding : '4px 0' ,
26- borderLeft : '3px solid' ,
27- borderColor : 'primary.light' ,
28- paddingLeft : 1 ,
29- } ,
30- '& strong' : {
31- fontWeight : 600 ,
32- color : 'primary.dark' ,
33- } ,
34- '& ul' : {
35- margin : '8px 0' ,
36- paddingLeft : '20px' ,
37- } ,
38- '& li' : {
39- marginBottom : '4px' ,
40- } ,
41- } } >
42- { title && (
43- < Box className = "evaluation-item" >
44- < Typography component = "h3" sx = { { fontWeight : 600 , mb : 1 } } >
45- { title }
46- </ Typography >
47- </ Box >
48- ) }
49-
50- { description && (
51- < Box className = "evaluation-item" >
52- < Typography component = "span" sx = { { fontWeight : 600 } } >
53- { t ( 'description' ) }
54- </ Typography >
55- { ' ' }
56- { description }
57- </ Box >
58- ) }
59-
60- { scopes && scopes . length > 0 && (
61- < Box className = "evaluation-item" >
62- < Typography component = "span" sx = { { fontWeight : 600 } } >
63- { t ( 'development_scopes' ) }
64- </ Typography >
65- < Box component = "ul" sx = { { mt : 0.5 } } >
66- { scopes . map ( ( scope , index ) => (
67- < Box key = { index } component = "li" sx = { { ml : 1 } } >
68- { scope }
69- </ Box >
70- ) ) }
23+ return (
24+ < Box
25+ sx = { {
26+ '& .evaluation-item' : {
27+ marginBottom : 1 ,
28+ fontSize : '0.875rem' ,
29+ padding : '4px 0' ,
30+ borderLeft : '3px solid' ,
31+ borderColor : 'primary.light' ,
32+ paddingLeft : 1 ,
33+ } ,
34+ '& ul' : {
35+ margin : '8px 0' ,
36+ paddingLeft : '20px' ,
37+ } ,
38+ '& li' : {
39+ marginBottom : '4px' ,
40+ } ,
41+ } }
42+ >
43+ { title && (
44+ < Box className = "evaluation-item" >
45+ < Typography component = "h3" sx = { { fontWeight : 600 , mb : 1 } } >
46+ { title }
47+ </ Typography >
7148 </ Box >
72- </ Box >
73- ) }
74-
75- { workload && (
76- < Box className = "evaluation-item" >
77- < Typography component = "span" sx = { { fontWeight : 600 } } >
78- { t ( 'workload' ) }
79- </ Typography >
80- { ' ' }
81- { workload } { t ( 'hours' ) }
82- </ Box >
83- ) }
84-
85- { monthPeriod && (
86- < Box className = "evaluation-item" >
87- < Typography component = "span" sx = { { fontWeight : 600 } } >
88- { t ( 'timeline' ) }
89- </ Typography >
90- { ' ' }
91- { monthPeriod } { t ( 'months' ) }
92- </ Box >
93- ) }
94-
95- { budget && (
96- < Box className = "evaluation-item" >
97- < Typography component = "span" sx = { { fontWeight : 600 } } >
98- { t ( 'budget' ) }
99- </ Typography >
100- { ' ' }
101- ${ budget . toLocaleString ( ) }
102- </ Box >
103- ) }
104-
105- { ( developerCount || designerCount ) && (
106- < Box className = "evaluation-item" >
107- < Typography component = "span" sx = { { fontWeight : 600 } } >
108- { t ( 'team_size' ) }
109- </ Typography >
110- { ' ' }
111- { [
112- developerCount && `${ developerCount } ${ t ( 'developers' ) } ` ,
113- designerCount && `${ designerCount } ${ t ( 'designers' ) } `
114- ] . filter ( Boolean ) . join ( ', ' ) }
115- </ Box >
116- ) }
117-
118- { factor && (
119- < Box className = "evaluation-item" >
120- < Typography component = "span" sx = { { fontWeight : 600 } } >
121- { t ( 'complexity_factor' ) }
122- </ Typography >
123- { ' ' }
124- { factor }
125- </ Box >
126- ) }
127- </ Box >
128- ) ;
129- } ;
49+ ) }
50+ { scopes [ 0 ] && (
51+ < Box className = "evaluation-item" >
52+ < Typography component = "h4" sx = { { fontWeight : 600 } } >
53+ { t ( 'development_scopes' ) }
54+ </ Typography >
55+ < Box component = "ul" sx = { { mt : 0.5 } } >
56+ { scopes . map ( scope => (
57+ < Box key = { scope } component = "li" sx = { { ml : 1 } } >
58+ { scope }
59+ </ Box >
60+ ) ) }
61+ </ Box >
62+ </ Box >
63+ ) }
64+ { workload && (
65+ < Box className = "evaluation-item" >
66+ < Typography component = "h4" sx = { { fontWeight : 600 } } >
67+ { t ( 'workload' ) }
68+ </ Typography > { ' ' }
69+ { workload } { t ( 'hours' ) }
70+ </ Box >
71+ ) }
72+ { monthPeriod && (
73+ < Box className = "evaluation-item" >
74+ < Typography component = "h4" sx = { { fontWeight : 600 } } >
75+ { t ( 'timeline' ) }
76+ </ Typography > { ' ' }
77+ { monthPeriod } { t ( 'months' ) }
78+ </ Box >
79+ ) }
80+ { budget && (
81+ < Box className = "evaluation-item" >
82+ < Typography component = "h4" sx = { { fontWeight : 600 } } >
83+ { t ( 'budget' ) }
84+ </ Typography > { ' ' }
85+ ¥{ budget . toLocaleString ( ) }
86+ </ Box >
87+ ) }
88+ { ( developerCount || designerCount ) && (
89+ < Box className = "evaluation-item" >
90+ < Typography component = "h4" sx = { { fontWeight : 600 } } >
91+ { t ( 'team_size' ) }
92+ </ Typography > { ' ' }
93+ { [
94+ developerCount && `${ developerCount } ${ t ( 'developers' ) } ` ,
95+ designerCount && `${ designerCount } ${ t ( 'designers' ) } ` ,
96+ ]
97+ . filter ( Boolean )
98+ . join ( ', ' ) }
99+ </ Box >
100+ ) }
101+ { roles && roles . includes ( 2 as UserRole . Client ) && (
102+ < Box className = "evaluation-item" >
103+ < Typography component = "h4" sx = { { fontWeight : 600 } } >
104+ { t ( 'complexity_factor' ) }
105+ </ Typography > { ' ' }
106+ { factor }
107+ </ Box >
108+ ) }
109+ </ Box >
110+ ) ;
111+ } ,
112+ ) ;
0 commit comments