Skip to content

Commit 7709e47

Browse files
committed
Add the QR code link button to the dev toolbar
1 parent 04b71fd commit 7709e47

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/App.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class App extends React.Component<IAppProps, {}> {
5555
<div>
5656
<DevToolbar
5757
dispatch={this.props.dispatch}
58+
account={this.props.account}
5859
/>
5960
{this.renderApp()}
6061
</div>

src/components/DevToolbar.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { login, clearAccount } from "actions/account";
99

1010
interface IDevToolbarProps {
1111
dispatch: Function
12+
account: IAccount
1213
}
1314

1415
export default class DevToolbar extends React.Component<IDevToolbarProps, {}> {
@@ -26,11 +27,21 @@ export default class DevToolbar extends React.Component<IDevToolbarProps, {}> {
2627
this.props.dispatch(addProduct(codes[randomIndex]));
2728
}
2829

30+
qrcode() {
31+
if (this.props.account.token) {
32+
var url = process.env.API.host + "/profile/" + this.props.account.token;
33+
return (
34+
<Button icon="qrcode" onClick={() => window.open(url)}/>
35+
);
36+
}
37+
}
38+
2939
render() {
3040
var dispatch = this.props.dispatch;
3141
return (
3242
<Flex pl={2} align="center" auto className={style.devbar}>
3343
<Box auto>{process.env.API.host}</Box>
44+
{this.qrcode()}
3445
<Button icon="credit-card" onClick={() => dispatch(login('1337'))}/>
3546
<Button icon="plus" onClick={() => this.addRandomProduct()}/>
3647
</Flex>

0 commit comments

Comments
 (0)