Pinafore-Web-Client-Frontend/routes/_components/AccountProfile.html

210 lines
5.6 KiB
HTML

<div class="account-profile {{headerIsMissing ? 'header-is-missing' : ''}}"
style="background-image: url({{$autoplayGifs ? profile.header : profile.header_static}});">
<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" />
</div>
<div class="account-profile-name">
<ExternalLink href="{{profile.url}}" showIcon="true" normalIconColor="true">
{{profile.display_name || profile.acct}}
</ExternalLink>
</div>
<div class="account-profile-username">
{{'@' + profile.acct}}
</div>
<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
label="{{following ? 'Unfollow' : 'Follow'}}"
href="{{following ? '#fa-user-times' : '#fa-user-plus'}}"
pressable="true"
pressed="{{following}}"
big="true"
/>
{{/if}}
</div>
<div class="account-profile-note">
{{{massagedNote}}}
</div>
</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;
background-color: #ccc;
}
.account-profile-backdrop {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 5;
}
.account-profile-grid {
display: grid;
grid-template-areas: "avatar name followed-by follow"
"avatar username username follow"
"avatar note note follow";
grid-template-columns: min-content auto 1fr min-content;
grid-column-gap: 10px;
grid-row-gap: 5px;
padding: 20px;
justify-content: center;
z-index: 10;
position: relative;
}
@supports (-webkit-backdrop-filter: blur(1px) saturate(1%)) or (backdrop-filter: blur(1px) saturate(1%)) {
:global(.account-profile-grid-wrapper) {
-webkit-backdrop-filter: blur(7px) saturate(110%);
backdrop-filter: blur(7px) saturate(110%);
background-color: rgba(255, 255, 255, 0.7);
}
}
@supports not ((-webkit-backdrop-filter: blur(1px) saturate(1%)) or (backdrop-filter: blur(1px) saturate(1%))) {
:global(.account-profile-grid-wrapper) {
background-color: rgba(255, 255, 255, 0.9);
}
}
.account-profile-followed-by {
grid-area: followed-by;
align-self: center;
text-transform: uppercase;
color: var(--deemphasized-text-color);
font-size: 0.8em;
}
.account-profile-followed-by span {
background: rgba(30, 30, 30, 0.2);
border-radius: 4px;
padding: 3px 5px;
white-space: nowrap;
}
.account-profile-avatar {
grid-area: avatar;
}
.account-profile-username {
grid-area: username;
color: var(--deemphasized-text-color);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
align-self: center;
}
.account-profile-follow {
grid-area: follow;
align-self: flex-start;
}
.account-profile-name {
grid-area: name;
font-size: 1.5em;
align-self: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
min-width: 0;
}
:global(.account-profile-name a) {
color: var(--body-text-color);
text-decoration: none;
}
:global(.account-profile-name a:hover) {
color: var(--body-text-color);
text-decoration: underline;
}
.account-profile-note {
grid-area: note;
padding: 10px 0;
font-size: 0.9em;
word-wrap: break-word;
overflow: hidden;
white-space: pre-wrap;
}
:global(.account-profile-note p) {
margin: 0 0 20px;
}
:global(.account-profile-note p:first-child) {
margin: 0 0 20px;
}
:global(.account-profile-note p:last-child) {
margin: 0;
}
@media (max-width: 767px) {
.account-profile-name {
font-size: 1.3em;
}
.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;
padding: 10px;
}
.account-profile-note {
padding: 5px 0;
}
.account-profile-username {
font-size: 1.1em;
}
.account-profile-name, .account-profile-username {
align-self: flex-start;
}
}
</style>
<script>
import IconButton from './IconButton.html'
import ExternalLink from './ExternalLink.html'
import Avatar from './Avatar.html'
import { store } from '../_store/store'
export default {
computed: {
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
},
following: (relationship) => relationship && relationship.following
},
store: () => store,
components: {
IconButton,
ExternalLink,
Avatar
}
}
</script>