Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Notifications #365

Merged
merged 6 commits into from
Apr 14, 2017
Merged

Notifications #365

merged 6 commits into from
Apr 14, 2017

Conversation

FrigoEU
Copy link
Contributor

@FrigoEU FrigoEU commented Apr 13, 2017

Hey,

This is a pretty big PR that corresponds to #98 most closely, in the future maybe to #39 and the design is stolen for the most part from atom/notifications#29. I started from the atom css and markup but ending up rendering it in a normal table.

I split up the commits in 3:

  • The first one is the biggest one, adding the actual component, hooking it up to Redux, adding layout, adding some examples etc.
  • The second adds some extra actions for showing/hiding, and adds a command to show the panel
  • The third implements the notifications in the NeovimInstance and the Config

This is not really finished yet, but far enough along to show I think. Here's some screenshots, mixing the example data and some actual notifications:

screen shot 2017-04-13 at 11 18 25

screen shot 2017-04-13 at 11 18 38

Use the new command "Show Notifications" to see it pop open. Note that the first few notifications are examples.

What still needs to happen:

  • Remove examples. I thought I'd leave them in if anyone wants to check
  • Refactor some more console statements. I figure this can be done in a later PR
  • The biggest: position the panel correctly. Right now I render it straight over the editor, hiding a good chunk of it. This is obviously not OK, but I'm not sure yet how to handle this in a robust way. I'd basically need to shrink and grow the .oni-text-editor when the changeNotificationVisibility actions come in, but this also comes into contact with UI: Externalize Window Management #362 so I thought I'd hold off on that just for now until somebody else can take a look at it.
  • Right now the only way you can view this new notifications panel is via a command. I think it would be nice to integrate it with Beginning external status line implementation #201 once it's ready.

Some other remarks on the code:

  • I think emitting some new events from the NeovimInstance was the best idea, to avoid tight coupling. I just followed along with how it already works.
  • Config was already an EventEmitter, but it wasn't emitting anything yet. I have it emit an event now + added a method to check for parsing errors. I wish I didn't have to do both, but because of how the Config initialises, you can never listen to the first parsing error being emitted so I "solved" it like this. Any input more than welcome.
  • I made the CSS and markup as simple and straightforward as I could, but I again introduced a bunch of variables etc that need to be part of some design system/theming solution/etc.

@bryphe
Copy link
Member

bryphe commented Apr 13, 2017

Wow, this change looks awesome! Thanks a lot for including the screenshot. The UI looks really great and since it was inspired by Atom it has that modern UX feel.

This seems like it would be a convenient place for hosting the compile errors & warnings as well, at some point. The redux state changes look solid to me.

I added a few comments inline, and then just had these questions:

  • Is it possible to style the scrollbar that comes up? At least on Windows, it looks pretty out-of-place:
  • I'm wondering if the current component should be named Logs/LogRenderer? When I think of Notifications, I think of the pop-up notifications like:
    image
    I imagine we'll have the need for both styles of Notifications, so naming the component in the PR Logs will mean we can use Notifications for that pop-up experience.

Another thing I'm thinking about in the longer-term is how to keep Oni keyboard-friendly with these new components. Something like the vimium behavior might be really helpful - I created #366 to discuss this. Not something we need to tackle now but longer-term it'd be useful, especially as we add more of these rich UI experiences to Oni.

Excellent work, this looks great!

@@ -97,7 +97,7 @@ export class NeovimInstance extends EventEmitter implements INeovimInstance {

this._initPromise = startNeovim(this._pluginManager.getAllRuntimePaths(), filesToOpen)
.then((nv) => {
console.log("NevoimInstance: Neovim started") // tslint:disable-line no-console
this.emit("logInfo", "NevoimInstance: Neovim started")
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind fixing my typo while you're here? 😄 I used NevoimInstance instead of NeovimInstance

@@ -326,7 +326,7 @@ export class NeovimInstance extends EventEmitter implements INeovimInstance {
this._initPromise.then(() => {
this._neovim.uiTryResize(columns, rows, (err?: Error) => {
if (err) {
console.error(err)
this.emit("logError", err)
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for hooking these up to the new logging infrastructure


@component-padding: 10px;
@border-color: rgb(25, 25, 25);
// @font-family-monospace:
Copy link
Member

Choose a reason for hiding this comment

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

Looks like there are a few unused lines here

@import (reference) "./common.less";

@icon-size: 30px;
@font-family-monospace: Consolas, "Liberation Mono", Menlo, Courier, monospace;
Copy link
Member

Choose a reason for hiding this comment

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

This might be a good candidate to have in common.less - same for a few other constants.

}
}
}
function mapStateToProps(s: State.IState): Partial<INotificationsProps> {
Copy link
Member

Choose a reason for hiding this comment

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

Nice use of Partial here! I need to remember to leverage that..

@FrigoEU
Copy link
Contributor Author

FrigoEU commented Apr 14, 2017

I renamed it all to Log/Logs, it fits better indeed. I cleaned up some of the CSS + corrected display of long stack traces.

I don't have a windows PC at my disposal right now, so I didn't do the scrollbars yet.

@bryphe
Copy link
Member

bryphe commented Apr 14, 2017

Awesome, thanks @FrigoEU ! This looks excellent. Appreciate you taking the time to do the rename... we need to get the rename IDE functionality in here to make that easier 😄

We can track the scrollbar issue separately, I'm happy to take a look at that since my main dev machine is Windows.

The only thing left is that we should remove the placeholder logs, could you please take those out? Otherwise I'm set to merge this in!

@FrigoEU
Copy link
Contributor Author

FrigoEU commented Apr 14, 2017

Oki, I removed the examples.

Yes, it would be nice to track the scrollbars in a different issue. Thanks for any help you can give, otherwise I'll find some windows machine to run Oni on later.

@bryphe
Copy link
Member

bryphe commented Apr 14, 2017

Awesome, thanks for addressing those! I'll open an issue for the windows scrollbar. I'm merging in now - thanks for the contribution, @FrigoEU !

@bryphe bryphe merged commit 0b860a7 into onivim:master Apr 14, 2017
@bryphe
Copy link
Member

bryphe commented Apr 14, 2017

FYI - logged #370 to track the windows styling issues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants