diff options
| author | Jules <jules@asdf.us> | 2018-06-20 12:29:36 -0400 |
|---|---|---|
| committer | Jules <jules@asdf.us> | 2018-06-20 12:29:36 -0400 |
| commit | 89c3c2546af95122099e5e3e7cc0c40448066508 (patch) | |
| tree | 226bcc92ebbfab003339ffbd346a90421d9c6fe0 /app/client/common | |
| parent | 95de035728c209a6d0acee9b14a86837e44d26e4 (diff) | |
| parent | 78abe1dc85c7b251cc871ffd4630a4a6c5eb2bd4 (diff) | |
oop
Diffstat (limited to 'app/client/common')
| -rw-r--r-- | app/client/common/fileList.component.js | 6 | ||||
| -rw-r--r-- | app/client/common/folderList.component.js | 8 | ||||
| -rw-r--r-- | app/client/common/textInput.component.js | 11 |
3 files changed, 20 insertions, 5 deletions
diff --git a/app/client/common/fileList.component.js b/app/client/common/fileList.component.js index 1108dbf..b71faae 100644 --- a/app/client/common/fileList.component.js +++ b/app/client/common/fileList.component.js @@ -64,6 +64,7 @@ export const FileRow = props => { const size = util.hush_size(file.size) const date = file.date || file.created_at const epoch = file.epoch || file.epochs || 0 + const count = file.count || 0 let name; let key; @@ -88,7 +89,7 @@ export const FileRow = props => { {file.persisted === false ? <span className='unpersisted'>{name}</span> : (linkFiles && file.url) - ? <a target='_blank' onClick={(e) => { if (!(e.metaKey || e.ctrlKey || e.altKey)) { e.preventDefault(); onClick && onClick(file, e) }}} href={file.url}>{name}</a> + ? <a target='_blank' onClick={(e) => { if (!(e.metaKey || e.ctrlKey || e.altKey) && onClick) { e.preventDefault(); onClick && onClick(file, e) }}} href={file.url}>{name}</a> : <span class='link' onClick={(e) => onClick && onClick(file, e)}>{name}</span> } </div> @@ -111,6 +112,9 @@ export const FileRow = props => { {fields.has('size') && <div className={"size " + size[0]}>{size[1]}</div> } + {fields.has('count') && + <div className={"count " + util.hush_null(count)[0]}>{count > 0 ? count + ' files' : ''}</div> + } {(fields.has('activity') || fields.has('module')) && <div className='activity'> {fields.has('activity') && file.activity} diff --git a/app/client/common/folderList.component.js b/app/client/common/folderList.component.js index ccf9848..b609685 100644 --- a/app/client/common/folderList.component.js +++ b/app/client/common/folderList.component.js @@ -16,15 +16,17 @@ export default function FolderList ({ db, path, emptyText }) { <Loading progress={db.progress} /> </div> ) - } else if (! db.data.folders.length && emptyText) { + } + let folderList = db.data.folders.filter(folder => !! folder.generated) + if (! folderList.length && emptyText) { return ( <div class='col folderList'> {emptyText} </div> ) } - console.log(db.data.folders) - const folders = db.data.folders.map(raw_folder => { + console.log(folders) + const folders = folderList.map(raw_folder => { const folder = db.data.folderLookup[raw_folder.id] const fileCount = folder.files ? folder.files.length : 0 const [ className, size ] = util.hush_null(fileCount) diff --git a/app/client/common/textInput.component.js b/app/client/common/textInput.component.js index 1e2ca01..a3739d4 100644 --- a/app/client/common/textInput.component.js +++ b/app/client/common/textInput.component.js @@ -3,14 +3,23 @@ import { h, Component } from 'preact' class TextInput extends Component { constructor(props){ super(props) + this.state = { value: null, changed: false } this.handleInput = this.handleInput.bind(this) this.handleKeydown = this.handleKeydown.bind(this) } handleInput(e){ + this.setState({ + value: e.target.value, + changed: true, + }) this.props.onInput && this.props.onInput(e.target.value) } handleKeydown(e){ if (e.keyCode === 13) { + this.setState({ + value: e.target.value, + changed: false, + }) this.props.onSave && this.props.onSave(e.target.value) } } @@ -21,7 +30,7 @@ class TextInput extends Component { <span>{this.props.title}</span> <input type='text' - value={this.props.value} + value={this.state.changed ? this.state.value : this.props.value} onInput={this.handleInput} onKeydown={this.handleKeydown} placeholder={this.props.placeholder} |
