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

Toolbar #36

Merged
merged 15 commits into from
Apr 11, 2019
Merged

Toolbar #36

merged 15 commits into from
Apr 11, 2019

Conversation

RvanderLaan
Copy link
Collaborator

@RvanderLaan RvanderLaan commented Apr 4, 2019

Closes #29
I tried to use the grid but it's a little more difficult than I hoped to make it act like the UI prototype.
It mostly contains placeholder elements, except for toggling the inspector+outliner (now with transitions!), the settings button and the sorting button (which only opens a menu).

Grids are hard. Might need some refactoring.
@RvanderLaan RvanderLaan changed the title Added Toolbar component with mostly placeholder elements Toolbar Apr 4, 2019
@schroef
Copy link
Contributor

schroef commented Apr 5, 2019

The way it's done in the prototype is simply by toggling classes. I've setup 4 classes which will change the look and feel of the results.

So when I click grid, first it deletes all 4 class, just to make sure none are than, than only the active one from the button is added. All elements inside a result div react to this class

@hummingly hummingly added this to the Alpha v. 1.0 milestone Apr 5, 2019
@hummingly
Copy link
Collaborator

I had a look yesterday. To solve the problem we should see the toolbar as a single entity. As I understand it, the toolbar is always going to be above the content and it will only move as the windows is resized.
This means we create a container div around the toolbar components that has either display: grid or display: flex. We also wrap <main>, <nav> and <aside> in a div and move the layoutContainer id to it. I haven't checked yet how you make the settings panel. Is it an overlay or should it be inside

?

@RvanderLaan
Copy link
Collaborator Author

Yep, that sounds good, I'll try it out. I was struggling a little bit with the CSS grid as I've never used it before so at the moment the toolbar buttons go all over the place.
The settings panel is a Drawer component from Blueprint, basically just an overlay on the right side. They added it only recently so I had to update the dependencies

@hummingly
Copy link
Collaborator

I totally forgot that content can be spread over several cells. The toolbars is the whole first row and uses flex-box now. I noticed one issue is that there is never a hotizontal scrollbar in main. The problem is that the height must be set to an absolute value but the toolbar takes space too.

@schroef
Copy link
Contributor

schroef commented Apr 6, 2019

When you use ID you can pin-point exacty where each div goes in the toolbar. Thats how we did it in the prototype aswell.

As for the settings panel, this is indeed a div which is set to display:none. That is the same as i did the search panel and the depricated locations panel.

@schroef
Copy link
Contributor

schroef commented Apr 6, 2019

PS indeed i think that drawer function looks the same. Cant jquery be used if this wont work?
How are you tackling the panels for tag and search?

@schroef
Copy link
Contributor

schroef commented Apr 6, 2019

I totally forgot that content can be spread over several cells. The toolbars is the whole first row and uses flex-box now. I noticed one issue is that there is never a hotizontal scrollbar in main. The problem is that the height must be set to an absolute value but the toolbar takes space too.

To hide a scrollbar you either use this for the content are
overflow: scroll;

If a scrollbar shows in other areas you can force hide it with this;
Here's more info about overflow, https://developer.mozilla.org/en-US/docs/Web/CSS/overflow

@hummingly
Copy link
Collaborator

Yeah I did this already but the height of the scrollbar depends on the height of the element. <main> inherits through its parents the height of <html> which is equivalent to 100vh. The scrollbar is properly shown when the toolbar is removed.

Notice the missing scrollbar element at the bottom.
grafik

Without the scrollbar it works.
grafik

The easiest way to resolve this and make the horizontal scrollbar visible is to calculate the height by setting the height of the toolbar and subtracting this value from the height. However, this should be done when the icons are finished.

@schroef
Copy link
Contributor

schroef commented Apr 7, 2019

@hummingly
Why would we want to have a horizontal scrollbar. The content area will adjust to the visible area right? Doesnt everybody hate that because it feels unnatural?

Im not sure i see any difference in that scrollbar track and thumb in these 2 images. In both images i see a scroll track and in both i believe i see an scroll-thumb. Isnt that the small rectangle at the top? But i guess you meant the missing horizontal one.

PS i added a custom scrollbar to my mockup and it works fine. You need to set the overflow-y:scroll to the content area.

Why does it need height actually? In my prototypes ive set the overflow area to initial. In order to get this to work the content area needs an extra div which i call forced-overflow. This has has these settings;

   overflow: initial;

You can check my prototype v10 and also this screengrab

I can also added this custom scrollbar to a select field field the tagging and also in the settings
custom-scrollbar

@schroef
Copy link
Contributor

schroef commented Apr 7, 2019

After comparing the images fullscreen i thing i understand what you meant. I also think by accident you typed horizontal scrollbar while meaning vertical. You mean the track height isnt correct in the first image. I still think that due overflow not set, in the second image you did add that and than it show fine. though you did need to delete the toolbar, im not sure why though.

@hummingly
Copy link
Collaborator

I opened the html file by default with Firefox which shows the default scrollbar and the arrow at the bottom is also missing. But openening in Chrome shows your custom scroll bar which is why it does not matter.
Horizontal scrolling is only for the extreme resizing case where content area's width is smaller than an image. In your mockup, you use absolute position and also set the height of the toolbar.

Now I have set a height for the toolbar and subtract it from the height. This fixes the issue.

@schroef
Copy link
Contributor

schroef commented Apr 8, 2019

Why does it need a height value to show the scrollbar? Mine works without setting any height. Because if it does need a height, than on resize you need to recalculate it otherwise it will break the scrollbar.

@hummingly
Copy link
Collaborator

Both images have overflow set. As you noted in the second image the scrollbar is correctly sized. The reason is that the height of the content area is 100vh (inherited from body), which means without toolbar it shows it correctly. But with the toolbar the total height is 100vh + height of toolbar which is greater than the viewport height (100vh). The scrollbar is moved down by the toolbar. That's why that arrow is missing.
It is only an issue when the viewport width is too small. Then there would be no horizontal scrollbar visible because it is below the viewport which would confuse the user.
For the toolbar I thought about preventing the icons from wrapping and let it overflow.

@hummingly
Copy link
Collaborator

Setting the height in the grid is better. I haven't done anything about the behaviour of the toolbar on resize yet but that can be done later.

@@ -73,6 +74,15 @@ class FileStore {
}
}

@action
async loadLocation(dir: string) {
await this.clearFileList();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is there an await? clearFileList is unlike removeFile not marked as async.

@@ -73,6 +74,15 @@ class FileStore {
}
}

@action
async loadLocation(dir: string) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Exception handling is missing which causes on my pc an exception since I moved those folders to another drive.

if (platform === 'win32') { // Windows
} else if (platform === 'darwin') { // Mac
} else if (platform === 'linux') { // Linix
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Electron only supports windows, linux and macos and there are also no plans for us to ship to other platforms right now. A switch statement would be better.

// https://www.npmjs.com/package/platform-folders
if (platform === 'win32') { // Windows
} else if (platform === 'darwin') { // Mac
} else if (platform === 'linux') { // Linix
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo

const platform = os.platform();
const homeDir = os.homedir();

const systemDirs = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could be an enum

@@ -29,8 +29,9 @@ class UiStore {
@observable theme: 'LIGHT' | 'DARK' = 'DARK';

// UI
@observable isOutlinerOpen: boolean = true;
@observable outlinerPage: 'LOCATIONS' | 'TAGS' | 'SEARCH' = 'TAGS';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could be an enum

@RvanderLaan
Copy link
Collaborator Author

I've replaced the Locations tab with an Import tab for now as we agreed on in the meeting, so most of that code has been removed (but I agree with your comments @hummingly !)
About the enums/strings, I've noticed that many people prefer using string literals over enums (like Blueprint). Is there a specific reason you prefer enums?

@hummingly
Copy link
Collaborator

I'm just used to using a lot of enums and it was more meant as a suggestion. It is mostly to prevent small typos as mistyping the name of an enum variant will result in an error. If we're going to use those string literals in a lot of places, it would be better to use the auto-completion than copy and pasting.

@RvanderLaan
Copy link
Collaborator Author

The cool thing about Typescript is that string literals have that behavior too, without having to import anything :D

@RvanderLaan
Copy link
Collaborator Author

Is it alright to merge this PR? It would be nice to make a release before the meeting. We'd also have to merge #32 which has some conflicts with this one

@hummingly
Copy link
Collaborator

Let me take a look. I would merge the toolbar branch and #23 into master first and then rebase #32.

@hummingly hummingly merged commit f737aa3 into file-select-and-opening Apr 11, 2019
@hummingly
Copy link
Collaborator

hummingly commented Apr 11, 2019

Closes #29

@hummingly hummingly deleted the toolbar branch April 11, 2019 22:53
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.

3 participants