Skip to content

Commit

Permalink
fix:teamspace-setting
Browse files Browse the repository at this point in the history
render teamname, team permissions from data
  • Loading branch information
het-t committed Jul 22, 2024
1 parent f5dd775 commit 38b24d7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
20 changes: 14 additions & 6 deletions src/ui/components/DialogTeamspaceSettingMembers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<span>
<base-button style="padding: 0 8px; height: 28px;"
>Full access</base-button>
>{{ getMemberTypeAccessLevel("explicit_team_owner_permission") }}</base-button>
</span>
</div>

Expand All @@ -44,7 +44,7 @@

<span>
<base-button style="padding: 0 8px; height: 28px;"
>Full access</base-button>
>{{ getMemberTypeAccessLevel("explicit_team_permission") }}</base-button>
</span>
</div>

Expand All @@ -55,7 +55,7 @@

<span>
<base-button style="padding: 0 8px; height: 28px;"
>Full access</base-button>
>{{ getMemberTypeAccessLevel("space_permission") }}</base-button>
</span>
</div>
</div>
Expand Down Expand Up @@ -115,9 +115,7 @@
}}</span>
</base-button>
</div>

</div>

</div>
</template>

Expand Down Expand Up @@ -159,7 +157,7 @@ function handleTeamspaceTypesDisplay() {
const recordValuesStore = useRecordValuesStore();
const { memberships } = recordValuesStore.getRecordValue({
const { memberships, permissions } = recordValuesStore.getRecordValue({
id: props.teamId,
table: "team",
spaceId: "f2cf1fd1-8789-4ddd-9190-49f41966c446"
Expand All @@ -172,4 +170,14 @@ memberships.map(({ user_id: id }) => syncRecordValueFromApi(
id,
"f2cf1fd1-8789-4ddd-9190-49f41966c446"
));
function getMemberTypeAccessLevel(memberType) {
switch(permissions.find(({ type }) => type === memberType)?.role) {
case "editor": return "Full access";
case "edit_only": return "Edit";
case "comment_only": return "Comment";
case "view_only": return "View";
default: return "Unknown"
}
}
</script>
10 changes: 9 additions & 1 deletion src/ui/views/TeamspaceSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<div style="height: 100%; user-select: none;">
<div style="display: flex; padding-top: 20px; flex-direction: column; height: 100%; width: 100%;">
<div style="display: flex; margin: 0 36px; flex-shrink: 0; align-items: center;">
<div style="font-weight: 600; font-size: 16px;">XDoc</div>
<div style="font-weight: 600; font-size: 16px;"
>{{ teamName }}</div>
<div style="flex-grow: 1"></div>
<base-button style="padding: 0 16px; border-radius: 13px; font-weight: 600; font-size: 13px; height: 26px;"
:hover-style="{ backgroundColor: 'rgba(55, 53, 47, 0.16)' }"
Expand Down Expand Up @@ -93,6 +94,7 @@ import DialogTeamspaceSettingMembers from '../components/DialogTeamspaceSettingM
import DialogTeamspaceSettingMemberships from '../components/DialogTeamspaceSettingMemberships.vue';
import DialogTeamspaceTypes from '../components/DialogTeamspaceTypes.vue';
import { reactive, defineProps, computed } from 'vue';
import { useRecordValuesStore } from '@/stores/recordValues';
const props = defineProps({
teamId: {
Expand All @@ -101,6 +103,12 @@ const props = defineProps({
}
});
const teamName = useRecordValuesStore().getRecordValue({
id: props.teamId,
table: "team",
spaceId: "f2cf1fd1-8789-4ddd-9190-49f41966c446"
}).name;
const generalStore = useGeneralStore();
const component = computed(() => generalStore.getCurrentComponentAndProps());
Expand Down

0 comments on commit 38b24d7

Please sign in to comment.