-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduct-requirements-document.tsx
More file actions
1446 lines (1373 loc) · 73.6 KB
/
Copy pathproduct-requirements-document.tsx
File metadata and controls
1446 lines (1373 loc) · 73.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"use client"
import { useState } from "react"
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { Badge } from "@/components/ui/badge"
import { ScrollArea } from "@/components/ui/scroll-area"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import {
Download,
CheckCircle2,
Clock,
AlertCircle,
FileDown,
FileText,
Users,
Workflow,
BarChart4,
Settings,
Code,
Layers,
Sliders,
Lightbulb,
Gauge,
Puzzle,
} from "lucide-react"
export default function ProductRequirementsDocument() {
const [activeTab, setActiveTab] = useState("overview")
const [expandedSections, setExpandedSections] = useState<Record<string, boolean>>({
overview: true,
"user-stories": false,
features: false,
technical: false,
roadmap: false,
})
const toggleSection = (section: string) => {
setExpandedSections((prev) => ({
...prev,
[section]: !prev[section],
}))
}
const downloadPRD = () => {
// In a real application, this would generate a PDF or other document format
alert("In a real application, this would download the PRD as a PDF or other document format.")
}
return (
<div className="container mx-auto py-8 max-w-5xl">
<div className="flex justify-between items-center mb-6">
<div>
<h1 className="text-3xl font-bold">Product Requirements Document</h1>
<p className="text-xl text-muted-foreground">Modular Flowchart Application</p>
</div>
<Button onClick={downloadPRD} className="gap-2">
<Download className="h-4 w-4" />
Download PRD
</Button>
</div>
<Card className="mb-8">
<CardHeader className="bg-slate-50">
<div className="flex justify-between items-center">
<div>
<CardTitle>Document Information</CardTitle>
<CardDescription>Version 1.0 | Last Updated: April 28, 2024</CardDescription>
</div>
<Badge variant="outline" className="px-3 py-1">
DRAFT
</Badge>
</div>
</CardHeader>
<CardContent className="pt-6">
<div className="grid grid-cols-2 gap-4">
<div>
<p className="text-sm font-medium text-muted-foreground">Project Name</p>
<p>Modular Flowchart Application</p>
</div>
<div>
<p className="text-sm font-medium text-muted-foreground">Document Owner</p>
<p>Product Management Team</p>
</div>
<div>
<p className="text-sm font-medium text-muted-foreground">Status</p>
<p>Draft - For Review</p>
</div>
<div>
<p className="text-sm font-medium text-muted-foreground">Target Release</p>
<p>Q3 2024</p>
</div>
</div>
</CardContent>
</Card>
<Tabs value={activeTab} onValueChange={setActiveTab} className="mb-8">
<TabsList className="grid grid-cols-5 mb-4">
<TabsTrigger value="overview" className="flex items-center gap-2">
<FileText className="h-4 w-4" /> Overview
</TabsTrigger>
<TabsTrigger value="user-stories" className="flex items-center gap-2">
<Users className="h-4 w-4" /> User Stories
</TabsTrigger>
<TabsTrigger value="features" className="flex items-center gap-2">
<Workflow className="h-4 w-4" /> Features
</TabsTrigger>
<TabsTrigger value="technical" className="flex items-center gap-2">
<Code className="h-4 w-4" /> Technical
</TabsTrigger>
<TabsTrigger value="roadmap" className="flex items-center gap-2">
<BarChart4 className="h-4 w-4" /> Roadmap
</TabsTrigger>
</TabsList>
<TabsContent value="overview" className="mt-0">
<Card>
<CardHeader>
<CardTitle>Product Overview</CardTitle>
<CardDescription>A high-level description of the Modular Flowchart application</CardDescription>
</CardHeader>
<CardContent className="space-y-6">
<div>
<h3 className="text-lg font-medium mb-2">Product Vision</h3>
<p>
The Modular Flowchart application is a powerful visual programming and modeling tool that enables
users to create, connect, and analyze modular components in a flowchart interface. It allows for
real-time calculation, sensitivity analysis, and visualization of complex data flows and
relationships.
</p>
</div>
<div>
<h3 className="text-lg font-medium mb-2">Problem Statement</h3>
<p>
Traditional flowcharting and modeling tools often lack the ability to perform real-time calculations,
analyze sensitivities, and provide interactive feedback. Users need a more dynamic way to visualize
and manipulate data flows, especially for financial modeling, process optimization, and system design.
</p>
</div>
<div>
<h3 className="text-lg font-medium mb-2">Target Users</h3>
<ul className="list-disc pl-6 space-y-1">
<li>Financial analysts and modelers</li>
<li>Process engineers and system designers</li>
<li>Data scientists and analysts</li>
<li>Business intelligence professionals</li>
<li>Operations researchers</li>
<li>Educational institutions teaching modeling concepts</li>
</ul>
</div>
<div>
<h3 className="text-lg font-medium mb-2">Key Differentiators</h3>
<ul className="list-disc pl-6 space-y-1">
<li>Real-time calculation and propagation of changes</li>
<li>Interactive sensitivity analysis</li>
<li>Modular design with expandable components</li>
<li>Visual representation of data flows and impacts</li>
<li>Customizable module creation and library</li>
<li>Code export capabilities</li>
<li>Heatmap visualization for impact analysis</li>
</ul>
</div>
<div>
<h3 className="text-lg font-medium mb-2">Success Metrics</h3>
<ul className="list-disc pl-6 space-y-1">
<li>User adoption rate and active user growth</li>
<li>Time spent creating and analyzing models</li>
<li>Number of modules created and saved</li>
<li>User satisfaction with analysis capabilities</li>
<li>Reduction in time to perform sensitivity analysis compared to traditional methods</li>
</ul>
</div>
</CardContent>
</Card>
</TabsContent>
<TabsContent value="user-stories" className="mt-0">
<Card>
<CardHeader>
<CardTitle>User Stories</CardTitle>
<CardDescription>Key user stories and acceptance criteria</CardDescription>
</CardHeader>
<CardContent>
<ScrollArea className="h-[600px] pr-4">
<div className="space-y-6">
{/* User Story 1 */}
<div className="border rounded-lg p-4">
<div className="flex justify-between items-start mb-3">
<h3 className="text-lg font-medium">Creating and Connecting Modules</h3>
<Badge className="bg-green-100 text-green-800">High Priority</Badge>
</div>
<p className="mb-3">
<span className="font-medium">As a</span> financial analyst,
<span className="font-medium"> I want to</span> create and connect calculation modules in a
flowchart,
<span className="font-medium"> so that</span> I can model complex financial scenarios visually.
</p>
<div className="mt-4">
<h4 className="text-sm font-medium mb-2">Acceptance Criteria:</h4>
<ul className="list-disc pl-6 space-y-1 text-sm">
<li>Users can add predefined modules from a library</li>
<li>Users can create custom modules with custom formulas</li>
<li>Modules can be connected via drag-and-drop</li>
<li>Connections visually represent data flow between modules</li>
<li>Module positions can be adjusted on the canvas</li>
<li>Modules display key information in collapsed state</li>
</ul>
</div>
</div>
{/* User Story 2 */}
<div className="border rounded-lg p-4">
<div className="flex justify-between items-start mb-3">
<h3 className="text-lg font-medium">Real-time Calculation</h3>
<Badge className="bg-green-100 text-green-800">High Priority</Badge>
</div>
<p className="mb-3">
<span className="font-medium">As a</span> data analyst,
<span className="font-medium"> I want to</span> see calculations update in real-time when I change
input values,
<span className="font-medium"> so that</span> I can immediately understand the impact of my
changes.
</p>
<div className="mt-4">
<h4 className="text-sm font-medium mb-2">Acceptance Criteria:</h4>
<ul className="list-disc pl-6 space-y-1 text-sm">
<li>Changes to input values propagate through the flowchart</li>
<li>Calculations update automatically or with a manual recalculate option</li>
<li>Visual indication when a module is calculating</li>
<li>Visual indication when a module needs recalculation</li>
<li>Performance is optimized for complex flowcharts</li>
</ul>
</div>
</div>
{/* User Story 3 */}
<div className="border rounded-lg p-4">
<div className="flex justify-between items-start mb-3">
<h3 className="text-lg font-medium">Module Expansion and Drilldown</h3>
<Badge className="bg-green-100 text-green-800">High Priority</Badge>
</div>
<p className="mb-3">
<span className="font-medium">As a</span> system designer,
<span className="font-medium"> I want to</span> expand modules to see details and drill down into
specific metrics,
<span className="font-medium"> so that</span> I can analyze components without cluttering my view.
</p>
<div className="mt-4">
<h4 className="text-sm font-medium mb-2">Acceptance Criteria:</h4>
<ul className="list-disc pl-6 space-y-1 text-sm">
<li>Modules can be expanded in place to show more details</li>
<li>Expanded modules show inputs, formula preview, and outputs</li>
<li>Detailed drilldown available through a dedicated button</li>
<li>Drilldown provides full editing capabilities</li>
<li>Expansion and drilldown are separate actions</li>
</ul>
</div>
</div>
{/* User Story 4 */}
<div className="border rounded-lg p-4">
<div className="flex justify-between items-start mb-3">
<h3 className="text-lg font-medium">Sensitivity Analysis</h3>
<Badge className="bg-green-100 text-green-800">High Priority</Badge>
</div>
<p className="mb-3">
<span className="font-medium">As a</span> business analyst,
<span className="font-medium"> I want to</span> perform sensitivity analysis on my models,
<span className="font-medium"> so that</span> I can understand how changes to inputs affect
overall outcomes.
</p>
<div className="mt-4">
<h4 className="text-sm font-medium mb-2">Acceptance Criteria:</h4>
<ul className="list-disc pl-6 space-y-1 text-sm">
<li>Users can select specific inputs for sensitivity analysis</li>
<li>Users can adjust input values by percentage</li>
<li>System shows impact on all affected modules</li>
<li>Results display percentage changes in outputs</li>
<li>Users can apply simulated changes to the actual model</li>
<li>Reset functionality to return to original values</li>
</ul>
</div>
</div>
{/* User Story 5 */}
<div className="border rounded-lg p-4">
<div className="flex justify-between items-start mb-3">
<h3 className="text-lg font-medium">Heatmap Visualization</h3>
<Badge className="bg-amber-100 text-amber-800">Medium Priority</Badge>
</div>
<p className="mb-3">
<span className="font-medium">As a</span> data scientist,
<span className="font-medium"> I want to</span> visualize the relative values of a specific metric
across all modules,
<span className="font-medium"> so that</span> I can quickly identify hotspots and patterns.
</p>
<div className="mt-4">
<h4 className="text-sm font-medium mb-2">Acceptance Criteria:</h4>
<ul className="list-disc pl-6 space-y-1 text-sm">
<li>Users can enable a heatmap mode for the flowchart</li>
<li>Users can select which metric to visualize</li>
<li>Modules are colored based on their relative metric values</li>
<li>A legend shows the color scale and min/max values</li>
<li>Heatmap can be toggled on/off</li>
</ul>
</div>
</div>
{/* User Story 6 */}
<div className="border rounded-lg p-4">
<div className="flex justify-between items-start mb-3">
<h3 className="text-lg font-medium">Code Export</h3>
<Badge className="bg-amber-100 text-amber-800">Medium Priority</Badge>
</div>
<p className="mb-3">
<span className="font-medium">As a</span> developer,
<span className="font-medium"> I want to</span> export my flowchart as executable code,
<span className="font-medium"> so that</span> I can integrate it into other applications.
</p>
<div className="mt-4">
<h4 className="text-sm font-medium mb-2">Acceptance Criteria:</h4>
<ul className="list-disc pl-6 space-y-1 text-sm">
<li>Users can export the entire flowchart as code</li>
<li>Code maintains the relationships between modules</li>
<li>Generated code is well-formatted and documented</li>
<li>Users can select the export format/language</li>
<li>Export includes all necessary functions and dependencies</li>
</ul>
</div>
</div>
{/* User Story 7 */}
<div className="border rounded-lg p-4">
<div className="flex justify-between items-start mb-3">
<h3 className="text-lg font-medium">Saving and Loading</h3>
<Badge className="bg-green-100 text-green-800">High Priority</Badge>
</div>
<p className="mb-3">
<span className="font-medium">As a</span> user,
<span className="font-medium"> I want to</span> save my flowcharts and load them later,
<span className="font-medium"> so that</span> I can continue my work across sessions.
</p>
<div className="mt-4">
<h4 className="text-sm font-medium mb-2">Acceptance Criteria:</h4>
<ul className="list-disc pl-6 space-y-1 text-sm">
<li>Flowcharts are automatically saved at regular intervals</li>
<li>Users can manually save flowcharts</li>
<li>Saved flowcharts include all module data and connections</li>
<li>Users can reset to initial state if needed</li>
<li>Visual indication of last save time</li>
</ul>
</div>
</div>
{/* User Story 8 */}
<div className="border rounded-lg p-4">
<div className="flex justify-between items-start mb-3">
<h3 className="text-lg font-medium">Module Library</h3>
<Badge className="bg-amber-100 text-amber-800">Medium Priority</Badge>
</div>
<p className="mb-3">
<span className="font-medium">As a</span> frequent user,
<span className="font-medium"> I want to</span> access a library of pre-built modules,
<span className="font-medium"> so that</span> I can quickly build common model patterns.
</p>
<div className="mt-4">
<h4 className="text-sm font-medium mb-2">Acceptance Criteria:</h4>
<ul className="list-disc pl-6 space-y-1 text-sm">
<li>Library contains categorized pre-built modules</li>
<li>Users can search and filter the library</li>
<li>Modules can be added to the flowchart from the library</li>
<li>Library includes description and purpose for each module</li>
<li>Common module types are available (math, logic, input, output, etc.)</li>
</ul>
</div>
</div>
</div>
</ScrollArea>
</CardContent>
</Card>
</TabsContent>
<TabsContent value="features" className="mt-0">
<Card>
<CardHeader>
<CardTitle>Feature Specifications</CardTitle>
<CardDescription>Detailed specifications for key features</CardDescription>
</CardHeader>
<CardContent>
<ScrollArea className="h-[600px] pr-4">
<div className="space-y-8">
{/* Feature 1 */}
<div>
<div className="flex items-center gap-2 mb-3">
<Layers className="h-5 w-5 text-primary" />
<h3 className="text-xl font-medium">Module System</h3>
</div>
<div className="pl-7 space-y-4">
<p>
The core of the application is a modular system that allows users to create, connect, and
manipulate calculation modules in a visual flowchart.
</p>
<div>
<h4 className="text-base font-medium mb-2">Module Types</h4>
<Table>
<TableHeader>
<TableRow>
<TableHead>Type</TableHead>
<TableHead>Purpose</TableHead>
<TableHead>Color Coding</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>Input</TableCell>
<TableCell>Provides initial values to the flowchart</TableCell>
<TableCell>
<div className="flex items-center gap-2">
<div className="w-4 h-4 bg-blue-500 rounded"></div>
<span>Blue</span>
</div>
</TableCell>
</TableRow>
<TableRow>
<TableCell>Math</TableCell>
<TableCell>Performs mathematical calculations</TableCell>
<TableCell>
<div className="flex items-center gap-2">
<div className="w-4 h-4 bg-green-500 rounded"></div>
<span>Green</span>
</div>
</TableCell>
</TableRow>
<TableRow>
<TableCell>Logic</TableCell>
<TableCell>Performs logical operations and conditionals</TableCell>
<TableCell>
<div className="flex items-center gap-2">
<div className="w-4 h-4 bg-purple-500 rounded"></div>
<span>Purple</span>
</div>
</TableCell>
</TableRow>
<TableRow>
<TableCell>Filter</TableCell>
<TableCell>Filters data based on conditions</TableCell>
<TableCell>
<div className="flex items-center gap-2">
<div className="w-4 h-4 bg-amber-500 rounded"></div>
<span>Amber</span>
</div>
</TableCell>
</TableRow>
<TableRow>
<TableCell>Transform</TableCell>
<TableCell>Transforms data from one format to another</TableCell>
<TableCell>
<div className="flex items-center gap-2">
<div className="w-4 h-4 bg-indigo-500 rounded"></div>
<span>Indigo</span>
</div>
</TableCell>
</TableRow>
<TableRow>
<TableCell>Output</TableCell>
<TableCell>Represents final results or outputs</TableCell>
<TableCell>
<div className="flex items-center gap-2">
<div className="w-4 h-4 bg-rose-500 rounded"></div>
<span>Rose</span>
</div>
</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
<div>
<h4 className="text-base font-medium mb-2">Module Structure</h4>
<ul className="list-disc pl-6 space-y-1">
<li>
<span className="font-medium">Header:</span> Module name, type badge, and status indicators
</li>
<li>
<span className="font-medium">Content:</span> Description and key metrics preview
</li>
<li>
<span className="font-medium">Expandable Section:</span> Detailed inputs, formula, and
outputs
</li>
<li>
<span className="font-medium">Footer:</span> Action buttons (details, reset, delete)
</li>
<li>
<span className="font-medium">Connection Points:</span> Input and output handles for
connections
</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Module Interactions</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Expand/collapse for viewing details in place</li>
<li>Quick edit mode for adjusting inputs</li>
<li>Drilldown for detailed editing and analysis</li>
<li>Drag to reposition on the canvas</li>
<li>Connect inputs and outputs between modules</li>
<li>Visual feedback for calculation status</li>
</ul>
</div>
</div>
</div>
{/* Feature 2 */}
<div>
<div className="flex items-center gap-2 mb-3">
<Workflow className="h-5 w-5 text-primary" />
<h3 className="text-xl font-medium">Flowchart Canvas</h3>
</div>
<div className="pl-7 space-y-4">
<p>The interactive canvas where users create and manipulate their modular flowcharts.</p>
<div>
<h4 className="text-base font-medium mb-2">Canvas Features</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Infinite canvas with pan and zoom capabilities</li>
<li>Snap-to-grid for precise module placement</li>
<li>Mini-map for navigation in complex flowcharts</li>
<li>Background grid for visual reference</li>
<li>Animated connections showing data flow direction</li>
<li>Selection and multi-selection of modules</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Toolbar</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Add module button</li>
<li>Connection management</li>
<li>Code export</li>
<li>Save/reset flowchart</li>
<li>Recalculate button with auto-recalculate toggle</li>
<li>Library access</li>
<li>Sensitivity analysis</li>
<li>Heatmap toggle</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Connection System</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Drag-and-drop connection creation</li>
<li>Named connection points for specific inputs/outputs</li>
<li>Visual indication of connection validity</li>
<li>Animated connections showing active data flow</li>
<li>Connection management panel for complex flowcharts</li>
</ul>
</div>
</div>
</div>
{/* Feature 3 */}
<div>
<div className="flex items-center gap-2 mb-3">
<Sliders className="h-5 w-5 text-primary" />
<h3 className="text-xl font-medium">Sensitivity Analysis</h3>
</div>
<div className="pl-7 space-y-4">
<p>Tools for analyzing how changes to inputs affect outputs throughout the flowchart.</p>
<div>
<h4 className="text-base font-medium mb-2">Analysis Capabilities</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Select specific inputs for analysis</li>
<li>Adjust input values by percentage</li>
<li>Simulate changes without affecting the actual model</li>
<li>View impact on all affected modules</li>
<li>Percentage change visualization</li>
<li>Apply simulated changes to the model if desired</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Dashboard Interface</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Input change summary</li>
<li>Affected modules list</li>
<li>Most significant changes highlight</li>
<li>Expandable details for each affected module</li>
<li>Direct navigation to affected modules</li>
<li>Apply/cancel options for changes</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Integration with Module Drilldown</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Access sensitivity analysis from module details</li>
<li>Input-specific analysis options</li>
<li>Reset percentage slider</li>
<li>Input change visualization</li>
<li>Direct application of changes from drilldown</li>
</ul>
</div>
</div>
</div>
{/* Feature 4 */}
<div>
<div className="flex items-center gap-2 mb-3">
<BarChart4 className="h-5 w-5 text-primary" />
<h3 className="text-xl font-medium">Visualization Tools</h3>
</div>
<div className="pl-7 space-y-4">
<p>Visual tools for understanding data relationships and impacts across the flowchart.</p>
<div>
<h4 className="text-base font-medium mb-2">Heatmap</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Color-coding of modules based on selected metric</li>
<li>Dynamic color scale based on min/max values</li>
<li>Legend showing color gradient and value range</li>
<li>Toggle for enabling/disabling heatmap</li>
<li>Metric selection for different visualizations</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Metric Drilldown</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Detailed analysis of specific metrics</li>
<li>Visualization of metric dependencies</li>
<li>Impact flow diagrams</li>
<li>Direct navigation to related modules</li>
<li>Historical value tracking</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Status Indicators</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Calculation status animation</li>
<li>"Needs update" indicators</li>
<li>Modified input highlighting</li>
<li>Connection activity visualization</li>
<li>Error state indicators</li>
</ul>
</div>
</div>
</div>
{/* Feature 5 */}
<div>
<div className="flex items-center gap-2 mb-3">
<Code className="h-5 w-5 text-primary" />
<h3 className="text-xl font-medium">Formula and Code System</h3>
</div>
<div className="pl-7 space-y-4">
<p>Tools for creating, editing, and exporting formulas and code.</p>
<div>
<h4 className="text-base font-medium mb-2">Formula Builder</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Visual formula construction</li>
<li>Input variable integration</li>
<li>Formula validation</li>
<li>Syntax highlighting</li>
<li>Error checking and suggestions</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Code Editor</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Raw code editing for advanced users</li>
<li>Function code preview</li>
<li>Syntax highlighting</li>
<li>Input/output mapping</li>
<li>Code validation</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Code Export</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Export entire flowchart as executable code</li>
<li>Multiple language/format options</li>
<li>Code preview before export</li>
<li>Documentation generation</li>
<li>Module dependency resolution</li>
</ul>
</div>
</div>
</div>
{/* Feature 6 */}
<div>
<div className="flex items-center gap-2 mb-3">
<Settings className="h-5 w-5 text-primary" />
<h3 className="text-xl font-medium">Module Management</h3>
</div>
<div className="pl-7 space-y-4">
<p>Tools for creating, editing, and managing modules.</p>
<div>
<h4 className="text-base font-medium mb-2">Module Creation</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Add module dialog with type selection</li>
<li>Name and description fields</li>
<li>Input definition</li>
<li>Formula/function creation</li>
<li>Default values configuration</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Module Library</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Categorized pre-built modules</li>
<li>Search and filter functionality</li>
<li>Module previews</li>
<li>Drag-and-drop addition to flowchart</li>
<li>Custom module templates</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Module Details Panel</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Comprehensive module editing</li>
<li>Multiple tabs for different aspects (overview, inputs, formula, outputs, explanation)</li>
<li>Input management with grouping by affected metrics</li>
<li>Formula editing with visual builder and code view</li>
<li>Sensitivity analysis tools</li>
<li>Save/reset functionality</li>
</ul>
</div>
</div>
</div>
{/* Feature 7 */}
<div>
<div className="flex items-center gap-2 mb-3">
<Gauge className="h-5 w-5 text-primary" />
<h3 className="text-xl font-medium">Performance Optimization</h3>
</div>
<div className="pl-7 space-y-4">
<p>Features ensuring the application performs well with complex flowcharts.</p>
<div>
<h4 className="text-base font-medium mb-2">Calculation Optimization</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Selective recalculation of affected modules</li>
<li>Dependency tracking for efficient updates</li>
<li>Auto-recalculate toggle for user control</li>
<li>Debounced updates to prevent cascading renders</li>
<li>Asynchronous calculation for UI responsiveness</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Rendering Optimization</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Virtualized rendering for large flowcharts</li>
<li>Memoization of stable components</li>
<li>Lazy loading of complex features</li>
<li>Throttled UI updates</li>
<li>Optimized canvas rendering</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Storage Optimization</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Efficient data serialization</li>
<li>Debounced auto-save</li>
<li>Circular reference handling</li>
<li>Optimized local storage usage</li>
<li>Incremental updates</li>
</ul>
</div>
</div>
</div>
{/* Feature 8 */}
<div>
<div className="flex items-center gap-2 mb-3">
<Puzzle className="h-5 w-5 text-primary" />
<h3 className="text-xl font-medium">Connection Management</h3>
</div>
<div className="pl-7 space-y-4">
<p>Tools for managing connections between modules.</p>
<div>
<h4 className="text-base font-medium mb-2">Connection Panel</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Visual connection management interface</li>
<li>Source and target module selection</li>
<li>Input/output mapping</li>
<li>Connection deletion</li>
<li>Connection validation</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Connection Visualization</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Animated connections showing data flow</li>
<li>Direction indicators</li>
<li>Connection highlighting on hover</li>
<li>Visual feedback for active connections</li>
<li>Error indication for invalid connections</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Connection Interaction</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Drag-and-drop connection creation</li>
<li>Click-to-delete functionality</li>
<li>Reconnection of existing connections</li>
<li>Multi-connection selection</li>
<li>Connection routing optimization</li>
</ul>
</div>
</div>
</div>
</div>
</ScrollArea>
</CardContent>
</Card>
</TabsContent>
<TabsContent value="technical" className="mt-0">
<Card>
<CardHeader>
<CardTitle>Technical Specifications</CardTitle>
<CardDescription>Technical details and architecture</CardDescription>
</CardHeader>
<CardContent>
<ScrollArea className="h-[600px] pr-4">
<div className="space-y-8">
{/* Technical Section 1 */}
<div>
<h3 className="text-xl font-medium mb-4">Technology Stack</h3>
<div className="space-y-4">
<div>
<h4 className="text-base font-medium mb-2">Frontend</h4>
<ul className="list-disc pl-6 space-y-1">
<li>React with Next.js (App Router)</li>
<li>TypeScript for type safety</li>
<li>Tailwind CSS for styling</li>
<li>shadcn/ui for UI components</li>
<li>ReactFlow for flowchart visualization</li>
<li>Lucide React for icons</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">State Management</h4>
<ul className="list-disc pl-6 space-y-1">
<li>React hooks for component state</li>
<li>ReactFlow hooks for flowchart state</li>
<li>Local storage for persistence</li>
<li>Refs for performance optimization</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Performance Optimizations</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Memoization with useCallback and useMemo</li>
<li>Debounced updates and saves</li>
<li>Asynchronous calculations</li>
<li>Selective recalculation</li>
<li>Virtualized rendering</li>
</ul>
</div>
</div>
</div>
{/* Technical Section 2 */}
<div>
<h3 className="text-xl font-medium mb-4">Architecture</h3>
<div className="space-y-4">
<div>
<h4 className="text-base font-medium mb-2">Component Structure</h4>
<ul className="list-disc pl-6 space-y-1">
<li>ModularFlowchart: Main container component</li>
<li>FlowChart: Inner component with ReactFlow integration</li>
<li>ModuleNode: Custom node component for modules</li>
<li>ModuleDetails: Detailed editing panel</li>
<li>SensitivityDashboard: Analysis interface</li>
<li>Various utility and UI components</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Data Flow</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Nodes and edges stored in ReactFlow state</li>
<li>Module data stored in node.data property</li>
<li>Calculations performed with Function objects created from code strings</li>
<li>Changes propagate through connected modules based on edge definitions</li>
<li>State updates trigger recalculation when needed</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Module Structure</h4>
<pre className="bg-slate-100 p-3 rounded-md text-xs overflow-x-auto">
{`// Module data structure
{
id: string,
type: "moduleNode",
position: { x: number, y: number },
data: {
label: string,
description: string,
type: "input" | "math" | "logic" | "filter" | "transform" | "output",
inputs: Record<string, any>,
outputs: Record<string, any>,
defaultInputs: Record<string, any>,
function: Function,
functionCode: string,
isUserAdded: boolean,
needsRecalculation: boolean,
onDelete: (nodeId: string) => void,
onCancel: (nodeId: string) => void,
onUpdateInputs: (nodeId: string, inputs: Record<string, any>) => void,
onRecalculate: (nodeId: string) => void,
onSaveDefaults: (nodeId: string) => void
}
}`}
</pre>
</div>
</div>
</div>
{/* Technical Section 3 */}
<div>
<h3 className="text-xl font-medium mb-4">Calculation Engine</h3>
<div className="space-y-4">
<div>
<h4 className="text-base font-medium mb-2">Function Execution</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Functions created from string code using Function constructor</li>
<li>Inputs passed as arguments to functions</li>
<li>Outputs returned as objects</li>
<li>Error handling for invalid functions</li>
<li>Sandboxed execution environment</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Recalculation Logic</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Topological sorting of nodes based on dependencies</li>
<li>Selective recalculation of affected nodes</li>
<li>Propagation of changes through connected nodes</li>
<li>Cycle detection and handling</li>
<li>Optimization for large flowcharts</li>
</ul>
</div>
<div>
<h4 className="text-base font-medium mb-2">Sensitivity Analysis Algorithm</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Deep cloning of nodes to simulate changes</li>
<li>Modification of selected input by percentage</li>
<li>Recalculation of affected nodes</li>
<li>Comparison of original and new outputs</li>
<li>Calculation of percentage changes</li>
<li>Sorting and highlighting of significant changes</li>
</ul>
</div>
</div>
</div>
{/* Technical Section 4 */}
<div>
<h3 className="text-xl font-medium mb-4">Storage and Persistence</h3>
<div className="space-y-4">
<div>
<h4 className="text-base font-medium mb-2">Local Storage</h4>
<ul className="list-disc pl-6 space-y-1">
<li>Flowchart data stored in browser's localStorage</li>
<li>Automatic saving at regular intervals</li>
<li>Manual save option</li>
<li>Serialization of nodes and edges</li>
<li>Function code stored as strings</li>
<li>Circular reference handling</li>
</ul>