ox_lib icon indicating copy to clipboard operation
ox_lib copied to clipboard

[Bug] Context menu bug

Open east-22 opened this issue 1 year ago • 2 comments

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.

https://github.com/overextended/ox_lib/assets/74319971/04c4c5af-08e6-4494-85bd-a14e5643d311

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 avatar May 01 '24 19:05 east-22

You should provide steps and code to reproduce the bug

Moozdzn avatar May 01 '24 22:05 Moozdzn

When and how often is the contextmenu being registered?

googleoblivion avatar May 02 '24 22:05 googleoblivion

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

CeebDev avatar Jun 07 '24 10:06 CeebDev