2018-03-12 14:35:31 +01:00
|
|
|
<template>
|
2018-07-09 17:57:34 +02:00
|
|
|
<div class="status" tabIndex="0">
|
2018-07-15 03:34:08 +02:00
|
|
|
<div v-show="filtered(message)" class="filtered">
|
2018-07-09 17:57:34 +02:00
|
|
|
Filtered
|
|
|
|
</div>
|
2018-07-15 03:34:08 +02:00
|
|
|
<div v-show="!filtered(message)" class="favourite">
|
2018-03-12 14:35:31 +01:00
|
|
|
<div class="action">
|
|
|
|
<div class="action-mark">
|
|
|
|
<icon name="star" scale="0.7"></icon>
|
|
|
|
</div>
|
|
|
|
<div class="action-detail">
|
2018-03-30 10:45:20 +02:00
|
|
|
<span class="bold" @click="openUser(message.account)">{{ username(message.account) }}</span> favourited your status
|
2018-03-12 14:35:31 +01:00
|
|
|
</div>
|
|
|
|
<div class="action-icon">
|
|
|
|
<img :src="message.account.avatar" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
<div class="target">
|
2018-03-30 10:45:20 +02:00
|
|
|
<div class="icon" @click="openUser(message.status.account)">
|
2018-03-12 14:35:31 +01:00
|
|
|
<img :src="message.status.account.avatar" />
|
|
|
|
</div>
|
|
|
|
<div class="detail">
|
|
|
|
<div class="toot-header">
|
2018-03-30 10:45:20 +02:00
|
|
|
<div class="user" @click="openUser(message.status.account)">
|
2018-03-26 12:49:35 +02:00
|
|
|
{{ username(message.status.account) }}
|
2018-03-12 14:35:31 +01:00
|
|
|
</div>
|
|
|
|
<div class="timestamp">
|
|
|
|
{{ parseDatetime(message.status.created_at) }}
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-03-26 15:18:15 +02:00
|
|
|
<div class="content" v-html="message.status.content" @click.capture.prevent="tootClick"></div>
|
2018-03-12 14:35:31 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
</div>
|
2018-07-09 17:57:34 +02:00
|
|
|
<div class="fill-line"></div>
|
|
|
|
</div>
|
2018-03-12 14:35:31 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import moment from 'moment'
|
2018-03-26 15:18:15 +02:00
|
|
|
import { shell } from 'electron'
|
2018-06-20 01:54:26 +02:00
|
|
|
import { findAccount, findLink, isTag } from '../../../../utils/link'
|
2018-03-12 14:35:31 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'favourite',
|
2018-07-09 17:57:34 +02:00
|
|
|
props: {
|
|
|
|
message: {
|
|
|
|
type: Object,
|
|
|
|
default: {}
|
|
|
|
},
|
|
|
|
filter: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
}
|
|
|
|
},
|
2018-03-12 14:35:31 +01:00
|
|
|
methods: {
|
2018-03-26 12:49:35 +02:00
|
|
|
username (account) {
|
|
|
|
if (account.display_name !== '') {
|
|
|
|
return account.display_name
|
|
|
|
} else {
|
|
|
|
return account.username
|
|
|
|
}
|
|
|
|
},
|
2018-03-12 14:35:31 +01:00
|
|
|
parseDatetime (datetime) {
|
|
|
|
return moment(datetime).format('YYYY-MM-DD HH:mm:ss')
|
2018-03-26 15:18:15 +02:00
|
|
|
},
|
|
|
|
tootClick (e) {
|
2018-06-02 18:06:31 +02:00
|
|
|
if (isTag(e.target)) {
|
|
|
|
const tag = `/${this.$route.params.id}/hashtag/${e.target.innerText}`
|
|
|
|
this.$router.push({ path: tag })
|
|
|
|
return tag
|
|
|
|
}
|
2018-06-20 01:54:26 +02:00
|
|
|
const accountURL = findAccount(e.target)
|
|
|
|
if (accountURL !== null) {
|
|
|
|
this.$store.commit('TimelineSpace/Contents/SideBar/changeOpenSideBar', true)
|
|
|
|
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/searchAccount', accountURL)
|
|
|
|
.then((account) => {
|
|
|
|
this.$store.dispatch('TimelineSpace/Contents/SideBar/openAccountComponent')
|
|
|
|
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/changeAccount', account)
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
this.$message({
|
2018-08-13 08:27:53 +02:00
|
|
|
message: this.$t('message.find_account_error'),
|
2018-06-20 01:54:26 +02:00
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
this.$store.commit('TimelineSpace/Contents/SideBar/changeOpenSideBar', false)
|
|
|
|
})
|
|
|
|
return accountURL
|
|
|
|
}
|
2018-03-26 15:18:15 +02:00
|
|
|
const link = findLink(e.target)
|
|
|
|
if (link !== null) {
|
2018-06-02 18:06:31 +02:00
|
|
|
return shell.openExternal(link)
|
2018-03-26 15:18:15 +02:00
|
|
|
}
|
2018-03-30 10:45:20 +02:00
|
|
|
},
|
|
|
|
openUser (account) {
|
|
|
|
this.$store.dispatch('TimelineSpace/Contents/SideBar/openAccountComponent')
|
|
|
|
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/changeAccount', account)
|
|
|
|
this.$store.commit('TimelineSpace/Contents/SideBar/changeOpenSideBar', true)
|
2018-07-09 17:57:34 +02:00
|
|
|
},
|
|
|
|
filtered (message) {
|
2018-07-10 15:52:08 +02:00
|
|
|
return this.filter.length > 0 && message.status.content.search(this.filter) >= 0
|
2018-03-12 14:35:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.bold {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
|
|
|
.favourite {
|
2018-03-21 03:32:37 +01:00
|
|
|
padding: 8px 0 0 16px;
|
2018-03-12 14:35:31 +01:00
|
|
|
|
|
|
|
.action {
|
|
|
|
margin-right: 8px;
|
|
|
|
|
|
|
|
.action-mark {
|
|
|
|
color: #e6a23c;
|
|
|
|
float: left;
|
|
|
|
width: 32px;
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
|
|
|
|
.action-detail {
|
|
|
|
margin-left: 10px;
|
2018-04-21 11:59:34 +02:00
|
|
|
font-size: var(--base-font-size);
|
2018-03-12 14:35:31 +01:00
|
|
|
float: left;
|
2018-03-30 11:09:26 +02:00
|
|
|
max-width: 80%;
|
2018-03-30 10:45:20 +02:00
|
|
|
|
|
|
|
.bold {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2018-03-12 14:35:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.action-icon {
|
|
|
|
width: 100%;
|
|
|
|
text-align: right;
|
|
|
|
|
|
|
|
img {
|
|
|
|
width: 16px;
|
|
|
|
height: 16px;
|
|
|
|
border-radius: 2px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.target {
|
|
|
|
.icon {
|
|
|
|
float: left;
|
|
|
|
width: 42px;
|
2018-03-30 10:45:20 +02:00
|
|
|
cursor: pointer;
|
2018-03-12 14:35:31 +01:00
|
|
|
|
|
|
|
img {
|
|
|
|
width: 32px;
|
|
|
|
height: 32px;
|
|
|
|
border-radius: 4px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.detail {
|
|
|
|
margin: 8px 8px 0 42px;
|
|
|
|
color: #909399;
|
|
|
|
|
|
|
|
.toot-header {
|
|
|
|
.user {
|
|
|
|
float: left;
|
2018-04-21 11:59:34 +02:00
|
|
|
font-size: var(--base-font-size);
|
2018-03-30 10:45:20 +02:00
|
|
|
cursor: pointer;
|
2018-03-12 14:35:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.timestamp {
|
2018-04-21 11:59:34 +02:00
|
|
|
font-size: var(--base-font-size);
|
2018-03-12 14:35:31 +01:00
|
|
|
text-align: right;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
2018-04-21 11:59:34 +02:00
|
|
|
font-size: var(--base-font-size);
|
2018-03-12 14:35:31 +01:00
|
|
|
margin: 4px 0 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-07-09 17:57:34 +02:00
|
|
|
}
|
2018-04-13 02:23:33 +02:00
|
|
|
|
2018-07-09 17:57:34 +02:00
|
|
|
.filtered {
|
|
|
|
align-items: center;
|
|
|
|
display: flex;
|
|
|
|
height: 40px;
|
|
|
|
justify-content: center;
|
2018-03-12 14:35:31 +01:00
|
|
|
}
|
2018-03-21 03:32:37 +01:00
|
|
|
|
2018-07-09 17:57:34 +02:00
|
|
|
.status:focus {
|
2018-04-14 14:46:26 +02:00
|
|
|
background-color: var(--theme-selected-background-color);
|
2018-03-21 03:32:37 +01:00
|
|
|
outline: 0;
|
|
|
|
}
|
2018-07-09 17:57:34 +02:00
|
|
|
|
|
|
|
.fill-line {
|
|
|
|
height: 1px;
|
|
|
|
background-color: var(--theme-border-color);
|
|
|
|
margin: 4px 0 0;
|
|
|
|
}
|
2018-03-12 14:35:31 +01:00
|
|
|
</style>
|