Skip to content

Commit 060440f

Browse files
committed
Show message on empty directory
Closes #191
1 parent 9c3966a commit 060440f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

static/dirView.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface DirViewProps {
1919

2020
export const DirView: React.SFC<DirViewProps> = (props) => {
2121
const dirPath = props.path.join('/').replace('//', '/');
22-
let files = props.files.map((f: any) => {
22+
let files: any = props.files.map((f: any) => {
2323
const onClick = () => props.app.loadSource(`${dirPath}/${f.name}`);
2424
const className = f.kind === "Directory" ? 'div_entry_name div_dir_entry' : 'div_entry_name div_file_entry';
2525
return (
@@ -28,6 +28,9 @@ export const DirView: React.SFC<DirViewProps> = (props) => {
2828
</div>
2929
);
3030
});
31+
if (files.length == 0) {
32+
files = <div className="div_entry">&lt;Empty directory&gt;</div>
33+
}
3134
return <div id="src">
3235
<BreadCrumbs path={props.path} app={props.app} />
3336
<div id="div_dir_view">

static/rustw.out.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36859,6 +36859,9 @@ exports.DirView = (props) => {
3685936859
return (React.createElement("div", { className: "div_entry", key: f.name },
3686036860
React.createElement("span", { className: className, onClick: onClick }, f.name)));
3686136861
});
36862+
if (files.length == 0) {
36863+
files = React.createElement("div", { className: "div_entry" }, "<Empty directory>");
36864+
}
3686236865
return React.createElement("div", { id: "src" },
3686336866
React.createElement(breadCrumbs_1.BreadCrumbs, { path: props.path, app: props.app }),
3686436867
React.createElement("div", { id: "div_dir_view" },

static/rustw.out.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)