Skip to content

Commit

Permalink
device selection
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkp committed Apr 16, 2016
1 parent d3e6c51 commit 015f501
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
13 changes: 12 additions & 1 deletion app/src/components/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,22 @@ class Application extends React.Component {

let dx = this.state.dx;
dx[device] = {device, card: atr};

this.setState({
card: atr,
dx: dx
});

if (device === this.state.device) {
let log = this.state.log;
log.push({
type: 'card-inserted',
atr: atr,
device: device
});
this.setState({
log: log
});
}
});
ipc.on('card-removed', (event, {device}) => {
console.log(`* Card removed from '${device}' `);
Expand Down
6 changes: 3 additions & 3 deletions app/src/components/console-entry/control-entry.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
.console-entry {

padding: 1rem 1rem;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;

@extend .truncate;

&:first-child {
/*&:first-child {
border-top: none;
}
}*/
}
11 changes: 11 additions & 0 deletions app/src/components/console/Console.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ export default ({
</Fixed>
<ScrollToBottom className="commands">
{ log.map((result, key) => {

console.log(`result ${JSON.stringify(result)}`);
if (result.type && result.type === 'card-inserted') {
return (
<div className={`card-inserted`} key={key}>
<div className={`device`}>{result.device}</div>
<div className={`atr`}>{result.atr}</div>
</div>
);
}

return <ConsoleEntry key={key}
command={result.command}
ok={result.ok}
Expand Down
22 changes: 22 additions & 0 deletions app/src/components/console/console.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,26 @@
font-family: "Menlo", "Lucida Console", monospace;
}


.card-inserted {

border-bottom: 1px solid #ddd;

.device {
display: inline-block;
padding: 1rem;
}

.atr {
display: inline-block;
padding: 1rem;
border-left: 1px solid #ddd;
&:before {
content: "Answer to reset:";
padding-right: .5rem;
}
}


}
}

0 comments on commit 015f501

Please sign in to comment.