Skip to content

Commit 577d659

Browse files
committed
added Null Closure Transition Table inside Drawer in ModifiedTable
1 parent 0a57205 commit 577d659

File tree

14 files changed

+42
-55
lines changed

14 files changed

+42
-55
lines changed

src/common/AppBarAndDrawer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const AppBarAndDrawer = (props: AppBarAndDrawerProps) => {
8080
...(props.open === 0 && { mt: 0.5 }),
8181
}}
8282
>
83-
{props.title}
83+
{props.headerTitle}
8484
</Typography>
8585
</Grid>
8686
</Grid>
@@ -115,7 +115,7 @@ export const AppBarAndDrawer = (props: AppBarAndDrawerProps) => {
115115
align="center"
116116
fontWeight={"bold"}
117117
>
118-
Transition Table
118+
{props?.drawerTitle ?? "Transition Table"}
119119
</Typography>
120120
<IconButton
121121
onClick={() => {
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { ToolsTransitionTableProps } from "../../features/components/tools/props/TransitionTableProps";
22

33
export type AppBarAndDrawerProps = {
4-
title: string;
4+
headerTitle: string;
55
open: number;
66
setOpen: React.Dispatch<React.SetStateAction<number>>;
77
transitionTableProps: ToolsTransitionTableProps;
8+
drawerTitle?: string;
89
};

src/features/NfaToDfa.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export const NfaToDfa = () => {
110110
};
111111
}),
112112
setRows: setModifiedRows,
113+
nullClosureRows: nullClosureRows,
113114
setIsModifiedTransitionTableComplete: setIsModifiedTransitionTableComplete,
114115
};
115116

src/features/TestAString.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,12 @@ const TestAString = (props: TestAStringProps) => {
273273
};
274274

275275
const appBarAndDrawerProps: AppBarAndDrawerProps = {
276-
title: "Test a String",
276+
headerTitle: "Test a String",
277277
open,
278278
setOpen,
279279
transitionTableProps: {
280-
rows: GetDrawerTransitionTableRows(dataContext, TestStringStateId),
281-
columns: GetDrawerTransitionTableColumns(dataContext, false),
280+
rows: GetDrawerTransitionTableRows(dataContext.rows, TestStringStateId),
281+
columns: GetDrawerTransitionTableColumns(dataContext.columns, ["nul"]),
282282
},
283283
};
284284

src/features/components/minimzeDfa/EquivalentStates.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ export const EquivalentStates = (props: EquivalentStatesProps) => {
568568
};
569569

570570
const appBarAndDrawerProps: AppBarAndDrawerProps = {
571-
title: "Equivalent States",
571+
headerTitle: "Equivalent States",
572572
open,
573573
setOpen,
574574
transitionTableProps,

src/features/components/minimzeDfa/MinimizedDfa.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ export const MinimizedDfa = (props: MinimizedDfaProps) => {
426426
};
427427

428428
const appBarAndDrawerProps: AppBarAndDrawerProps = {
429-
title: "Minimized DFA",
429+
headerTitle: "Minimized DFA",
430430
open,
431431
setOpen,
432432
transitionTableProps,

src/features/components/nfaToDfa/ModifiedTable.tsx

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ import { ToolsTransitionTable } from "../tools/TransitionTable";
2020
import PlayArrowRoundedIcon from "@mui/icons-material/PlayArrowRounded";
2121
import PauseRoundedIcon from "@mui/icons-material/PauseRounded";
2222
import ReplayRoundedIcon from "@mui/icons-material/ReplayRounded";
23-
import { ModifiedTableStateId } from "../../../consts/StateIdsExtensions";
23+
import {
24+
ModifiedTableStateId,
25+
NullClosureStateId,
26+
} from "../../../consts/StateIdsExtensions";
2427
import { AppBarAndDrawer } from "../../../common/AppBarAndDrawer";
2528
import { DrawerHeader } from "../../../common/DrawerHeader";
2629
import { MainContent } from "../../../common/MainContent";
@@ -37,7 +40,7 @@ export const ModifiedTable = (props: ModifiedTableProps) => {
3740

3841
const dataContext = useContext(DataContext);
3942

40-
const [duration, setDuration] = useState(AnimationDurationOptions[0]);
43+
const [duration, setDuration] = useState(AnimationDurationOptions[3]);
4144
const [isPlaying, setIsPlaying] = useState(false);
4245

4346
const [isComplete, setIsComplete] = useState(false); // set to true when data is completely displayed
@@ -73,11 +76,6 @@ export const ModifiedTable = (props: ModifiedTableProps) => {
7376
const [open, setOpen] = useState(1);
7477

7578
useEffect(() => {
76-
console.log(
77-
"ModifiedTable useEffect, isPlaying, duration: ",
78-
isPlaying,
79-
duration
80-
);
8179
if (isPlaying) {
8280
let timer = setTimeout(() => {
8381
console.log("inside set timeout, index", index);
@@ -99,12 +97,6 @@ export const ModifiedTable = (props: ModifiedTableProps) => {
9997
}, [props, modifiedTableRows, isPlaying]);
10098

10199
const handleUpdateData = (rowIndex: number, rows: RowModel[]) => {
102-
console.log(
103-
"handleUpdateData, rowIndex, index, rows: ",
104-
rowIndex,
105-
index,
106-
rows
107-
);
108100
setModifiedTableRowId(rowIndex);
109101
setModifiedTableRows(
110102
rows.map((row, mapIndex) => {
@@ -171,16 +163,10 @@ export const ModifiedTable = (props: ModifiedTableProps) => {
171163
};
172164

173165
const handleDurationChange = (event: SelectChangeEvent) => {
174-
console.log(
175-
"ModifiedTable handleDurationChange, event.target.value, duration: ",
176-
event.target.value,
177-
duration
178-
);
179166
setDuration(Number(event.target.value));
180167
};
181168

182169
const handleAnimation = () => {
183-
console.log("ModifiedTable handleAnimation");
184170
if (isComplete) {
185171
setIsReady(false);
186172
setIsComplete(false);
@@ -190,7 +176,6 @@ export const ModifiedTable = (props: ModifiedTableProps) => {
190176
};
191177

192178
const showNextRow = () => {
193-
console.log("ModifiedTable show next row, index: ", index);
194179
const rowIndex = Math.floor(index / numberOfColumns);
195180
if (isComplete) {
196181
setIsReady(true);
@@ -228,12 +213,16 @@ export const ModifiedTable = (props: ModifiedTableProps) => {
228213
};
229214

230215
const appBarAndDrawerProps: AppBarAndDrawerProps = {
231-
title: "Modified Transition Table",
216+
headerTitle: "Modified Transition Table",
217+
drawerTitle: "Null Closure Table",
232218
open,
233219
setOpen,
234220
transitionTableProps: {
235-
rows: GetDrawerTransitionTableRows(dataContext, ModifiedTableStateId),
236-
columns: GetDrawerTransitionTableColumns(dataContext, false),
221+
rows: GetDrawerTransitionTableRows(
222+
props.nullClosureRows,
223+
NullClosureStateId
224+
),
225+
columns: GetDrawerTransitionTableColumns(dataContext.columns, ["a", "b"]),
237226
},
238227
};
239228

@@ -252,6 +241,7 @@ export const ModifiedTable = (props: ModifiedTableProps) => {
252241
sm: 2,
253242
md: 3,
254243
}}
244+
pt={1.6}
255245
>
256246
{/* Transition table grid */}
257247
<Grid item xs={12} md={4}>

src/features/components/nfaToDfa/NullClosure.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Box,
44
Button,
55
ButtonGroup,
6+
CssBaseline,
67
FormControl,
78
Grid,
89
InputLabel,
@@ -285,12 +286,12 @@ export const NullClosure = (props: NullClosureProps) => {
285286
};
286287

287288
const appBarAndDrawerProps: AppBarAndDrawerProps = {
288-
title: "Null Closure",
289+
headerTitle: "Null Closure",
289290
open,
290291
setOpen,
291292
transitionTableProps: {
292-
rows: GetDrawerTransitionTableRows(dataContext, NullClosureStateId),
293-
columns: GetDrawerTransitionTableColumns(dataContext, false),
293+
rows: GetDrawerTransitionTableRows(dataContext.rows, NullClosureStateId),
294+
columns: GetDrawerTransitionTableColumns(dataContext.columns, ["nul"]),
294295
},
295296
};
296297

@@ -319,7 +320,7 @@ export const NullClosure = (props: NullClosureProps) => {
319320

320321
<AppBarAndDrawer {...appBarAndDrawerProps} />
321322

322-
<MainContent open={open} sx={{ paddingBottom: 12 }}>
323+
<MainContent open={open}>
323324
<DrawerHeader />
324325
{/* Grid to incorporate Transition table and Playground */}
325326
<Grid
@@ -329,6 +330,7 @@ export const NullClosure = (props: NullClosureProps) => {
329330
sm: 2,
330331
md: 3,
331332
}}
333+
pt={1.6}
332334
>
333335
{/* Transition table grid */}
334336
<Grid item xs={12} md={4}>

src/features/components/nfaToDfa/ResultantDfa.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,12 +515,12 @@ export const ResultantDfa = (props: ResultantDfaProps) => {
515515
};
516516

517517
const appBarAndDrawerProps: AppBarAndDrawerProps = {
518-
title: "Resultant DFA",
518+
headerTitle: "Resultant DFA",
519519
open,
520520
setOpen,
521521
transitionTableProps: {
522-
rows: GetDrawerTransitionTableRows(dataContext, ResultantDfaStateId),
523-
columns: GetDrawerTransitionTableColumns(dataContext, false),
522+
rows: GetDrawerTransitionTableRows(dataContext.rows, ResultantDfaStateId),
523+
columns: GetDrawerTransitionTableColumns(dataContext.columns, ["nul"]),
524524
},
525525
};
526526

@@ -538,6 +538,7 @@ export const ResultantDfa = (props: ResultantDfaProps) => {
538538
sm: 2,
539539
md: 3,
540540
}}
541+
pt={1.6}
541542
>
542543
{/* Transition table grid */}
543544
<Grid item xs={12} md={4}>

src/features/components/nfaToDfa/props/ModifiedTableProps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { RowModel } from "../../../../models";
33
export type ModifiedTableProps = {
44
rows: RowModel[];
55
setRows: React.Dispatch<React.SetStateAction<RowModel[]>>;
6+
nullClosureRows: RowModel[];
67
setIsModifiedTransitionTableComplete?: React.Dispatch<
78
React.SetStateAction<boolean>
89
>;

0 commit comments

Comments
 (0)