Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Refactor of tabs related components (redux component) #8396

Merged
merged 4 commits into from
Jun 2, 2017

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Apr 19, 2017

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Resolves #8690

Test Plan:

@NejcZdovc NejcZdovc added this to the 0.15.1 milestone Apr 19, 2017
@NejcZdovc NejcZdovc self-assigned this Apr 19, 2017
@NejcZdovc NejcZdovc force-pushed the redux/tabs branch 3 times, most recently from 7e416ab to bc46948 Compare April 25, 2017 12:27
@NejcZdovc NejcZdovc mentioned this pull request Apr 27, 2017
51 tasks
@NejcZdovc NejcZdovc force-pushed the redux/tabs branch 5 times, most recently from ecde624 to e44e6d4 Compare April 28, 2017 20:53
@NejcZdovc NejcZdovc changed the title refactor of TabsToolbar (redux component) Refactor of tabs related components (redux component) Apr 28, 2017
@NejcZdovc NejcZdovc force-pushed the redux/tabs branch 2 times, most recently from 01742ee to 1ecede5 Compare May 4, 2017 13:11
@NejcZdovc NejcZdovc modified the milestones: 0.15.4, 0.15.3 May 4, 2017
@NejcZdovc NejcZdovc force-pushed the redux/tabs branch 7 times, most recently from c0adaaf to ad1decb Compare May 22, 2017 10:43
@NejcZdovc
Copy link
Contributor Author

I will squash it after a review, don't merge without squashing it first

Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

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

sequential tab closing isn't recovering tab size after mouse leaves the tab. see https://github.com/brave/browser-laptop/pull/8396/files#diff-15331dd5e010a9a3d250a1a37d851653R48 this is the only blocker I could find. There is also wrong variable name for audio muted, but just for proper readability, feature works.

// We switch to blue top bar for all breakpoints but default
return this.props.frame.get('breakpoint') === 'default'
get audioIcon () {
const isMuted = this.props.pageCanPlayAudio && !this.props.audioMuted
Copy link
Contributor

Choose a reason for hiding this comment

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

variable defines that page can play audio, and is not muted, maybe isNotMuted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

get pageCanPlayAudio () {
return !!this.props.frame.get('audioPlaybackActive')
class AudioTabIcon extends React.Component {
constructor (props) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is props required? maybe for redux component? afaik this is only needed if you want to use this.props in the constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah props is required because of redux. More about this PR #9061

const frame = frameStateUtil.getFrameByKey(currentWindow, ownProps.frameKey)

const props = {}
// used in renderer
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove this comment to avoid confusion?

Copy link
Contributor Author

@NejcZdovc NejcZdovc May 27, 2017

Choose a reason for hiding this comment

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

Can you tell me a little bit more about this? I added this because this way you exactly know what is used in renderer and what in other functions in the component. Because of that changing and looking for thing should be easier then looking at a big list of variables.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, but // used in renderer is followed by a blank line and then we have // used in other functions. If both applies wouldn't be better to // used in render and in other functions? Reading the code the blank line between both comments lead me to think that comment was left after some code removal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah sorry, didn't check out the code. If nothing is added for a renderer, this line should be removed. I agree

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -32,85 +28,11 @@ module.exports.tabUpdateFrameRate = 66

/**
* Check whether or not current breakpoint match defined criteria
* @param {Object} props - Object that hosts the tab breakpoint
* @param {Object} breakpoint - Brake point value
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: typo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

}

onMouseLeave () {
if (this.props.fixTabWidth) {
return
Copy link
Contributor

Choose a reason for hiding this comment

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

we are returning before fixTabWidth is set to null, this is making tabs unable to recover size after sequential tab close:

bug_tab_close

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cezaraugusto this if was copied from https://github.com/brave/browser-laptop/pull/8396/files#diff-15331dd5e010a9a3d250a1a37d851653L132. If I remove it from a function is working correctly, but I would like to understand why it was there in the first place

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, now I can see where the problem was. I switched if statement. It's fixed now.

@cezaraugusto
Copy link
Contributor

fyi and QA guidance I manually tested the following, all passing.

  1. ✓ tabs breakpoint change based on window size with proper icons show/hide state
  2. ✓ privateTab icon and colors are properly shown
  3. ✓ audio indicator is properly shown and toggles on/off
  4. ✓ new session tabs shows partition number but not partition string
  5. ✓ tabs load with proper themecolor
  6. ✓ loading indicator shows properly when tab is loading
  7. ✓ closeTab icon closes a tab
  8. ✓ colored tabs shows white text when required
  9. ✓ colored tabs with white text should be bolder in macOS
  10. ✓ colored tabs with white text have a white shadow behind favicon
  11. ✓ websites without favicon show paper icon instead of icon
  12. ✓ reordering a tab with drag and drop works as expected
  13. ✓ caret for notification bar shows when notification is open
  14. ✓ Tab pages respect max tabs per page defined in preferences
  15. ✓ Tab pages switch back/forward actions
  16. ✓ Context menu for tabs display properly

@NejcZdovc
Copy link
Contributor Author

@cezaraugusto thank you very much for a thorough review. I think that all you comments were addressed.

Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

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

automated tests pass, str pass, own manual tests pass, comments addressed, nice work lgtm

@NejcZdovc NejcZdovc requested a review from luixxiul May 31, 2017 20:50
@bsclifton
Copy link
Member

bsclifton commented Jun 2, 2017

possible small regression (something tests might help with):
Clicking the close button doesn't automatically highlight (turn orange) the next tabs close button
close-button

(it only turns orange when I click and then takes a moment to close because I have so many bookmarks)

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

While testing, I found some issues and fixed (see 446a7f2)

Changes look good! I manually tested (see feedback about close button not auto-highlighting). Other than that, I didn't find any issues 😄

(More tests are always welcome 😄 )

resolve(iconHref + resolution)
}
})
}
Copy link
Member

Choose a reason for hiding this comment

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

Nice! Thanks for removing this 😄

NejcZdovc and others added 4 commits June 2, 2017 15:04
… way:

- iconSize was not being exported correctly (it always had undefined). I moved to config and verified it has a value now
- the tab size methods now handle null/undefined properly
- updated tabContentState to use the braveExtensionId constant

Auditors: @NejcZdovc
@bsclifton bsclifton merged commit ea04da9 into brave:master Jun 2, 2017
bsclifton added a commit that referenced this pull request Jun 2, 2017
Refactor of tabs related components (redux component)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants