Add basic user profiles.
This commit is contained in:
parent
83a376a254
commit
fcccb9df68
5 changed files with 38 additions and 2 deletions
|
@ -18,8 +18,10 @@
|
|||
<div class="user-content">
|
||||
<h4 class="media-heading">
|
||||
{{status.user.name}}
|
||||
<small><a :href="status.user.statusnet_profile_url">{{status.user.screen_name}}</a></small>
|
||||
<small v-if="status.in_reply_to_screen_name"> > <a :href="status.in_reply_to_profileurl">{{status.in_reply_to_screen_name}}</a></small>
|
||||
<small><router-link :to="{ name: 'user-profile', params: { id: status.user.id } }">{{status.user.screen_name}}</router-link></small>
|
||||
<small v-if="status.in_reply_to_screen_name"> >
|
||||
<a :href="status.in_reply_to_profileurl">{{status.in_reply_to_screen_name}}</a>
|
||||
</small>
|
||||
-
|
||||
<small>
|
||||
<router-link :to="{ name: 'conversation', params: { id: status.id } }">
|
||||
|
|
17
src/components/user_profile/user_profile.js
Normal file
17
src/components/user_profile/user_profile.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import UserCardContent from '../user_card_content/user_card_content.vue'
|
||||
import { find } from 'lodash'
|
||||
|
||||
const UserProfile = {
|
||||
computed: {
|
||||
user () {
|
||||
const id = this.$route.params.id
|
||||
const user = find(this.$store.state.users.users, {id})
|
||||
return user
|
||||
}
|
||||
},
|
||||
components: {
|
||||
UserCardContent
|
||||
}
|
||||
}
|
||||
|
||||
export default UserProfile
|
14
src/components/user_profile/user_profile.vue
Normal file
14
src/components/user_profile/user_profile.vue
Normal file
|
@ -0,0 +1,14 @@
|
|||
<template>
|
||||
<div class="user-profile panel panel-default">
|
||||
<user-card-content :user="user"></user-card-content>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="./user_profile.js"></script>
|
||||
|
||||
<style>
|
||||
.user-profile {
|
||||
flex: 2;
|
||||
flex-basis: 500px;
|
||||
}
|
||||
</style>
|
|
@ -7,6 +7,7 @@ import PublicAndExternalTimeline from './components/public_and_external_timeline
|
|||
import FriendsTimeline from './components/friends_timeline/friends_timeline.vue'
|
||||
import Conversation from './components/conversation/conversation.vue'
|
||||
import Mentions from './components/mentions/mentions.vue'
|
||||
import UserProfile from './components/user_profile/user_profile.vue'
|
||||
|
||||
import statusesModule from './modules/statuses.js'
|
||||
import usersModule from './modules/users.js'
|
||||
|
@ -37,6 +38,7 @@ const routes = [
|
|||
{ path: '/main/public', component: PublicTimeline },
|
||||
{ path: '/main/friends', component: FriendsTimeline },
|
||||
{ name: 'conversation', path: '/notice/:id', component: Conversation },
|
||||
{ name: 'user-profile', path: '/users/:id', component: UserProfile },
|
||||
{ name: 'mentions', path: '/:username/mentions', component: Mentions }
|
||||
]
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import { map, each, find, merge } from 'lodash'
|
|||
|
||||
// TODO: Unify with mergeOrAdd in statuses.js
|
||||
export const mergeOrAdd = (arr, item) => {
|
||||
if (!item) { return false }
|
||||
const oldItem = find(arr, {id: item.id})
|
||||
if (oldItem) {
|
||||
// We already have this, so only merge the new info.
|
||||
|
|
Loading…
Reference in a new issue