<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">

<t t-name="mail.DiscussContent">
    <t t-set="partitionedActions" t-value="threadActions.partition"/>
    <div class="o-mail-DiscussContent d-flex flex-column h-100 w-100 overflow-auto o-scrollbar-thin" t-ref="root">
        <div class="o-mail-DiscussContent-header ps-3 d-flex flex-shrink-0 align-items-center border-bottom border-dark o-border-opacity-15 gap-1 z-1 flex-grow-0" t-ref="header" t-att-class="{ 'py-1': !state.correspondentLocalDateTimeFormatted }">
            <t t-if="thread">
                <div t-if="showThreadAvatar" class="o-mail-DiscussContent-threadAvatar position-relative align-self-center align-items-center bg-inherit">
                    <DiscussAvatar thread="thread" size="26"/>
                    <FileUploader t-if="isThreadAvatarEditable" acceptedFileExtensions="'.bmp, .jpg, .jpeg, .png, .svg'" showUploadingText="false" multiUpload="false" onUploaded.bind="(data) => this.onFileUploaded(data)">
                        <t t-set-slot="toggler">
                            <a href="#" class="position-absolute z-1 h-100 w-100 rounded-2 start-0 bottom-0" title="Upload Avatar">
                                <i class="position-absolute top-50 start-50 fa fa-sm fa-pencil text-white"/>
                            </a>
                        </t>
                    </FileUploader>
                </div>
                <t t-else="">
                    <ThreadIcon className="'align-self-center fs-3 my-2 opacity-75'" size="'large'" thread="thread"/>
                </t>
                <div class="flex-grow-1 align-self-center align-items-center h-100 py-1" t-att-class="{ 'lh-sm': showsChatLocalDateTime }">
                    <div class="d-flex">
                        <div t-if="thread.channel?.parent_channel_id" class="d-flex align-items-center gap-1 ms-1">
                            <span class="fw-bolder cursor-pointer opacity-75 opacity-100-hover o-hover-text-underline" t-esc="thread.channel.parent_channel_id.displayName" t-on-click="() => this.thread?.channel?.parent_channel_id?.open({ focus: true })"/>
                            <i class="oi oi-chevron-right o-xsmaller mx-1"/>
                        </div>
                        <AutoresizeInput
                            className="'o-mail-DiscussContent-threadName fw-bold flex-shrink-1 py-0 ' + (showsChatLocalDateTime ? 'fs-5' : 'fs-4')"
                            enabled="!!thread.channel?.isAllowedToRename"
                            onValidate.bind="renameThread"
                            value="thread.displayName || ''"
                        />
                        <t t-if="thread.channel?.allowDescription and (thread.channel?.allowEditDescription or thread.description)">
                            <div class="flex-shrink-0 mx-1 py-2 border-start"/>
                            <t t-set="autogrowDescriptionPlaceholder">Add a description</t>
                            <AutoresizeInput
                                className="attClassObjectToString(threadDescriptionAttClass)"
                                enabled="thread.channel?.allowEditDescription"
                                onValidate.bind="updateThreadDescription"
                                placeholder="thread.channel?.allowEditDescription ? autogrowDescriptionPlaceholder : ''"
                                value="thread.description or ''"
                            />
                        </t>
                    </div>
                    <div t-if="showsChatLocalDateTime" class="text-muted smaller ms-1" t-out="state.correspondentLocalDateTimeFormatted"/>
                </div>
                <div class="pe-3 flex-shrink-0 d-print-none">
                    <ActionList actions="[partitionedActions.quick, partitionedActions.other, ...partitionedActions.group.slice().reverse()]" inline="true" odooControlPanelSwitchStyle="true"/>
                </div>
                <div t-if="store.inPublicPage and !ui.isSmall" class="d-flex align-items-center">
                    <img class="o-mail-DiscussContent-selfAvatar me-1 rounded-3 object-fit-cover flex-shrink-0 smaller" alt="Avatar" t-att-src="store.self.avatarUrl"/>
                    <div t-if="store.self_user" class="text-nowrap px-1 me-2" t-esc="store.self_user.name"/>
                    <AutoresizeInput t-else="" className="'py-1'" onValidate.bind="renameGuest" value="store.self_guest.name"/>
                </div>
            </t>
        </div>
        <div class="o-mail-DiscussContent-main d-flex overflow-hidden flex-grow-1" t-ref="main">
            <t t-if="ui.isSmall" t-call="mail.Discuss.loading"/>
            <div class="o-mail-DiscussContent-core overflow-auto o-scrollbar-thin d-flex flex-grow-1 w-100" t-ref="core">
                <t name="core-content">
                    <t t-if="thread">
                        <div t-if="!ui.isSmall or !threadActions.activeAction?.actionPanelComponentCondition" class="d-flex flex-column flex-grow-1 bg-inherit o-min-width-0">
                            <t name="thread"><Thread thread="thread" t-key="thread.localId" jumpPresent="state.jumpThreadPresent" autofocus="thread.channel?.composerHidden"/></t>
                            <Composer t-if="!thread.channel?.composerHidden and (thread.model !== 'mail.box' or thread.composer.replyToMessage)" t-key="thread.localId" composer="thread.composer" autofocus="true" onDiscardCallback="() => (thread.composer.replyToMessage = undefined)" onPostCallback.bind="() => this.state.jumpThreadPresent++" dropzoneRef="root" type="thread.composer.replyToMessage ? (thread.composer.replyToMessage.isNote ? 'note' : 'message') : undefined"/>
                            <span t-if="thread.channel?.composerHidden" class="bg-200 py-1 text-center fst-italic fw-bold text-muted" t-esc="thread.channel?.composerHiddenText"/>
                        </div>
                        <div t-if="threadActions.activeAction?.actionPanelComponentCondition" t-attf-class="{{ threadActions.activeAction.actionPanelOuterClass }}" class="o-mail-DiscussContent-panelContainer o-mail-discussSidebarBgColor h-100 border-start border-dark o-border-opacity-15 flex-shrink-0 d-print-none" t-att-class="{ 'w-100': ui.isSmall }">
                            <t t-component="threadActions.activeAction.actionPanelComponent" t-props="threadActions.activeAction.actionPanelComponentProps"/>
                        </div>
                    </t>
                    <div t-elif="(!ui.isSmall or store.discuss.activeTab === 'notification') and store.discuss.hasRestoredThread" class="d-flex flex-grow-1 align-items-center justify-content-center w-100">
                        <h4 class="text-muted"><b><i>No conversation selected.</i></b></h4>
                    </div>
                </t>
            </div>
        </div>
    </div>
</t>

</templates>
