Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf075110

Browse files
committed
Web: Descriptive transformations without steps
1 parent2ea42ed commitf075110

File tree

2 files changed

+58
-48
lines changed

2 files changed

+58
-48
lines changed

‎app/src/pages/CFGCNF.tsx‎

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,17 @@ export class CFGCNF extends Component<{}, State> {
130130
<>
131131
<h4>Bin</h4>
132132
{
133-
this.state.steps.bin.map(([cfg,desc],i)=>
134-
<divkey={i}>
135-
<p>{desc}</p>
136-
<CFGTable
137-
cfg={cfg}
138-
readonly={true}
139-
/>
140-
</div>
141-
)
133+
this.state.steps.bin.length===0 ?
134+
<p>No transformation needed.</p> :
135+
this.state.steps.bin.map(([cfg,desc],i)=>
136+
<divkey={i}>
137+
<p>{desc}</p>
138+
<CFGTable
139+
cfg={cfg}
140+
readonly={true}
141+
/>
142+
</div>
143+
)
142144
}
143145
<br/>
144146
<hr/>
@@ -149,15 +151,17 @@ export class CFGCNF extends Component<{}, State> {
149151
<>
150152
<h4>Del</h4>
151153
{
152-
this.state.steps.del.map(([cfg,desc],i)=>
153-
<divkey={i}>
154-
<p>{desc}</p>
155-
<CFGTable
156-
cfg={cfg}
157-
readonly={true}
158-
/>
159-
</div>
160-
)
154+
this.state.steps.del.length===0 ?
155+
<p>No transformation needed.</p> :
156+
this.state.steps.del.map(([cfg,desc],i)=>
157+
<divkey={i}>
158+
<p>{desc}</p>
159+
<CFGTable
160+
cfg={cfg}
161+
readonly={true}
162+
/>
163+
</div>
164+
)
161165
}
162166
<br/>
163167
<hr/>
@@ -168,15 +172,17 @@ export class CFGCNF extends Component<{}, State> {
168172
<>
169173
<h4>Unit</h4>
170174
{
171-
this.state.steps.unit.map(([cfg,desc],i)=>
172-
<divkey={i}>
173-
<p>{desc}</p>
174-
<CFGTable
175-
cfg={cfg}
176-
readonly={true}
177-
/>
178-
</div>
179-
)
175+
this.state.steps.unit.length===0 ?
176+
<p>No transformation needed.</p> :
177+
this.state.steps.unit.map(([cfg,desc],i)=>
178+
<divkey={i}>
179+
<p>{desc}</p>
180+
<CFGTable
181+
cfg={cfg}
182+
readonly={true}
183+
/>
184+
</div>
185+
)
180186
}
181187
<br/>
182188
<hr/>
@@ -187,15 +193,17 @@ export class CFGCNF extends Component<{}, State> {
187193
<>
188194
<h4>Term</h4>
189195
{
190-
this.state.steps.term.map(([cfg,desc],i)=>
191-
<divkey={i}>
192-
<p>{desc}</p>
193-
<CFGTable
194-
cfg={cfg}
195-
readonly={true}
196-
/>
197-
</div>
198-
)
196+
this.state.steps.term.length===0 ?
197+
<p>No transformation needed.</p> :
198+
this.state.steps.term.map(([cfg,desc],i)=>
199+
<divkey={i}>
200+
<p>{desc}</p>
201+
<CFGTable
202+
cfg={cfg}
203+
readonly={true}
204+
/>
205+
</div>
206+
)
199207
}
200208
<br/>
201209
<hr/>

‎app/src/pages/CFGTransformation.tsx‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { CFGTable } from "../components/CFGTable";
44

55
interfaceState{
66
cfg:CFG.ContextFreeGrammar;
7-
steps:Array<[CFG.ContextFreeGrammar,string]>;
7+
steps:Array<[CFG.ContextFreeGrammar,string]>|null;
88
}
99

1010
exportabstractclassCFGTransformationextendsComponent<{},State>{
@@ -17,7 +17,7 @@ export abstract class CFGTransformation extends Component<{}, State> {
1717

1818
this.state={
1919
cfg:newCFG.ContextFreeGrammar(),
20-
steps:newArray<[CFG.ContextFreeGrammar,string]>(),
20+
steps:null,
2121
};
2222

2323
this.transform=this.transform.bind(this);
@@ -49,19 +49,21 @@ export abstract class CFGTransformation extends Component<{}, State> {
4949
</button>
5050
</section>
5151
{
52-
this.state.steps.length===0 ?null :
52+
this.state.steps==null ?null :
5353
<section>
5454
<h3>Transformation Steps</h3>
5555
{
56-
this.state.steps.map(([cfg,desc],i)=>
57-
<divkey={i}>
58-
<p>{desc}</p>
59-
<CFGTable
60-
cfg={cfg}
61-
readonly={true}
62-
/>
63-
</div>
64-
)
56+
this.state.steps.length===0 ?
57+
<p>No transformation needed.</p> :
58+
this.state.steps.map(([cfg,desc],i)=>
59+
<divkey={i}>
60+
<p>{desc}</p>
61+
<CFGTable
62+
cfg={cfg}
63+
readonly={true}
64+
/>
65+
</div>
66+
)
6567
}
6668
</section>
6769
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp