-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Allow user view toot detail at sidebar #206
Changes from all commits
9465d89
ca3aeb0
c062afa
7da9da3
bdeb77c
5d42f9c
99a80fc
e605f3a
af9ea04
b7f3fd2
9d6edc2
f09552c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
<div class="icon"> | ||
<img :src="originalMessage(message).account.avatar" @click="openUser(originalMessage(message).account)"/> | ||
</div> | ||
<div class="detail"> | ||
<div class="detail" @click="openDetail(message)"> | ||
<div class="toot-header"> | ||
<div class="user" @click="openUser(originalMessage(message).account)"> | ||
{{ username(originalMessage(message).account) }} | ||
|
@@ -38,6 +38,16 @@ | |
<el-button type="text" @click="changeFavourite(originalMessage(message))" :class="originalMessage(message).favourited ? 'favourited' : 'favourite'"> | ||
<icon name="star" scale="0.9"></icon> | ||
</el-button> | ||
<el-button type="text" v-popover="{ name: message.id }"> | ||
<icon name="ellipsis-h" scale="0.9"></icon> | ||
</el-button> | ||
<popover :name="message.id" :width="120"> | ||
<ul class="toot-menu"> | ||
<li role="button" @click="openDetail(message)"> | ||
View Toot Detail | ||
</li> | ||
</ul> | ||
</popover> | ||
</div> | ||
</div> | ||
<div class="clearfix"></div> | ||
|
@@ -79,6 +89,11 @@ export default { | |
openReply (message) { | ||
this.$store.dispatch('TimelineSpace/Modals/NewToot/openReply', message) | ||
}, | ||
openDetail (message) { | ||
this.$store.dispatch('TimelineSpace/Contents/SideBar/openTootComponent') | ||
this.$store.dispatch('TimelineSpace/Contents/SideBar/TootDetail/changeToot', message) | ||
this.$store.commit('TimelineSpace/Contents/SideBar/changeOpenSideBar', true) | ||
}, | ||
changeReblog (message) { | ||
if (message.reblogged) { | ||
this.$store.dispatch('TimelineSpace/Contents/Cards/Toot/unreblog', message) | ||
|
@@ -247,6 +262,28 @@ function findLink (target) { | |
.favourited { | ||
color: #e6a23c; | ||
} | ||
|
||
.toot-menu{ | ||
padding: 0; | ||
font-size: 0.8em; | ||
margin-left: 0.5em; | ||
list-style-type: none; | ||
text-align: center; | ||
|
||
li{ | ||
padding-bottom: 0.5em; | ||
border-bottom: 1px solid #ddd; | ||
|
||
&:hover{ | ||
cursor: pointer; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😆 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see Σ(;゚д゚) |
||
} | ||
|
||
&:last-child{ | ||
border: 0; | ||
padding: 0; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.reply:hover, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<template> | ||
<div class="toot-detail" ref="detail"> | ||
<div class="toot-ancestors" v-for="(message, index) in ancestors" v-bind:key="'ancestors-' + index"> | ||
<toot :message="message"></toot> | ||
</div> | ||
<div class="original-toot" ref="original"> | ||
<toot :message="message"></toot> | ||
</div> | ||
<div class="toot-descendants" v-for="(message, index) in descendants" v-bind:key="'descendants' + index"> | ||
<toot :message="message"></toot> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { mapState } from 'vuex' | ||
import Toot from '../Cards/Toot' | ||
|
||
export default { | ||
name: 'toot-detail', | ||
components: { Toot }, | ||
computed: { | ||
...mapState({ | ||
message: state => state.TimelineSpace.Contents.SideBar.TootDetail.message, | ||
ancestors: state => state.TimelineSpace.Contents.SideBar.TootDetail.ancestors, | ||
descendants: state => state.TimelineSpace.Contents.SideBar.TootDetail.descendants | ||
}) | ||
}, | ||
created () { | ||
this.load() | ||
}, | ||
watch: { | ||
message: function () { | ||
this.load() | ||
} | ||
}, | ||
methods: { | ||
load () { | ||
this.$store.dispatch('TimelineSpace/Contents/SideBar/TootDetail/fetchToot', this.message) | ||
.then(() => { | ||
const toot = this.$refs.original | ||
toot.scrollIntoView() | ||
}) | ||
.catch(() => { | ||
this.$message({ | ||
message: 'Could not fetch toot detail', | ||
type: 'error' | ||
}) | ||
}) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.original-toot{ | ||
.toot{ | ||
background-color: #f2f6fc; | ||
outline: 0; | ||
} | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import Mastodon from 'mastodon-api' | ||
|
||
const TootDetail = { | ||
namespaced: true, | ||
state: { | ||
message: null, | ||
ancestors: [], | ||
descendants: [] | ||
}, | ||
mutations: { | ||
changeToot (state, message) { | ||
state.message = message | ||
}, | ||
updateAncestors (state, ancestors) { | ||
state.ancestors = ancestors | ||
}, | ||
updateDescendants (state, descendants) { | ||
state.descendants = descendants | ||
} | ||
}, | ||
actions: { | ||
changeToot ({ commit, dispatch }, message) { | ||
commit('changeToot', message) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semicolon. |
||
}, | ||
fetchToot ({ state, commit, rootState }, message) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'concise methods' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz). |
||
return new Promise((resolve, reject) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6'). |
||
const client = new Mastodon( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz). |
||
{ | ||
access_token: rootState.TimelineSpace.account.accessToken, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Identifier 'access_token' is not in camel case. |
||
api_url: rootState.TimelineSpace.account.baseURL + '/api/v1' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Identifier 'api_url' is not in camel case. |
||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semicolon. |
||
client.get(`/statuses/${message.id}/context`, { limit: 40 }, (err, data, res) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. |
||
if (err) return reject(err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected '{' and instead saw 'return'. |
||
commit('updateAncestors', data.ancestors) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semicolon. |
||
commit('updateDescendants', data.descendants) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semicolon. |
||
resolve(res) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semicolon. |
||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semicolon. |
||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semicolon. |
||
} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semicolon. |
||
|
||
export default TootDetail | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'export' is only available in ES6 (use 'esversion: 6'). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want the cursor to be a pointer when a mouse points over this object. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think so too. I added the toot menu but forgot to change the cursor to pointer, sorry : (
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New commit added &:hover{ cursor: pointer; } to toot menu item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!