<template>
    <v-card tile flat
        :width="app.width"
        :height="height ? height : (app.height - 76)"
    >
        <file-preview
            v-if="previewFile"
            :app="app"
            :height="height ? height - 2 : (app.height - 78)"
            :customer="customer"
            :activeFile="previewFile"
            :width="app.width"
        />

        <template v-else>
            <folders-panel 
                v-if="uploader.panel === 'folders-panel'"
                :height="height ? height : (app.height - 76)"
                :uploader="uploader"
            />

            <all-files-panel 
                v-else
                :height="height ? height : (app.height - 76)"
                :uploader="uploader"
            />

        </template>
    </v-card>
</template>

<script>
    export default {
        props: {
            uploader: {required: true},
            height: {default: null},
        },

        computed: {
            app() {
                return this.uploader.app;
            },

            customer() {
                return this.uploader.customer;
            },

            previewFile() {
                return this.uploader.activeFileManager.previewFile;
            }
        },

        name: 'UploaderContainer',
    }
</script>