Skip to content

Commit 8c47ca7

Browse files
committed
sort ui files into corresponding subfolder
1 parent 1dd3329 commit 8c47ca7

22 files changed

+57
-62
lines changed

src/DeadCodeView.re

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Navigation.re

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/WarningView.re

Lines changed: 0 additions & 27 deletions
This file was deleted.
File renamed without changes.

src/ui/panel/DeadCodeView.re

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
open Batteries;
2+
3+
[@react.component]
4+
let make = (~dispatch, ~locations) => {
5+
<div className="filebox">
6+
{
7+
if (List.length(locations) == 0)
8+
{<h2>{"No dead code found!" |> React.string}</h2>}
9+
else {
10+
<ul>
11+
{locations
12+
|> List.mapi((i, loc: GoblintCil.location) => {
13+
<li
14+
className="cursor warnitem"
15+
key={string_of_int(i)}
16+
onClick={_ => {
17+
dispatch @@ `DisplayFile(loc.file);
18+
dispatch @@ `InspectLine(GvInspect.Line.of_location(loc));
19+
}}>
20+
{string_of_int(loc.line) ++ " : " ++ loc.file |> React.string}
21+
</li>
22+
})
23+
|> React.list}
24+
</ul>
25+
}}
26+
</div>;
27+
};

src/Panel.re renamed to src/ui/panel/Panel.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ let make = (~state, ~dispatch) => {
4343
let current = state.selected_panel;
4444
<div className="d-flex flex-column border-right border-left h-25">
4545
{make_nav_pills(current, dispatch)}
46-
<div className="tab-content flex-fill overflow-auto">
46+
<div className="tab-content overflow-auto pt-2">
4747
<div className="tab-pane active">
4848
{switch (current) {
4949
| Some(Warnings) => <WarningView warnings={state.warnings} dispatch />
File renamed without changes.

src/ui/panel/WarningView.re

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
open Batteries;
2+
module Message = GvMessages.Message;
3+
4+
[@react.component]
5+
let make = (~warnings, ~dispatch) => {
6+
<div className="filebox">
7+
{if (List.length(warnings) == 0) {
8+
<h2>
9+
{"No warnings found!" |> React.string}
10+
</h2>
11+
} else {
12+
<ul>
13+
{warnings
14+
|> List.map(w => (Message.to_string(w), Message.location(w)))
15+
|> List.mapi((i, (text, loc)) => {
16+
let onClick =
17+
loc
18+
|> Option.map((loc, _) =>
19+
dispatch @@ `InspectLine(GvInspect.Line.of_location(loc))
20+
);
21+
<li className="cursor warnitem" key={string_of_int(i)} ?onClick>
22+
{text |> React.string}
23+
</li>;
24+
})
25+
|> React.list}
26+
</ul>
27+
}}
28+
</div>;
29+
};
File renamed without changes.

0 commit comments

Comments
 (0)