
<script type="module">
    import { njet } from "/njet.js"

    app.channel = {}


    app.channel.remove = function(channelUid){
    
        const dialog = new njet.showDialog({
            title: 'Upload in progress',
            content: 'Please wait for the current upload to complete.',
            primaryButton: {
                text: 'OK',
                handler: function () {
                    dialog.remove();
                }
            }
        })
    }
    
    app.channel._fileManager = null
    app.channel.toggleDrive = function(channelUid){
        if(app.channel._fileManager){
            app.channel._fileManager.remove()
            app.channel._fileManager = null
            document.querySelector('message-list').style.display = 'block'
            return
        }
        app.channel._fileManager = document.createElement("file-manager")
        app.channel._fileManager.style.padding = '10px'
        app.channel._fileManager.setAttribute("url",`/channel/${app.channelUid}/drive.json`)
        document.querySelector(".chat-area").insertBefore(app.channel._fileManager,document.querySelector(".chat-area").firstChild)
        document.querySelector("message-list").style.display = 'none'
    }
    



</script>
