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

[Bug] Context menu bug #568

Open
east-22 opened this issue May 1, 2024 · 3 comments
Open

[Bug] Context menu bug #568

east-22 opened this issue May 1, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@east-22
Copy link

east-22 commented May 1, 2024

So, better is that i just show the video that i quickly recorded, because it doesnt update the status of the buttons and text on the first open.

2024-05-01.21-59-16.mp4

Code:

                lib.registerContext({
                    id = 'some_menu',
                    title = _U('menu_crypto'),
                    options = {
                        {
                            title = _U('menu_computer'),
                        },
                        {
                            title = _U('menu_mining'),
                            description = mining and _U('mining_on') or _U('mining_off'),
                            icon = 'circle',
                            iconColor = mining and 'green' or 'red',
                            metadata = {
                                { label = _U('status'), value = mining and _U('mining') or _U('not_mining') },
                            },
                        },
                        {
                            title = _U('servertila'),
                            description = serverIsOn and _U('mining_on') or _U('mining_off'),
                            icon = 'circle',
                            iconColor = serverIsOn and 'green' or 'red',
                        },
                        {
                            title = _U('menu_cryptos'),
                            description = _U('cryptos'),
                            icon = 'fa-brands fa-monero',
                            iconColor = 'yellow',
                            metadata = {
                                { label = 'Bitcoin',  value = cryptos['bitcoin'] },
                                { label = 'Ethereum', value = cryptos['ethereum'] },
                                { label = 'Dogecoin', value = cryptos['dogecoin'] }
                            },
                        },
                        {
                            title = mining and _U('stop_mining') or _U('start_mining'),
                            description = mining and _U('stop_mining') or _U('start_mining'),
                            icon = 'fa-solid fa-circle-play',
                            iconColor = mining and 'green' or 'red',
                            onSelect = function()
                                if serverIsOn then
                                    if mining then
                                        notif(_U('mining_stopped'), 'success')
                                        mining = false
                                    else
                                        notif(_U('mining_started'), 'success')
                                        mining = true
                                        startmining()
                                    end
                                else
                                    notif(_U('serveroff'), "error")
                                end
                            end,
                        },
                    }
                })
@east-22 east-22 added the bug Something isn't working label May 1, 2024
@Moozdzn
Copy link
Contributor

Moozdzn commented May 1, 2024

You should provide steps and code to reproduce the bug

@googleoblivion
Copy link

When and how often is the contextmenu being registered?

@CeebDev
Copy link

CeebDev commented Jun 7, 2024

Context menu can't be updated on runtime, it has to be closed, updated and reopen

Since we dont know what you are doing in backstage we can't help you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants