@@ -70,6 +70,8 @@ type Data = {
7070 color : string ;
7171 med_records : MedRecord [ ] ;
7272 sec_records : SecRecord [ ] ;
73+ selected_med_record : MedRecord [ ] ;
74+ selected_sec_record : SecRecord [ ] ;
7375}
7476
7577export const AirlockJackTextSwitch = params => {
@@ -87,12 +89,24 @@ export const AirlockJackTextSwitch = params => {
8789 }
8890} ;
8991
92+ export const MedRecordColour = ( mental , physical ) => {
93+ if ( mental === "*Insane*" || physical === "*Deceased*" ) {
94+ return "#990000;" ;
95+ } else if ( mental === "*Unstable*" || physical === "*Unconscious*" ) {
96+ return "#CD6500;" ;
97+ } else if ( mental === "*Watch*" || physical === "Physically Unfit" ) {
98+ return "#3BB9FF;" ;
99+ } else {
100+ return "#4F7529;" ;
101+ }
102+ } ;
103+
90104export const PaiInterface = ( props , context ) => {
91105 const { act, data } = useBackend < Data > ( context ) ;
92106 const { modules_tabs = [ ] } = data ;
93107 const [ selectedMainTab , setMainTab ] = useLocalState ( context , "selectedMainTab" , 0 ) ;
94108 return (
95- < Window width = { 600 } height = { 550 } >
109+ < Window width = { 650 } height = { 550 } > { /* Width matters for medical records, height matters for download more software */ }
96110 < Window . Content >
97111 < Flex >
98112 < Flex . Item grow = { 1 } >
@@ -127,6 +141,8 @@ const PaiBox = (props, context) => {
127141 const { hacking, hackprogress, cable, door } = data ;
128142 const { code, frequency, minFrequency, maxFrequency, color } = data ;
129143 const { med_records, sec_records } = data ;
144+ const [ record_view , set_record_view ] = useLocalState ( context , "record_view" , 0 ) ;
145+ const { selected_med_record } = data ;
130146 switch ( modules_tabs [ selectedMainTab ] . module_name ) {
131147 case "directives" :
132148 return (
@@ -347,56 +363,118 @@ const PaiBox = (props, context) => {
347363 </ Section >
348364 ) ;
349365 case "medical records" :
350- return (
351- < Section title = { modules_tabs [ selectedMainTab ] . title } >
352- { med_records [ 0 ] . name }
353- < Table >
354- < Table . Row >
355- < Table . Cell >
356- Name:
357- </ Table . Cell >
358- < Table . Cell >
359- ID:
360- </ Table . Cell >
361- < Table . Cell >
362- Fingerprint:
363- </ Table . Cell >
364- < Table . Cell >
365- Blood type:
366- </ Table . Cell >
367- < Table . Cell >
368- Physical state:
369- </ Table . Cell >
370- < Table . Cell >
371- Mental state:
372- </ Table . Cell >
373- </ Table . Row >
374- { med_records . map ( MedRecord => (
375- < Table . Row
376- key = { MedRecord } >
377- < Table . Cell >
378- { MedRecord . name }
379- </ Table . Cell >
380- < Table . Cell >
381- { MedRecord . id }
382- </ Table . Cell >
383- < Table . Cell >
384- { MedRecord . fingerprint }
385- </ Table . Cell >
386- < Table . Cell >
387- { MedRecord . blood_type }
388- </ Table . Cell >
389- < Table . Cell >
390- { MedRecord . p_state }
391- </ Table . Cell >
392- < Table . Cell >
393- { MedRecord . m_state }
394- </ Table . Cell >
395- </ Table . Row >
396- ) ) }
397- </ Table >
398- </ Section >
399- ) ;
366+ if ( selected_med_record ) {
367+ return (
368+ < Section title = { modules_tabs [ selectedMainTab ] . title } >
369+ < Button icon = "arrow-left"
370+ onClick = { ( ) => act ( "med_record back" ) } >
371+ Back
372+ </ Button >
373+ < Stack vertical ml = { 2 } >
374+ < Stack . Item >
375+ Name: { selected_med_record . name }
376+ </ Stack . Item >
377+ < Stack . Item >
378+ ID: { selected_med_record . id }
379+ </ Stack . Item >
380+ < Stack . Item >
381+ Gender: { selected_med_record . gender }
382+ </ Stack . Item >
383+ < Stack . Item >
384+ Physical status: { selected_med_record . p_state }
385+ </ Stack . Item >
386+ < Stack . Item >
387+ Mental status: { selected_med_record . m_state }
388+ </ Stack . Item >
389+ < Stack . Item >
390+ Blood type: { selected_med_record . blood_type }
391+ </ Stack . Item >
392+ < Stack . Item >
393+ DNA: { selected_med_record . dna }
394+ </ Stack . Item >
395+ < br />
396+ < Stack . Item >
397+ Minor disabilities: { selected_med_record . minor_disabilities }
398+ </ Stack . Item >
399+ < Stack . Item >
400+ Details: { selected_med_record . minor_disabilities_details }
401+ </ Stack . Item >
402+ < Stack . Item >
403+ Major disabilities: { selected_med_record . major_disabilities }
404+ </ Stack . Item >
405+ < Stack . Item >
406+ Details: { selected_med_record . major_disabilities_details }
407+ </ Stack . Item >
408+ < Stack . Item >
409+ Allergies: { selected_med_record . allergies }
410+ </ Stack . Item >
411+ < Stack . Item >
412+ Details: { selected_med_record . allergies_details }
413+ </ Stack . Item >
414+ < Stack . Item >
415+ Current diseases: { selected_med_record . current_diseases }
416+ </ Stack . Item >
417+ < Stack . Item >
418+ Details: { selected_med_record . current_diseases_details }
419+ </ Stack . Item >
420+ < Stack . Item >
421+ Important notes: { selected_med_record . important_notes }
422+ </ Stack . Item >
423+ < Stack . Item >
424+ Comments: { selected_med_record . comments }
425+ </ Stack . Item >
426+ </ Stack >
427+ </ Section >
428+ ) ;
429+ } else {
430+ return (
431+ < Section title = { modules_tabs [ selectedMainTab ] . title } >
432+ < Table >
433+ < Table . Row >
434+ < Table . Cell textAlign = { "center" } bold = { 1 } >
435+ Name:
436+ </ Table . Cell >
437+ < Table . Cell textAlign = { "center" } bold = { 1 } >
438+ ID:
439+ </ Table . Cell >
440+ < Table . Cell textAlign = { "center" } bold = { 1 } >
441+ Blood type:
442+ </ Table . Cell >
443+ < Table . Cell textAlign = { "center" } bold = { 1 } >
444+ Physical status:
445+ </ Table . Cell >
446+ < Table . Cell textAlign = { "center" } bold = { 1 } >
447+ Mental status:
448+ </ Table . Cell >
449+ </ Table . Row >
450+ { med_records . map ( MedRecord => (
451+ < Table . Row
452+ key = { MedRecord }
453+ height = { 3 } >
454+ < Table . Cell backgroundColor = { MedRecordColour ( MedRecord . m_state , MedRecord . p_state ) } >
455+ < Button
456+ onClick = { ( ) => act ( "med_record" , { record : MedRecord . id } ) } m = { 1 } >
457+ { MedRecord . name }
458+ </ Button >
459+ </ Table . Cell >
460+ < Table . Cell backgroundColor = { MedRecordColour ( MedRecord . m_state , MedRecord . p_state ) } >
461+ { MedRecord . id }
462+ </ Table . Cell >
463+ < Table . Cell backgroundColor = { MedRecordColour ( MedRecord . m_state , MedRecord . p_state ) } textAlign = { "center" } >
464+ { MedRecord . blood_type }
465+ </ Table . Cell >
466+ < Table . Cell backgroundColor = { MedRecordColour ( MedRecord . m_state , MedRecord . p_state ) } textAlign = { "center" } >
467+ { MedRecord . p_state }
468+ </ Table . Cell >
469+ < Table . Cell backgroundColor = { MedRecordColour ( MedRecord . m_state , MedRecord . p_state ) } textAlign = { "center" } >
470+ { MedRecord . m_state }
471+ </ Table . Cell >
472+ </ Table . Row >
473+ ) ) }
474+ </ Table >
475+ </ Section >
476+ ) ;
477+ }
400478 case "host scan" :
401479 return (
402480 < Section title = { modules_tabs [ selectedMainTab ] . title } >
0 commit comments