@frigear-nu/teams 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -2
- package/dist/module.d.mts +278 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +134 -0
- package/dist/runtime/access.d.ts +1 -0
- package/dist/runtime/access.js +39 -0
- package/dist/runtime/app/components/TeamFormSlideover.d.vue.ts +13 -0
- package/dist/runtime/app/components/TeamFormSlideover.vue +126 -0
- package/dist/runtime/app/components/TeamFormSlideover.vue.d.ts +13 -0
- package/dist/runtime/app/components/TeamLadderSlideover.d.vue.ts +11 -0
- package/dist/runtime/app/components/TeamLadderSlideover.vue +125 -0
- package/dist/runtime/app/components/TeamLadderSlideover.vue.d.ts +11 -0
- package/dist/runtime/app/components/TeamMappingSlideover.d.vue.ts +15 -0
- package/dist/runtime/app/components/TeamMappingSlideover.vue +134 -0
- package/dist/runtime/app/components/TeamMappingSlideover.vue.d.ts +15 -0
- package/dist/runtime/app/components/TeamMemberSlideover.d.vue.ts +13 -0
- package/dist/runtime/app/components/TeamMemberSlideover.vue +79 -0
- package/dist/runtime/app/components/TeamMemberSlideover.vue.d.ts +13 -0
- package/dist/runtime/app/composables/index.d.ts +6 -0
- package/dist/runtime/app/composables/index.js +5 -0
- package/dist/runtime/app/composables/useTeamActions.d.ts +25 -0
- package/dist/runtime/app/composables/useTeamActions.js +56 -0
- package/dist/runtime/app/composables/useTeamLinks.d.ts +8 -0
- package/dist/runtime/app/composables/useTeamLinks.js +6 -0
- package/dist/runtime/app/composables/useTeamMappingActions.d.ts +20 -0
- package/dist/runtime/app/composables/useTeamMappingActions.js +46 -0
- package/dist/runtime/app/composables/useTeamMemberActions.d.ts +16 -0
- package/dist/runtime/app/composables/useTeamMemberActions.js +47 -0
- package/dist/runtime/app/composables/useTeamsTranslate.d.ts +7 -0
- package/dist/runtime/app/composables/useTeamsTranslate.js +15 -0
- package/dist/runtime/app/dashboard/MyTeams.d.vue.ts +3 -0
- package/dist/runtime/app/dashboard/MyTeams.vue +75 -0
- package/dist/runtime/app/dashboard/MyTeams.vue.d.ts +3 -0
- package/dist/runtime/app/grants/TeamGrantField.d.vue.ts +15 -0
- package/dist/runtime/app/grants/TeamGrantField.vue +120 -0
- package/dist/runtime/app/grants/TeamGrantField.vue.d.ts +15 -0
- package/dist/runtime/app/pages/admin-team.d.vue.ts +3 -0
- package/dist/runtime/app/pages/admin-team.vue +271 -0
- package/dist/runtime/app/pages/admin-team.vue.d.ts +3 -0
- package/dist/runtime/app/pages/admin.d.vue.ts +3 -0
- package/dist/runtime/app/pages/admin.vue +159 -0
- package/dist/runtime/app/pages/admin.vue.d.ts +3 -0
- package/dist/runtime/app/tabs/OwnerTeams.d.vue.ts +9 -0
- package/dist/runtime/app/tabs/OwnerTeams.vue +94 -0
- package/dist/runtime/app/tabs/OwnerTeams.vue.d.ts +9 -0
- package/dist/runtime/app/utils/admin-team.d.ts +27 -0
- package/dist/runtime/app/utils/admin-team.js +13 -0
- package/dist/runtime/dashboard.d.ts +8 -0
- package/dist/runtime/dashboard.js +14 -0
- package/dist/runtime/i18n/lang/da.json +174 -0
- package/dist/runtime/i18n/lang/en.json +174 -0
- package/dist/runtime/menus.d.ts +2 -0
- package/dist/runtime/menus.js +19 -0
- package/dist/runtime/server/candidates.d.ts +34 -0
- package/dist/runtime/server/candidates.js +16 -0
- package/dist/runtime/server/db/schema.postgresql.d.ts +628 -0
- package/dist/runtime/server/db/schema.postgresql.js +66 -0
- package/dist/runtime/server/db/schema.sqlite.d.ts +662 -0
- package/dist/runtime/server/db/schema.sqlite.js +66 -0
- package/dist/runtime/server/grants/team.d.ts +3 -0
- package/dist/runtime/server/grants/team.js +61 -0
- package/dist/runtime/server/plugins/ladders.d.ts +2 -0
- package/dist/runtime/server/plugins/ladders.js +7 -0
- package/dist/runtime/server/plugins/oauth-claims.d.ts +5 -0
- package/dist/runtime/server/plugins/oauth-claims.js +18 -0
- package/dist/runtime/server/plugins/owners.d.ts +2 -0
- package/dist/runtime/server/plugins/owners.js +19 -0
- package/dist/runtime/server/plugins/subscriptions.d.ts +2 -0
- package/dist/runtime/server/plugins/subscriptions.js +23 -0
- package/dist/runtime/server/policies.d.ts +2 -0
- package/dist/runtime/server/policies.js +14 -0
- package/dist/runtime/server/routes/admin/ladder.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/ladder.get.js +9 -0
- package/dist/runtime/server/routes/admin/ladder.put.d.ts +2 -0
- package/dist/runtime/server/routes/admin/ladder.put.js +27 -0
- package/dist/runtime/server/routes/admin/ladders.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/ladders.get.js +5 -0
- package/dist/runtime/server/routes/admin/mapping.delete.d.ts +2 -0
- package/dist/runtime/server/routes/admin/mapping.delete.js +11 -0
- package/dist/runtime/server/routes/admin/mapping.patch.d.ts +2 -0
- package/dist/runtime/server/routes/admin/mapping.patch.js +18 -0
- package/dist/runtime/server/routes/admin/mappings.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/mappings.get.js +22 -0
- package/dist/runtime/server/routes/admin/mappings.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/mappings.post.js +20 -0
- package/dist/runtime/server/routes/admin/member.delete.d.ts +2 -0
- package/dist/runtime/server/routes/admin/member.delete.js +18 -0
- package/dist/runtime/server/routes/admin/member.patch.d.ts +2 -0
- package/dist/runtime/server/routes/admin/member.patch.js +29 -0
- package/dist/runtime/server/routes/admin/member.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/member.post.js +18 -0
- package/dist/runtime/server/routes/admin/team.delete.d.ts +2 -0
- package/dist/runtime/server/routes/admin/team.delete.js +10 -0
- package/dist/runtime/server/routes/admin/team.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/team.get.js +9 -0
- package/dist/runtime/server/routes/admin/team.patch.d.ts +2 -0
- package/dist/runtime/server/routes/admin/team.patch.js +10 -0
- package/dist/runtime/server/routes/admin/teams.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/teams.get.js +26 -0
- package/dist/runtime/server/routes/admin/teams.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/teams.post.js +8 -0
- package/dist/runtime/server/routes/admin/users.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/users.get.js +13 -0
- package/dist/runtime/server/routes/me/teams.get.d.ts +2 -0
- package/dist/runtime/server/routes/me/teams.get.js +14 -0
- package/dist/runtime/server/routes/members.get.d.ts +2 -0
- package/dist/runtime/server/routes/members.get.js +14 -0
- package/dist/runtime/server/routes/team.get.d.ts +2 -0
- package/dist/runtime/server/routes/team.get.js +9 -0
- package/dist/runtime/server/search-index.d.ts +2 -0
- package/dist/runtime/server/search-index.js +7 -0
- package/dist/runtime/server/utils/teams-dto.d.ts +24 -0
- package/dist/runtime/server/utils/teams-dto.js +64 -0
- package/dist/runtime/server/utils/teams-ladders.d.ts +22 -0
- package/dist/runtime/server/utils/teams-ladders.js +53 -0
- package/dist/runtime/server/utils/teams-mappings.d.ts +16 -0
- package/dist/runtime/server/utils/teams-mappings.js +29 -0
- package/dist/runtime/server/utils/teams-roles.d.ts +63 -0
- package/dist/runtime/server/utils/teams-roles.js +242 -0
- package/dist/runtime/server/utils/teams-schemas.d.ts +127 -0
- package/dist/runtime/server/utils/teams-schemas.js +69 -0
- package/dist/runtime/server/utils/teams-search.d.ts +3 -0
- package/dist/runtime/server/utils/teams-search.js +2 -0
- package/dist/runtime/server/utils/teams.d.ts +65 -0
- package/dist/runtime/server/utils/teams.js +140 -0
- package/dist/runtime/utils/api.d.ts +30 -0
- package/dist/runtime/utils/api.js +33 -0
- package/dist/runtime/utils/claims.d.ts +7 -0
- package/dist/runtime/utils/claims.js +14 -0
- package/dist/runtime/utils/grants.d.ts +17 -0
- package/dist/runtime/utils/grants.js +9 -0
- package/dist/runtime/utils/index.d.ts +11 -0
- package/dist/runtime/utils/index.js +9 -0
- package/dist/runtime/utils/ladders.d.ts +22 -0
- package/dist/runtime/utils/ladders.js +43 -0
- package/dist/runtime/utils/links.d.ts +13 -0
- package/dist/runtime/utils/links.js +10 -0
- package/dist/runtime/utils/resolve.d.ts +29 -0
- package/dist/runtime/utils/resolve.js +57 -0
- package/dist/types.d.mts +5 -0
- package/package.json +121 -3
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { teamLadderIssues } from "../../utils/ladders";
|
|
3
|
+
import { teamsApi } from "../../utils/api";
|
|
4
|
+
import { $fetch, computed, reactive, useAction, useModuleT, useTeamsTranslate } from "#imports";
|
|
5
|
+
defineOptions({ name: "TeamLadderSlideover" });
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
ladder: { type: Object, required: true }
|
|
8
|
+
});
|
|
9
|
+
const emit = defineEmits(["close"]);
|
|
10
|
+
const t = useModuleT("teams");
|
|
11
|
+
const tr = useTeamsTranslate();
|
|
12
|
+
const { busy, run } = useAction();
|
|
13
|
+
const state = reactive({
|
|
14
|
+
roles: props.ladder.roles.map((role) => ({ key: role.key, label: role.label })),
|
|
15
|
+
leadFrom: props.ladder.leadFrom ?? ""
|
|
16
|
+
});
|
|
17
|
+
const NONE = "__none";
|
|
18
|
+
const leadOptions = computed(() => [
|
|
19
|
+
{ label: t("admin.noLead", "Nobody leads"), value: NONE },
|
|
20
|
+
...state.roles.filter((role) => role.key).map((role) => ({ label: tr(role.label) || role.key, value: role.key }))
|
|
21
|
+
]);
|
|
22
|
+
const leadFrom = computed({
|
|
23
|
+
get: () => state.leadFrom || NONE,
|
|
24
|
+
set: (value) => {
|
|
25
|
+
state.leadFrom = value === NONE ? "" : value;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const roles = computed(() => state.roles.map((role) => ({ key: role.key.trim(), label: role.label ?? role.key })));
|
|
29
|
+
const issues = computed(() => teamLadderIssues({ roles: roles.value, leadFrom: state.leadFrom || null }));
|
|
30
|
+
function move(index, by) {
|
|
31
|
+
const [role] = state.roles.splice(index, 1);
|
|
32
|
+
state.roles.splice(index + by, 0, role);
|
|
33
|
+
}
|
|
34
|
+
async function save() {
|
|
35
|
+
if (issues.value.length) return;
|
|
36
|
+
const saved = await run(
|
|
37
|
+
() => $fetch(teamsApi.admin.ladder(props.ladder.kind), { method: "PUT", body: { roles: roles.value, leadFrom: state.leadFrom || null } }),
|
|
38
|
+
{ success: t("admin.ladderSaved", "Saved the {kind} ladder", { kind: props.ladder.kind }) }
|
|
39
|
+
);
|
|
40
|
+
if (saved) emit("close", saved);
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<FormSlideover
|
|
46
|
+
form-id="team-ladder-form"
|
|
47
|
+
:title="t('admin.editLadder', 'Edit the {kind} ladder', { kind: ladder.kind })"
|
|
48
|
+
:description="t('admin.ladderHelp', 'Roles from lowest to highest. Keys are stored on members and rules: use lower case letters.')"
|
|
49
|
+
:submit-label="t('admin.saveLadder', 'Save ladder')"
|
|
50
|
+
:loading="busy"
|
|
51
|
+
:disabled="issues.length > 0"
|
|
52
|
+
@close="emit('close', false)"
|
|
53
|
+
>
|
|
54
|
+
<form
|
|
55
|
+
id="team-ladder-form"
|
|
56
|
+
class="flex flex-col gap-4"
|
|
57
|
+
@submit.prevent="save"
|
|
58
|
+
>
|
|
59
|
+
<div
|
|
60
|
+
v-for="(role, index) in state.roles"
|
|
61
|
+
:key="index"
|
|
62
|
+
class="flex flex-col gap-2 rounded-md border border-default p-3"
|
|
63
|
+
>
|
|
64
|
+
<div class="flex items-center gap-2">
|
|
65
|
+
<UInput
|
|
66
|
+
v-model="role.key"
|
|
67
|
+
:aria-label="t('admin.roleKey', 'Key')"
|
|
68
|
+
:placeholder="t('admin.roleKey', 'Key')"
|
|
69
|
+
class="flex-1"
|
|
70
|
+
/>
|
|
71
|
+
<UButton
|
|
72
|
+
icon="i-lucide-arrow-up"
|
|
73
|
+
color="neutral"
|
|
74
|
+
variant="ghost"
|
|
75
|
+
:disabled="index === 0"
|
|
76
|
+
:aria-label="t('admin.moveUp', 'Move up')"
|
|
77
|
+
@click="move(index, -1)"
|
|
78
|
+
/>
|
|
79
|
+
<UButton
|
|
80
|
+
icon="i-lucide-arrow-down"
|
|
81
|
+
color="neutral"
|
|
82
|
+
variant="ghost"
|
|
83
|
+
:disabled="index === state.roles.length - 1"
|
|
84
|
+
:aria-label="t('admin.moveDown', 'Move down')"
|
|
85
|
+
@click="move(index, 1)"
|
|
86
|
+
/>
|
|
87
|
+
<UButton
|
|
88
|
+
icon="i-lucide-trash-2"
|
|
89
|
+
color="error"
|
|
90
|
+
variant="ghost"
|
|
91
|
+
:disabled="state.roles.length === 1"
|
|
92
|
+
:aria-label="t('admin.removeRole', 'Remove role')"
|
|
93
|
+
@click="state.roles.splice(index, 1)"
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
<TranslatedInput v-model="role.label" />
|
|
97
|
+
</div>
|
|
98
|
+
<UButton
|
|
99
|
+
icon="i-lucide-plus"
|
|
100
|
+
color="neutral"
|
|
101
|
+
variant="outline"
|
|
102
|
+
:label="t('admin.addRole', 'Add role')"
|
|
103
|
+
class="self-start"
|
|
104
|
+
@click="state.roles.push({ key: '', label: void 0 })"
|
|
105
|
+
/>
|
|
106
|
+
<UFormField
|
|
107
|
+
:label="t('admin.leadFrom', 'Leads from')"
|
|
108
|
+
:description="t('admin.leadFromHelp', 'People with this role or higher lead their team.')"
|
|
109
|
+
>
|
|
110
|
+
<USelect
|
|
111
|
+
v-model="leadFrom"
|
|
112
|
+
:items="leadOptions"
|
|
113
|
+
class="w-full"
|
|
114
|
+
/>
|
|
115
|
+
</UFormField>
|
|
116
|
+
<UAlert
|
|
117
|
+
v-if="issues.length"
|
|
118
|
+
color="warning"
|
|
119
|
+
variant="subtle"
|
|
120
|
+
icon="i-lucide-triangle-alert"
|
|
121
|
+
:description="issues.join(' ')"
|
|
122
|
+
/>
|
|
123
|
+
</form>
|
|
124
|
+
</FormSlideover>
|
|
125
|
+
</template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StaffTeamLadder } from '../utils/admin-team.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
ladder: StaffTeamLadder;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
close: (saved: false | import("../../utils/index.js").TeamLadderDto) => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
8
|
+
onClose?: ((saved: false | import("../../utils/index.js").TeamLadderDto) => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StaffTeam, StaffTeamLadder, StaffTeamMapping } from '../utils/admin-team.js';
|
|
2
|
+
import type { TeamOwner } from '../../../types.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
owner: TeamOwner;
|
|
5
|
+
ladders: StaffTeamLadder[];
|
|
6
|
+
team?: StaffTeam;
|
|
7
|
+
mapping?: StaffTeamMapping;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
close: (saved: false | import("../../utils/index.js").TeamRoleMappingDto) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onClose?: ((saved: false | import("../../utils/index.js").TeamRoleMappingDto) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { teamRoleOptions } from "../utils/admin-team";
|
|
4
|
+
import { teamsApi } from "../../utils/api";
|
|
5
|
+
import { $fetch, computed, reactive, useAction, useModuleT, useTeamsTranslate } from "#imports";
|
|
6
|
+
defineOptions({ name: "TeamMappingSlideover" });
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
owner: { type: Object, required: true },
|
|
9
|
+
ladders: { type: Array, required: true },
|
|
10
|
+
team: { type: Object, required: false },
|
|
11
|
+
mapping: { type: Object, required: false }
|
|
12
|
+
});
|
|
13
|
+
const emit = defineEmits(["close"]);
|
|
14
|
+
const t = useModuleT("teams");
|
|
15
|
+
const tr = useTeamsTranslate();
|
|
16
|
+
const { busy, run } = useAction();
|
|
17
|
+
const schema = z.object({
|
|
18
|
+
matchType: z.enum(["role", "plan"]),
|
|
19
|
+
matchValue: z.string().trim().min(1, t("admin.matchRequired", "Enter a role or a plan.")),
|
|
20
|
+
scope: z.enum(["team", "owner"]),
|
|
21
|
+
teamRole: z.string().min(1, t("admin.roleRequired", "Choose a role.")),
|
|
22
|
+
priority: z.number().int().min(-1e3).max(1e3)
|
|
23
|
+
});
|
|
24
|
+
const match = props.mapping?.match;
|
|
25
|
+
const state = reactive({
|
|
26
|
+
matchType: match && "plan" in match ? "plan" : "role",
|
|
27
|
+
matchValue: match ? "plan" in match ? match.plan : match.role : "",
|
|
28
|
+
scope: props.mapping ? props.mapping.teamId ? "team" : "owner" : props.team ? "team" : "owner",
|
|
29
|
+
teamRole: props.mapping?.teamRole ?? "",
|
|
30
|
+
priority: props.mapping?.priority ?? 0
|
|
31
|
+
});
|
|
32
|
+
const matchTypeOptions = computed(() => [
|
|
33
|
+
{ label: t("admin.matchRole", "A global role"), value: "role" },
|
|
34
|
+
{ label: t("admin.matchPlan", "An active subscription plan"), value: "plan" }
|
|
35
|
+
]);
|
|
36
|
+
const scopeOptions = computed(() => [
|
|
37
|
+
...props.team || props.mapping?.teamId ? [{ label: t("admin.scopeTeam", "This team only"), value: "team" }] : [],
|
|
38
|
+
{ label: t("admin.scopeOwner", "Every team of the owner"), value: "owner" }
|
|
39
|
+
]);
|
|
40
|
+
const roleOptions = computed(() => {
|
|
41
|
+
if (state.scope === "team" && props.team) return teamRoleOptions(props.ladders, props.team.kind, tr);
|
|
42
|
+
const seen = /* @__PURE__ */ new Map();
|
|
43
|
+
for (const ladder of props.ladders) for (const option of teamRoleOptions([ladder], ladder.kind, tr)) if (!seen.has(option.value)) seen.set(option.value, option.label);
|
|
44
|
+
return [...seen].map(([value, label]) => ({ value, label }));
|
|
45
|
+
});
|
|
46
|
+
async function save(event) {
|
|
47
|
+
const data = event.data;
|
|
48
|
+
const body = {
|
|
49
|
+
match: data.matchType === "plan" ? { plan: data.matchValue } : { role: data.matchValue },
|
|
50
|
+
teamRole: data.teamRole,
|
|
51
|
+
priority: data.priority,
|
|
52
|
+
teamId: data.scope === "team" ? props.team?.id ?? props.mapping?.teamId ?? null : null
|
|
53
|
+
};
|
|
54
|
+
const saved = await run(
|
|
55
|
+
() => props.mapping ? $fetch(teamsApi.admin.mapping(props.mapping.id), { method: "PATCH", body }) : $fetch(teamsApi.admin.mappings, { method: "POST", body: { ...body, ownerType: props.owner.ownerType, ownerId: props.owner.ownerId } }),
|
|
56
|
+
{ success: props.mapping ? t("admin.mappingSaved", "Saved the mapping rule") : t("admin.mappingCreated", "Added the mapping rule") }
|
|
57
|
+
);
|
|
58
|
+
if (saved) emit("close", saved);
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<template>
|
|
63
|
+
<FormSlideover
|
|
64
|
+
form-id="team-mapping-form"
|
|
65
|
+
:title="mapping ? t('admin.editMapping', 'Edit mapping rule') : t('admin.addMapping', 'Add mapping rule')"
|
|
66
|
+
:description="t('admin.mappingHelp', 'People who meet the rule hold the team role without being added. An explicit membership always wins.')"
|
|
67
|
+
:submit-label="mapping ? t('admin.saveMapping', 'Save mapping rule') : t('admin.addMappingAction', 'Add mapping rule')"
|
|
68
|
+
:loading="busy"
|
|
69
|
+
@close="emit('close', false)"
|
|
70
|
+
>
|
|
71
|
+
<UForm
|
|
72
|
+
id="team-mapping-form"
|
|
73
|
+
:schema="schema"
|
|
74
|
+
:state="state"
|
|
75
|
+
class="flex flex-col gap-4"
|
|
76
|
+
@submit="save"
|
|
77
|
+
>
|
|
78
|
+
<UFormField
|
|
79
|
+
name="matchType"
|
|
80
|
+
:label="t('admin.matchType', 'Who')"
|
|
81
|
+
required
|
|
82
|
+
>
|
|
83
|
+
<USelect
|
|
84
|
+
v-model="state.matchType"
|
|
85
|
+
:items="matchTypeOptions"
|
|
86
|
+
class="w-full"
|
|
87
|
+
/>
|
|
88
|
+
</UFormField>
|
|
89
|
+
<UFormField
|
|
90
|
+
name="matchValue"
|
|
91
|
+
:label="state.matchType === 'plan' ? t('admin.plan', 'Plan') : t('admin.globalRole', 'Global role')"
|
|
92
|
+
:description="state.matchType === 'plan' ? t('admin.planHelp', 'The plan key, such as yearly. Needs the subscriptions module.') : t('admin.globalRoleHelp', 'The key of a global role. Roles that inherit it match too.')"
|
|
93
|
+
required
|
|
94
|
+
>
|
|
95
|
+
<UInput
|
|
96
|
+
v-model="state.matchValue"
|
|
97
|
+
class="w-full"
|
|
98
|
+
/>
|
|
99
|
+
</UFormField>
|
|
100
|
+
<UFormField
|
|
101
|
+
name="scope"
|
|
102
|
+
:label="t('admin.scope', 'Teams')"
|
|
103
|
+
required
|
|
104
|
+
>
|
|
105
|
+
<USelect
|
|
106
|
+
v-model="state.scope"
|
|
107
|
+
:items="scopeOptions"
|
|
108
|
+
class="w-full"
|
|
109
|
+
/>
|
|
110
|
+
</UFormField>
|
|
111
|
+
<UFormField
|
|
112
|
+
name="teamRole"
|
|
113
|
+
:label="t('admin.teamRole', 'Team role')"
|
|
114
|
+
required
|
|
115
|
+
>
|
|
116
|
+
<USelect
|
|
117
|
+
v-model="state.teamRole"
|
|
118
|
+
:items="roleOptions"
|
|
119
|
+
class="w-full"
|
|
120
|
+
/>
|
|
121
|
+
</UFormField>
|
|
122
|
+
<UFormField
|
|
123
|
+
name="priority"
|
|
124
|
+
:label="t('admin.priority', 'Priority')"
|
|
125
|
+
:description="t('admin.priorityHelp', 'When several rules match one person on a team, the highest priority wins, then the higher role.')"
|
|
126
|
+
>
|
|
127
|
+
<UInputNumber
|
|
128
|
+
v-model="state.priority"
|
|
129
|
+
class="w-full"
|
|
130
|
+
/>
|
|
131
|
+
</UFormField>
|
|
132
|
+
</UForm>
|
|
133
|
+
</FormSlideover>
|
|
134
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StaffTeam, StaffTeamLadder, StaffTeamMapping } from '../utils/admin-team.js';
|
|
2
|
+
import type { TeamOwner } from '../../../types.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
owner: TeamOwner;
|
|
5
|
+
ladders: StaffTeamLadder[];
|
|
6
|
+
team?: StaffTeam;
|
|
7
|
+
mapping?: StaffTeamMapping;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
close: (saved: false | import("../../utils/index.js").TeamRoleMappingDto) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onClose?: ((saved: false | import("../../utils/index.js").TeamRoleMappingDto) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StaffTeam, StaffTeamLadder, StaffTeamMember } from '../utils/admin-team.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
team: StaffTeam;
|
|
4
|
+
ladders: StaffTeamLadder[];
|
|
5
|
+
member?: StaffTeamMember;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
close: (saved: false | import("../../utils/index.js").TeamMemberDto) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onClose?: ((saved: false | import("../../utils/index.js").TeamMemberDto) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { teamRoleOptions } from "../utils/admin-team";
|
|
4
|
+
import { teamsApi } from "../../utils/api";
|
|
5
|
+
import { $fetch, computed, reactive, ref, useAction, useModuleT, useTeamsTranslate } from "#imports";
|
|
6
|
+
defineOptions({ name: "TeamMemberSlideover" });
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
team: { type: Object, required: true },
|
|
9
|
+
ladders: { type: Array, required: true },
|
|
10
|
+
member: { type: Object, required: false }
|
|
11
|
+
});
|
|
12
|
+
const emit = defineEmits(["close"]);
|
|
13
|
+
const t = useModuleT("teams");
|
|
14
|
+
const tr = useTeamsTranslate();
|
|
15
|
+
const { busy, run } = useAction();
|
|
16
|
+
const editing = computed(() => props.member?.source === "explicit");
|
|
17
|
+
const roleOptions = computed(() => teamRoleOptions(props.ladders, props.team.kind, tr));
|
|
18
|
+
const picked = ref(null);
|
|
19
|
+
const schema = z.object({
|
|
20
|
+
userId: z.number({ error: t("admin.userRequired", "Choose a person.") }).int().positive(),
|
|
21
|
+
role: z.string().min(1, t("admin.roleRequired", "Choose a role."))
|
|
22
|
+
});
|
|
23
|
+
const lowest = () => roleOptions.value.at(-1)?.value ?? "";
|
|
24
|
+
const state = reactive({ userId: props.member?.userId, role: props.member?.role ?? lowest() });
|
|
25
|
+
async function save(event) {
|
|
26
|
+
const { userId, role } = event.data;
|
|
27
|
+
const name = props.member?.name ?? (picked.value?.id === userId ? picked.value.name || picked.value.email : null) ?? `#${userId}`;
|
|
28
|
+
const saved = await run(
|
|
29
|
+
() => editing.value ? $fetch(teamsApi.admin.member(props.team.id, userId), { method: "PATCH", body: { role } }) : $fetch(teamsApi.admin.members(props.team.id), { method: "POST", body: { userId, role } }),
|
|
30
|
+
{ success: editing.value ? t("admin.memberRoleChanged", "Changed the role of {name}", { name }) : t("admin.memberAdded", "Added {name} to {team}", { name, team: tr(props.team.name) }) }
|
|
31
|
+
);
|
|
32
|
+
if (saved) emit("close", saved);
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<FormSlideover
|
|
38
|
+
form-id="team-member-form"
|
|
39
|
+
:title="member ? t('admin.changeRoleTitle', 'Change role of {name}', { name: member.name ?? '' }) : t('admin.addMember', 'Add member')"
|
|
40
|
+
:description="member?.source === 'mapped' ? t('admin.mappedToExplicit', 'A mapping rule gives them their role now. Saving makes the membership explicit, so it no longer follows the rule.') : void 0"
|
|
41
|
+
:submit-label="editing ? t('admin.saveRole', 'Save role') : t('admin.addMemberAction', 'Add member')"
|
|
42
|
+
:loading="busy"
|
|
43
|
+
@close="emit('close', false)"
|
|
44
|
+
>
|
|
45
|
+
<UForm
|
|
46
|
+
id="team-member-form"
|
|
47
|
+
:schema="schema"
|
|
48
|
+
:state="state"
|
|
49
|
+
class="flex flex-col gap-4"
|
|
50
|
+
@submit="save"
|
|
51
|
+
>
|
|
52
|
+
<UFormField
|
|
53
|
+
v-if="!member"
|
|
54
|
+
name="userId"
|
|
55
|
+
:label="t('admin.person', 'Person')"
|
|
56
|
+
:description="t('admin.personHelp', 'Search by name or email.')"
|
|
57
|
+
required
|
|
58
|
+
>
|
|
59
|
+
<UserPicker
|
|
60
|
+
v-model="state.userId"
|
|
61
|
+
:endpoint="teamsApi.admin.users"
|
|
62
|
+
:placeholder="t('admin.searchPeople', 'Search people')"
|
|
63
|
+
@picked="(user) => picked = user"
|
|
64
|
+
/>
|
|
65
|
+
</UFormField>
|
|
66
|
+
<UFormField
|
|
67
|
+
name="role"
|
|
68
|
+
:label="t('admin.role', 'Role')"
|
|
69
|
+
required
|
|
70
|
+
>
|
|
71
|
+
<USelect
|
|
72
|
+
v-model="state.role"
|
|
73
|
+
:items="roleOptions"
|
|
74
|
+
class="w-full"
|
|
75
|
+
/>
|
|
76
|
+
</UFormField>
|
|
77
|
+
</UForm>
|
|
78
|
+
</FormSlideover>
|
|
79
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StaffTeam, StaffTeamLadder, StaffTeamMember } from '../utils/admin-team.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
team: StaffTeam;
|
|
4
|
+
ladders: StaffTeamLadder[];
|
|
5
|
+
member?: StaffTeamMember;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
close: (saved: false | import("../../utils/index.js").TeamMemberDto) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onClose?: ((saved: false | import("../../utils/index.js").TeamMemberDto) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useTeamsLocale, useTeamsFallbackLocale, useTeamsTranslate } from './useTeamsTranslate.js';
|
|
2
|
+
export { useTeamLinks } from './useTeamLinks.js';
|
|
3
|
+
export { useTeamActions } from './useTeamActions.js';
|
|
4
|
+
export type { TeamMenuOptions } from './useTeamActions.js';
|
|
5
|
+
export { useTeamMemberActions } from './useTeamMemberActions.js';
|
|
6
|
+
export { useTeamMappingActions } from './useTeamMappingActions.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useTeamsLocale, useTeamsFallbackLocale, useTeamsTranslate } from "./useTeamsTranslate.js";
|
|
2
|
+
export { useTeamLinks } from "./useTeamLinks.js";
|
|
3
|
+
export { useTeamActions } from "./useTeamActions.js";
|
|
4
|
+
export { useTeamMemberActions } from "./useTeamMemberActions.js";
|
|
5
|
+
export { useTeamMappingActions } from "./useTeamMappingActions.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DropdownMenuItem } from '@nuxt/ui';
|
|
2
|
+
import type { StaffTeam } from '../utils/admin-team.js';
|
|
3
|
+
import type { TeamOwner } from '../../../types.js';
|
|
4
|
+
export type TeamMenuOptions = {
|
|
5
|
+
/** Runs after the team was deleted (refresh a list, leave the team page). */
|
|
6
|
+
onRemoved?: () => unknown;
|
|
7
|
+
/** Runs after the team was edited. */
|
|
8
|
+
onChanged?: () => unknown;
|
|
9
|
+
/** Leave out "Open", e.g. on the team's own page. Defaults to `true`. */
|
|
10
|
+
open?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* What staff can do with a team, shared by the list, the team page and the Teams tab of an owner: `create` (a
|
|
14
|
+
* slideover, optionally for a fixed `owner`; navigates to the new team unless `navigate: false`), `edit`, `remove`
|
|
15
|
+
* (confirms first) and `menu(team)`: Open | Edit | Delete.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useTeamActions(): {
|
|
18
|
+
create: (options?: {
|
|
19
|
+
owner?: TeamOwner;
|
|
20
|
+
navigate?: boolean;
|
|
21
|
+
}) => Promise<StaffTeam | false>;
|
|
22
|
+
edit: (team: StaffTeam) => Promise<StaffTeam | false>;
|
|
23
|
+
remove: (team: StaffTeam) => Promise<boolean>;
|
|
24
|
+
menu: (team: StaffTeam, options?: TeamMenuOptions) => DropdownMenuItem[][];
|
|
25
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import TeamFormSlideover from "../components/TeamFormSlideover.vue";
|
|
2
|
+
import { teamsApi } from "../../utils/api.js";
|
|
3
|
+
import { $fetch, navigateTo, useAction, useConfirmDialog, useModuleT, useOverlay, useTeamLinks, useTeamsTranslate } from "#imports";
|
|
4
|
+
export function useTeamActions() {
|
|
5
|
+
const t = useModuleT("teams");
|
|
6
|
+
const overlay = useOverlay();
|
|
7
|
+
const confirm = useConfirmDialog();
|
|
8
|
+
const { run } = useAction();
|
|
9
|
+
const links = useTeamLinks();
|
|
10
|
+
const tr = useTeamsTranslate();
|
|
11
|
+
async function create(options = {}) {
|
|
12
|
+
const created = await overlay.create(TeamFormSlideover, { destroyOnClose: true, props: { team: void 0, owner: options.owner } }).open();
|
|
13
|
+
if (!created) return false;
|
|
14
|
+
if (options.navigate !== false) await navigateTo(links.adminTeam(created.id));
|
|
15
|
+
return created;
|
|
16
|
+
}
|
|
17
|
+
async function edit(team) {
|
|
18
|
+
return await overlay.create(TeamFormSlideover, { destroyOnClose: true, props: { team } }).open();
|
|
19
|
+
}
|
|
20
|
+
async function remove(team) {
|
|
21
|
+
const name = tr(team.name);
|
|
22
|
+
const confirmed = await confirm({
|
|
23
|
+
title: t("admin.deleteTitle", "Delete {name}?", { name }),
|
|
24
|
+
description: t("admin.deleteDescription", "Its {count} members lose their role on it, and the mapping rules for this team are deleted too.", { count: team.memberCount }),
|
|
25
|
+
confirmText: t("admin.deleteAction", "Delete team"),
|
|
26
|
+
destructive: true
|
|
27
|
+
});
|
|
28
|
+
if (!confirmed) return false;
|
|
29
|
+
const done = await run(
|
|
30
|
+
// 204: resolves with no body, so map success to `true` (`run` resolves `undefined` on failure).
|
|
31
|
+
() => $fetch(teamsApi.admin.team(team.id), { method: "DELETE" }).then(() => true),
|
|
32
|
+
{ success: t("admin.deleted", "Deleted {name}", { name }), error: t("admin.deleteFailed", "Could not delete the team") }
|
|
33
|
+
);
|
|
34
|
+
return done === true;
|
|
35
|
+
}
|
|
36
|
+
function menu(team, options = {}) {
|
|
37
|
+
const main = options.open === false ? [] : [{ label: t("admin.open", "Open"), icon: "i-lucide-arrow-right", to: links.adminTeam(team.id) }];
|
|
38
|
+
const edits = [{
|
|
39
|
+
label: t("admin.edit", "Edit"),
|
|
40
|
+
icon: "i-lucide-pencil",
|
|
41
|
+
onSelect: async () => {
|
|
42
|
+
if (await edit(team)) await options.onChanged?.();
|
|
43
|
+
}
|
|
44
|
+
}];
|
|
45
|
+
const destructive = [{
|
|
46
|
+
label: t("admin.deleteAction", "Delete team"),
|
|
47
|
+
icon: "i-lucide-trash-2",
|
|
48
|
+
color: "error",
|
|
49
|
+
onSelect: async () => {
|
|
50
|
+
if (await remove(team)) await options.onRemoved?.();
|
|
51
|
+
}
|
|
52
|
+
}];
|
|
53
|
+
return [main, edits, destructive].filter((group) => group.length);
|
|
54
|
+
}
|
|
55
|
+
return { create, edit, remove, menu };
|
|
56
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale-aware links to the teams pages (the admin list, optionally filtered by owner, and a team's page). Always use
|
|
3
|
+
* these instead of building the path by hand: they keep the locale prefix and follow `teams.settings.pages`.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useTeamLinks(): {
|
|
6
|
+
admin: (query?: Record<string, string>) => string;
|
|
7
|
+
adminTeam: (id: string) => string;
|
|
8
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createTeamLinks } from "../../utils/links.js";
|
|
2
|
+
import { useLocaleLink, useRuntimeConfig } from "#imports";
|
|
3
|
+
export function useTeamLinks() {
|
|
4
|
+
const { localize } = useLocaleLink();
|
|
5
|
+
return createTeamLinks(useRuntimeConfig().public.teams?.pages, localize);
|
|
6
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DropdownMenuItem } from '@nuxt/ui';
|
|
2
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
3
|
+
import type { StaffTeam, StaffTeamLadder, StaffTeamMapping } from '../utils/admin-team.js';
|
|
4
|
+
import type { TeamOwner } from '../../../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* What staff can do with the role mapping rules of an owner (seen from one `team`, when given): `create`, `edit`,
|
|
7
|
+
* `remove` (confirms first) and `menu(rule)`: Edit | Delete.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useTeamMappingActions(context: MaybeRefOrGetter<{
|
|
10
|
+
owner: TeamOwner;
|
|
11
|
+
ladders: StaffTeamLadder[];
|
|
12
|
+
team?: StaffTeam;
|
|
13
|
+
}>): {
|
|
14
|
+
create: () => Promise<false | import("../../utils/index.js").TeamRoleMappingDto>;
|
|
15
|
+
edit: (mapping: StaffTeamMapping) => Promise<false | import("../../utils/index.js").TeamRoleMappingDto>;
|
|
16
|
+
remove: (mapping: StaffTeamMapping) => Promise<boolean>;
|
|
17
|
+
menu: (mapping: StaffTeamMapping, options?: {
|
|
18
|
+
onChanged?: () => unknown;
|
|
19
|
+
}) => DropdownMenuItem[][];
|
|
20
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import TeamMappingSlideover from "../components/TeamMappingSlideover.vue";
|
|
2
|
+
import { teamsApi } from "../../utils/api.js";
|
|
3
|
+
import { $fetch, toValue, useAction, useConfirmDialog, useModuleT, useOverlay } from "#imports";
|
|
4
|
+
export function useTeamMappingActions(context) {
|
|
5
|
+
const t = useModuleT("teams");
|
|
6
|
+
const overlay = useOverlay();
|
|
7
|
+
const confirm = useConfirmDialog();
|
|
8
|
+
const { run } = useAction();
|
|
9
|
+
const open = (mapping) => overlay.create(TeamMappingSlideover, { destroyOnClose: true, props: { ...toValue(context), mapping } }).open();
|
|
10
|
+
const create = () => open();
|
|
11
|
+
const edit = (mapping) => open(mapping);
|
|
12
|
+
async function remove(mapping) {
|
|
13
|
+
const confirmed = await confirm({
|
|
14
|
+
title: t("admin.deleteMappingTitle", "Delete this mapping rule?"),
|
|
15
|
+
description: t("admin.deleteMappingDescription", "People who only held a role through it lose that role on the next request."),
|
|
16
|
+
confirmText: t("admin.deleteMappingAction", "Delete mapping rule"),
|
|
17
|
+
destructive: true
|
|
18
|
+
});
|
|
19
|
+
if (!confirmed) return false;
|
|
20
|
+
const done = await run(
|
|
21
|
+
() => $fetch(teamsApi.admin.mapping(mapping.id), { method: "DELETE" }).then(() => true),
|
|
22
|
+
{ success: t("admin.mappingDeleted", "Deleted the mapping rule"), error: t("admin.deleteMappingFailed", "Could not delete the mapping rule") }
|
|
23
|
+
);
|
|
24
|
+
return done === true;
|
|
25
|
+
}
|
|
26
|
+
function menu(mapping, options = {}) {
|
|
27
|
+
return [
|
|
28
|
+
[{
|
|
29
|
+
label: t("admin.edit", "Edit"),
|
|
30
|
+
icon: "i-lucide-pencil",
|
|
31
|
+
onSelect: async () => {
|
|
32
|
+
if (await edit(mapping)) await options.onChanged?.();
|
|
33
|
+
}
|
|
34
|
+
}],
|
|
35
|
+
[{
|
|
36
|
+
label: t("admin.deleteMappingAction", "Delete mapping rule"),
|
|
37
|
+
icon: "i-lucide-trash-2",
|
|
38
|
+
color: "error",
|
|
39
|
+
onSelect: async () => {
|
|
40
|
+
if (await remove(mapping)) await options.onChanged?.();
|
|
41
|
+
}
|
|
42
|
+
}]
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
return { create, edit, remove, menu };
|
|
46
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DropdownMenuItem } from '@nuxt/ui';
|
|
2
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
3
|
+
import type { StaffTeam, StaffTeamLadder, StaffTeamMember } from '../utils/admin-team.js';
|
|
4
|
+
/**
|
|
5
|
+
* What staff can do with the members of `team`: `add` (a slideover with a user search), `changeRole` (for a mapped
|
|
6
|
+
* member it assigns the role explicitly), `remove` (explicit members only, confirms first) and `menu(member)`:
|
|
7
|
+
* Change role | Remove.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useTeamMemberActions(team: MaybeRefOrGetter<StaffTeam>, ladders: MaybeRefOrGetter<StaffTeamLadder[]>): {
|
|
10
|
+
add: () => Promise<false | import("../../utils/index.js").TeamMemberDto>;
|
|
11
|
+
changeRole: (member: StaffTeamMember) => Promise<false | import("../../utils/index.js").TeamMemberDto>;
|
|
12
|
+
remove: (member: StaffTeamMember) => Promise<boolean>;
|
|
13
|
+
menu: (member: StaffTeamMember, options?: {
|
|
14
|
+
onChanged?: () => unknown;
|
|
15
|
+
}) => DropdownMenuItem[][];
|
|
16
|
+
};
|