Skip to content

Commit c95e944

Browse files
authored
Fix displaying of activity types (#769)
1 parent 37643c0 commit c95e944

7 files changed

Lines changed: 59 additions & 21 deletions

File tree

frontend/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"dependencies": {
2222
"@cubejs-client/core": "^0.31.63",
2323
"@cubejs-client/vue3": "^0.31.63",
24-
"@formbricks/js": "^0.1.8",
24+
"@formbricks/js": "^0.1.10",
2525
"@loomhq/loom-embed": "^1.5.0",
2626
"@nangohq/frontend": "^0.9.0",
2727
"@octokit/core": "^3.6.0",

frontend/src/i18n/en.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ const en = {
190190
activities: 'Activities',
191191
activityCount: '# of activities',
192192
numberOfOpenSourceContributions: '# of open source contributions',
193-
activityTypes: 'Activity Type',
193+
activityTypes: 'Activity type',
194194
location: 'Location',
195195
organization: 'Organization',
196196
organizations: 'Organizations',

frontend/src/modules/dashboard/components/activity/dashboard-activity-types.vue

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,22 @@
5454
>
5555
<div class="flex items-center">
5656
<img
57+
v-if="getPlatformDetails(plat)"
5758
class="w-4 h-4 mr-3"
5859
:src="getPlatformDetails(plat).image"
5960
:alt="getPlatformDetails(plat).name"
6061
/>
61-
<p class="text-xs leading-5 activity-type">
62-
<app-i18n
63-
:code="`entities.activity.${plat}.${type}`"
64-
/>
62+
<i v-else class="ri-radar-line text-base text-gray-400 mr-3" />
63+
<p v-if="typeNames?.[plat]?.[type]?.display" class="text-xs leading-5 activity-type">
64+
{{ typeNames?.[plat]?.[type]?.display?.short }}
6565
</p>
66+
<app-i18n
67+
v-else-if="getPlatformDetails(plat)"
68+
:code="`entities.activity.${plat}.${type}`"
69+
/>
6670
</div>
6771
<p class="text-2xs text-gray-400">
68-
{{ total }} activities
72+
{{ pluralize('activity', total, true) }}
6973
{{
7074
Math.round(
7175
(total
@@ -104,8 +108,32 @@ import { CrowdIntegrations } from '@/integrations/integrations-config';
104108
import { mapGetters } from '@/shared/vuex/vuex.helpers';
105109
import AppCubeRender from '@/shared/cube/cube-render.vue';
106110
import AppLoading from '@/shared/loading/loading-placeholder.vue';
111+
import { useActivityTypeStore } from '@/modules/activity/store/type';
112+
import { storeToRefs } from 'pinia';
113+
import { computed, watch } from 'vue';
114+
import pluralize from 'pluralize';
107115
108116
const { period, platform } = mapGetters('dashboard');
117+
const { currentTenant } = mapGetters('auth');
118+
119+
const activityTypeStore = useActivityTypeStore();
120+
const { types } = storeToRefs(activityTypeStore);
121+
const { setTypes } = activityTypeStore;
122+
123+
const typeNames = computed(() => ({
124+
...types.value.default,
125+
...types.value.custom,
126+
}));
127+
128+
watch(
129+
() => currentTenant,
130+
(tenant) => {
131+
if (tenant.value.settings.length > 0) {
132+
setTypes(tenant.value.settings[0].activityTypes);
133+
}
134+
},
135+
{ immediate: true, deep: true },
136+
);
109137
110138
const compileData = (resultSet) => {
111139
const pivot = resultSet.chartPivot();

frontend/src/modules/layout/components/menu.vue

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@
368368

369369
<script setup>
370370
import { useStore } from 'vuex';
371-
import { computed } from 'vue';
371+
import { computed, watch } from 'vue';
372372
import { RouterLink, useLink } from 'vue-router';
373373
import { SettingsPermissions } from '@/modules/settings/settings-permissions';
374374
import { ReportPermissions } from '@/modules/report/report-permissions';
@@ -381,21 +381,32 @@ import config from '@/config';
381381
import { mapGetters } from '@/shared/vuex/vuex.helpers';
382382
import { TaskPermissions } from '@/modules/task/task-permissions';
383383
import formbricks from '@/plugins/formbricks';
384+
import { useActivityTypeStore } from '@/modules/activity/store/type';
384385
import AppWorkspaceDropdown from './workspace-dropdown.vue';
385386
import AppSupportDropdown from './support-dropdown.vue';
386387
import AppAccountDropdown from './account-dropdown.vue';
387388
388389
const store = useStore();
390+
const { currentTenant } = mapGetters('auth');
391+
const { setTypes } = useActivityTypeStore();
392+
393+
watch(
394+
() => currentTenant,
395+
(tenant) => {
396+
if (tenant.value.settings.length > 0) {
397+
setTypes(tenant.value.settings[0].activityTypes);
398+
}
399+
},
400+
{ immediate: true, deep: true },
401+
);
402+
389403
const { route } = useLink(RouterLink.props);
390404
const isCollapsed = computed(
391405
() => store.getters['layout/menuCollapsed'],
392406
);
393407
const currentUser = computed(
394408
() => store.getters['auth/currentUser'],
395409
);
396-
const currentTenant = computed(
397-
() => store.getters['auth/currentTenant'],
398-
);
399410
400411
function toggleMenu() {
401412
store.dispatch('layout/toggleMenu');

frontend/src/modules/member/member-model.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ const fields = {
122122
{
123123
required: true,
124124
filterable: true,
125-
fromMembers: true,
126125
},
127126
),
128127
engagementLevel: new MemberEngagementLevelField(

frontend/src/shared/filter/components/type/filter-type-select-group.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const includeModel = computed({
135135
});
136136
137137
const additionalOptions = computed(() => {
138-
if (props.label === 'Activity type') {
138+
if (props.label === 'Activity type' && types.value?.custom) {
139139
return [
140140
{
141141
label: reactive({
@@ -147,7 +147,7 @@ const additionalOptions = computed(() => {
147147
.map(([, platformTypes]) => Object.entries(platformTypes))
148148
.flat()
149149
.map(([type, display]) => ({
150-
label: display.short,
150+
label: display.display.short,
151151
value: type,
152152
})),
153153
},

0 commit comments

Comments
 (0)