-
Notifications
You must be signed in to change notification settings - Fork 975
Responsive tab / refactor to Aphrodite #6900
Conversation
For reference, @bradleyrichter reported some improvements here: #5918 (comment) |
c14ad16
to
e7fba5b
Compare
There is a lot of errors which seems to me to be related with the changes |
moving to 0.13.2, will consider moving back if tests are fixed up in time. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just now got to reviewing (doh- sorry)
I did notice this though:
Much of the code is using process.platform
for the win32 check. This is not going to work in the renderer, because the renderer process (ex: where the tab runs) does not have access to node.js.
For a safe way to check, take a peek at the platformUtil helper code (specifically the isWindows). This checks the process.platform (which will return undefined) but also checks navigator
Once ready, this may also fix #6845 |
e7fba5b
to
dffa875
Compare
@bsclifton thanks added to PR description |
Updated with test fixes. The below are intermittent, but passed locally:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! I tested on Windows and Mac and found 2 issues (only 1 that I think we need to address)
-
When you set the max tab count as 20, things can get a little cramped. However, I think this is outside the scope of this change. The behavior with this PR is MUCH better than what we have today. I think this would be a great follow up issue
-
There was a PR by @gyandeeps which made the tabs stay the same size when closing. This does appear to still work... but the close button is hidden. STR:
- open up a bunch of tabs
- close them, starting in the middle
- notice after closing one that the close icon doesn't automatically show. You have to move mouse off tab and back on. But by doing that, mouse leaves and triggers the resize code.
edit:
here are pics of the cramped area when max tabs is set to 20 and width is smallest; we can use this for creating a follow up issue
const {StyleSheet} = require('aphrodite') | ||
const globalStyles = require('./global') | ||
|
||
const styles = StyleSheet.create({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really well done here! 😄 This is perfect
tabIcon: '14px', | ||
tabTitle: '12px' | ||
}, | ||
appIcons: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
module.exports.isLinux = () => { | ||
return !module.exports.isDarwin() && | ||
!module.exports.isWindows() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is perfect! For anyone else looking at this... I believe this is the best way because there could be many variations of navigator.platform
for Linux. We can't rely on process.platform because this code is often invoked in the renderer (like in this PR)
Updated after #6900 (review) regarding sequential tab closing issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the feedback I left with small nitpicks, everything else looks great! Awesome job on this one 😄
js/components/tab.js
Outdated
const locationHasFavicon = this.props.tab.get('location') !== 'about:newtab' | ||
componentDidMount () { | ||
// Execute resize handler at a rate of 15fps | ||
window.addEventListener('resize', throttle(this.onUpdateTabSize, 66)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 66 magic number may make more sense as a constant in tabUtil.js
js/stores/windowStore.js
Outdated
// Copy the hover state if tab closed with mouse | ||
// This allow us to have closeTab button visible | ||
// for sequential frames closing, until onMouseLeave event happens. | ||
if (hoverState) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may also want to check nextFrame; like if (hoverState && nextFrame) {
z-index: @zindexTabs; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing all this deleted is beautiful! 😄
@bbondy did you want to give this one a go? I think you'll like it 😄 |
265caaf
to
2428ae2
Compare
wow this is very awesome @cezaraugusto, nice work. |
2428ae2
to
31513ae
Compare
Auditors: @bsclifton, @bbondy /cc @bradleyrichter Fix #5431 Fix #6511 Fix #6845 Fix #1776 Fix #100
31513ae
to
600f53a
Compare
@cezaraugusto need your help with 2 things 😄
|
@bsclifton failing tests not related to selector. Failing on master as well.
Searches for
Test is described inside Also updated target issues with test plan pointing for this PR's top comment. |
Test plan
Automated tests
Covered by automated tests
git rebase -i
to squash commits (if needed).Auditors: @bsclifton, @bbondy
/cc @bradleyrichter
Fix #5431
Fix #6511
Fix #6845
Fix #1776
Fix #100