Improve dashboard

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-10-15 11:04:05 +02:00
parent dacec2672b
commit f6480cb37e
10 changed files with 163 additions and 34 deletions

View File

@@ -4,6 +4,7 @@ export const DASHBOARD = gql`
query {
dashboard {
lastPublicEventPublished {
id
uuid
title
picture {
@@ -12,10 +13,24 @@ export const DASHBOARD = gql`
url
}
}
lastGroupCreated {
id
preferredUsername
domain
name
avatar {
id
url
}
}
numberOfUsers
numberOfEvents
numberOfComments
numberOfReports
numberOfGroups
numberOfFollowers
numberOfFollowings
numberOfConfirmedParticipationsToLocalEvents
}
}
`;

View File

@@ -281,7 +281,7 @@
"Public feeds": "Public feeds",
"Public iCal Feed": "Public iCal Feed",
"Publish": "Publish",
"Published events": "Published events",
"Published events with <b>{comments}</b> comments and <b>{participations}</b> confirmed participations": "Published events with <b>{comments}</b> comments and <b>{participations}</b> confirmed participations",
"RSS/Atom Feed": "RSS/Atom Feed",
"Read Framasofts statement of intent on the Framablog": "Read Framasofts statement of intent on the Framablog",
"Redirecting to event…": "Redirecting to event…",
@@ -800,5 +800,8 @@
"To register for an event by choosing one of your identities": "To register for an event by choosing one of your identities",
"To create or join an group and start organizing with other people": "To create or join an group and start organizing with other people",
"About {instance}": "About {instance}",
"Please read the {fullRules} published by {instance}'s administrators.": "Please read the {fullRules} published by {instance}'s administrators."
"Please read the {fullRules} published by {instance}'s administrators.": "Please read the {fullRules} published by {instance}'s administrators.",
"Instances following you": "Instances following you",
"Instances you follow": "Instances you follow",
"Last group created": "Last group created"
}

View File

@@ -532,7 +532,7 @@
"Public page": "Page publique",
"Publication date": "Date de publication",
"Publish": "Publier",
"Published events": "Événements publiés",
"Published events with <b>{comments}</b> comments and <b>{participations}</b> confirmed participations": "Événements publiés avec <b>{comments}</b> commentaires et <b>{participations}</b> participations confirmées",
"RSS/Atom Feed": "Flux RSS/Atom",
"Radius": "Rayon",
"Read Framasofts statement of intent on the Framablog": "Lire la note dintention de Framasoft sur le Framablog",
@@ -850,5 +850,8 @@
"To register for an event by choosing one of your identities": "Pour s'inscrire à un évènement en choisissant une de vos identités",
"To create or join an group and start organizing with other people": "Pour créer ou rejoindre un groupe et commencer à vous organiser avec d'autres personnes",
"About {instance}": "À propos de {instance}",
"Please read the {fullRules} published by {instance}'s administrators.": "Merci de lire les {fullRules} publiées par les administrateur·ices de {instance}."
"Please read the {fullRules} published by {instance}'s administrators.": "Merci de lire les {fullRules} publiées par les administrateur·ices de {instance}.",
"Instances following you": "Instances vous suivant",
"Instances you follow": "Instances que vous suivez",
"Last group created": "Dernier groupe créé"
}

View File

@@ -1,11 +1,17 @@
import { IEvent } from "@/types/event.model";
import { IGroup } from "./actor";
export interface IDashboard {
lastPublicEventPublished: IEvent;
lastGroupCreated: IGroup;
numberOfUsers: number;
numberOfEvents: number;
numberOfComments: number;
numberOfReports: number;
numberOfGroups: number;
numberOfFollowers: number;
numberOfFollowings: number;
numberOfConfirmedParticipationsToLocalEvents: number;
}
export enum InstanceTermsType {

View File

@@ -18,11 +18,23 @@
<div class="tile is-parent is-vertical is-6">
<article class="tile is-child box">
<p class="dashboard-number">{{ dashboard.numberOfEvents }}</p>
<p>{{ $t("Published events") }}</p>
<p
v-html="
$t(
'Published events with <b>{comments}</b> comments and <b>{participations}</b> confirmed participations',
{
comments: dashboard.numberOfComments,
participations: dashboard.numberOfConfirmedParticipationsToLocalEvents,
}
)
"
/>
</article>
<article class="tile is-child box">
<p class="dashboard-number">{{ dashboard.numberOfComments }}</p>
<p>{{ $t("Comments") }}</p>
<router-link :to="{ name: RouteName.ADMIN_GROUPS }">
<p class="dashboard-number">{{ dashboard.numberOfGroups }}</p>
<p>{{ $t("Groups") }}</p>
</router-link>
</article>
</div>
<div class="tile is-parent is-vertical">
@@ -32,29 +44,66 @@
<p>{{ $t("Users") }}</p>
</router-link>
</article>
<article class="tile is-child box">
<router-link :to="{ name: RouteName.RELAY_FOLLOWERS }">
<p class="dashboard-number">{{ dashboard.numberOfFollowers }}</p>
<p>{{ $t("Instances following you") }}</p>
</router-link>
</article>
</div>
<div class="tile is-parent is-vertical">
<article class="tile is-child box">
<router-link :to="{ name: RouteName.REPORTS }">
<p class="dashboard-number">{{ dashboard.numberOfReports }}</p>
<p>{{ $t("Opened reports") }}</p>
</router-link>
</article>
<article class="tile is-child box">
<router-link :to="{ name: RouteName.RELAY_FOLLOWINGS }">
<p class="dashboard-number">{{ dashboard.numberOfFollowings }}</p>
<p>{{ $t("Instances you follow") }}</p>
</router-link>
</article>
</div>
</div>
<div class="tile is-parent" v-if="dashboard.lastPublicEventPublished">
<router-link
:to="{
name: RouteName.EVENT,
params: { uuid: dashboard.lastPublicEventPublished.uuid },
}"
>
<div class="tile">
<div class="tile is-parent is-vertical is-6" v-if="dashboard.lastPublicEventPublished">
<article class="tile is-child box">
<p class="dashboard-number">{{ $t("Last published event") }}</p>
<p class="subtitle">{{ dashboard.lastPublicEventPublished.title }}</p>
<figure class="image is-4by3" v-if="dashboard.lastPublicEventPublished.picture">
<img :src="dashboard.lastPublicEventPublished.picture.url" />
</figure>
<router-link
:to="{
name: RouteName.EVENT,
params: { uuid: dashboard.lastPublicEventPublished.uuid },
}"
>
<p>{{ $t("Last published event") }}</p>
<p class="subtitle">{{ dashboard.lastPublicEventPublished.title }}</p>
<figure class="image is-4by3" v-if="dashboard.lastPublicEventPublished.picture">
<img :src="dashboard.lastPublicEventPublished.picture.url" />
</figure>
</router-link>
</article>
</router-link>
</div>
<div class="tile is-parent is-vertical" v-if="dashboard.lastGroupCreated">
<article class="tile is-child box">
<router-link
:to="{
name: RouteName.GROUP,
params: { preferredUsername: usernameWithDomain(dashboard.lastGroupCreated) },
}"
>
<p>{{ $t("Last group created") }}</p>
<p class="subtitle">
{{
dashboard.lastGroupCreated.name ||
dashboard.lastGroupCreated.preferredUsername
}}
</p>
<figure class="image is-4by3" v-if="dashboard.lastGroupCreated.avatar">
<img :src="dashboard.lastGroupCreated.avatar.url" />
</figure>
</router-link>
</article>
</div>
</div>
</div>
</div>
@@ -65,6 +114,7 @@
import { Component, Vue } from "vue-property-decorator";
import { DASHBOARD } from "@/graphql/admin";
import { IDashboard } from "@/types/admin.model";
import { usernameWithDomain } from "@/types/actor";
import RouteName from "../../router/name";
@Component({
@@ -85,6 +135,8 @@ export default class Dashboard extends Vue {
dashboard!: IDashboard;
RouteName = RouteName;
usernameWithDomain = usernameWithDomain;
}
</script>