2020-06-19 19:27:10 +02:00
|
|
|
<template>
|
|
|
|
<div v-if="config">
|
|
|
|
<section class="hero is-primary">
|
|
|
|
<div class="hero-body">
|
|
|
|
<div class="container">
|
|
|
|
<h2 class="title">{{ config.name }}</h2>
|
|
|
|
<p>{{ config.description }}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<section class="columns contact-statistics" v-if="statistics">
|
|
|
|
<div class="column is-three-quarters-desktop statistics">
|
|
|
|
<i18n tag="p" path="Home to {number} users">
|
|
|
|
<strong slot="number">{{ statistics.numberOfUsers }}</strong>
|
|
|
|
</i18n>
|
2020-09-30 10:42:19 +02:00
|
|
|
<i18n tag="p" path="and {number} groups">
|
2020-10-07 10:05:07 +02:00
|
|
|
<strong slot="number">{{ statistics.numberOfLocalGroups }}</strong>
|
2020-09-30 10:42:19 +02:00
|
|
|
</i18n>
|
2020-06-19 19:27:10 +02:00
|
|
|
<i18n tag="p" path="Who published {number} events">
|
2020-10-07 10:05:07 +02:00
|
|
|
<strong slot="number">{{ statistics.numberOfLocalEvents }}</strong>
|
2020-06-19 19:27:10 +02:00
|
|
|
</i18n>
|
|
|
|
<i18n tag="p" path="And {number} comments">
|
2020-10-07 10:05:07 +02:00
|
|
|
<strong slot="number">{{ statistics.numberOfLocalComments }}</strong>
|
2020-06-19 19:27:10 +02:00
|
|
|
</i18n>
|
|
|
|
</div>
|
|
|
|
<div class="column contact">
|
|
|
|
<h4>{{ $t("Contact") }}</h4>
|
|
|
|
<p>
|
2020-11-30 10:24:11 +01:00
|
|
|
<a
|
|
|
|
:title="config.contact"
|
|
|
|
v-if="generateConfigLink()"
|
|
|
|
:href="generateConfigLink().uri"
|
|
|
|
>{{ generateConfigLink().text }}</a
|
|
|
|
>
|
2020-06-19 19:27:10 +02:00
|
|
|
<span v-else-if="config.contact">{{ config.contact }}</span>
|
|
|
|
<span v-else>{{ $t("contact uninformed") }}</span>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<hr />
|
2020-06-23 11:14:07 +02:00
|
|
|
<section class="long-description content">
|
2020-06-19 19:27:10 +02:00
|
|
|
<div v-html="config.longDescription" />
|
|
|
|
</section>
|
|
|
|
<hr />
|
|
|
|
<section class="config">
|
|
|
|
<h3 class="subtitle">{{ $t("Instance configuration") }}</h3>
|
|
|
|
<table class="table is-fullwidth">
|
2020-10-20 10:36:43 +02:00
|
|
|
<tr>
|
|
|
|
<td>{{ $t("Instance languages") }}</td>
|
2020-12-04 15:08:49 +01:00
|
|
|
<td :title="this.config ? this.config.languages.join(', ') : ''">
|
2020-11-30 10:24:11 +01:00
|
|
|
{{ formattedLanguageList }}
|
|
|
|
</td>
|
2020-10-20 10:36:43 +02:00
|
|
|
</tr>
|
2020-06-19 19:27:10 +02:00
|
|
|
<tr>
|
|
|
|
<td>{{ $t("Mobilizon version") }}</td>
|
|
|
|
<td>{{ config.version }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>{{ $t("Registrations") }}</td>
|
2020-09-29 09:53:48 +02:00
|
|
|
<td v-if="config.registrationsOpen && config.registrationsAllowlist">
|
2020-06-19 19:27:10 +02:00
|
|
|
{{ $t("Restricted") }}
|
|
|
|
</td>
|
2020-09-29 09:53:48 +02:00
|
|
|
<td v-if="config.registrationsOpen && !config.registrationsAllowlist">
|
2020-06-19 19:27:10 +02:00
|
|
|
{{ $t("Open") }}
|
|
|
|
</td>
|
|
|
|
<td v-else>{{ $t("Closed") }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>{{ $t("Federation") }}</td>
|
|
|
|
<td v-if="config.federating">{{ $t("Enabled") }}</td>
|
|
|
|
<td v-else>{{ $t("Disabled") }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>{{ $t("Anonymous participations") }}</td>
|
2020-11-30 10:24:11 +01:00
|
|
|
<td v-if="config.anonymous.participation.allowed">
|
|
|
|
{{ $t("If allowed by organizer") }}
|
|
|
|
</td>
|
2020-06-19 19:27:10 +02:00
|
|
|
<td v-else>{{ $t("Disabled") }}</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Vue } from "vue-property-decorator";
|
2020-10-20 10:36:43 +02:00
|
|
|
import { formatList } from "@/utils/i18n";
|
2020-11-02 11:22:54 +01:00
|
|
|
import { LANGUAGES_CODES } from "@/graphql/admin";
|
|
|
|
import { ILanguage } from "@/types/admin.model";
|
2020-06-19 19:27:10 +02:00
|
|
|
import { ABOUT } from "../../graphql/config";
|
|
|
|
import { STATISTICS } from "../../graphql/statistics";
|
|
|
|
import { IConfig } from "../../types/config.model";
|
|
|
|
import { IStatistics } from "../../types/statistics.model";
|
2020-10-20 10:36:43 +02:00
|
|
|
import langs from "../../i18n/langs.json";
|
2020-06-19 19:27:10 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
apollo: {
|
|
|
|
config: ABOUT,
|
|
|
|
statistics: STATISTICS,
|
2020-11-02 11:22:54 +01:00
|
|
|
languages: {
|
|
|
|
query: LANGUAGES_CODES,
|
|
|
|
variables() {
|
|
|
|
return {
|
|
|
|
codes: this.config.languages,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
skip() {
|
2020-12-04 15:08:49 +01:00
|
|
|
return !this.config || !this.config.languages;
|
2020-11-02 11:22:54 +01:00
|
|
|
},
|
|
|
|
},
|
2020-06-19 19:27:10 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class AboutInstance extends Vue {
|
|
|
|
config!: IConfig;
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-06-19 19:27:10 +02:00
|
|
|
statistics!: IStatistics;
|
|
|
|
|
2020-11-02 11:22:54 +01:00
|
|
|
languages!: ILanguage[];
|
2020-10-20 10:36:43 +02:00
|
|
|
|
2020-06-19 19:27:10 +02:00
|
|
|
get isContactEmail(): boolean {
|
|
|
|
return this.config && this.config.contact.includes("@");
|
|
|
|
}
|
|
|
|
|
|
|
|
get isContactURL(): boolean {
|
|
|
|
return this.config && this.config.contact.match(/^https?:\/\//g) !== null;
|
|
|
|
}
|
|
|
|
|
2020-11-02 11:22:54 +01:00
|
|
|
get formattedLanguageList(): string {
|
2020-12-04 15:08:49 +01:00
|
|
|
if (this.languages) {
|
|
|
|
const list = this.languages.map(({ name }) => name);
|
|
|
|
return formatList(list);
|
|
|
|
}
|
|
|
|
return "";
|
2020-11-02 11:22:54 +01:00
|
|
|
}
|
|
|
|
|
2020-10-20 10:36:43 +02:00
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
|
|
getLanguageNameForCode(code: string): string {
|
|
|
|
const languageMaps = langs as Record<string, any>;
|
|
|
|
return languageMaps[code];
|
|
|
|
}
|
|
|
|
|
2020-06-19 19:27:10 +02:00
|
|
|
generateConfigLink(): { uri: string; text: string } | null {
|
|
|
|
if (!this.config.contact) return null;
|
|
|
|
if (this.isContactEmail) {
|
2020-11-30 10:24:11 +01:00
|
|
|
return {
|
|
|
|
uri: `mailto:${this.config.contact}`,
|
|
|
|
text: this.config.contact,
|
|
|
|
};
|
2020-07-09 17:24:28 +02:00
|
|
|
}
|
|
|
|
if (this.isContactURL) {
|
2020-06-19 19:27:10 +02:00
|
|
|
return {
|
|
|
|
uri: this.config.contact,
|
2020-11-30 10:24:11 +01:00
|
|
|
text:
|
|
|
|
AboutInstance.urlToHostname(this.config.contact) ||
|
|
|
|
(this.$t("Contact") as string),
|
2020-06-19 19:27:10 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-09-30 10:45:22 +02:00
|
|
|
static urlToHostname(url: string): string | null {
|
2020-06-19 19:27:10 +02:00
|
|
|
try {
|
|
|
|
return new URL(url).hostname;
|
|
|
|
} catch (e) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
section {
|
|
|
|
&:not(:first-child) {
|
|
|
|
margin: 2rem auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.hero {
|
|
|
|
h2.title {
|
|
|
|
margin: auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.contact-statistics {
|
|
|
|
margin: 2px auto;
|
|
|
|
.statistics {
|
2020-09-30 10:42:19 +02:00
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fit, 150px);
|
2020-10-07 10:05:07 +02:00
|
|
|
gap: 2rem 0;
|
2020-06-19 19:27:10 +02:00
|
|
|
p {
|
|
|
|
text-align: right;
|
|
|
|
padding: 0 15px;
|
|
|
|
|
|
|
|
& > * {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
strong {
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 32px;
|
|
|
|
line-height: 48px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.contact {
|
2020-10-07 10:05:07 +02:00
|
|
|
h4 {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
2020-06-19 19:27:10 +02:00
|
|
|
p {
|
|
|
|
width: 200px;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|