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

Add top banner #2381

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

Myzel394
Copy link
Contributor

closes #2366

This is not the full PR yet. @zadam what do you think so far? If you are ok with this approach so far, I will add the internet-lost-message.

--banner-background-color-warning: #daad1b;
--banner-background-color-success: #67da1b;
--banner-background-color-plain: var(--more-accented-background-color);
--banner-color: var(--main-text-color);
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think it's needed to have this themable since it's for exceptional cases only and user shouldn't see it often.

@@ -55,10 +55,6 @@ table td, table th {
background-color: var(--modal-backdrop-color) !important;
}

.component {
contain: size;
}
Copy link
Owner

Choose a reason for hiding this comment

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

This PR shouldn't be changing such fundamental classes.

@@ -10,4 +10,10 @@ export default class FlexContainer extends Container {

this.attrs.style = `display: flex; flex-direction: ${direction};`;
}

withFullSize() {
this.attrs.style += `width: 100%; height: 100%;`;
Copy link
Owner

Choose a reason for hiding this comment

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

This does not look correct.

The root container is already 100% height, banner has certain fixed height and then the rest (the main app) should be filled with flex-grow (filling() method)

Alternatively, wouldn't it be better to have this floating with absolute coordinates above (in the z-index sense) the main content? Since with your approach the main app will jump up and down as connection is lost/renewed.

In such case bootstrap toasts might be used as an existing solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alternatively, wouldn't it be better to have this floating with absolute coordinates above (in the z-index sense) the main content? Since with your approach the main app will jump up and down as connection is lost/renewed.

I don't think this is a good idea. This is what it looks like:

image

Copy link
Owner

Choose a reason for hiding this comment

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

What about this:

image

can be done with few lines of code:

toastService.showPersistent({
    id: "network-down",
    title: "Network is down!",
    message: "Trilium backend is currently not accessible.",
    icon: "wifi-off"
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's intrusive. You can't see the full title anymoe and some buttons are harder to reach. If you're on a plane, editing your notes with only partial internet, this would drive you crazy since you wouldn't be able to do your workflow properly.

Copy link
Owner

Choose a reason for hiding this comment

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

When you're on a plane and don't have internet, basically no functionality will work correctly. You should in fact stop editing until you have an internet connection, otherwise you risk data loss.

Copy link
Contributor Author

@Myzel394 Myzel394 Dec 1, 2021

Choose a reason for hiding this comment

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

Wait - just for clarification. Does Trilium Notes save the progress offline and then uploads it once it has a connection back?

Copy link
Owner

Choose a reason for hiding this comment

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

Web version - no, it has no offline storage.

Desktop version works fully offline and then synchronizes with the server periodically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay in that case your solution would fit as well for the web version (only). However, we should probably change the location to the top right (or something less intrusive).

this.$timer = this.$widget.find(".timer");

this.$widget.on("mouseenter", this.pauseTimer.bind(this));
this.$widget.on("mouseleave", this.resumeTimer.bind(this));
Copy link
Owner

Choose a reason for hiding this comment

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

Can you clarify what's going on here?

In my mind it's really simple - (non-pausable) timer, when it detects that the network is down it will show the banner, once it's up again, banner disappears. But here I see info, warning, success, plain, what is all that for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In case we want to show other notifications, they should be pauseable

Copy link
Owner

Choose a reason for hiding this comment

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

To be honest I don't understand what "pausable notification" is, but in general YAGNI principle applies here.

@lovitus
Copy link

lovitus commented Oct 14, 2022

@Myzel394 I do really think to have a place for showing the connect status and sync status for WEB version is a great idea.
I use Web version more than desktop version on my many devices.
each time I see the pop-up dialog shows connection problem , I have to copy entire content , then refresh the page to paste it again .
I do not sure if my all changes are saved on server correctly , or do I still connected to the server .

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.

(Feature request) Add non-intrusive internet connection lost message
3 participants