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

updatenotification: check Active (something displayed) #3426

Closed

Conversation

bugsounet
Copy link
Contributor

Added:

  • check if module is active (avoid unwanted <div></div> and module spacing)

this need #3425, should I merge with it and make one PR only ?

@bugsounet bugsounet changed the title check Active (something displayed) updatenotification: check Active (something displayed) Apr 18, 2024
@sdetweil
Copy link
Collaborator

what do you mean active? not hidden?

not active mean display:none;

modules are ALWAYS 'active' , just not displayed..
could be working in the background..
with display:none the content doesn't go away.

if a module is not loaded, then it is not there at all.

@bugsounet
Copy link
Contributor Author

inactive -> nothing displayed ;)
active -> updatenotification display something

Why i add this:

  • If you set a background in this module, you have a strange result

like this:

image

in top bar: it's the result of <div></div> and nothing displayed of updatenotification

@sdetweil
Copy link
Collaborator

what module?

@bugsounet
Copy link
Contributor Author

I don't understand, what module ? sorry :/

@sdetweil
Copy link
Collaborator

you said if you add a background in this module, I want to see the module, and its source code
we shouldn't be overcorrecting for bad implementation

hide should kill its background as its a z-index, not a diifferent dom placement

@bugsounet
Copy link
Contributor Author

euh ... this module is updatenotification ;)

@sdetweil
Copy link
Collaborator

how would updatenotification get a background, it's not coded for one in css or njk

@bugsounet
Copy link
Contributor Author

bugsounet commented Apr 18, 2024

after.... maybe i'm crazy ... but if you apply a padding to updatenotification with some effect
you have "color band"

image

image

css:

.module-content > *:not(.inactive):not(.hidden) {
    padding: 5px;
    border-radius: 10px;
    box-shadow: -5px -5px 8px #000;
    background: rgba(0, 0, 0, 15%);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 10%);
}

@bugsounet
Copy link
Contributor Author

I think, that i'm not ONLY in the same case or ... I have to return to code learning school :) :) :)

image

and ... no "color bar"

@sdetweil
Copy link
Collaborator

what is the content normally, not hidden, just the empty div from the njk?

@bugsounet
Copy link
Contributor Author

yes it's the <div></div> (empty) when nothing is displayed

@bugsounet
Copy link
Contributor Author

bugsounet commented Apr 18, 2024

the better way (for me) is add an display: none style when nothing is displayed

BUT:

  • updateDom() is not async... so you can't await for add/del an "inactive" class
  • updateDom() have no callback when done

So...

  • maybe create an callback option with DOM_CONTENT_UPDATED notification

something like:

updateDom({ options : { callback: true } })
  • or again call a function
updateDom({ options : { callback: myfonction() } })

in all case ... thanks njk :)

@sdetweil
Copy link
Collaborator

there is no getDom() with templated modules

it's getTemplateData()

see weather.js

@bugsounet
Copy link
Contributor Author

bugsounet commented Apr 18, 2024

already tested.
-> you can't play with the main njk div content
-> njk result is inside njk main div content -> <div> ... njk decoded ... </div>

Note that why I have added this

div.className = `${this.name}-njk`;`

in module.js

@sdetweil
Copy link
Collaborator

sdetweil commented Apr 18, 2024

but why do you need that? module is over that and you can get the div below module-content, easy w jquery. and just as easy in css file.

as we havent had any reports of UN showing when hidden.. what's the problem u are trying to solve?

@bugsounet
Copy link
Contributor Author

I was simply trying not to display an empty div which causes a color band when using css padding on this div
Only when the module displays the following result <div></div>
I report the module name: updatenotification

now if you can determine it with css: well done
adding jQuery to updatenotification a joke?

In all case, you have right sam, it's noted : no report = no change

I just added disabled: true in config and magical there is no color band.

Can I close #3425 too then (because one needs the other) ?
Because no updateDom() callback is needed and no njk classname div is require

@bugsounet bugsounet closed this Apr 19, 2024
@bugsounet bugsounet deleted the updatenotification branch April 19, 2024 09:37
@bugsounet
Copy link
Contributor Author

more seriously, it's solved with this CSS pointer

.module-content > *:not(:empty) {
 <...>
}

@sdetweil
Copy link
Collaborator

just for clarity and accuracy, that is called the selector

of course it needs the module name class prefix so.it doesn't apply to all .modules

@bugsounet
Copy link
Contributor Author

No no, there is no report about this, so i made no change
It's works since many year like that

@bugsounet
Copy link
Contributor Author

@sdetweil It's ok for you ? because it's very clear for me

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.

None yet

2 participants