<template>
    <div class="timeline-item-wrapper">
        <div class="timeline-item-description">
            <i class="avatar | small">
                <font-awesome-icon icon="user"/>
            </i>
            <span> linked ticket <span class="badge badge-secondary">#{{ item.issue_thread.id }} </span> on
                <time :datetime="timestamp">{{ timestamp }}</time> as
                <span class="badge badge-primary">{{ item.status }}</span>
            </span>
        </div>
        <div class="timeline-item-description">
            <router-link :to="{name: 'ticket', params: {id: item.issue_thread.id}}">
                <h6 class="card-title">Ticket #{{ item.issue_thread.id }} - {{ item.issue_thread.name }}</h6>
            </router-link>
        </div>
    </div>
</template>

<script>

import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
import AuthenticatedDataLink from "@/components/AuthenticatedDataLink.vue";
import Lightbox from "@/components/Lightbox.vue";

export default {
    name: 'TimelineRelatedTicket',
    components: {Lightbox},
    props: {
        'item': {
            type: Object,
            required: true
        }
    },
    computed: {
        'timestamp': function () {
            return new Date(this.item.timestamp).toLocaleString();
        }
    },
};
</script>

<style scoped>

a {
    color: inherit;
}

.timeline-item-description {
    display: flex;
    padding-top: 6px;
    gap: 8px;
    color: var(--gray);

    img {
        flex-shrink: 0;
    }

    a {
        /*color: var(--c-grey-500);*/
        font-weight: 500;
        text-decoration: none;

        &:hover,
        &:focus {
            outline: 0; /* Don't actually do this */
            color: var(--info);
        }
    }
}


.card {
    border: 1px solid var(--gray);
}

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    width: 40px;
    height: 40px;

    &.small {
        width: 28px;
        height: 28px;
    }

    img {
        object-fit: cover;
    }
}

</style>