2021-07-10 07:46:29 -07:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div class="mb-3 d-flex justify-content-between flex-column flex-md-row">
|
2022-01-02 12:08:11 -08:00
|
|
|
<div class="mw-50">
|
|
|
|
<div class="text-nowrap d-flex align-items-center">
|
|
|
|
<Avatar :user="user" class="me-3"/>
|
|
|
|
<div>
|
|
|
|
<h2>
|
|
|
|
@{{user.username}}
|
|
|
|
</h2>
|
|
|
|
<p v-if="profile.teamName || profile.footerName" class="mb-2">
|
|
|
|
<nuxt-link :to="`/${config.contact.team.route}`" class="badge bg-primary text-white">
|
|
|
|
<Icon v="collective-logo.svg" class="inverted"/>
|
|
|
|
<T>contact.team.member</T>
|
|
|
|
</nuxt-link>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-10 07:46:29 -07:00
|
|
|
<div class="flex-grow-1 text-lg-end">
|
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-07-10 08:04:07 -07:00
|
|
|
<section class="row">
|
2021-07-11 07:05:38 -07:00
|
|
|
<div v-if="hasDescriptionColumn" :class="['col-12', manyFlagsLayout ? '' : 'col-lg-6']">
|
2021-07-10 08:04:07 -07:00
|
|
|
<p v-for="line in profile.description.split('\n')" class="mb-1">
|
2021-11-15 12:11:25 -08:00
|
|
|
<Twemoji><Spelling escape :text="line"/></Twemoji>
|
2021-07-10 08:04:07 -07:00
|
|
|
</p>
|
2022-02-13 08:06:46 -08:00
|
|
|
<p v-if="profile.age && profile.age >= minAge">
|
2021-07-10 08:04:07 -07:00
|
|
|
<Icon v="birthday-cake"/>
|
|
|
|
{{ profile.age }}
|
|
|
|
</p>
|
|
|
|
</div>
|
2021-07-10 07:46:29 -07:00
|
|
|
|
2021-07-11 02:00:57 -07:00
|
|
|
<div v-if="profile.flags.length || Object.keys(profile.customFlags).length" :class="['col-12', manyFlagsLayout ? '' : 'col-lg-6']">
|
2021-07-10 08:04:07 -07:00
|
|
|
<ul class="list-inline">
|
|
|
|
<li v-for="flag in profile.flags" v-if="allFlags[flag]" class="list-inline-item p-1">
|
|
|
|
<Flag :name="flag.startsWith('-') ? allFlags[flag] : $translateForPronoun(allFlags[flag], mainPronoun)"
|
|
|
|
:alt="allFlags[flag]"
|
|
|
|
:img="`/flags/${flag}.png`"
|
2022-05-07 13:52:18 -07:00
|
|
|
:terms="terms || []"
|
|
|
|
:asterisk="flagsAsterisk.includes(flag)"
|
|
|
|
/>
|
2021-07-10 08:04:07 -07:00
|
|
|
</li>
|
|
|
|
<li v-for="(desc, flag) in profile.customFlags" class="list-inline-item p-1">
|
|
|
|
<Flag :name="desc"
|
|
|
|
:alt="desc"
|
|
|
|
:img="buildImageUrl(flag, 'flag')"
|
|
|
|
:terms="terms|| []"
|
|
|
|
custom/>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2021-07-10 07:46:29 -07:00
|
|
|
</section>
|
|
|
|
|
2021-07-10 08:04:07 -07:00
|
|
|
<section class="row">
|
2021-08-28 13:06:23 -07:00
|
|
|
<div v-if="Object.keys(profile.names).length" :class="['col-6', mainRowCount === 3 ? 'col-lg-4' : 'col-lg-6']">
|
2021-07-10 07:46:29 -07:00
|
|
|
<h3>
|
|
|
|
<Icon v="signature"/>
|
|
|
|
<T>profile.names</T>
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<ul class="list-unstyled">
|
|
|
|
<li v-for="(opinion, name) in profile.names"><Opinion :word="name" :opinion="opinion"/></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2021-08-28 13:06:23 -07:00
|
|
|
<div v-if="Object.keys(profile.pronouns).length" :class="['col-6', mainRowCount === 3 ? 'col-lg-4' : 'col-lg-6']">
|
2021-07-10 07:46:29 -07:00
|
|
|
<h3>
|
|
|
|
<Icon v="tags"/>
|
|
|
|
<T>profile.pronouns</T>
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<ul class="list-unstyled">
|
|
|
|
<li v-for="{link, pronoun, opinion} in pronounOpinions">
|
2021-09-03 06:33:36 -07:00
|
|
|
<Opinion :word="typeof pronoun === 'string' ? pronoun : pronoun.name(glue)" :opinion="opinion" :link="`/${link}`"/>
|
2021-07-10 07:46:29 -07:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2021-08-28 13:06:23 -07:00
|
|
|
<div v-if="profile.links.length" :class="['col-12', mainRowCount === 3 ? 'col-lg-4' : 'col-lg-6']">
|
2021-07-10 08:04:07 -07:00
|
|
|
<h3>
|
|
|
|
<Icon v="link"/>
|
|
|
|
<T>profile.links</T>
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<ul class="list-unstyled">
|
|
|
|
<li v-for="link in profile.links">
|
2021-12-14 06:15:27 -08:00
|
|
|
<ProfileLink :link="link" :expand="expandLinks" :verifiedLinks="profile.verifiedLinks || {}"/>
|
2021-07-10 08:04:07 -07:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2021-07-10 07:46:29 -07:00
|
|
|
</section>
|
|
|
|
|
2021-08-28 13:06:23 -07:00
|
|
|
<section class="clearfix" v-if="Object.values(profile.words).map(w => Object.keys(w).length).reduce((a, b) => a + b, 0) > 0">
|
2021-07-10 07:46:29 -07:00
|
|
|
<h3>
|
|
|
|
<Icon v="scroll-old"/>
|
|
|
|
<T>profile.words</T>
|
|
|
|
</h3>
|
|
|
|
|
2021-07-10 08:04:07 -07:00
|
|
|
<div class="row">
|
2021-08-28 13:06:23 -07:00
|
|
|
<div v-for="group in profile.words" v-if="Object.keys(group).length" class="col-6 col-lg-3">
|
2021-07-10 07:46:29 -07:00
|
|
|
<ul class="list-unstyled">
|
|
|
|
<li v-for="(opinion, word) in group"><Opinion :word="word" :opinion="opinion"/></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<OpinionLegend/>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { pronouns } from "~/src/data";
|
|
|
|
import { buildPronoun } from "../src/buildPronoun";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
2021-07-24 05:54:15 -07:00
|
|
|
user: { required: true },
|
2021-07-10 07:46:29 -07:00
|
|
|
profile: { required: true },
|
|
|
|
terms: { 'default': null },
|
2021-09-07 08:37:24 -07:00
|
|
|
expandLinks: { type: Boolean },
|
2021-07-10 07:46:29 -07:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
allFlags: process.env.FLAGS,
|
|
|
|
glue: ' ' + this.$t('pronouns.or') + ' ',
|
2022-02-13 08:06:46 -08:00
|
|
|
minAge: parseInt(process.env.MIN_AGE),
|
2022-05-07 13:52:18 -07:00
|
|
|
flagsAsterisk: process.env.FLAGS_ASTERISK,
|
|
|
|
};
|
2021-07-10 07:46:29 -07:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
pronounOpinions() {
|
|
|
|
const pronounOpinions = [];
|
|
|
|
for (let pronoun in this.profile.pronouns) {
|
|
|
|
if (!this.profile.pronouns.hasOwnProperty(pronoun)) { continue; }
|
|
|
|
|
|
|
|
let link = decodeURIComponent(
|
|
|
|
pronoun
|
|
|
|
.trim()
|
|
|
|
.replace(new RegExp('^' + this.$base), '')
|
|
|
|
.replace(new RegExp('^' + this.$base.replace(/^https?:\/\//, '')), '')
|
|
|
|
.replace(new RegExp('^/'), '')
|
|
|
|
);
|
|
|
|
if (!link.startsWith(':')) {
|
|
|
|
link = link.toLowerCase();
|
|
|
|
}
|
|
|
|
|
2022-03-17 09:21:00 -07:00
|
|
|
const linkNorm = link.toLowerCase();
|
|
|
|
if (linkNorm === this.config.pronouns.any
|
|
|
|
|| linkNorm.startsWith(this.config.pronouns.any + ':')
|
|
|
|
|| (this.config.pronouns.null && this.config.pronouns.null.routes && this.config.pronouns.null.routes.includes(linkNorm))
|
|
|
|
|| (this.config.pronouns.mirror && this.config.pronouns.mirror.route === linkNorm)
|
2021-09-28 12:34:25 -07:00
|
|
|
) {
|
2021-07-10 07:46:29 -07:00
|
|
|
pronounOpinions.push({
|
|
|
|
link,
|
2021-12-23 03:36:54 -08:00
|
|
|
pronoun: link.replace(/:+/g, ' '),
|
2021-07-10 07:46:29 -07:00
|
|
|
opinion: this.profile.pronouns[pronoun],
|
|
|
|
});
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
const pronounEntity = buildPronoun(pronouns, link);
|
|
|
|
|
|
|
|
if (pronounEntity) {
|
|
|
|
pronounOpinions.push({
|
|
|
|
link,
|
|
|
|
pronoun: pronounEntity,
|
|
|
|
opinion: this.profile.pronouns[pronoun],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pronounOpinions;
|
|
|
|
},
|
|
|
|
mainPronoun() {
|
|
|
|
let mainPronoun = buildPronoun(pronouns, this.config.profile.flags.defaultPronoun);
|
|
|
|
let mainOpinion = -1;
|
|
|
|
for (let {pronoun, opinion} of this.pronounOpinions) {
|
|
|
|
if (typeof pronoun === 'string') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (opinion === 2) {
|
|
|
|
opinion = 0.5;
|
|
|
|
}
|
2021-12-14 07:48:49 -08:00
|
|
|
if (opinion === 3) {
|
|
|
|
opinion = 0.5;
|
|
|
|
}
|
2021-07-10 07:46:29 -07:00
|
|
|
if (opinion > mainOpinion) {
|
|
|
|
mainPronoun = pronoun;
|
|
|
|
mainOpinion = opinion;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return mainPronoun;
|
|
|
|
},
|
2021-07-11 07:05:38 -07:00
|
|
|
countFlags() {
|
|
|
|
return this.profile.flags.length + Object.keys(this.profile.customFlags).length;
|
|
|
|
},
|
2021-07-11 02:00:57 -07:00
|
|
|
manyFlagsLayout() {
|
2021-07-11 07:05:38 -07:00
|
|
|
return this.countFlags > 36 || this.countFlags === 0 || !this.hasDescriptionColumn;
|
|
|
|
},
|
|
|
|
hasDescriptionColumn() {
|
2022-02-13 08:06:46 -08:00
|
|
|
return (this.profile.age && this.profile.age > this.minAge)
|
|
|
|
|| this.profile.description.trim().length
|
|
|
|
|| this.profile.team;
|
2021-07-11 02:00:57 -07:00
|
|
|
},
|
2021-08-28 13:06:23 -07:00
|
|
|
mainRowCount() {
|
|
|
|
let c = 0;
|
|
|
|
if (Object.keys(this.profile.names).length) { c++; }
|
|
|
|
if (Object.keys(this.profile.pronouns).length) { c++; }
|
|
|
|
if (this.profile.links.length) { c++; }
|
|
|
|
return c;
|
|
|
|
}
|
2021-07-10 07:46:29 -07:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.avatar {
|
|
|
|
width: 100%;
|
|
|
|
max-width: 5rem;
|
|
|
|
max-height: 5rem;
|
|
|
|
}
|
2021-08-26 08:36:58 -07:00
|
|
|
|
|
|
|
.mw-50 {
|
|
|
|
min-width: 50%;
|
|
|
|
}
|
2021-07-10 07:46:29 -07:00
|
|
|
</style>
|