openreplay/frontend/app/components/Client/ProfileSettings/Api.js
Shekar Siri d0bcae82f2
change(ui) - player improvements (#1164)
* change(ui) - player - back button spacing

* change(ui) - onboarding - changes

* change(ui) - onboarding - changes

* change(ui) - integrations gap-4

* change(ui) - install script copy button styles

* change(ui) - copy button in account settings

* fix(ui) - error details modal loader position

* change(ui) - share popup styles

* change(ui) - player improvements

* change(ui) - player improvements - playback speed with menu

* change(ui) - player improvements - current timezone

* change(ui) - player improvements - autoplay options
2023-04-13 17:53:36 +02:00

46 lines
1.2 KiB
JavaScript

import React from 'react';
import copy from 'copy-to-clipboard';
import { connect } from 'react-redux';
import styles from './profileSettings.module.css';
import { Form, Input, Button, CopyButton } from 'UI';
@connect(state => ({
apiKey: state.getIn([ 'user', 'account', 'apiKey' ]),
loading: state.getIn([ 'user', 'updateAccountRequest', 'loading' ]) ||
state.getIn([ 'user', 'putClientRequest', 'loading' ]),
}))
export default class Api extends React.PureComponent {
state = { copied: false }
copyHandler = () => {
const { apiKey } = this.props;
this.setState({ copied: true });
copy(apiKey);
setTimeout(() => {
this.setState({ copied: false });
}, 1000);
};
render() {
const { apiKey } = this.props;
const { copied } = this.state;
return (
<Form onSubmit={ this.handleSubmit } className={ styles.form }>
<Form.Field>
<label htmlFor="apiKey">{ 'Organization API Key' }</label>
<Input
name="apiKey"
id="apiKey"
type="text"
readOnly={ true }
value={ apiKey }
leadingButton={
<CopyButton content={ apiKey } />
}
/>
</Form.Field>
</Form>
);
}
}