Add link to remote profile to profile menu

This commit is contained in:
silverpill 2022-01-15 00:46:19 +00:00
parent 7b04cdfebe
commit 1f01f6c60d
3 changed files with 57 additions and 0 deletions

View file

@ -15,6 +15,7 @@ export interface Profile {
id: string; id: string;
username: string; username: string;
acct: string; acct: string;
url: string;
display_name: string | null; display_name: string | null;
note: string | null; note: string | null;
avatar: string | null; avatar: string | null;

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-more-vertical"><circle cx="12" cy="12" r="1"></circle><circle cx="12" cy="5" r="1"></circle><circle cx="12" cy="19" r="1"></circle></svg>

After

Width:  |  Height:  |  Size: 343 B

View file

@ -18,6 +18,29 @@
<template v-if="isFollowRequestPending()">Cancel follow request</template> <template v-if="isFollowRequestPending()">Cancel follow request</template>
<template v-else>Unfollow</template> <template v-else>Unfollow</template>
</button> </button>
<div
v-if="!isLocalUser()"
class="dropdown-menu-wrapper"
v-click-away="hideProfileMenu"
>
<button title="More" @click="toggleProfileMenu()">
<img :src="require('@/assets/feather/more-vertical.svg')">
</button>
<ul v-if="profileMenuVisible" class="dropdown-menu">
<li>
<a
v-if="!isLocalUser()"
title="Open profile page"
:href="profile.url"
target="_blank"
rel="noreferrer"
@click="hideProfileMenu()"
>
Open profile page
</a>
</li>
</ul>
</div>
</div> </div>
</div> </div>
<div class="bio" v-html="profile.note"></div> <div class="bio" v-html="profile.note"></div>
@ -108,6 +131,9 @@ export default class ProfileView extends Vue {
profile: Profile | null = null profile: Profile | null = null
relationship: Relationship | null = null relationship: Relationship | null = null
profileMenuVisible = false
tabName = "posts" tabName = "posts"
posts: Post[] = [] posts: Post[] = []
followList: Profile[] = [] followList: Profile[] = []
@ -197,6 +223,21 @@ export default class ProfileView extends Vue {
) )
} }
toggleProfileMenu() {
this.profileMenuVisible = !this.profileMenuVisible
}
hideProfileMenu() {
this.profileMenuVisible = false
}
isLocalUser(): boolean {
if (!this.profile) {
return false
}
return this.profile.username === this.profile.acct
}
async loadNextPage(maxId: string) { async loadNextPage(maxId: string) {
if (!this.profile) { if (!this.profile) {
return return
@ -237,6 +278,7 @@ $avatar-size: 170px;
.profile-info { .profile-info {
@include block-btn; @include block-btn;
align-items: flex-start;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
@ -266,6 +308,13 @@ $avatar-size: 170px;
user-select: all; user-select: all;
} }
} }
.buttons {
display: flex;
flex-grow: 1;
gap: $block-inner-padding;
justify-content: right;
}
} }
.bio { .bio {
@ -324,6 +373,12 @@ $avatar-size: 170px;
} }
} }
.dropdown-menu-wrapper {
@include post-dropdown-menu;
align-self: center;
}
.profile { .profile {
margin-bottom: $block-outer-padding; margin-bottom: $block-outer-padding;
} }