works but hacky

This commit is contained in:
shpuld 2018-12-20 22:20:04 +02:00
commit 67263cde05
24 changed files with 260 additions and 191 deletions

View file

@ -31,11 +31,6 @@ export default {
window.CSS.supports('-ms-mask-size', 'contain') || window.CSS.supports('-ms-mask-size', 'contain') ||
window.CSS.supports('-o-mask-size', 'contain') window.CSS.supports('-o-mask-size', 'contain')
), ),
mobileViews: {
postStatus: 'poststatus',
notifications: 'notifications',
timeline: 'timeline'
},
showMobileSidebar: false showMobileSidebar: false
}), }),
created () { created () {

View file

@ -237,13 +237,11 @@ i[class*=icon-] {
flex-wrap: wrap; flex-wrap: wrap;
.nav-icon { .nav-icon {
font-size: 1.1em;
margin-left: 0.4em; margin-left: 0.4em;
} }
&.right { &.right {
justify-content: flex-end; justify-content: flex-end;
padding-right: 20px;
} }
} }
@ -251,7 +249,8 @@ i[class*=icon-] {
flex: 1 flex: 1
} }
nav { .nav-bar {
padding: 0;
width: 100%; width: 100%;
align-items: center; align-items: center;
position: fixed; position: fixed;
@ -295,10 +294,13 @@ nav {
} }
.inner-nav { .inner-nav {
margin: auto;
box-sizing: border-box;
padding-left: 10px;
padding-right: 10px;
display: flex; display: flex;
align-items: center; align-items: center;
flex-basis: 970px; flex-basis: 970px;
margin: auto;
height: 50px; height: 50px;
a, a i { a, a i {
@ -466,7 +468,7 @@ nav {
&.hidden { &.hidden {
opacity: 0; opacity: 0;
max-width: 20px; max-width: 5px;
} }
} }
} }
@ -606,22 +608,8 @@ nav {
} }
} }
@media all and (max-width: 959px) { .item.right {
.mobile-hidden { text-align: right;
display: none;
}
.panel-switcher {
display: flex;
}
.container {
padding: 0 0 0 0;
}
.panel {
margin: 0.5em 0 0.5em 0;
}
} }
.visibility-tray { .visibility-tray {
@ -650,3 +638,31 @@ nav {
border-radius: $fallback--inputRadius; border-radius: $fallback--inputRadius;
border-radius: var(--inputRadius, $fallback--inputRadius); border-radius: var(--inputRadius, $fallback--inputRadius);
} }
@media all and (max-width: 959px) {
.mobile-hidden {
display: none;
}
.panel-switcher {
display: flex;
}
.container {
padding: 0;
}
.panel {
margin: 0.5em 0 0.5em 0;
}
.button-icon {
font-size: 1.2em;
}
.status .status-actions {
div {
max-width: 4em;
}
}
}

View file

@ -1,6 +1,6 @@
<template> <template>
<div id="app" v-bind:style="style"> <div id="app" v-bind:style="style">
<nav class='container' @click="scrollToTop()" id="nav"> <nav class='nav-bar container' @click="scrollToTop()" id="nav">
<div class='logo' :style='logoBgStyle'> <div class='logo' :style='logoBgStyle'>
<div class='mask' :style='logoMaskStyle'></div> <div class='mask' :style='logoMaskStyle'></div>
<img :src='logo' :style='logoStyle'> <img :src='logo' :style='logoStyle'>
@ -13,10 +13,10 @@
<router-link class="site-name" :to="{ name: 'root' }" active-class="home">{{sitename}}</router-link> <router-link class="site-name" :to="{ name: 'root' }" active-class="home">{{sitename}}</router-link>
</div> </div>
<div class='item right'> <div class='item right'>
<a href="#" @click.prevent="toggleMobileSidebar()"><i class="icon-menu"></i></a> <a href="#" @click.stop.prevent="toggleMobileSidebar()"><i class="button-icon icon-menu"></i></a>
<user-finder class="nav-icon" @toggled="onFinderToggled"></user-finder> <user-finder class="button-icon nav-icon" @toggled="onFinderToggled"></user-finder>
<router-link @click.native="activatePanel('timeline')" :to="{ name: 'settings'}"><i class="icon-cog nav-icon" :title="$t('nav.preferences')"></i></router-link> <router-link @click.native="activatePanel('timeline')" :to="{ name: 'settings'}"><i class="button-icon icon-cog nav-icon" :title="$t('nav.preferences')"></i></router-link>
<a href="#" v-if="currentUser" @click.prevent="logout"><i class="icon-logout nav-icon" :title="$t('login.logout')"></i></a> <a href="#" v-if="currentUser" @click.prevent="logout"><i class="button-icon icon-logout nav-icon" :title="$t('login.logout')"></i></a>
</div> </div>
</div> </div>
</nav> </nav>
@ -24,7 +24,7 @@
<div v-if="" class="container" id="content"> <div v-if="" class="container" id="content">
<side-drawer :activatePanel="activatePanel" :closed="!showMobileSidebar"></side-drawer> <side-drawer :activatePanel="activatePanel" :closed="!showMobileSidebar" :clickoutside="toggleMobileSidebar"></side-drawer>
<!-- <!--
<button @click="activatePanel(mobileViews.postStatus)">post status</button> <button @click="activatePanel(mobileViews.postStatus)">post status</button>
<button @click="activatePanel(mobileViews.notifications)">notifs</button> <button @click="activatePanel(mobileViews.notifications)">notifs</button>
@ -34,12 +34,12 @@
<div class="sidebar-bounds"> <div class="sidebar-bounds">
<div class="sidebar-scroller"> <div class="sidebar-scroller">
<div class="sidebar"> <div class="sidebar">
<user-panel :activatePanel="activatePanel" :class="mobileShowOnlyIn(mobileViews.postStatus)"></user-panel> <user-panel :activatePanel="activatePanel" :class="mobileShowOnlyIn('poststatus')"></user-panel>
<nav-panel :activatePanel="activatePanel" class="mobile-hidden"></nav-panel> <nav-panel :activatePanel="activatePanel" class="mobile-hidden"></nav-panel>
<instance-specific-panel v-if="showInstanceSpecificPanel" class="mobile-hidden"></instance-specific-panel> <instance-specific-panel v-if="showInstanceSpecificPanel" class="mobile-hidden"></instance-specific-panel>
<features-panel v-if="!currentUser"></features-panel> <features-panel v-if="!currentUser"></features-panel>
<who-to-follow-panel v-if="currentUser && suggestionsEnabled"></who-to-follow-panel> <who-to-follow-panel v-if="currentUser && suggestionsEnabled"></who-to-follow-panel>
<notifications :activatePanel="activatePanel" v-if="currentUser" :class="mobileShowOnlyIn(mobileViews.notifications)"></notifications> <notifications :activatePanel="activatePanel" v-if="currentUser" :class="mobileShowOnlyIn('notifications')"></notifications>
</div> </div>
</div> </div>
</div> </div>

View file

@ -13,11 +13,16 @@ const afterStoreSetup = ({ store, i18n }) => {
store.dispatch('setInstanceOption', { name: 'name', value: name }) store.dispatch('setInstanceOption', { name: 'name', value: name })
store.dispatch('setInstanceOption', { name: 'registrationOpen', value: (registrationClosed === '0') }) store.dispatch('setInstanceOption', { name: 'registrationOpen', value: (registrationClosed === '0') })
store.dispatch('setInstanceOption', { name: 'textlimit', value: parseInt(textlimit) }) store.dispatch('setInstanceOption', { name: 'textlimit', value: parseInt(textlimit) })
store.dispatch('setInstanceOption', { name: 'server', value: server })
// TODO: default values for this stuff, added if to not make it break on
// my dev config out of the box.
if (uploadlimit) {
store.dispatch('setInstanceOption', { name: 'uploadlimit', value: parseInt(uploadlimit.uploadlimit) }) store.dispatch('setInstanceOption', { name: 'uploadlimit', value: parseInt(uploadlimit.uploadlimit) })
store.dispatch('setInstanceOption', { name: 'avatarlimit', value: parseInt(uploadlimit.avatarlimit) }) store.dispatch('setInstanceOption', { name: 'avatarlimit', value: parseInt(uploadlimit.avatarlimit) })
store.dispatch('setInstanceOption', { name: 'backgroundlimit', value: parseInt(uploadlimit.backgroundlimit) }) store.dispatch('setInstanceOption', { name: 'backgroundlimit', value: parseInt(uploadlimit.backgroundlimit) })
store.dispatch('setInstanceOption', { name: 'bannerlimit', value: parseInt(uploadlimit.bannerlimit) }) store.dispatch('setInstanceOption', { name: 'bannerlimit', value: parseInt(uploadlimit.bannerlimit) })
store.dispatch('setInstanceOption', { name: 'server', value: server }) }
if (data.nsfwCensorImage) { if (data.nsfwCensorImage) {
store.dispatch('setInstanceOption', { name: 'nsfwCensorImage', value: data.nsfwCensorImage }) store.dispatch('setInstanceOption', { name: 'nsfwCensorImage', value: data.nsfwCensorImage })

View file

@ -1,7 +1,7 @@
<template> <template>
<div v-if="canDelete"> <div v-if="canDelete">
<a href="#" v-on:click.prevent="deleteStatus()"> <a href="#" v-on:click.prevent="deleteStatus()">
<i class='icon-cancel delete-status'></i> <i class='button-icon icon-cancel delete-status'></i>
</a> </a>
</div> </div>
</template> </template>

View file

@ -1,10 +1,10 @@
<template> <template>
<div v-if="loggedIn"> <div v-if="loggedIn">
<i :class='classes' class='favorite-button fav-active' @click.prevent='favorite()' :title="$t('tool_tip.favorite')"/> <i :class='classes' class='button-icon favorite-button fav-active' @click.prevent='favorite()' :title="$t('tool_tip.favorite')"/>
<span v-if='!hidePostStatsLocal && status.fave_num > 0'>{{status.fave_num}}</span> <span v-if='!hidePostStatsLocal && status.fave_num > 0'>{{status.fave_num}}</span>
</div> </div>
<div v-else> <div v-else>
<i :class='classes' class='favorite-button' :title="$t('tool_tip.favorite')"/> <i :class='classes' class='button-icon favorite-button' :title="$t('tool_tip.favorite')"/>
<span v-if='!hidePostStatsLocal && status.fave_num > 0'>{{status.fave_num}}</span> <span v-if='!hidePostStatsLocal && status.fave_num > 0'>{{status.fave_num}}</span>
</div> </div>
</template> </template>

View file

@ -75,11 +75,11 @@
</div> </div>
<div class='alert error' v-if="error"> <div class='alert error' v-if="error">
Error: {{ error }} Error: {{ error }}
<i class="icon-cancel" @click="clearError"></i> <i class="button-icon icon-cancel" @click="clearError"></i>
</div> </div>
<div class="attachments"> <div class="attachments">
<div class="media-upload-wrapper" v-for="file in newStatus.files"> <div class="media-upload-wrapper" v-for="file in newStatus.files">
<i class="fa icon-cancel" @click="removeMediaFile(file)"></i> <i class="fa button-icon icon-cancel" @click="removeMediaFile(file)"></i>
<div class="media-upload-container attachment"> <div class="media-upload-container attachment">
<img class="thumbnail media-upload" :src="file.image" v-if="type(file) === 'image'"></img> <img class="thumbnail media-upload" :src="file.image" v-if="type(file) === 'image'"></img>
<video v-if="type(file) === 'video'" :src="file.image" controls></video> <video v-if="type(file) === 'video'" :src="file.image" controls></video>

View file

@ -1,15 +1,15 @@
<template> <template>
<div v-if="loggedIn"> <div v-if="loggedIn">
<template v-if="visibility !== 'private' && visibility !== 'direct'"> <template v-if="visibility !== 'private' && visibility !== 'direct'">
<i :class='classes' class='retweet-button icon-retweet rt-active' v-on:click.prevent='retweet()' :title="$t('tool_tip.repeat')"></i> <i :class='classes' class='button-icon retweet-button icon-retweet rt-active' v-on:click.prevent='retweet()' :title="$t('tool_tip.repeat')"></i>
<span v-if='!hidePostStatsLocal && status.repeat_num > 0'>{{status.repeat_num}}</span> <span v-if='!hidePostStatsLocal && status.repeat_num > 0'>{{status.repeat_num}}</span>
</template> </template>
<template v-else> <template v-else>
<i :class='classes' class='icon-lock' :title="$t('timeline.no_retweet_hint')"></i> <i :class='classes' class='button-icon icon-lock' :title="$t('timeline.no_retweet_hint')"></i>
</template> </template>
</div> </div>
<div v-else-if="!loggedIn"> <div v-else-if="!loggedIn">
<i :class='classes' class='icon-retweet' :title="$t('tool_tip.repeat')"></i> <i :class='classes' class='button-icon icon-retweet' :title="$t('tool_tip.repeat')"></i>
<span v-if='!hidePostStatsLocal && status.repeat_num > 0'>{{status.repeat_num}}</span> <span v-if='!hidePostStatsLocal && status.repeat_num > 0'>{{status.repeat_num}}</span>
</div> </div>
</template> </template>

View file

@ -1,11 +1,19 @@
const SideDrawer = { const SideDrawer = {
props: [ 'activatePanel', 'closed' ], props: [ 'activatePanel', 'closed', 'clickoutside' ],
computed: { computed: {
currentUser () { currentUser () {
return this.$store.state.users.currentUser return this.$store.state.users.currentUser
}
}, },
chat () { methods: {
return this.$store.state.chat.channel gotoPanel (panel) {
this.activatePanel(panel)
this.clickoutside && this.clickoutside()
},
clickedOutside () {
if (typeof this.clickoutside === 'function') {
this.clickoutside()
}
} }
} }
} }

View file

@ -1,39 +1,46 @@
<template> <template>
<div> <div class="side-drawer-container" :class="{'side-drawer-container-closed': closed, 'side-drawer-container-open': !closed}">
<div class="panel panel-default side-drawer" :class="{'side-drawer-closed': closed}"> <div class="panel panel-default side-drawer" :class="{'side-drawer-closed': closed}">
<ul> <ul>
<li v-if='currentUser'> <li v-if='currentUser'>
<router-link @click.native="activatePanel('timeline')" to='/main/friends'> <a href="#" @click="gotoPanel('poststatus')">poststatus</a>
</li>
<li v-if='currentUser'>
<a href="#" @click="gotoPanel('notifications')">notifications</a>
</li>
<li v-if='currentUser'>
<router-link @click.native="gotoPanel('timeline')" to='/main/friends'>
{{ $t("nav.timeline") }} {{ $t("nav.timeline") }}
</router-link> </router-link>
</li> </li>
<li v-if='currentUser'> <li v-if='currentUser'>
<router-link @click.native="activatePanel('timeline')" :to="{ name: 'mentions', params: { username: currentUser.screen_name } }"> <router-link @click.native="gotoPanel('timeline')" :to="{ name: 'mentions', params: { username: currentUser.screen_name } }">
{{ $t("nav.mentions") }} {{ $t("nav.mentions") }}
</router-link> </router-link>
</li> </li>
<li v-if='currentUser'> <li v-if='currentUser'>
<router-link @click.native="activatePanel('timeline')" :to="{ name: 'dms', params: { username: currentUser.screen_name } }"> <router-link @click.native="gotoPanel('timeline')" :to="{ name: 'dms', params: { username: currentUser.screen_name } }">
{{ $t("nav.dms") }} {{ $t("nav.dms") }}
</router-link> </router-link>
</li> </li>
<li v-if='currentUser && currentUser.locked'> <li v-if='currentUser && currentUser.locked'>
<router-link @click.native="activatePanel('timeline')" to='/friend-requests'> <router-link @click.native="gotoPanel('timeline')" to='/friend-requests'>
{{ $t("nav.friend_requests") }} {{ $t("nav.friend_requests") }}
</router-link> </router-link>
</li> </li>
<li> <li>
<router-link @click.native="activatePanel('timeline')" to='/main/public'> <router-link @click.native="gotoPanel('timeline')" to='/main/public'>
{{ $t("nav.public_tl") }} {{ $t("nav.public_tl") }}
</router-link> </router-link>
</li> </li>
<li> <li>
<router-link @click.native="activatePanel('timeline')" to='/main/all'> <router-link @click.native="gotoPanel('timeline')" to='/main/all'>
{{ $t("nav.twkn") }} {{ $t("nav.twkn") }}
</router-link> </router-link>
</li> </li>
</ul> </ul>
</div> </div>
<div class="side-drawer-click-outside" @click.stop.prevent="clickedOutside" :class="{'side-drawer-click-outside-closed': closed}"></div>
</div> </div>
</template> </template>
@ -42,21 +49,48 @@
<style lang="scss"> <style lang="scss">
@import '../../_variables.scss'; @import '../../_variables.scss';
.side-drawer-container {
position: fixed;
z-index: 1000;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: stretch;
}
.side-drawer-container-open {
transition-delay: 0.0s;
transition-property: left;
}
.side-drawer-container-closed {
left: -100%;
transition-delay: 0.5s;
transition-property: left;
}
.side-drawer-click-outside {
flex: 1 1 100%;
}
.side-drawer { .side-drawer {
height: 100%; /* 100% Full-height */
position: fixed; /* Stay in place */
z-index: 1000; /* Stay on top */
top: 0; /* Stay at the top */
left: -200px;
overflow-x: hidden; /* Disable horizontal scroll */ overflow-x: hidden; /* Disable horizontal scroll */
transition: 0.5s; /* 0.5 second transition effect to slide in the sidenav */ transition: 0.5s; /* 0.5 second transition effect to slide in the sidenav */
transition-timing-function: cubic-bezier(0, 1, 0.5, 1); transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
margin: 0; margin: 0 0 0 -100px;
padding-left: 200px; padding: 0 0 0 100px;
width: 75%;
flex: 0 0 75%;
}
.side-drawer-click-outside-closed {
flex: 0 0 0;
} }
.side-drawer-closed { .side-drawer-closed {
left: calc(-100% - 200px); margin: 0 0 0 calc(-100% - 100px);
} }
.side-drawer .panel { .side-drawer .panel {

View file

@ -8,7 +8,7 @@
</router-link> </router-link>
</small> </small>
<small class="muteWords">{{muteWordHits.join(', ')}}</small> <small class="muteWords">{{muteWordHits.join(', ')}}</small>
<a href="#" class="unmute" @click.prevent="toggleMute"><i class="icon-eye-off"></i></a> <a href="#" class="unmute" @click.prevent="toggleMute"><i class="button-icon icon-eye-off"></i></a>
</div> </div>
</template> </template>
<template v-else> <template v-else>
@ -48,7 +48,7 @@
</router-link> </router-link>
</span> </span>
<a v-if="isReply && !noReplyLinks" href="#" @click.prevent="gotoOriginal(status.in_reply_to_status_id)" :title="$t('tool_tip.reply')"> <a v-if="isReply && !noReplyLinks" href="#" @click.prevent="gotoOriginal(status.in_reply_to_status_id)" :title="$t('tool_tip.reply')">
<i class="icon-reply" @mouseenter="replyEnter(status.in_reply_to_status_id, $event)" @mouseout="replyLeave()"></i> <i class="button-icon icon-reply" @mouseenter="replyEnter(status.in_reply_to_status_id, $event)" @mouseout="replyLeave()"></i>
</a> </a>
</span> </span>
</div> </div>
@ -63,18 +63,18 @@
<router-link class="timeago" @click.native="activatePanel('timeline')" :to="{ name: 'conversation', params: { id: status.id } }"> <router-link class="timeago" @click.native="activatePanel('timeline')" :to="{ name: 'conversation', params: { id: status.id } }">
<timeago :since="status.created_at" :auto-update="60"></timeago> <timeago :since="status.created_at" :auto-update="60"></timeago>
</router-link> </router-link>
<div class="visibility-icon" v-if="status.visibility"> <div class="button-icon visibility-icon" v-if="status.visibility">
<i :class="visibilityIcon(status.visibility)" :title="status.visibility | capitalize"></i> <i :class="visibilityIcon(status.visibility)" :title="status.visibility | capitalize"></i>
</div> </div>
<a :href="status.external_url" target="_blank" v-if="!status.is_local" class="source_url" title="Source"> <a :href="status.external_url" target="_blank" v-if="!status.is_local" class="source_url" title="Source">
<i class="icon-link-ext-alt"></i> <i class="button-icon icon-link-ext-alt"></i>
</a> </a>
<template v-if="expandable"> <template v-if="expandable">
<a href="#" @click.prevent="toggleExpanded" title="Expand"> <a href="#" @click.prevent="toggleExpanded" title="Expand">
<i class="icon-plus-squared"></i> <i class="button-icon icon-plus-squared"></i>
</a> </a>
</template> </template>
<a href="#" @click.prevent="toggleMute" v-if="unmuted"><i class="icon-eye-off"></i></a> <a href="#" @click.prevent="toggleMute" v-if="unmuted"><i class="button-icon icon-eye-off"></i></a>
</div> </div>
</div> </div>
@ -101,7 +101,7 @@
<div v-if="!noHeading && !noReplyLinks" class='status-actions media-body'> <div v-if="!noHeading && !noReplyLinks" class='status-actions media-body'>
<div v-if="loggedIn"> <div v-if="loggedIn">
<a href="#" v-on:click.prevent="toggleReplying" :title="$t('tool_tip.reply')"> <a href="#" v-on:click.prevent="toggleReplying" :title="$t('tool_tip.reply')">
<i class="icon-reply" :class="{'icon-reply-active': replying}"></i> <i class="button-icon icon-reply" :class="{'icon-reply-active': replying}"></i>
</a> </a>
</div> </div>
<retweet-button :visibility='status.visibility' :loggedIn='loggedIn' :status='status'></retweet-button> <retweet-button :visibility='status.visibility' :loggedIn='loggedIn' :status='status'></retweet-button>

View file

@ -37,10 +37,10 @@
</i18n> </i18n>
<div class="icons"> <div class="icons">
<i style="color: var(--cBlue)" class="icon-reply"/> <i style="color: var(--cBlue)" class="button-icon icon-reply"/>
<i style="color: var(--cGreen)" class="icon-retweet"/> <i style="color: var(--cGreen)" class="button-icon icon-retweet"/>
<i style="color: var(--cOrange)" class="icon-star"/> <i style="color: var(--cOrange)" class="button-icon icon-star"/>
<i style="color: var(--cRed)" class="icon-cancel"/> <i style="color: var(--cRed)" class="button-icon icon-cancel"/>
</div> </div>
</div> </div>
</div> </div>

View file

@ -26,7 +26,6 @@
.tab-wrapper { .tab-wrapper {
height: 28px; height: 28px;
overflow: hidden;
position: relative; position: relative;
display: flex; display: flex;
flex: 0 0 auto; flex: 0 0 auto;

View file

@ -10,7 +10,8 @@ const Timeline = {
'timelineName', 'timelineName',
'title', 'title',
'userId', 'userId',
'tag' 'tag',
'embedded'
], ],
data () { data () {
return { return {
@ -20,15 +21,6 @@ const Timeline = {
}, },
computed: { computed: {
timelineError () { return this.$store.state.statuses.error }, timelineError () { return this.$store.state.statuses.error },
followers () {
return this.timeline.followers
},
friends () {
return this.timeline.friends
},
viewing () {
return this.timeline.viewing
},
newStatusCount () { newStatusCount () {
return this.timeline.newStatusCount return this.timeline.newStatusCount
}, },
@ -38,6 +30,14 @@ const Timeline = {
} else { } else {
return ` (${this.newStatusCount})` return ` (${this.newStatusCount})`
} }
},
classes () {
return {
root: ['timeline'].concat(!this.embedded ? ['panel', 'panel-default'] : []),
header: ['timeline-heading'].concat(!this.embedded ? ['panel-heading'] : []),
body: ['timeline-body'].concat(!this.embedded ? ['panel-body'] : []),
footer: ['timeline-footer'].concat(!this.embedded ? ['panel-footer'] : [])
}
} }
}, },
components: { components: {
@ -60,12 +60,6 @@ const Timeline = {
userId: this.userId, userId: this.userId,
tag: this.tag tag: this.tag
}) })
// don't fetch followers for public, friend, twkn
if (this.timelineName === 'user') {
this.fetchFriends()
this.fetchFollowers()
}
}, },
mounted () { mounted () {
if (typeof document.hidden !== 'undefined') { if (typeof document.hidden !== 'undefined') {
@ -103,16 +97,6 @@ const Timeline = {
tag: this.tag tag: this.tag
}).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false })) }).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false }))
}, 1000, this), }, 1000, this),
fetchFollowers () {
const id = this.userId
this.$store.state.api.backendInteractor.fetchFollowers({ id })
.then((followers) => this.$store.dispatch('addFollowers', { followers }))
},
fetchFriends () {
const id = this.userId
this.$store.state.api.backendInteractor.fetchFriends({ id })
.then((friends) => this.$store.dispatch('addFriends', { friends }))
},
scrollLoad (e) { scrollLoad (e) {
const bodyBRect = document.body.getBoundingClientRect() const bodyBRect = document.body.getBoundingClientRect()
const height = Math.max(bodyBRect.height, -(bodyBRect.y)) const height = Math.max(bodyBRect.height, -(bodyBRect.y))

View file

@ -1,6 +1,6 @@
<template> <template>
<div class="timeline panel panel-default" v-if="viewing == 'statuses'"> <div :class="classes.root">
<div class="panel-heading timeline-heading"> <div :class="classes.header">
<div class="title"> <div class="title">
{{title}} {{title}}
</div> </div>
@ -14,43 +14,20 @@
{{$t('timeline.up_to_date')}} {{$t('timeline.up_to_date')}}
</div> </div>
</div> </div>
<div class="panel-body"> <div :class="classes.body">
<div class="timeline"> <div class="timeline">
<status-or-conversation v-for="status in timeline.visibleStatuses" :key="status.id" v-bind:statusoid="status" class="status-fadein"></status-or-conversation> <status-or-conversation v-for="status in timeline.visibleStatuses" :key="status.id" v-bind:statusoid="status" class="status-fadein"></status-or-conversation>
</div> </div>
</div> </div>
<div class="panel-footer"> <div :class="classes.footer">
<a href="#" v-on:click.prevent='fetchOlderStatuses()' v-if="!timeline.loading"> <a href="#" v-on:click.prevent='fetchOlderStatuses()' v-if="!timeline.loading">
<div class="new-status-notification text-center panel-footer">{{$t('timeline.load_older')}}</div> <div class="new-status-notification text-center panel-footer">{{$t('timeline.load_older')}}</div>
</a> </a>
<div class="new-status-notification text-center panel-footer" v-else>...</div> <div class="new-status-notification text-center panel-footer" v-else>...</div>
</div> </div>
</div> </div>
<div class="timeline panel panel-default" v-else-if="viewing == 'followers'">
<div class="panel-heading timeline-heading">
<div class="title">
{{$t('user_card.followers')}}
</div>
</div>
<div class="panel-body">
<div class="timeline">
<user-card v-for="follower in followers" :key="follower.id" :user="follower" :showFollows="false"></user-card>
</div>
</div>
</div>
<div class="timeline panel panel-default" v-else-if="viewing == 'friends'">
<div class="panel-heading timeline-heading">
<div class="title">
{{$t('user_card.followees')}}
</div>
</div>
<div class="panel-body">
<div class="timeline">
<user-card v-for="friend in friends" :key="friend.id" :user="friend" :showFollows="true"></user-card>
</div>
</div>
</div>
</template> </template>
<script src="./timeline.js"></script> <script src="./timeline.js"></script>
<style lang="scss"> <style lang="scss">

View file

@ -1,4 +1,5 @@
import UserCardContent from '../user_card_content/user_card_content.vue' import UserCardContent from '../user_card_content/user_card_content.vue'
import StillImage from '../still-image/still-image.vue'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
const UserCard = { const UserCard = {
@ -13,7 +14,8 @@ const UserCard = {
} }
}, },
components: { components: {
UserCardContent UserCardContent,
StillImage
}, },
computed: { computed: {
currentUser () { return this.$store.state.users.currentUser } currentUser () { return this.$store.state.users.currentUser }

View file

@ -1,7 +1,7 @@
<template> <template>
<div class="card"> <div class="card">
<a href="#"> <a href="#">
<img @click.prevent="toggleUserExpanded" class="avatar" :src="user.profile_image_url"> <StillImage @click.prevent="toggleUserExpanded" class="avatar" :src="user.profile_image_url"/>
</a> </a>
<div class="usercard" v-if="userExpanded"> <div class="usercard" v-if="userExpanded">
<user-card-content :user="user" :switcher="false"></user-card-content> <user-card-content :user="user" :switcher="false"></user-card-content>
@ -41,6 +41,14 @@
margin-top:0.0em; margin-top:0.0em;
text-align: left; text-align: left;
width: 100%; width: 100%;
.user-name {
img {
object-fit: contain;
height: 16px;
width: 16px;
vertical-align: middle;
}
}
} }
.follows-you { .follows-you {

View file

@ -3,7 +3,7 @@
<div class="panel-heading text-center"> <div class="panel-heading text-center">
<div class='user-info'> <div class='user-info'>
<router-link @click.native="activatePanel && activatePanel('timeline')" :to="{ name: 'user-settings' }" style="float: right; margin-top:16px;" v-if="!isOtherUser"> <router-link @click.native="activatePanel && activatePanel('timeline')" :to="{ name: 'user-settings' }" style="float: right; margin-top:16px;" v-if="!isOtherUser">
<i class="icon-cog usersettings" :title="$t('tool_tip.user_settings')"></i> <i class="button-icon icon-cog usersettings" :title="$t('tool_tip.user_settings')"></i>
</router-link> </router-link>
<a :href="user.statusnet_profile_url" target="_blank" class="floater" v-if="isOtherUser"> <a :href="user.statusnet_profile_url" target="_blank" class="floater" v-if="isOtherUser">
<i class="icon-link-ext usersettings"></i> <i class="icon-link-ext usersettings"></i>
@ -104,16 +104,16 @@
</div> </div>
</div> </div>
<div class="panel-body profile-panel-body" v-if="!hideBio"> <div class="panel-body profile-panel-body" v-if="!hideBio">
<div v-if="!hideUserStatsLocal || switcher" class="user-counts" :class="{clickable: switcher}"> <div v-if="!hideUserStatsLocal || switcher" class="user-counts">
<div class="user-count" v-on:click.prevent="setProfileView('statuses')" :class="{selected: selected === 'statuses'}"> <div class="user-count" v-on:click.prevent="setProfileView('statuses')">
<h5>{{ $t('user_card.statuses') }}</h5> <h5>{{ $t('user_card.statuses') }}</h5>
<span v-if="!hideUserStatsLocal">{{user.statuses_count}} <br></span> <span v-if="!hideUserStatsLocal">{{user.statuses_count}} <br></span>
</div> </div>
<div class="user-count" v-on:click.prevent="setProfileView('friends')" :class="{selected: selected === 'friends'}"> <div class="user-count" v-on:click.prevent="setProfileView('friends')">
<h5>{{ $t('user_card.followees') }}</h5> <h5>{{ $t('user_card.followees') }}</h5>
<span v-if="!hideUserStatsLocal">{{user.friends_count}}</span> <span v-if="!hideUserStatsLocal">{{user.friends_count}}</span>
</div> </div>
<div class="user-count" v-on:click.prevent="setProfileView('followers')" :class="{selected: selected === 'followers'}"> <div class="user-count" v-on:click.prevent="setProfileView('followers')">
<h5>{{ $t('user_card.followers') }}</h5> <h5>{{ $t('user_card.followers') }}</h5>
<span v-if="!hideUserStatsLocal">{{user.followers_count}}</span> <span v-if="!hideUserStatsLocal">{{user.followers_count}}</span>
</div> </div>
@ -304,18 +304,6 @@
justify-content: space-between; justify-content: space-between;
color: $fallback--lightText; color: $fallback--lightText;
color: var(--lightText, $fallback--lightText); color: var(--lightText, $fallback--lightText);
&.clickable {
.user-count {
cursor: pointer;
&:hover:not(.selected) {
transition: border-bottom 100ms;
border-bottom: 3px solid $fallback--link;
border-bottom: 3px solid var(--link, $fallback--link);
}
}
}
} }
.user-count { .user-count {
@ -323,14 +311,6 @@
padding: .5em 0 .5em 0; padding: .5em 0 .5em 0;
margin: 0 .5em; margin: 0 .5em;
&.selected {
transition: none;
border-bottom: 5px solid $fallback--link;
border-bottom: 5px solid var(--link, $fallback--link);
border-radius: $fallback--btnRadius;
border-radius: var(--btnRadius, $fallback--btnRadius);
}
h5 { h5 {
font-size:1em; font-size:1em;
font-weight: bolder; font-weight: bolder;

View file

@ -7,7 +7,7 @@
<button class="btn search-button" @click="findUser(username)"> <button class="btn search-button" @click="findUser(username)">
<i class="icon-search"/> <i class="icon-search"/>
</button> </button>
<i class="icon-cancel user-finder-icon" @click.prevent.stop="toggleHidden"/> <i class="button-icon icon-cancel user-finder-icon" @click.prevent.stop="toggleHidden"/>
</template> </template>
</div> </div>
</template> </template>
@ -29,7 +29,8 @@
height: 29px; height: 29px;
} }
.user-finder-input { .user-finder-input {
max-width: 80%; // TODO: do this properly without a rough guesstimate of 2 icons + paddings
max-width: calc(100% - 30px - 30px - 20px);
} }
.search-button { .search-button {

View file

@ -1,4 +1,5 @@
import UserCardContent from '../user_card_content/user_card_content.vue' import UserCardContent from '../user_card_content/user_card_content.vue'
import UserCard from '../user_card/user_card.vue'
import Timeline from '../timeline/timeline.vue' import Timeline from '../timeline/timeline.vue'
const UserProfile = { const UserProfile = {
@ -39,6 +40,16 @@ const UserProfile = {
return this.$route.name === 'external-user-profile' return this.$route.name === 'external-user-profile'
} }
}, },
methods: {
fetchFollowers () {
const id = this.userId
this.$store.dispatch('addFollowers', { id })
},
fetchFriends () {
const id = this.userId
this.$store.dispatch('addFriends', { id })
}
},
watch: { watch: {
userName () { userName () {
if (this.isExternal) { if (this.isExternal) {
@ -55,10 +66,17 @@ const UserProfile = {
this.$store.dispatch('stopFetching', 'user') this.$store.dispatch('stopFetching', 'user')
this.$store.commit('clearTimeline', { timeline: 'user' }) this.$store.commit('clearTimeline', { timeline: 'user' })
this.$store.dispatch('startFetching', ['user', this.userId]) this.$store.dispatch('startFetching', ['user', this.userId])
},
user () {
if (!this.user.followers) {
this.fetchFollowers()
this.fetchFriends()
}
} }
}, },
components: { components: {
UserCardContent, UserCardContent,
UserCard,
Timeline Timeline
} }
} }

View file

@ -1,7 +1,26 @@
<template> <template>
<div> <div>
<div v-if="user" class="user-profile panel panel-default"> <div v-if="user" class="user-profile panel panel-default">
<user-card-content :user="user" :switcher="true" :selected="timeline.viewing"></user-card-content> <user-card-content :user="user" :switcher="true" :selected="timeline.viewing"></user-card-content>
<tab-switcher>
<Timeline :label="$t('user_card.statuses')" :embedded="true" :title="$t('user_profile.timeline_title')" :timeline="timeline" :timeline-name="'user'" :user-id="userId"/>
<div :label="$t('user_card.followees')">
<div v-if="friends">
<user-card v-for="friend in friends" :key="friend.id" :user="friend" :showFollows="true"></user-card>
</div>
<div class="userlist-placeholder" v-else>
<i class="icon-spin3 animate-spin"></i>
</div>
</div>
<div :label="$t('user_card.followers')">
<div v-if="followers">
<user-card v-for="follower in followers" :key="follower.id" :user="follower" :showFollows="false"></user-card>
</div>
<div class="userlist-placeholder" v-else>
<i class="icon-spin3 animate-spin"></i>
</div>
</div>
</tab-switcher>
</div> </div>
<div v-else class="panel user-profile-placeholder"> <div v-else class="panel user-profile-placeholder">
<div class="panel-heading"> <div class="panel-heading">
@ -13,8 +32,7 @@
<i class="icon-spin3 animate-spin"></i> <i class="icon-spin3 animate-spin"></i>
</div> </div>
</div> </div>
<Timeline :title="$t('user_profile.timeline_title')" :timeline="timeline" :timeline-name="'user'" :user-id="userId"/> </div>
</div>
</template> </template>
<script src="./user_profile.js"></script> <script src="./user_profile.js"></script>
@ -24,12 +42,36 @@
.user-profile { .user-profile {
flex: 2; flex: 2;
flex-basis: 500px; flex-basis: 500px;
padding-bottom: 10px;
.panel-heading { .panel-heading {
background: transparent; background: transparent;
flex-direction: column; flex-direction: column;
align-items: stretch; align-items: stretch;
} }
.userlist-placeholder {
display: flex;
justify-content: center;
align-items: middle;
padding: 2em;
}
.timeline-heading {
display: flex;
justify-content: center;
.loadmore-button, .alert {
flex: 1;
}
.loadmore-button {
height: 28px;
margin: 10px .6em;
}
.title, .loadmore-text {
display: none
}
}
} }
.user-profile-placeholder { .user-profile-placeholder {
.panel-body { .panel-body {

View file

@ -49,7 +49,7 @@
<button class="btn btn-default" v-else-if="avatarPreview" @click="submitAvatar">{{$t('general.submit')}}</button> <button class="btn btn-default" v-else-if="avatarPreview" @click="submitAvatar">{{$t('general.submit')}}</button>
<div class='alert error' v-if="avatarUploadError"> <div class='alert error' v-if="avatarUploadError">
Error: {{ avatarUploadError }} Error: {{ avatarUploadError }}
<i class="icon-cancel" @click="clearUploadError('avatar')"></i> <i class="button-icon icon-cancel" @click="clearUploadError('avatar')"></i>
</div> </div>
</div> </div>
<div class="setting-item"> <div class="setting-item">
@ -66,7 +66,7 @@
<button class="btn btn-default" v-else-if="bannerPreview" @click="submitBanner">{{$t('general.submit')}}</button> <button class="btn btn-default" v-else-if="bannerPreview" @click="submitBanner">{{$t('general.submit')}}</button>
<div class='alert error' v-if="bannerUploadError"> <div class='alert error' v-if="bannerUploadError">
Error: {{ bannerUploadError }} Error: {{ bannerUploadError }}
<i class="icon-cancel" @click="clearUploadError('banner')"></i> <i class="button-icon icon-cancel" @click="clearUploadError('banner')"></i>
</div> </div>
</div> </div>
<div class="setting-item"> <div class="setting-item">
@ -81,7 +81,7 @@
<button class="btn btn-default" v-else-if="backgroundPreview" @click="submitBg">{{$t('general.submit')}}</button> <button class="btn btn-default" v-else-if="backgroundPreview" @click="submitBg">{{$t('general.submit')}}</button>
<div class='alert error' v-if="backgroundUploadError"> <div class='alert error' v-if="backgroundUploadError">
Error: {{ backgroundUploadError }} Error: {{ backgroundUploadError }}
<i class="icon-cancel" @click="clearUploadError('background')"></i> <i class="button-icon icon-cancel" @click="clearUploadError('background')"></i>
</div> </div>
</div> </div>
</div> </div>

View file

@ -14,7 +14,6 @@ const emptyTl = () => ({
loading: false, loading: false,
followers: [], followers: [],
friends: [], friends: [],
viewing: 'statuses',
userId: 0, userId: 0,
flushMarker: 0 flushMarker: 0
}) })
@ -399,16 +398,6 @@ export const mutations = {
setNotificationsSilence (state, { value }) { setNotificationsSilence (state, { value }) {
state.notifications.desktopNotificationSilence = value state.notifications.desktopNotificationSilence = value
}, },
setProfileView (state, { v }) {
// load followers / friends only when needed
state.timelines['user'].viewing = v
},
addFriends (state, { friends }) {
state.timelines['user'].friends = friends
},
addFollowers (state, { followers }) {
state.timelines['user'].followers = followers
},
markNotificationsAsSeen (state) { markNotificationsAsSeen (state) {
each(state.notifications.data, (notification) => { each(state.notifications.data, (notification) => {
notification.seen = true notification.seen = true
@ -437,12 +426,6 @@ const statuses = {
setNotificationsSilence ({ rootState, commit }, { value }) { setNotificationsSilence ({ rootState, commit }, { value }) {
commit('setNotificationsSilence', { value }) commit('setNotificationsSilence', { value })
}, },
addFriends ({ rootState, commit }, { friends }) {
commit('addFriends', { friends })
},
addFollowers ({ rootState, commit }, { followers }) {
commit('addFollowers', { followers })
},
deleteStatus ({ rootState, commit }, status) { deleteStatus ({ rootState, commit }, status) {
commit('setDeleted', { status }) commit('setDeleted', { status })
apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials }) apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials })

View file

@ -51,6 +51,15 @@ export const mutations = {
endLogin (state) { endLogin (state) {
state.loggingIn = false state.loggingIn = false
}, },
// TODO Clean after ourselves?
addFriends (state, { id, friends }) {
const user = state.usersObject[id]
user.friends = friends
},
addFollowers (state, { id, followers }) {
const user = state.usersObject[id]
user.followers = followers
},
addNewUsers (state, users) { addNewUsers (state, users) {
each(users, (user) => mergeOrAdd(state.users, state.usersObject, user)) each(users, (user) => mergeOrAdd(state.users, state.usersObject, user))
}, },
@ -92,6 +101,14 @@ const users = {
store.rootState.api.backendInteractor.fetchUser({ id }) store.rootState.api.backendInteractor.fetchUser({ id })
.then((user) => store.commit('addNewUsers', [user])) .then((user) => store.commit('addNewUsers', [user]))
}, },
addFriends ({ rootState, commit }, { id }) {
rootState.api.backendInteractor.fetchFriends({ id })
.then((friends) => commit('addFriends', { id, friends }))
},
addFollowers ({ rootState, commit }, { id }) {
rootState.api.backendInteractor.fetchFollowers({ id })
.then((followers) => commit('addFollowers', { id, followers }))
},
registerPushNotifications (store) { registerPushNotifications (store) {
const token = store.state.currentUser.credentials const token = store.state.currentUser.credentials
const vapidPublicKey = store.rootState.instance.vapidPublicKey const vapidPublicKey = store.rootState.instance.vapidPublicKey