Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record Audio UI - Initial #24012

Merged
merged 14 commits into from Aug 2, 2018
Merged

Record Audio UI - Initial #24012

merged 14 commits into from Aug 2, 2018

Conversation

epeach
Copy link

@epeach epeach commented Jul 31, 2018

This is the basic UI for the Record Audio feature. Includes initial buttons that I can break out before incorporating the audio recording library. Behind the experiment flag 'recordAudio'.

Before:
screenshot from 2018-07-31 14-25-57

After:
screenshot from 2018-07-31 17-30-09

@epeach epeach requested a review from islemaster July 31, 2018 21:42
@@ -146,6 +153,30 @@ export default class AssetManager extends React.Component {
</span>
</div>);

const recordButton = (<div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: I know this file hasn't done this so far, but I prefer stateless functional components and composition as an organizing principle.

// Defined in the file's top scope:
const RecordButton = () => (
  <div>
    <button {...}>
      <i {...}/>
      &nbsp;Record Audio
    </button>
  </div>
);

const Buttons = ({recordAudioEnabled}) => (
  <div>
    {recordAudioEnabled && <AudioRecorder {...}/>}
    <span style={...}>
      {uploadButton}
      {recordAudioEnabled && <RecordButton/>}
    </span>
  </div>
);
Buttons.propTypes = {
  recordAudioEnabled: PropTypes.bool,
};
{experiments.isEnabled('recordAudio') && <RecordButton/>}

// in render()
<Buttons recordAudioEnabled={experiments.isEnabled('recordAudio')}/>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also prefer this style and it reads more 'React-y', in my opinion. I added a stateless functional component for RecordButton. However, with a change I made to the when AudioRecorder gets displayed, the buttons is now tied into the state of the AssetManager (i.e. has a button been selected). In this case, I think it is no longer advantageous to move buttons to its own component, but I'm definitely able to be convinced that it's still preferable. I'd love to hear your opinions!

className="share"
>
<i className="fa fa-microphone" />
&nbsp;Record Audio
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well i18n now.

const buttons = (
<div>
{experiments.isEnabled('recordAudio') &&
<AudioRecorder isVisible={this.state.recordingAudio}/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the state for showing/not showing the recorder component lives up here, why not put the logic for it here as well?

{experiments.isEnabled('recordAudio') &&
  this.state.recordingAudio &&
  <AudioRecorder/>}


render() {
if (this.props.visible) {
return <div></div>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Unless you need the empty div for some reason, fine to return null to render nothing. This might also be moot, if logic for visibility of this component moves into the parent.

<button
onClick={this.onStopClick}
id="stop-record"
style={{...styles.blueButton, ...styles.button}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout: Can we reuse our new-style Button component (source, storybook) instead of just using the DOM button? It's already got styling and support for icons.

<input type="text" placeholder="mysound1.mp3" onChange={this.onNameChange} value={this.state.audioName}></input>
<span>
<button
onClick={this.onStopClick}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.onStopClick is not defined.

@no_mobile
Feature: Manage Assets

# This scenario will be removed when the feature is released.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Useful comments.

@@ -1486,3 +1486,10 @@ def get_section_id_from_table(row_index)
@browser.execute_script(code)
wait_short_until {@browser.execute_script('return window.signOutComplete;')}
end

Then /^I open the Manage Assets dialog$/ do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Yay steps that read as English!

@epeach
Copy link
Author

epeach commented Aug 1, 2018

@islemaster PTAL, thanks!

Copy link
Contributor

@islemaster islemaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 🎤 Looks awesome!

@epeach epeach merged commit fadd7fc into staging Aug 2, 2018
@epeach epeach deleted the record-audio-ui branch August 2, 2018 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants