diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js
new file mode 100644
index 00000000..0cb616f4
--- /dev/null
+++ b/src/components/user_card/user_card.js
@@ -0,0 +1,148 @@
+import UserAvatar from '../user_avatar/user_avatar.vue'
+import { hex2rgb } from '../../services/color_convert/color_convert.js'
+import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate'
+import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
+
+export default {
+ props: [ 'user', 'switcher', 'selected', 'hideBio', 'rounded', 'bordered' ],
+ data () {
+ return {
+ followRequestInProgress: false,
+ followRequestSent: false,
+ hideUserStatsLocal: typeof this.$store.state.config.hideUserStats === 'undefined'
+ ? this.$store.state.instance.hideUserStats
+ : this.$store.state.config.hideUserStats,
+ betterShadow: this.$store.state.interface.browserSupport.cssFilter
+ }
+ },
+ computed: {
+ classes () {
+ return [{
+ 'user-card-rt': this.rounded === 'top', // set border-top-left-radius and border-top-right-radius
+ 'user-card-r': this.rounded === true, // set border-radius for all sides
+ 'user-card-b': this.bordered === true // set border for all sides
+ }]
+ },
+ style () {
+ const color = this.$store.state.config.customTheme.colors
+ ? this.$store.state.config.customTheme.colors.bg // v2
+ : this.$store.state.config.colors.bg // v1
+
+ if (color) {
+ const rgb = (typeof color === 'string') ? hex2rgb(color) : color
+ const tintColor = `rgba(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)}, .5)`
+
+ const gradient = [
+ [tintColor, this.hideBio ? '60%' : ''],
+ this.hideBio ? [
+ color, '100%'
+ ] : [
+ tintColor, ''
+ ]
+ ].map(_ => _.join(' ')).join(', ')
+
+ return {
+ backgroundColor: `rgb(${Math.floor(rgb.r * 0.53)}, ${Math.floor(rgb.g * 0.56)}, ${Math.floor(rgb.b * 0.59)})`,
+ backgroundImage: [
+ `linear-gradient(to bottom, ${gradient})`,
+ `url(${this.user.cover_photo})`
+ ].join(', ')
+ }
+ }
+ },
+ isOtherUser () {
+ return this.user.id !== this.$store.state.users.currentUser.id
+ },
+ subscribeUrl () {
+ // eslint-disable-next-line no-undef
+ const serverUrl = new URL(this.user.statusnet_profile_url)
+ return `${serverUrl.protocol}//${serverUrl.host}/main/ostatus`
+ },
+ loggedIn () {
+ return this.$store.state.users.currentUser
+ },
+ dailyAvg () {
+ const days = Math.ceil((new Date() - new Date(this.user.created_at)) / (60 * 60 * 24 * 1000))
+ return Math.round(this.user.statuses_count / days)
+ },
+ userHighlightType: {
+ get () {
+ const data = this.$store.state.config.highlight[this.user.screen_name]
+ return data && data.type || 'disabled'
+ },
+ set (type) {
+ const data = this.$store.state.config.highlight[this.user.screen_name]
+ if (type !== 'disabled') {
+ this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: data && data.color || '#FFFFFF', type })
+ } else {
+ this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: undefined })
+ }
+ }
+ },
+ userHighlightColor: {
+ get () {
+ const data = this.$store.state.config.highlight[this.user.screen_name]
+ return data && data.color
+ },
+ set (color) {
+ this.$store.dispatch('setHighlight', { user: this.user.screen_name, color })
+ }
+ },
+ visibleRole () {
+ const validRole = (this.user.role === 'admin' || this.user.role === 'moderator')
+ const showRole = this.isOtherUser || this.user.show_role
+
+ return validRole && showRole && this.user.role
+ }
+ },
+ components: {
+ UserAvatar
+ },
+ methods: {
+ followUser () {
+ this.followRequestInProgress = true
+ requestFollow(this.user, this.$store).then(({sent}) => {
+ this.followRequestInProgress = false
+ this.followRequestSent = sent
+ })
+ },
+ unfollowUser () {
+ this.followRequestInProgress = true
+ requestUnfollow(this.user, this.$store).then(() => {
+ this.followRequestInProgress = false
+ })
+ },
+ blockUser () {
+ const store = this.$store
+ store.state.api.backendInteractor.blockUser(this.user.id)
+ .then((blockedUser) => store.commit('addNewUsers', [blockedUser]))
+ },
+ unblockUser () {
+ const store = this.$store
+ store.state.api.backendInteractor.unblockUser(this.user.id)
+ .then((unblockedUser) => store.commit('addNewUsers', [unblockedUser]))
+ },
+ toggleMute () {
+ const store = this.$store
+ store.commit('setMuted', {user: this.user, muted: !this.user.muted})
+ store.state.api.backendInteractor.setUserMute(this.user)
+ },
+ setProfileView (v) {
+ if (this.switcher) {
+ const store = this.$store
+ store.commit('setProfileView', { v })
+ }
+ },
+ linkClicked ({target}) {
+ if (target.tagName === 'SPAN') {
+ target = target.parentNode
+ }
+ if (target.tagName === 'A') {
+ window.open(target.href, '_blank')
+ }
+ },
+ userProfileLink (user) {
+ return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
+ }
+ }
+}
diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue
new file mode 100644
index 00000000..b90f57a1
--- /dev/null
+++ b/src/components/user_card/user_card.vue
@@ -0,0 +1,420 @@
+
+
+
+
+
+
+
+
+
+
+
+
{{user.name}}
+
+
+
+
+
+
+
+
+
+ @{{user.screen_name}}
+ {{visibleRole}}
+
+ {{dailyAvg}} {{ $t('user_card.per_day') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ $t('user_card.statuses') }}
+ {{user.statuses_count}}
+
+
+
{{ $t('user_card.followees') }}
+ {{user.friends_count}}
+
+
+
{{ $t('user_card.followers') }}
+ {{user.followers_count}}
+
+
+
+
{{ user.description }}
+
+
+
+
+
+
+
diff --git a/src/components/user_card_content/user_card_content.js b/src/components/user_card_content/user_card_content.js
deleted file mode 100644
index 96c6036c..00000000
--- a/src/components/user_card_content/user_card_content.js
+++ /dev/null
@@ -1,148 +0,0 @@
-import UserAvatar from '../user_avatar/user_avatar.vue'
-import { hex2rgb } from '../../services/color_convert/color_convert.js'
-import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate'
-import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
-
-export default {
- props: [ 'user', 'switcher', 'selected', 'hideBio', 'rounded', 'bordered' ],
- data () {
- return {
- followRequestInProgress: false,
- followRequestSent: false,
- hideUserStatsLocal: typeof this.$store.state.config.hideUserStats === 'undefined'
- ? this.$store.state.instance.hideUserStats
- : this.$store.state.config.hideUserStats,
- betterShadow: this.$store.state.interface.browserSupport.cssFilter
- }
- },
- computed: {
- classes () {
- return [{
- 'user-card-content-rt': this.rounded === 'top', // set border-top-left-radius and border-top-right-radius
- 'user-card-content-r': this.rounded === true, // set border-radius for all sides
- 'user-card-content-b': this.bordered === true // set border for all sides
- }]
- },
- style () {
- const color = this.$store.state.config.customTheme.colors
- ? this.$store.state.config.customTheme.colors.bg // v2
- : this.$store.state.config.colors.bg // v1
-
- if (color) {
- const rgb = (typeof color === 'string') ? hex2rgb(color) : color
- const tintColor = `rgba(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)}, .5)`
-
- const gradient = [
- [tintColor, this.hideBio ? '60%' : ''],
- this.hideBio ? [
- color, '100%'
- ] : [
- tintColor, ''
- ]
- ].map(_ => _.join(' ')).join(', ')
-
- return {
- backgroundColor: `rgb(${Math.floor(rgb.r * 0.53)}, ${Math.floor(rgb.g * 0.56)}, ${Math.floor(rgb.b * 0.59)})`,
- backgroundImage: [
- `linear-gradient(to bottom, ${gradient})`,
- `url(${this.user.cover_photo})`
- ].join(', ')
- }
- }
- },
- isOtherUser () {
- return this.user.id !== this.$store.state.users.currentUser.id
- },
- subscribeUrl () {
- // eslint-disable-next-line no-undef
- const serverUrl = new URL(this.user.statusnet_profile_url)
- return `${serverUrl.protocol}//${serverUrl.host}/main/ostatus`
- },
- loggedIn () {
- return this.$store.state.users.currentUser
- },
- dailyAvg () {
- const days = Math.ceil((new Date() - new Date(this.user.created_at)) / (60 * 60 * 24 * 1000))
- return Math.round(this.user.statuses_count / days)
- },
- userHighlightType: {
- get () {
- const data = this.$store.state.config.highlight[this.user.screen_name]
- return data && data.type || 'disabled'
- },
- set (type) {
- const data = this.$store.state.config.highlight[this.user.screen_name]
- if (type !== 'disabled') {
- this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: data && data.color || '#FFFFFF', type })
- } else {
- this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: undefined })
- }
- }
- },
- userHighlightColor: {
- get () {
- const data = this.$store.state.config.highlight[this.user.screen_name]
- return data && data.color
- },
- set (color) {
- this.$store.dispatch('setHighlight', { user: this.user.screen_name, color })
- }
- },
- visibleRole () {
- const validRole = (this.user.role === 'admin' || this.user.role === 'moderator')
- const showRole = this.isOtherUser || this.user.show_role
-
- return validRole && showRole && this.user.role
- }
- },
- components: {
- UserAvatar
- },
- methods: {
- followUser () {
- this.followRequestInProgress = true
- requestFollow(this.user, this.$store).then(({sent}) => {
- this.followRequestInProgress = false
- this.followRequestSent = sent
- })
- },
- unfollowUser () {
- this.followRequestInProgress = true
- requestUnfollow(this.user, this.$store).then(() => {
- this.followRequestInProgress = false
- })
- },
- blockUser () {
- const store = this.$store
- store.state.api.backendInteractor.blockUser(this.user.id)
- .then((blockedUser) => store.commit('addNewUsers', [blockedUser]))
- },
- unblockUser () {
- const store = this.$store
- store.state.api.backendInteractor.unblockUser(this.user.id)
- .then((unblockedUser) => store.commit('addNewUsers', [unblockedUser]))
- },
- toggleMute () {
- const store = this.$store
- store.commit('setMuted', {user: this.user, muted: !this.user.muted})
- store.state.api.backendInteractor.setUserMute(this.user)
- },
- setProfileView (v) {
- if (this.switcher) {
- const store = this.$store
- store.commit('setProfileView', { v })
- }
- },
- linkClicked ({target}) {
- if (target.tagName === 'SPAN') {
- target = target.parentNode
- }
- if (target.tagName === 'A') {
- window.open(target.href, '_blank')
- }
- },
- userProfileLink (user) {
- return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
- }
- }
-}
diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue
deleted file mode 100644
index e003e850..00000000
--- a/src/components/user_card_content/user_card_content.vue
+++ /dev/null
@@ -1,420 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
{{user.name}}
-
-
-
-
-
-
-
-
-
- @{{user.screen_name}}
- {{visibleRole}}
-
- {{dailyAvg}} {{ $t('user_card.per_day') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ $t('user_card.statuses') }}
- {{user.statuses_count}}
-
-
-
{{ $t('user_card.followees') }}
- {{user.friends_count}}
-
-
-
{{ $t('user_card.followers') }}
- {{user.followers_count}}
-
-
-
-
{{ user.description }}
-
-
-
-
-
-
-
diff --git a/src/components/user_panel/user_panel.js b/src/components/user_panel/user_panel.js
index 15804b88..d4478290 100644
--- a/src/components/user_panel/user_panel.js
+++ b/src/components/user_panel/user_panel.js
@@ -1,6 +1,6 @@
import LoginForm from '../login_form/login_form.vue'
import PostStatusForm from '../post_status_form/post_status_form.vue'
-import UserCardContent from '../user_card_content/user_card_content.vue'
+import UserCard from '../user_card/user_card.vue'
const UserPanel = {
computed: {
@@ -9,7 +9,7 @@ const UserPanel = {
components: {
LoginForm,
PostStatusForm,
- UserCardContent
+ UserCard
}
}
diff --git a/src/components/user_panel/user_panel.vue b/src/components/user_panel/user_panel.vue
index 4b3d8971..8310f30e 100644
--- a/src/components/user_panel/user_panel.vue
+++ b/src/components/user_panel/user_panel.vue
@@ -1,7 +1,7 @@
-
+
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
index cdf1cee9..54126514 100644
--- a/src/components/user_profile/user_profile.js
+++ b/src/components/user_profile/user_profile.js
@@ -1,6 +1,6 @@
import { compose } from 'vue-compose'
import get from 'lodash/get'
-import UserCardContent from '../user_card_content/user_card_content.vue'
+import UserCard from '../user_card/user_card.vue'
import FollowCard from '../follow_card/follow_card.vue'
import Timeline from '../timeline/timeline.vue'
import withLoadMore from '../../hocs/with_load_more/with_load_more'
@@ -147,7 +147,7 @@ const UserProfile = {
}
},
components: {
- UserCardContent,
+ UserCard,
Timeline,
FollowerList,
FriendList
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index c57d3409..7d4a8b1f 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -1,7 +1,7 @@
-
+
Date: Mon, 11 Mar 2019 16:51:37 +0000
Subject: Add floating post-status button on mobile
---
src/App.js | 4 +-
src/App.scss | 25 ++++++
src/App.vue | 1 +
src/boot/routes.js | 2 -
src/components/media_modal/media_modal.vue | 15 +---
.../mobile_post_status_modal.js | 91 ++++++++++++++++++++++
.../mobile_post_status_modal.vue | 76 ++++++++++++++++++
src/components/side_drawer/side_drawer.vue | 15 ++--
8 files changed, 203 insertions(+), 26 deletions(-)
create mode 100644 src/components/mobile_post_status_modal/mobile_post_status_modal.js
create mode 100644 src/components/mobile_post_status_modal/mobile_post_status_modal.vue
(limited to 'src/components/side_drawer/side_drawer.vue')
diff --git a/src/App.js b/src/App.js
index 214e0f48..5c27a3df 100644
--- a/src/App.js
+++ b/src/App.js
@@ -8,6 +8,7 @@ import WhoToFollowPanel from './components/who_to_follow_panel/who_to_follow_pan
import ChatPanel from './components/chat_panel/chat_panel.vue'
import MediaModal from './components/media_modal/media_modal.vue'
import SideDrawer from './components/side_drawer/side_drawer.vue'
+import MobilePostStatusModal from './components/mobile_post_status_modal/mobile_post_status_modal.vue'
import { unseenNotificationsFromStore } from './services/notification_utils/notification_utils'
export default {
@@ -22,7 +23,8 @@ export default {
WhoToFollowPanel,
ChatPanel,
MediaModal,
- SideDrawer
+ SideDrawer,
+ MobilePostStatusModal
},
data: () => ({
mobileActivePanel: 'timeline',
diff --git a/src/App.scss b/src/App.scss
index a0d1a804..598735d9 100644
--- a/src/App.scss
+++ b/src/App.scss
@@ -671,6 +671,31 @@ nav {
border-radius: var(--inputRadius, $fallback--inputRadius);
}
+@keyframes modal-background-fadein {
+ from {
+ background-color: rgba(0, 0, 0, 0);
+ }
+ to {
+ background-color: rgba(0, 0, 0, 0.5);
+ }
+}
+
+.modal-view {
+ z-index: 1000;
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ overflow: auto;
+ animation-duration: 0.2s;
+ background-color: rgba(0, 0, 0, 0.5);
+ animation-name: modal-background-fadein;
+}
+
.button-icon {
font-size: 1.2em;
}
diff --git a/src/App.vue b/src/App.vue
index acbbeb75..4fff3d1d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -50,6 +50,7 @@
+
diff --git a/src/boot/routes.js b/src/boot/routes.js
index cfbcb1fe..7e54a98b 100644
--- a/src/boot/routes.js
+++ b/src/boot/routes.js
@@ -13,7 +13,6 @@ import FollowRequests from 'components/follow_requests/follow_requests.vue'
import OAuthCallback from 'components/oauth_callback/oauth_callback.vue'
import UserSearch from 'components/user_search/user_search.vue'
import Notifications from 'components/notifications/notifications.vue'
-import UserPanel from 'components/user_panel/user_panel.vue'
import LoginForm from 'components/login_form/login_form.vue'
import ChatPanel from 'components/chat_panel/chat_panel.vue'
import WhoToFollow from 'components/who_to_follow/who_to_follow.vue'
@@ -43,7 +42,6 @@ export default (store) => {
{ name: 'friend-requests', path: '/friend-requests', component: FollowRequests },
{ name: 'user-settings', path: '/user-settings', component: UserSettings },
{ name: 'notifications', path: '/:username/notifications', component: Notifications },
- { name: 'new-status', path: '/:username/new-status', component: UserPanel },
{ name: 'login', path: '/login', component: LoginForm },
{ name: 'chat', path: '/chat', component: ChatPanel, props: () => ({ floating: false }) },
{ name: 'oauth-callback', path: '/oauth-callback', component: OAuthCallback, props: (route) => ({ code: route.query.code }) },
diff --git a/src/components/media_modal/media_modal.vue b/src/components/media_modal/media_modal.vue
index 427bf12b..7f666603 100644
--- a/src/components/media_modal/media_modal.vue
+++ b/src/components/media_modal/media_modal.vue
@@ -1,5 +1,5 @@
-
- -
-
- {{ $t("post_status.new_status") }}
-
-
- -
+
-
{{ $t("login.login") }}
@@ -119,14 +114,14 @@
}
.side-drawer-container-open {
- transition-delay: 0.0s;
- transition-property: left;
+ transition: 0.35s;
+ transition-property: background-color;
+ background-color: rgba(0, 0, 0, 0.5);
}
.side-drawer-container-closed {
left: -100%;
- transition-delay: 0.5s;
- transition-property: left;
+ background-color: rgba(0, 0, 0, 0);
}
.side-drawer-click-outside {
--
cgit v1.2.3-70-g09d2