-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add module to package * application view * fix a typing error * edit code base on comments
- Loading branch information
Showing
17 changed files
with
732 additions
and
60 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,9 @@ export default class ClipContainer extends React.Component { | |
super(props); | ||
this.state = { | ||
clips: [], | ||
checkedClips: [] | ||
checkedClips: [], | ||
launchOnStartup: false, | ||
showNotification: false | ||
}; | ||
} | ||
|
||
|
@@ -28,6 +30,10 @@ export default class ClipContainer extends React.Component { | |
}); | ||
} | ||
|
||
toggleEnableTranslation() { | ||
this.setState({enableTranslation: !this.state.enableTranslation}); | ||
} | ||
|
||
loadClips() { | ||
this.setState({clips: ipcRenderer.sendSync('load-clips')}); | ||
} | ||
|
@@ -45,7 +51,14 @@ export default class ClipContainer extends React.Component { | |
|
||
renderDeleteBar() { | ||
return ( | ||
<div style={{flexBasis: 47, display: 'flex', flexDirection: 'column'}}> | ||
<div style={{ | ||
flexBasis: 47, | ||
display: 'flex', | ||
flexDirection: 'column', | ||
borderBottomStyle: 'solid', | ||
borderBottomWidth: 1, | ||
borderBottomColor: '#eaefef' | ||
}}> | ||
<div style={{flexBasis: 20}}/> | ||
<div style={{display: 'flex', flexBasis: 15}}> | ||
<div style={{flexBasis: 8}}/> | ||
|
@@ -85,22 +98,74 @@ export default class ClipContainer extends React.Component { | |
); | ||
} | ||
// TODO : refactoring component | ||
|
||
renderDeleteOption(isChecked, source) { | ||
return ( | ||
<div style={{display: 'flex', flexDirection: 'column', flexBasis: 37}}> | ||
<div style={{flex: 1, display: 'flex'}}> | ||
<div style={{flexBasis: 8}}/> | ||
<div style={{ | ||
flexBasis: 14, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center' | ||
}}> | ||
<img src={isChecked ? | ||
'../resources/delete_checked/[email protected]' : | ||
'../resources/delete_unchecked/[email protected]' | ||
} | ||
style={{height: 14, width: 14}} | ||
onClick={()=>{ | ||
if (isChecked) { | ||
this.deleteCheckedClips(source); | ||
return; | ||
} | ||
this.addCheckedClips(source); | ||
}}/> | ||
</div> | ||
<div style={{flexBasis: 15}}/> | ||
</div> | ||
{this.props.enableTranslation && <div style={{flexBasis: 10}}/>} | ||
</div> | ||
); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div style={{display: 'flex', flex: 1}}> | ||
<div style={{flexBasis: 14, flexShrink: 0}}/> | ||
<div style={{flex: 1, display: 'flex', flexDirection: 'column'}}> | ||
{this.props.enableDelete && this.renderDeleteBar() } | ||
{this.props.enableDelete && this.renderDeleteBar()} | ||
<div style={{flexBasis: this.props.enableDelete ? 12 : 24}}/> | ||
{this.props.enableTranslation && !this.props.enableDelete && | ||
<Clip source='Enter text' | ||
google='Translation' | ||
enableTranslation={this.props.enableTranslation} | ||
textStyle={{ | ||
color: '#c6cbcc', | ||
fontSize: 12, | ||
fontFamiliy: 'SanFranciscoText-Regular' | ||
}}/> | ||
} | ||
{this.state.clips.map((content, i) => | ||
<Clip | ||
source={content.source} | ||
deleteLog={this.deleteClip} | ||
enableDelete={this.props.enableDelete} | ||
index={i} | ||
addCheckedClips={this.addCheckedClips} | ||
deleteCheckedClips={this.deleteCheckedClips} | ||
isChecked={this.state.checkedClips.indexOf(content.source) >= 0} | ||
/> | ||
<div style={{display: 'flex'}}> | ||
{ | ||
this.props.enableDelete && | ||
this.renderDeleteOption( | ||
this.state.checkedClips.indexOf(content.source) >= 0, content.source | ||
) | ||
} | ||
<div style={{flex: 1}}> | ||
<Clip | ||
source={content.source} | ||
google={content.google} | ||
deleteLog={this.deleteClip} | ||
enableDelete={this.props.enableDelete} | ||
index={i} | ||
enableTranslation={this.props.enableTranslation} | ||
/> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
<div style={{flexBasis: 14}}/> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import React from 'react'; | ||
import {ipcRenderer} from 'electron'; | ||
import autobind from 'autobind-decorator'; | ||
|
||
@autobind | ||
|
@@ -8,50 +7,17 @@ export default class Clip extends React.Component { | |
super(props); | ||
} | ||
|
||
deleteContents() { | ||
this.props.deleteLog(this.props.index); | ||
ipcRenderer.send('delete-contents', this.props.source); | ||
ipcRenderer.on('delete-result', () => { | ||
// TODO : alert message | ||
}); | ||
} | ||
|
||
render() { | ||
renderSingleWord() { | ||
return ( | ||
<div style={{ | ||
display: 'flex', | ||
borderBottomStyle: 'solid', | ||
borderBottomWidth: 1, | ||
borderColor: '#efeff2' | ||
borderColor: '#efeff2', | ||
flex: 1 | ||
}}> | ||
{ | ||
this.props.enableDelete && | ||
<div style={{flexBasis: 37, display: 'flex'}}> | ||
<div style={{flexBasis: 8}}/> | ||
<div style={{ | ||
flexBasis: 14, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center' | ||
}}> | ||
<img src={this.props.isChecked ? | ||
'../resources/delete_checked/[email protected]' : | ||
'../resources/delete_unchecked/[email protected]' | ||
} | ||
style={{height: 14, width: 14}} | ||
onClick={()=>{ | ||
if (this.props.isChecked) { | ||
this.props.deleteCheckedClips(this.props.source); | ||
return; | ||
} | ||
this.props.addCheckedClips(this.props.source); | ||
}}/> | ||
</div> | ||
<div style={{flexBasis: 15}}/> | ||
</div> | ||
} | ||
<div style={{flexBasis: 10}}/> | ||
<div style={{flexBasis: 352, display: 'flex', flexDirection: 'column'}}> | ||
<div style={{flex: 1, display: 'flex', flexDirection: 'column'}}> | ||
<div style={{flexBasis: 12}}/> | ||
<div style={{ | ||
fontFamily: 'SanFranciscoText-Regular', | ||
|
@@ -64,4 +30,71 @@ export default class Clip extends React.Component { | |
</div> | ||
); | ||
} | ||
|
||
renderDoubleWord() { | ||
return ( | ||
<div style={{display: 'flex', flexDirection: 'column'}}> | ||
<div style={{ | ||
display: 'flex', | ||
boxShadow: '0px 2px 8px 0px rgba(0, 0, 0, 0.1)', | ||
background: '#ffffff', | ||
flex: 1 | ||
}}> | ||
<div style={{flexBasis: 2}}/> | ||
<div style={{flex: 1, display: 'flex', flexDirection: 'column'}}> | ||
<div style={{flexBasis: 10}}/> | ||
<div style={{flex: 1, display: 'flex'}}> | ||
<div style={{flex: 1, display: 'flex'}}> | ||
<div style={{flexBasis: 12}}/> | ||
<div style={{flex: 1, display: 'flex', flexDirection: 'column'}}> | ||
<div style={{flexBasis: 4}}/> | ||
<div style={ | ||
this.props.textStyle ? this.props.textStyle : | ||
{ | ||
flex: 1, | ||
fontSize: 12, | ||
color: '#2e3031', | ||
fontFamily: 'SanFranciscoText-Regular' | ||
}}>{this.props.source} </div> | ||
<div style={{flexBasis: 4}}/> | ||
</div> | ||
<div style={{flexBasis: 12}}/> | ||
</div> | ||
<div style={{ | ||
flexBasis: 3, | ||
borderLeftStyle: 'solid', | ||
borderLeftWidth: 1, | ||
borderLeftColor: '#efeff2' | ||
}}/> | ||
<div style={{flex: 1, display: 'flex'}}> | ||
<div style={{flexBasis: 12}}/> | ||
<div style={{flex: 1, display: 'flex', flexDirection: 'column'}}> | ||
<div style={{flexBasis: 4}}/> | ||
<div style={this.props.textStyle ? this.props.textStyle : { | ||
flex: 1, | ||
fontSize: 12, | ||
color: '#2e3031', | ||
fontFamily: 'Times New Roman, Georgia, Serif' | ||
}}>{this.props.google} </div> | ||
<div style={{flexBasis: 4}}/> | ||
</div> | ||
<div style={{flexBasis: 12}}/> | ||
</div> | ||
</div> | ||
<div style={{flexBasis: 10}}/> | ||
</div> | ||
<div style={{flexBasis: 2}}/> | ||
</div> | ||
<div style={{flexBasis: 10}}/> | ||
</div> | ||
); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
{ this.props.enableTranslation ? this.renderDoubleWord() : this.renderSingleWord() } | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,19 +15,37 @@ export default class header extends React.Component { | |
style={{height: 12, width: 12}}/> | ||
</div> | ||
<div style={{flexBasis: 13, flexShrink: 0}}/> | ||
<div style={{flexGrow: 285, color: '#ffffff', fontFamily: 'SanFranciscoText-Regular'}}> | ||
Text Logger | Beta version | ||
<div style={{flexGrow: 285}}> | ||
<span style={{ | ||
fontSize: 14, | ||
color: '#ffffff', | ||
fontFamily: 'SanFranciscoText-Regular' | ||
}}>Text Logger </span> | ||
<span style={{ | ||
fontSize: 12, | ||
color: '#ffffff', | ||
fontFamily: 'SanFranciscoText-Regular' | ||
}}>| Beta version</span> | ||
</div> | ||
<div style={{flexBasis: 18}}/> | ||
<div style={{flexBasis: 18}}> | ||
{this.props.currentScene === 'clipList' ? | ||
<img src={'../resources/trash-closed/[email protected]'} | ||
style={{height: 14, width: 14}} | ||
onClick={this.props.setDeleteEnabled}/> | ||
onClick={this.props.setDeleteEnabled}/> : <div/> | ||
} | ||
</div> | ||
<div style={{flexBasis: 14}}/> | ||
<div style={{flexBasis: 17}}> | ||
<img src={'../resources/setting/[email protected]'} | ||
style={{height: 14, width: 14}}/> | ||
{this.props.currentScene === 'clipList' ? | ||
// TODO : change it using router later | ||
<img src={'../resources/setting/[email protected]'} | ||
style={{height: 14, width: 14}} | ||
onClick={()=>this.props.setCurrentScene('setting')}/> : | ||
<img src={'../resources/close/[email protected]'} | ||
style={{height: 14, width: 14}} | ||
onClick={()=>this.props.setCurrentScene('clipList')}/> | ||
} | ||
</div> | ||
<div style={{flexBasis: 17}}/> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.