

<template>
    <div class="ui_chattool_off_frame_close" @click="onClicked">
        <div class="ui_chattool_off">
            <img v-show="hasNewArrivalChatMessage" src="https://chatbotserv.com/img/new_message.png">
            <img v-show="!hasNewArrivalChatMessage" src="https://chatbotserv.com/img/comments.png">
            <div class="chattool_off_message">{{ message }}</div>
        </div>
    </div>
</template>

<script>
module.exports = {
    name: "ChattoolOff",
    props: ['message', 'has-new-arrival-chat-message'],
    data: function () {
        return {
        }
    },
    methods: {
        onClicked: function () {
            this.acceptAudio();
            this.$emit('clicked');
        },
        acceptAudio: function () {
            const sounds = [
                'https://chatbotserv.com/sound/ユーザ受信音.mp3',
            ];
            sounds.forEach((v) => {
                const audio = new Audio(v);
                audio.muted = true;
                audio.play();
                setTimeout(function () {
                    audio.pause();
                }, 1000);
            });
        },
    },
}
</script>

<style scoped>
.ui_chattool_off_frame_close {
    background-color: #E5BD55;
    position: fixed;
    right: 20px;
    bottom: 10px;
    z-index: 100000;
    border: solid thin #E5BD55;;
    width: 200px;
    height: 90px;
    color: white;
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    cursor: pointer;
}

.ui_chattool_off_frame_close:before {
    content: "";
    position: absolute;
    top: 50%;
    right: -24px;
    margin-top: -12px;
    border: 12px solid transparent;
    border-left: 12px solid #E5BD55;;
    z-index: 2;
}

/* semantics-ui などから移行 */
.ui_chattool_off {
    line-height: 1em;
    text-align: center;
    background: none transparent;
    -webkit-box-shadow: none;
    font-size: 10px;
    padding: 5px 0 0 0;
}
.ui_chattool_off:last-child {
    margin-bottom: 0em;
}
.ui_chattool_off:first-child {
    margin-top: 0em;
}
.ui_chattool_off img {
    padding: 0;
    margin: 0;
}
.chattool_off_message {
    line-height: 1.0em;
    font-weight: 100;
    margin: 0;
    padding: 0;
    font-size: 20px;
    width: 195px;
    font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif;
}
@media only screen and (max-width: 1024px) {
    .ui_chattool_off_frame_close {
        width: 125px !important;
        height: 40px !important;
        right: 13px !important;
    }
    .chattool_off_message {
        display: none !important;
    }
}
@media only screen and (max-width: 1023px) {
    .ui_chattool_off_frame_close {
        width: 125px !important;
        height: 40px !important;
        right: 13px !important;
    }
    .chattool_off_message {
        display: none !important;
    }
}
@media only screen and (max-width: 767px) {
    .ui_chattool_off_frame_close {
        width: 50px !important;
        height: 40px !important;
        right: 4px !important;
    }
    .ui_chattool_off_frame_close:before {
        display: none !important;        
    }
    .chattool_off_message {
        display: none !important;
    }
}
@media only screen and (max-width: 480px) {
    .ui_chattool_off_frame_close {
        width: 50px !important;
        height: 40px !important;
        right: 4px !important;
    }
    .ui_chattool_off_frame_close:before {
        display: none !important;        
    }
    .chattool_off_message {
        display: none !important;
    }
}
</style>

