aboutsummaryrefslogtreecommitdiff
path: root/src/components/staff_panel
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2021-03-08 22:01:28 +0200
committerHenry Jameson <me@hjkos.com>2021-03-08 22:01:28 +0200
commit2e7bd99444546b3a71e1ff0753e12e6706c8228e (patch)
treeb01067c88bc969041d23392e7e34c976fae7b801 /src/components/staff_panel
parent9a8bc245a6f76f1a41da9d05408dadc36625ffe9 (diff)
parent6281241b92bc17a9535b15a52e656b9f218e3322 (diff)
Merge remote-tracking branch 'origin/develop' into websocket-fixes
* origin/develop: (119 commits) Apply 1 suggestion(s) to 1 file(s) Make it possible to localize user highlight options remove shoutbox test hacks fix shoutbox header, use custom scroll-to-bottom system, remove vue-chat-scroll, temporarily add chat test hack update changelog with 2.3.0 change icons around Translated using Weblate (Japanese) Update timeline_quick_settings.js add screen_name_ui to tests separate screen_name and screen_name_ui with decoded punycode Update CHANGELOG.md add basic validation for statusless status notifications changelog mention fix chat unread badge update shelljs to get rid of warnings on build save a few characters focus input in emoji picker and react picker fix vue warnings add only to wording basic loggedin check for reply filtering ...
Diffstat (limited to 'src/components/staff_panel')
-rw-r--r--src/components/staff_panel/staff_panel.js20
-rw-r--r--src/components/staff_panel/staff_panel.vue27
2 files changed, 39 insertions, 8 deletions
diff --git a/src/components/staff_panel/staff_panel.js b/src/components/staff_panel/staff_panel.js
index 8665648a..b9561bf1 100644
--- a/src/components/staff_panel/staff_panel.js
+++ b/src/components/staff_panel/staff_panel.js
@@ -1,4 +1,6 @@
import map from 'lodash/map'
+import groupBy from 'lodash/groupBy'
+import { mapGetters, mapState } from 'vuex'
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
const StaffPanel = {
@@ -10,9 +12,21 @@ const StaffPanel = {
BasicUserCard
},
computed: {
- staffAccounts () {
- return map(this.$store.state.instance.staffAccounts, nickname => this.$store.getters.findUser(nickname)).filter(_ => _)
- }
+ groupedStaffAccounts () {
+ const staffAccounts = map(this.staffAccounts, this.findUser).filter(_ => _)
+ const groupedStaffAccounts = groupBy(staffAccounts, 'role')
+
+ return [
+ { role: 'admin', users: groupedStaffAccounts['admin'] },
+ { role: 'moderator', users: groupedStaffAccounts['moderator'] }
+ ].filter(group => group.users)
+ },
+ ...mapGetters([
+ 'findUser'
+ ]),
+ ...mapState({
+ staffAccounts: state => state.instance.staffAccounts
+ })
}
}
diff --git a/src/components/staff_panel/staff_panel.vue b/src/components/staff_panel/staff_panel.vue
index 1d13003d..c52ade42 100644
--- a/src/components/staff_panel/staff_panel.vue
+++ b/src/components/staff_panel/staff_panel.vue
@@ -7,11 +7,18 @@
</div>
</div>
<div class="panel-body">
- <basic-user-card
- v-for="user in staffAccounts"
- :key="user.screen_name"
- :user="user"
- />
+ <div
+ v-for="group in groupedStaffAccounts"
+ :key="group.role"
+ class="staff-group"
+ >
+ <h4>{{ $t('general.role.' + group.role) }}</h4>
+ <basic-user-card
+ v-for="user in group.users"
+ :key="user.screen_name"
+ :user="user"
+ />
+ </div>
</div>
</div>
</div>
@@ -20,4 +27,14 @@
<script src="./staff_panel.js" ></script>
<style lang="scss">
+
+.staff-group {
+ padding-left: 1em;
+ padding-top: 1em;
+
+ .basic-user-card {
+ padding-left: 0;
+ }
+}
+
</style>