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

[MM-10586] Desktop App Window/Tabs Update #1056

Merged
merged 89 commits into from
Jan 3, 2020

Conversation

devinbinnie
Copy link
Member

@devinbinnie devinbinnie commented Oct 5, 2019

Before submitting, please confirm you've

Please provide the following information:

Summary
New Server Tabs look and feel.

Issue link
https://mattermost.atlassian.net/browse/MM-10586

@devinbinnie devinbinnie added Feature null Work In Progress Not yet ready for review 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Oct 5, 2019
@devinbinnie devinbinnie added this to the v4.4.0 milestone Oct 5, 2019
Copy link
Contributor

@Willyfrog Willyfrog left a comment

Choose a reason for hiding this comment

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

since its wip, I did a quick review in case it helps you

Comment on lines +299 to +307
const doubleClickAction = remote.systemPreferences.getUserDefault('AppleActionOnDoubleClick', 'string');
const win = remote.getCurrentWindow();
if (doubleClickAction === 'Minimize') {
win.minimize();
} else if (doubleClickAction === 'Maximize' && !win.isMaximized()) {
win.maximize();
} else if (doubleClickAction === 'Maximize' && win.isMaximized()) {
win.unmaximize();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you want to have here some sort of strategy pattern, where you don't really care if it's win or mac, but define the behaviours on initialization and here you just apply whatever is configured.

Copy link
Member Author

Choose a reason for hiding this comment

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

So there's two completely different systems at play here. The Mac one relies on this function and a drag region, whereas the Windows/Linux one is a custom toolbar npm package that handles all this. I'm not really sure how I'd want to 'inject' them separately, since the app doesn't really provides the correct points of insertion, nor do they require the same points.

I think if we were to change the application to be more dependency injection receptive, then it might make sense to modularize these.

if (process.platform === 'darwin') {
topBarClassName += ' macOS';
if (this.state.isDarkMode) {
topBarClassName += ' darkMode';
Copy link
Contributor

Choose a reason for hiding this comment

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

is this for debugging purposes?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, but I guess that raises the question why I'm using state. I'll switch it to an instance variable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I forgot. It should be a state variable, since it can change as the OS changes from light to dark mode.

@@ -71,13 +74,15 @@ export default class TabBar extends React.Component { // need "this"
title='Add new server'
draggable={false}
>
<Glyphicon glyph='plus'/>
<div className='TabBar-tabSeperator'>
{'+'}
Copy link
Contributor

Choose a reason for hiding this comment

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

are we no longer using fonts for icons?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not across the board, but the new design uses just a generic +

@andrewbrown00
Copy link

@devinbinnie do you know why the Setup Cloud Test Server label isn't available in under Labels? Was trying to add the label so you'd know to spin up a test server whenever you need me to review.
image

@devinbinnie
Copy link
Member Author

@devinbinnie do you know why the Setup Cloud Test Server label isn't available in under Labels? Was trying to add the label so you'd know to spin up a test server whenever you need me to review.
image

We don't have an automated builder setup for desktop app currently, which I guess is a bit of a problem...

@andrewbrown00
Copy link

@devinbinnie thanks for clarifying 😄 Who's the best person to bring this issue up with?

@Willyfrog
Copy link
Contributor

Willyfrog commented Oct 8, 2019

@devinbinnie thanks for clarifying 😄 Who's the best person to bring this issue up with?

there is no setup test server but circle does build the app, although it doesn't sign it or package it. there are a couple of steps to get the build:

  1. click on show all checks
  2. on build_and_test click on details
  3. click on store_artifacts-1 which will open circle ci job
  4. click on artifacts tab
  5. select and download the app you will test

at some point it would be great if we posted back with a bot the link to the build, but currently that's not implemented

@devinbinnie devinbinnie removed the Work In Progress Not yet ready for review label Oct 11, 2019
@devinbinnie
Copy link
Member Author

All features complete! Still needs a bit of work here and there, but is mostly ready!

@mattermod
Copy link
Contributor

The file .circleci/config.yml is in the blacklist and should not be modified from external contributors, please if you are part of the Mattermost Org submit this PR in the upstream.
/cc @mattermost/core-security

@andrewbrown00
Copy link

@esethna answers to your previous comment:

  1. @devinbinnie will handle this
  2. New icons have been provided and are in the latest build
    image
  3. Separate ticket created https://mattermost.atlassian.net/browse/MM-21329
  4. Resolved by #2

@esethna
Copy link
Contributor

esethna commented Dec 20, 2019

@devinbinnie is this ready for final review?

@devinbinnie
Copy link
Member Author

@devinbinnie is this ready for final review?

Yep!

Copy link
Contributor

@esethna esethna left a comment

Choose a reason for hiding this comment

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

Thanks Devin!

@esethna esethna added 4: Reviews Complete All reviewers have approved the pull request and removed 1: PM Review Requires review by a product manager labels Dec 20, 2019
@esethna
Copy link
Contributor

esethna commented Dec 20, 2019

We can merge this

@Willyfrog
Copy link
Contributor

re-running the workflow as it doesn't make any sense to fail there

@devinbinnie
Copy link
Member Author

@Willyfrog could you do a quick re-review before we merge to make sure everything is up to standards?

@devinbinnie
Copy link
Member Author

/update-branch

Copy link
Contributor

@Willyfrog Willyfrog left a comment

Choose a reason for hiding this comment

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

looking mostly good, but I have a few concerns/changes to request

package.json Outdated
"mocha": "^5.2.0",
"mocha-circleci-reporter": "0.0.3",
"npm-run-all": "^4.1.5",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-smooth-dnd": "github:devinbinnie/react-smooth-dnd#a72095d3fa1fd6ffc3a6b797174d019a07d7b011",
Copy link
Contributor

Choose a reason for hiding this comment

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

if we are using a fork of a library, shouldn't it be under mattermost and have an associated pull request so we are sure of the changes being introduced?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, though i'm not sure how to go about adding a fork to the MM repo.

Copy link
Member

Choose a reason for hiding this comment

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

You'll have to transfer ownership of it to someone who has admin access to the GitHub organization. I'll message you more details.

@@ -0,0 +1,13 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

why is the file called debug? we should rename it

Copy link
Member Author

Choose a reason for hiding this comment

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

It's only used for debug mode, I think the name's okay.

Comment on lines +196 to +201
case 'mouse-move':
this.handleMouseMove(event.args[0]);
break;
case 'mouse-up':
this.handleMouseUp();
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need to handle movement and release of button?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a fix for the tab dragging and dropping, since if you leave the bounds of the DnD area before dropping, it doesn't drop the tab. This does it manually/

src/browser/components/TabBar.jsx Outdated Show resolved Hide resolved
Comment on lines +468 to +479
if (input.key === 'Alt' && input.type === 'keyUp' && altLastPressed) {
altLastPressed = false;
mainWindow.webContents.send('focus-three-dot-menu');
return;
}

// Hack to detect keyPress so that alt+<key> combinations don't default back to the 3-dot menu
if (input.key === 'Alt' && input.type === 'keyDown') {
altLastPressed = true;
} else {
altLastPressed = false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

why is ALT a shorcut? wouldn't that interfere not only with alt+up/down but with anything regarding the OS from the user if he has any shortcut using that? whouldn't it make more sense to use a separate shortcut for that that doesn't use a modifier key as the only one?
non-comprehensive list of things that might break:

  • alt+f4 on windows (as an example of OS related)
  • alt+right click for mark as unread (as an example of MM related)

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a manual override to do something the OS already does, which is open a window context menu when you press ALT. It was part of @esethna's suggestions for accessibility.

I agree it would be better to use a different shortcut, but that's why we're checking for keyup and keydown to make sure it's not being used as a combo.

src/main/Validator.js Outdated Show resolved Hide resolved
useSpellChecker: Joi.boolean().default(true),
enableHardwareAcceleration: Joi.boolean().default(true),
autostart: Joi.boolean().default(true),
spellCheckerLocale: Joi.string().regex(/^[a-z]{2}-[A-Z]{2}$/).default('en-US'),
Copy link
Contributor

Choose a reason for hiding this comment

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

i wouldn't change it in this PR as it has grown big enough, but shouldn't we consider using system's locale as default? we should create a ticket for that

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably a good idea!

devinbinnie and others added 3 commits January 2, 2020 10:57
Co-Authored-By: Guillermo Vayá <guivaya@gmail.com>
Co-Authored-By: Guillermo Vayá <guivaya@gmail.com>
@devinbinnie devinbinnie merged commit 932ddaf into mattermost:master Jan 3, 2020
@devinbinnie devinbinnie deleted the MM-10586 branch January 3, 2020 17:00
JtheBAB pushed a commit to JtheBAB/desktop that referenced this pull request Jan 17, 2020
* [MM-19054] Added new server tab look and feel, still missing proper hover states and session expired icon

* [MM-19055] Added window controls and removed border for macOS

* [MM-19055] Add dark mode for macOS

* [MM-19054] Added session expired icon

* Test windows titlebar

* Fixed the menu issue and added non-macOS dark mode

* Blank commit

* Fixed a lint issue

* Fixed more lint issues

* Fixed more issues

* New tray icons

* [MM-19603] Drag and drop tabs

* Fixed some assets and fixed build output to include missing assets

* Fixed a couple small issues

* Only show tabs for only 1 server on Mac

* Fixed some more tests

* Fixed another test

* Revert "Fixed another test"

This reverts commit 3604029.

* Fixed another test

* Trial and error!

* A bunch of additional fixes

* Fixed a lint issue

* Fixed restore focus on add server tab causing bad UX

* Trial and error on flaky test again

* Fixed some bugs based on PR feedback.

* blank commit to push tests

* Revert "Test windows titlebar"

This reverts commit 9cd46b7.

* Remove the rest of the old new titlebar and fixes

* Added three-dot link

* New menu

* Rest of new windows menu and other fixes

* Fixed lint errors

* Added windows 10 style title bar buttons for non mac OS

* Lint fixes and enabled the tab bar regardless of number of servers

* Missed one

* Fixed unicode characters

* Commenting out test that should no longer be applicable

* Removed Windows 10 style titlebar icons and used material design instead

* Fixed a lint issue

* Some small UX fixes

* blank commit

* Fixed an issue where dropping the first tab moves it too far over before snapping into place

* Additional style fixes

* Another small issue fix

* Back to Windows 10 style

* Lint fixes

* Accessible three dot menu

* Lint fixes

* Shrinking tabs when window is too small

* Gradient between tabs and title bar buttons when window is too small

* Add drag to gradient

* Replaced icons, drag and drop cursor sticking fix, slight tab change

* Lint and some mac fixes

* Light theme fix to three dot menu

* Hack for tab sticking to cursor on macOS

* Fixes for the find utility

* Fix for Catalina dark mode

* Revert "Fix for Catalina dark mode"

This reverts commit 45da05d.

* Fixed a couple issues Dean found

* More fixes

* Three dot hover effect to circle

* PR feedback

* Test fixes

* Test and config fixes

* Disable dragging when there are GPO servers

* [MM-20757] Fixed dark mode on debug when running macOS Catalina

* Allow future config versions to use v2 config if launching this version of the app

* Oops

* New titlebar icons, blur for titlebar on inactive

* Lint fix

* Set unfocused opacity to 0.4

* Final FINAL icons

* Fixed closing menu not returning focus to the app

* Lint fix

* Update src/browser/components/TabBar.jsx

Co-Authored-By: Guillermo Vayá <guivaya@gmail.com>

* Update src/main/Validator.js

Co-Authored-By: Guillermo Vayá <guivaya@gmail.com>

* Lint fixes

* Moved react-smooth-dnd fork to MM org and fixed another merge issue

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Guillermo Vayá <guivaya@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request Docs/Done Feature null QA Review Done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants