controls/variable-edit-modal.ps1

function New-UDEditVariableModal {

    param (
        [Parameter(Mandatory = $true)]
        $Variable
    )

    Show-UDModal -Content {
        New-UDPageHeader -Text ("Committing Changes to Variable: $($Variable.Id) - $($Variable.Name)")
        New-UDParagraph -Text "Specify a new value for the variable"

        New-UDCard -Content{
            
            New-UDTextbox -Id "NewVariableTextBoxValue" -Label "Value" -Type text -Value $Variable.Value

            # TODO SECRET MANAGER

            New-UDElement -Tag div -Attributes @{
                style = @{
                    textAlign = "right"
                }
            } -Content {
                New-UDButton -Text "Save Changes" -Icon folder_plus -OnClick {
                    
                    $VariableValue = ((Get-UDElement -Id 'NewVariableTextBoxValue').Attributes["value"])

                    Set-UAVariable -Variable $Variable -Value $VariableValue
                    Sync-UDElement -Id "VariablesGrid" -Broadcast
                    Hide-UDModal
                }
            }
        }
    }
}