Skip to content

Commit d647a6d

Browse files
committed
improved folder view
1 parent 5085db0 commit d647a6d

File tree

2 files changed

+63
-77
lines changed

2 files changed

+63
-77
lines changed

components/folder-page.jsx

+62-76
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,32 @@ const renderContent = require('../lib/renderContent')
88
let Files = class extends React.Component {
99
render() {
1010
return (
11-
<Panel
12-
title={this.props.title ? `"${this.props.title}" Results` : 'Entries'}
13-
noPadding={true}
14-
>
15-
<div style={{ overflow: 'auto', height: this.props.height }}>
16-
<table className="table">
17-
<tbody>
18-
{this.props.files
19-
.filter(x => x['.tag'] === 'file')
20-
.reverse()
21-
.map((file, index) => {
22-
var style = ''
23-
if (file === this.props.selectedFile) {
24-
style = 'cell-active'
11+
<div style={{ overflow: 'auto', height: this.props.height }}>
12+
<div className="list-group">
13+
{this.props.files
14+
.filter(x => x['.tag'] === 'file')
15+
.reverse()
16+
.map(file => {
17+
return (
18+
<a
19+
key={file.name}
20+
href="javascript:void(0);"
21+
onClick={this.props.onClick.bind(null, file)}
22+
className={
23+
file === this.props.selectedFile
24+
? 'list-group-item list-group-item-action active'
25+
: 'list-group-item-action list-group-item '
2526
}
26-
27-
const cellStyle = { cursor: 'pointer' }
28-
if (index === 0) cellStyle.borderTop = 0
29-
return (
30-
<tr key={file.id} className={style}>
31-
<td
32-
onClick={this.props.onClick.bind(null, file)}
33-
style={cellStyle}
34-
>
35-
<a
36-
href="javascript:void(0);"
37-
onClick={this.props.onClick.bind(null, file)}
38-
>
39-
<strong>{toDisplayName(file.name)}</strong>
40-
<p className="text-muted" style={{marginBottom:0}}>
41-
{prettyDate(file.client_modified)}
42-
</p>
43-
</a>
44-
</td>
45-
</tr>
46-
)
47-
})}
48-
</tbody>
49-
</table>
27+
>
28+
<h5>{toDisplayName(file.name)}</h5>
29+
<p style={{ marginBottom: 0 }}>
30+
{prettyDate(file.client_modified)}
31+
</p>
32+
</a>
33+
)
34+
})}
5035
</div>
51-
</Panel>
36+
</div>
5237
)
5338
}
5439
}
@@ -63,20 +48,21 @@ const FilePreview = class extends React.Component {
6348
}
6449
render() {
6550
return (
66-
<Panel title={toDisplayName(this.props.file.name)} noPadding={true}>
67-
<div
68-
style={{
69-
overflow: 'auto',
70-
height: this.props.height,
71-
padding: '20px'
72-
}}
73-
>
74-
<If test={this.props.loading}>
75-
<Loading />
76-
<div dangerouslySetInnerHTML={this.createMarkup()} />
77-
</If>
78-
</div>
79-
</Panel>
51+
<div
52+
style={{
53+
overflow: 'auto',
54+
height: this.props.height
55+
}}
56+
>
57+
<If test={this.props.loading}>
58+
<Loading />
59+
<div className="list-group">
60+
<div className="list-group-item">
61+
<div dangerouslySetInnerHTML={this.createMarkup()} />
62+
</div>
63+
</div>
64+
</If>
65+
</div>
8066
)
8167
}
8268
}
@@ -111,34 +97,36 @@ module.exports = class extends React.Component {
11197
}
11298

11399
render() {
114-
var height = 'calc(100vh - 155px)'
100+
var height = 'calc(100vh - 195px)'
115101
if (this.props.path) {
116-
height = 'calc(100vh - 225px)'
102+
height = 'calc(100vh - 240px)'
117103
}
118104

119105
return (
120106
<Page path={this.props.path}>
121-
<div className="row">
122-
<div className="col-md-3">
123-
<Files
124-
height={height}
125-
title={this.props.searchTerm}
126-
files={this.props.files}
127-
onClick={this.onClick}
128-
selectedFile={this.state.selectedFile}
129-
/>
130-
</div>
131-
<div className="col-md-9">
132-
<If test={this.state.selectedFile}>
133-
<FilePreview
107+
<Panel title="Notes">
108+
<div className="row">
109+
<div className="col-md-3">
110+
<Files
134111
height={height}
135-
file={this.state.selectedFile}
136-
loading={this.state.loading}
137-
fileContent={this.state.fileContent}
112+
title={this.props.searchTerm}
113+
files={this.props.files}
114+
onClick={this.onClick}
115+
selectedFile={this.state.selectedFile}
138116
/>
139-
</If>
117+
</div>
118+
<div className="col-md-9">
119+
<If test={this.state.selectedFile}>
120+
<FilePreview
121+
height={height}
122+
file={this.state.selectedFile}
123+
loading={this.state.loading}
124+
fileContent={this.state.fileContent}
125+
/>
126+
</If>
127+
</div>
140128
</div>
141-
</div>
129+
</Panel>
142130
</Page>
143131
)
144132
}
@@ -149,7 +137,5 @@ function toDisplayName(value) {
149137
}
150138

151139
function prettyDate(value) {
152-
const parts = value.split('T')
153-
const hourParts = parts[1].split('.')[0].split(':')
154-
return `${parts[0]} ${hourParts[0]}:${hourParts[1]}`
140+
return new Date(value).toLocaleString()
155141
}

dist/muonrevo.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)