fedilove-ui/routes/_components/AccountProfile.html

222 lines
6.1 KiB
HTML
Raw Normal View History

<div class="account-profile {{headerIsMissing ? 'header-is-missing' : ''}}"
style="background-image: url({{$autoplayGifs ? profile.header : profile.header_static}});">
2018-01-28 22:17:37 +00:00
<div class="account-profile-grid-wrapper">
<div class="account-profile-backdrop"></div>
<div class="account-profile-grid">
<div class="account-profile-avatar">
<Avatar account="{{profile}}" size="big" />
2018-01-28 22:17:37 +00:00
</div>
<div class="account-profile-name">
2018-02-10 22:35:21 +00:00
<ExternalLink href="{{profile.url}}" showIcon="true" normalIconColor="true">
2018-02-19 18:59:03 +00:00
{{profile.display_name || profile.acct}}
2018-01-29 03:01:51 +00:00
</ExternalLink>
2018-01-28 22:17:37 +00:00
</div>
2018-01-29 00:34:18 +00:00
<div class="account-profile-username">
{{'@' + profile.acct}}
</div>
2018-01-28 22:17:37 +00:00
<div class="account-profile-followed-by">
{{#if relationship && relationship.followed_by}}
<span>
Follows you
</span>
{{/if}}
</div>
<div class="account-profile-follow">
{{#if verifyCredentials && relationship && verifyCredentials.id !== relationship.id}}
<IconButton
2018-02-19 18:59:03 +00:00
label="{{following ? 'Unfollow' : 'Follow'}}"
href="{{following ? '#fa-user-times' : '#fa-user-plus'}}"
pressable="true"
pressed="{{following}}"
2018-01-28 22:17:37 +00:00
big="true"
on:click="onFollowButtonClick()"
2018-01-28 22:17:37 +00:00
/>
{{/if}}
</div>
<div class="account-profile-note">
2018-02-12 07:07:48 +00:00
{{{massagedNote}}}
2018-01-28 22:17:37 +00:00
</div>
2018-01-28 08:29:45 +00:00
</div>
</div>
</div>
<style>
.account-profile {
position: relative;
background-size: cover;
background-position: center;
padding-top: 175px;
}
.account-profile.header-is-missing {
padding-top: 0;
2018-01-28 20:51:48 +00:00
background-color: #ccc;
2018-01-28 08:29:45 +00:00
}
2018-01-28 22:17:37 +00:00
.account-profile-backdrop {
2018-01-28 08:29:45 +00:00
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 5;
}
.account-profile-grid {
display: grid;
2018-01-28 20:51:48 +00:00
grid-template-areas: "avatar name followed-by follow"
2018-01-29 00:34:18 +00:00
"avatar username username follow"
"avatar note note follow";
2018-01-28 08:49:51 +00:00
grid-template-columns: min-content auto 1fr min-content;
2018-01-28 08:29:45 +00:00
grid-column-gap: 10px;
2018-01-29 00:34:18 +00:00
grid-row-gap: 5px;
2018-01-29 00:44:13 +00:00
padding: 20px;
2018-01-28 08:29:45 +00:00
justify-content: center;
2018-01-28 22:17:37 +00:00
z-index: 10;
position: relative;
2018-01-28 08:29:45 +00:00
}
2018-01-28 22:05:48 +00:00
@supports (-webkit-backdrop-filter: blur(1px) saturate(1%)) or (backdrop-filter: blur(1px) saturate(1%)) {
2018-01-28 22:17:37 +00:00
:global(.account-profile-grid-wrapper) {
2018-01-28 22:05:48 +00:00
-webkit-backdrop-filter: blur(7px) saturate(110%);
backdrop-filter: blur(7px) saturate(110%);
background-color: rgba(255, 255, 255, 0.7);
2018-01-28 08:29:45 +00:00
}
}
2018-01-28 22:05:48 +00:00
@supports not ((-webkit-backdrop-filter: blur(1px) saturate(1%)) or (backdrop-filter: blur(1px) saturate(1%))) {
2018-01-28 22:17:37 +00:00
:global(.account-profile-grid-wrapper) {
2018-01-28 08:29:45 +00:00
background-color: rgba(255, 255, 255, 0.9);
}
}
2018-01-28 20:51:48 +00:00
.account-profile-followed-by {
grid-area: followed-by;
2018-01-28 08:29:45 +00:00
align-self: center;
text-transform: uppercase;
color: var(--deemphasized-text-color);
font-size: 0.8em;
}
2018-01-28 20:51:48 +00:00
.account-profile-followed-by span {
2018-01-28 08:29:45 +00:00
background: rgba(30, 30, 30, 0.2);
border-radius: 4px;
padding: 3px 5px;
2018-01-28 08:49:51 +00:00
white-space: nowrap;
2018-01-28 08:29:45 +00:00
}
.account-profile-avatar {
grid-area: avatar;
}
2018-01-29 00:34:18 +00:00
.account-profile-username {
grid-area: username;
color: var(--deemphasized-text-color);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
align-self: center;
}
2018-01-28 08:29:45 +00:00
.account-profile-follow {
grid-area: follow;
2018-01-29 00:34:18 +00:00
align-self: flex-start;
2018-01-28 08:29:45 +00:00
}
.account-profile-name {
grid-area: name;
font-size: 1.5em;
align-self: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
2018-01-28 08:49:51 +00:00
min-width: 0;
2018-01-28 08:29:45 +00:00
}
2018-01-29 03:01:51 +00:00
:global(.account-profile-name a) {
2018-01-29 01:10:03 +00:00
color: var(--body-text-color);
text-decoration: none;
}
2018-01-29 03:01:51 +00:00
:global(.account-profile-name a:hover) {
2018-01-29 01:10:03 +00:00
color: var(--body-text-color);
text-decoration: underline;
}
2018-01-28 08:29:45 +00:00
.account-profile-note {
grid-area: note;
2018-01-29 00:34:18 +00:00
padding: 10px 0;
2018-01-31 06:40:40 +00:00
font-size: 0.9em;
word-wrap: break-word;
overflow: hidden;
white-space: pre-wrap;
2018-01-28 08:29:45 +00:00
}
2018-01-31 06:40:40 +00:00
2018-01-28 08:29:45 +00:00
:global(.account-profile-note p) {
2018-01-31 06:40:40 +00:00
margin: 0 0 20px;
}
:global(.account-profile-note p:first-child) {
margin: 0 0 20px;
}
:global(.account-profile-note p:last-child) {
margin: 0;
2018-01-28 08:29:45 +00:00
}
2018-01-29 00:34:18 +00:00
@media (max-width: 767px) {
.account-profile-name {
2018-01-31 06:40:40 +00:00
font-size: 1.3em;
2018-01-29 00:34:18 +00:00
}
.account-profile-grid {
display: grid;
grid-template-areas: "avatar name follow"
"avatar username follow"
"avatar followed-by follow"
"note note note";
grid-template-columns: min-content minmax(auto, 1fr) min-content;
grid-template-rows: min-content min-content 1fr min-content;
2018-01-31 06:40:40 +00:00
padding: 10px;
2018-01-29 00:34:18 +00:00
}
.account-profile-note {
2018-01-29 00:35:35 +00:00
padding: 5px 0;
2018-01-29 00:34:18 +00:00
}
.account-profile-username {
2018-01-31 06:40:40 +00:00
font-size: 1.1em;
2018-01-29 00:34:18 +00:00
}
.account-profile-name, .account-profile-username {
align-self: flex-start;
}
}
2018-01-28 08:29:45 +00:00
</style>
<script>
2018-01-28 20:51:48 +00:00
import IconButton from './IconButton.html'
2018-01-29 03:01:51 +00:00
import ExternalLink from './ExternalLink.html'
2018-02-09 01:56:20 +00:00
import Avatar from './Avatar.html'
import { store } from '../_store/store'
import { setAccountFollowed } from '../_actions/follow'
import { database } from '../_database/database'
2018-01-28 20:51:48 +00:00
2018-01-28 08:29:45 +00:00
export default {
computed: {
2018-02-12 07:07:48 +00:00
headerIsMissing: (profile) => profile.header.endsWith('missing.png'),
note: (profile) => profile.note,
massagedNote: (note) => {
// GNU Social / Pleroma don't add <p> tags
if (!note.startsWith('<p>')) {
note = `<p>${note}</p>`
}
return note
2018-02-19 18:59:03 +00:00
},
following: (relationship) => relationship && relationship.following
2018-01-28 20:51:48 +00:00
},
methods: {
async onFollowButtonClick() {
let accountId = this.get('profile').id
let instanceName = this.store.get('currentInstance')
let following = this.get('following')
await setAccountFollowed(accountId, !following)
this.set({relationship: await database.getRelationship(instanceName, accountId)})
}
},
store: () => store,
2018-01-28 20:51:48 +00:00
components: {
2018-01-29 03:01:51 +00:00
IconButton,
ExternalLink,
Avatar
2018-01-28 08:29:45 +00:00
}
}
</script>