@frigear-nu/crew 0.1.2 → 0.1.4
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/dist/module.d.mts +22 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +34 -22
- package/dist/runtime/app/components/CrewAddMemberSlideover.d.vue.ts +2 -2
- package/dist/runtime/app/components/CrewAddMemberSlideover.vue.d.ts +2 -2
- package/dist/runtime/app/components/CrewInviteSlideover.vue +2 -2
- package/dist/runtime/app/components/CrewMemberSlideover.d.vue.ts +2 -2
- package/dist/runtime/app/components/CrewMemberSlideover.vue +22 -0
- package/dist/runtime/app/components/CrewMemberSlideover.vue.d.ts +2 -2
- package/dist/runtime/app/dashboard/CrewStatus.vue +12 -6
- package/dist/runtime/app/pages/apply.vue +3 -2
- package/dist/runtime/app/pages/invite.vue +5 -2
- package/dist/runtime/app/tabs/Crew.vue +38 -15
- package/dist/runtime/app/tabs/HomeStatus.vue +12 -7
- package/dist/runtime/app/widgets/InboxAddToCrew.vue +2 -1
- package/dist/runtime/dashboard.d.ts +5 -2
- package/dist/runtime/dashboard.js +2 -0
- package/dist/runtime/i18n/lang/da.json +18 -2
- package/dist/runtime/i18n/lang/en.json +18 -2
- package/dist/runtime/server/routes/admin/media-opt-outs.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/media-opt-outs.get.js +22 -0
- package/dist/runtime/server/utils/crew-dto.d.ts +7 -1
- package/dist/runtime/server/utils/crew-dto.js +3 -0
- package/dist/runtime/server/utils/crew-export.d.ts +15 -0
- package/dist/runtime/server/utils/crew-export.js +56 -0
- package/dist/runtime/server/utils/crew.js +9 -1
- package/dist/runtime/utils/api.d.ts +5 -0
- package/dist/runtime/utils/api.js +5 -0
- package/dist/runtime/utils/status.d.ts +2 -0
- package/dist/runtime/utils/status.js +1 -0
- package/dist/types.d.mts +1 -1
- package/package.json +24 -20
package/dist/module.d.mts
CHANGED
|
@@ -94,7 +94,13 @@ type CrewMemberDto = {
|
|
|
94
94
|
teamName: Translated;
|
|
95
95
|
userId: number;
|
|
96
96
|
name: string | null;
|
|
97
|
+
/** What the person likes to be called (`users.nickname`). */
|
|
98
|
+
nickname: string | null;
|
|
97
99
|
avatar: string | null;
|
|
100
|
+
/** The person asked not to be photographed as the main subject (`users.photoOptOut`, their own choice). */
|
|
101
|
+
photoOptOut: boolean;
|
|
102
|
+
/** The person asked not to be tagged in posts and photos online (`users.tagOptOut`, their own choice). */
|
|
103
|
+
tagOptOut: boolean;
|
|
98
104
|
/** Only with `crew:pii`; otherwise left out. */
|
|
99
105
|
email?: string | null;
|
|
100
106
|
/** Only with `crew:pii`; otherwise left out. */
|
|
@@ -112,6 +118,21 @@ type CrewMemberDto = {
|
|
|
112
118
|
/** The forms submission of the application (its answers need `crew:pii`). */
|
|
113
119
|
submissionId: string | null;
|
|
114
120
|
};
|
|
121
|
+
/**
|
|
122
|
+
* One person in the media opt-out export (`GET /api/admin/crew/operations/:operationId/media-opt-outs`, CSV): someone who
|
|
123
|
+
* takes part in the operation and opted out of photos or of tagging. Personal data: `crew:pii`.
|
|
124
|
+
*/
|
|
125
|
+
type CrewMediaOptOutRow = {
|
|
126
|
+
userId: number;
|
|
127
|
+
name: string;
|
|
128
|
+
nickname: string | null;
|
|
129
|
+
email: string;
|
|
130
|
+
avatar: string | null;
|
|
131
|
+
photoOptOut: boolean;
|
|
132
|
+
tagOptOut: boolean;
|
|
133
|
+
/** The names of the person's teams in the operation, in the export's language. */
|
|
134
|
+
teams: string[];
|
|
135
|
+
};
|
|
115
136
|
/** A user the "Add crew member" picker found (`GET /api/admin/crew/users?q=`); `email` only with `crew:pii`. */
|
|
116
137
|
type CrewUserLookupDto = {
|
|
117
138
|
id: number;
|
|
@@ -247,4 +268,4 @@ declare module 'nitropack' {
|
|
|
247
268
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
248
269
|
|
|
249
270
|
export { _default as default };
|
|
250
|
-
export type { CreatedCrewInviteDto, CrewApplyDto, CrewFormOptionDto, CrewInviteDto, CrewMemberContext, CrewMemberDto, CrewRolePreset, CrewRuntimeConfig, CrewSettingsDto, CrewStatus, CrewStatusEmail, CrewStatusEmails, CrewSubmissionDto, CrewUserLookupDto, ModuleOptions, MyCrewDto, PublicModuleOptions };
|
|
271
|
+
export type { CreatedCrewInviteDto, CrewApplyDto, CrewFormOptionDto, CrewInviteDto, CrewMediaOptOutRow, CrewMemberContext, CrewMemberDto, CrewRolePreset, CrewRuntimeConfig, CrewSettingsDto, CrewStatus, CrewStatusEmail, CrewStatusEmails, CrewSubmissionDto, CrewUserLookupDto, ModuleOptions, MyCrewDto, PublicModuleOptions };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, hasNuxtModule, addServerImportsDir, addNitroPlugin, addImports, addComponentsDir } from '@nuxt/kit';
|
|
2
|
-
import { registerModule, registerTailwindSource, registerLocales, resolveDashboardHubPath, isPathUnder, resolvePagePath, registerDatabaseTable, extendDatabaseTable, addModuleRoutes, inlineModuleRuntime, addModulePages, addPageRedirects, addOptionalMenuSource } from '@frigear-nu/module-kit/utils';
|
|
2
|
+
import { registerModule, registerTailwindSource, registerLocales, resolveDashboardHubPath, isPathUnder, resolvePagePath, registerDatabaseTable, extendDatabaseTable, addModuleRoutes, inlineModuleRuntime, isClientOnlyApp, addModulePages, addPageRedirects, addOptionalMenuSource, serverModuleDependencies } from '@frigear-nu/module-kit/utils';
|
|
3
3
|
import { registerAccess, addPolicies, guardPages } from '@frigear-nu/auth/utils';
|
|
4
4
|
import { crewAccess } from '../dist/runtime/access.js';
|
|
5
5
|
import { resolveCrewHomePath, CREW_DEFAULT_PAGES, CREW_HOME_TABS, CREW_HOME_TAB, crewHomeTab } from '../dist/runtime/utils/links.js';
|
|
6
|
-
import { extendDashboard } from '@frigear-nu/dashboard/utils';
|
|
7
|
-
import {
|
|
6
|
+
import { extendDashboard, extendHubDashboard } from '@frigear-nu/dashboard/utils';
|
|
7
|
+
import { crewDashboardItems, CREW_DASHBOARD } from '../dist/runtime/dashboard.js';
|
|
8
8
|
import { extendNotificationTopics } from '@frigear-nu/notify/utils';
|
|
9
9
|
import { crewNotificationTopics } from '../dist/runtime/notifications.js';
|
|
10
10
|
|
|
11
|
+
function crewMobileTab(pages) {
|
|
12
|
+
const to = pages.inDashboard && pages.home ? pages.home : pages.status;
|
|
13
|
+
if (!to) return void 0;
|
|
14
|
+
return {
|
|
15
|
+
id: "crew",
|
|
16
|
+
to,
|
|
17
|
+
label: "Crew",
|
|
18
|
+
labelKey: "crew.mobile.tab",
|
|
19
|
+
icon: "i-lucide-hand-heart",
|
|
20
|
+
sfSymbol: "person.3",
|
|
21
|
+
sfSymbolActive: "person.3.fill",
|
|
22
|
+
requiresAuth: true
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
11
26
|
const MODULE_NAME = "@frigear-nu/crew";
|
|
12
27
|
const module$1 = defineNuxtModule({
|
|
13
28
|
meta: { name: MODULE_NAME, configKey: "crew" },
|
|
14
29
|
defaults: {
|
|
15
30
|
settings: { pages: {} }
|
|
16
31
|
},
|
|
17
|
-
moduleDependencies: {
|
|
18
|
-
"@nuxthub/core": { version: ">=0.10" },
|
|
32
|
+
moduleDependencies: (nuxt) => ({
|
|
33
|
+
...serverModuleDependencies(nuxt, { "@nuxthub/core": { version: ">=0.10" } }),
|
|
19
34
|
"@frigear-nu/module-kit": { version: ">=0.0.1" },
|
|
20
35
|
"@frigear-nu/auth": { version: ">=0.0.1" },
|
|
21
36
|
// The crew are users: the member list, the phone number and the emails read the `users` table.
|
|
@@ -38,7 +53,7 @@ const module$1 = defineNuxtModule({
|
|
|
38
53
|
"@frigear-nu/mobile": { version: ">=0.0.0", optional: true },
|
|
39
54
|
// Renders the `crew-status-*` emails from the templates this module ships.
|
|
40
55
|
"@frigear-nu/email-templates": { version: ">=0.0.1", optional: true }
|
|
41
|
-
},
|
|
56
|
+
}),
|
|
42
57
|
async setup(options, nuxt) {
|
|
43
58
|
registerModule(MODULE_NAME, nuxt);
|
|
44
59
|
const resolver = createResolver(import.meta.url);
|
|
@@ -89,6 +104,7 @@ const module$1 = defineNuxtModule({
|
|
|
89
104
|
{ method: "post", path: "operations/:operationId/members", file: "admin/members.post" },
|
|
90
105
|
{ method: "post", path: "operations/:operationId/members/approve", file: "admin/members-approve.post" },
|
|
91
106
|
{ method: "get", path: "operations/:operationId/invites", file: "admin/invites.get" },
|
|
107
|
+
{ method: "get", path: "operations/:operationId/media-opt-outs", file: "admin/media-opt-outs.get" },
|
|
92
108
|
{ method: "post", path: "operations/:operationId/invites", file: "admin/invites.post" },
|
|
93
109
|
{ method: "get", path: "forms", file: "admin/forms.get" },
|
|
94
110
|
{ method: "get", path: "users", file: "admin/users.get" },
|
|
@@ -100,11 +116,13 @@ const module$1 = defineNuxtModule({
|
|
|
100
116
|
{ method: "get", path: "members/:id/submission", file: "admin/member-submission.get" },
|
|
101
117
|
{ method: "delete", path: "invites/:id", file: "admin/invite.delete" }
|
|
102
118
|
], { base: "/api/admin/crew" });
|
|
103
|
-
addServerImportsDir(resolver.resolve("./runtime/server/utils"));
|
|
104
119
|
inlineModuleRuntime(nuxt, resolver);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
120
|
+
if (!isClientOnlyApp(nuxt)) {
|
|
121
|
+
addServerImportsDir(resolver.resolve("./runtime/server/utils"));
|
|
122
|
+
addNitroPlugin(resolver.resolve("./runtime/server/plugins/participation"));
|
|
123
|
+
addNitroPlugin(resolver.resolve("./runtime/server/plugins/forms"));
|
|
124
|
+
nuxt.hook("notify:email:templates", (sources) => sources.push({ dir: resolver.resolve("./runtime/emails") }));
|
|
125
|
+
}
|
|
108
126
|
addImports([
|
|
109
127
|
{ name: "useCrewLinks", from: resolver.resolve("./runtime/app/composables/useCrewLinks") },
|
|
110
128
|
{ name: "useCrewActions", from: resolver.resolve("./runtime/app/composables/useCrewActions") },
|
|
@@ -150,21 +168,15 @@ const module$1 = defineNuxtModule({
|
|
|
150
168
|
order: 10,
|
|
151
169
|
permission: crewAccess.permissions.manage
|
|
152
170
|
});
|
|
153
|
-
|
|
171
|
+
const mobileTab = hasNuxtModule("@frigear-nu/mobile") ? crewMobileTab({ home: homePath, status: statusPath, inDashboard }) : void 0;
|
|
172
|
+
if (mobileTab) {
|
|
154
173
|
const { extendMobileTabs } = await import('@frigear-nu/mobile/utils');
|
|
155
|
-
extendMobileTabs(nuxt,
|
|
156
|
-
id: "crew",
|
|
157
|
-
to: statusPath,
|
|
158
|
-
label: "Crew",
|
|
159
|
-
labelKey: "crew.mobile.tab",
|
|
160
|
-
icon: "i-lucide-hand-heart",
|
|
161
|
-
sfSymbol: "person.3",
|
|
162
|
-
sfSymbolActive: "person.3.fill",
|
|
163
|
-
requiresAuth: true
|
|
164
|
-
});
|
|
174
|
+
extendMobileTabs(nuxt, mobileTab);
|
|
165
175
|
}
|
|
166
176
|
extendNotificationTopics(nuxt, crewNotificationTopics);
|
|
167
|
-
|
|
177
|
+
const dashboardItems = crewDashboardItems((path) => resolver.resolve(path));
|
|
178
|
+
extendDashboard(nuxt, CREW_DASHBOARD, dashboardItems);
|
|
179
|
+
extendHubDashboard(nuxt, dashboardItems, { except: CREW_DASHBOARD });
|
|
168
180
|
addOptionalMenuSource(nuxt, { file: resolver.resolve("./runtime/menus"), menu: "dashboard" });
|
|
169
181
|
}
|
|
170
182
|
});
|
|
@@ -10,9 +10,9 @@ type __VLS_Props = {
|
|
|
10
10
|
prefill?: UserPickerCreateInitial;
|
|
11
11
|
};
|
|
12
12
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
-
close: (added: false | import("
|
|
13
|
+
close: (added: false | import("../../utils/index.js").CrewMemberDto) => any;
|
|
14
14
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
-
onClose?: ((added: false | import("
|
|
15
|
+
onClose?: ((added: false | import("../../utils/index.js").CrewMemberDto) => any) | undefined;
|
|
16
16
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
17
|
declare const _default: typeof __VLS_export;
|
|
18
18
|
export default _default;
|
|
@@ -10,9 +10,9 @@ type __VLS_Props = {
|
|
|
10
10
|
prefill?: UserPickerCreateInitial;
|
|
11
11
|
};
|
|
12
12
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
-
close: (added: false | import("
|
|
13
|
+
close: (added: false | import("../../utils/index.js").CrewMemberDto) => any;
|
|
14
14
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
-
onClose?: ((added: false | import("
|
|
15
|
+
onClose?: ((added: false | import("../../utils/index.js").CrewMemberDto) => any) | undefined;
|
|
16
16
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
17
|
declare const _default: typeof __VLS_export;
|
|
18
18
|
export default _default;
|
|
@@ -65,12 +65,12 @@ async function save(event) {
|
|
|
65
65
|
:ui="{ trailing: 'pe-1' }"
|
|
66
66
|
>
|
|
67
67
|
<template #trailing>
|
|
68
|
-
<
|
|
68
|
+
<TooltipButton
|
|
69
69
|
icon="i-lucide-copy"
|
|
70
70
|
color="neutral"
|
|
71
71
|
variant="link"
|
|
72
72
|
size="sm"
|
|
73
|
-
:
|
|
73
|
+
:tooltip="t('admin.copyLinkHint', 'Copy the invite link to your clipboard')"
|
|
74
74
|
@click="copy(link)"
|
|
75
75
|
/>
|
|
76
76
|
</template>
|
|
@@ -6,9 +6,9 @@ type __VLS_Props = {
|
|
|
6
6
|
pii: boolean;
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
-
close: (saved: false | import("
|
|
9
|
+
close: (saved: false | import("../../utils/index.js").CrewMemberDto) => any;
|
|
10
10
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
-
onClose?: ((saved: false | import("
|
|
11
|
+
onClose?: ((saved: false | import("../../utils/index.js").CrewMemberDto) => any) | undefined;
|
|
12
12
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const _default: typeof __VLS_export;
|
|
14
14
|
export default _default;
|
|
@@ -34,9 +34,12 @@ watch(() => state.teamId, () => {
|
|
|
34
34
|
});
|
|
35
35
|
const dash = "\u2013";
|
|
36
36
|
const facts = computed(() => [
|
|
37
|
+
...props.member.nickname ? [{ key: "nickname", label: t("admin.nickname", "Nickname"), value: props.member.nickname }] : [],
|
|
37
38
|
{ key: "status", label: t("admin.status", "Status"), value: t(`admin.statuses.${props.member.crewStatus}`, CREW_STATUS_LABELS[props.member.crewStatus]) },
|
|
38
39
|
{ key: "applied", label: t("admin.applied", "Applied"), value: props.member.appliedAt ? format.dateTime(props.member.appliedAt) : dash },
|
|
39
40
|
{ key: "previous", label: t("admin.previousCrew", "Earlier crew"), value: props.member.previousCrew ? t("admin.yes", "Yes") : t("admin.no", "No") },
|
|
41
|
+
{ key: "photos", label: t("admin.media.photos", "Photos"), value: props.member.photoOptOut ? t("admin.media.photosOptOut", "Do not photograph as the main subject") : t("admin.media.allowed", "No objection") },
|
|
42
|
+
{ key: "tagging", label: t("admin.media.tagging", "Tagging online"), value: props.member.tagOptOut ? t("admin.media.taggingOptOut", "Do not tag in posts or photos") : t("admin.media.allowed", "No objection") },
|
|
40
43
|
...props.pii ? [
|
|
41
44
|
{ key: "email", label: t("admin.email", "Email"), value: props.member.email || dash },
|
|
42
45
|
{ key: "phone", label: t("admin.phone", "Phone"), value: props.member.phone || dash }
|
|
@@ -65,6 +68,25 @@ async function save(event) {
|
|
|
65
68
|
@close="emit('close', false)"
|
|
66
69
|
>
|
|
67
70
|
<div class="flex flex-col gap-6">
|
|
71
|
+
<div
|
|
72
|
+
v-if="member.photoOptOut || member.tagOptOut"
|
|
73
|
+
class="flex flex-wrap gap-2"
|
|
74
|
+
>
|
|
75
|
+
<StatusBadge
|
|
76
|
+
v-if="member.photoOptOut"
|
|
77
|
+
status="noPhotos"
|
|
78
|
+
:colors="{ nophotos: 'warning' }"
|
|
79
|
+
icon="i-lucide-camera-off"
|
|
80
|
+
:label="t('admin.media.noPhotos', 'No photos')"
|
|
81
|
+
/>
|
|
82
|
+
<StatusBadge
|
|
83
|
+
v-if="member.tagOptOut"
|
|
84
|
+
status="noTagging"
|
|
85
|
+
:colors="{ notagging: 'warning' }"
|
|
86
|
+
icon="i-lucide-tag"
|
|
87
|
+
:label="t('admin.media.noTagging', 'No tagging')"
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
68
90
|
<DescriptionList :items="facts" />
|
|
69
91
|
|
|
70
92
|
<UForm
|
|
@@ -6,9 +6,9 @@ type __VLS_Props = {
|
|
|
6
6
|
pii: boolean;
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
-
close: (saved: false | import("
|
|
9
|
+
close: (saved: false | import("../../utils/index.js").CrewMemberDto) => any;
|
|
10
10
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
-
onClose?: ((saved: false | import("
|
|
11
|
+
onClose?: ((saved: false | import("../../utils/index.js").CrewMemberDto) => any) | undefined;
|
|
12
12
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const _default: typeof __VLS_export;
|
|
14
14
|
export default _default;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { crewApi } from "../../utils/api";
|
|
3
|
-
import { CREW_STATUS_LABELS } from "../../utils/status";
|
|
4
|
-
import { computed, surfaceClass, useCrewLinks, useCrewTranslate,
|
|
3
|
+
import { CREW_ME_KEY, CREW_STATUS_LABELS } from "../../utils/status";
|
|
4
|
+
import { computed, surfaceClass, useCachedFetch, useCrewLinks, useCrewTranslate, useModuleT } from "#imports";
|
|
5
5
|
defineOptions({ name: "CrewStatusItem" });
|
|
6
6
|
const t = useModuleT("crew");
|
|
7
7
|
const tr = useCrewTranslate();
|
|
8
8
|
const links = useCrewLinks();
|
|
9
|
-
const { data,
|
|
10
|
-
key:
|
|
11
|
-
|
|
9
|
+
const { data, error, loading, refresh } = useCachedFetch(crewApi.me.crew, {
|
|
10
|
+
key: CREW_ME_KEY,
|
|
11
|
+
ttl: 0,
|
|
12
|
+
lazy: true,
|
|
12
13
|
onResponseError: () => {
|
|
13
14
|
}
|
|
14
15
|
});
|
|
15
|
-
const loading = computed(() => status.value === "pending" && !data.value?.length);
|
|
16
16
|
const entries = computed(() => {
|
|
17
17
|
const all = data.value ?? [];
|
|
18
18
|
const open = all.filter((entry) => entry.crewStatus !== "withdrawn" && entry.crewStatus !== "rejected");
|
|
@@ -46,6 +46,12 @@ const color = (value) => ({ approved: "success", applied: "info", waitlisted: "n
|
|
|
46
46
|
v-else
|
|
47
47
|
:class="[surfaceClass, 'flex h-full flex-col']"
|
|
48
48
|
>
|
|
49
|
+
<!-- Offline or a failed refresh: the last data stays, with a quiet note. -->
|
|
50
|
+
<StaleDataNotice
|
|
51
|
+
:error="error"
|
|
52
|
+
:refresh="refresh"
|
|
53
|
+
class="px-4 pt-2.5"
|
|
54
|
+
/>
|
|
49
55
|
<ul class="divide-default flex-1 divide-y px-4 text-sm [&>li]:py-2.5">
|
|
50
56
|
<li
|
|
51
57
|
v-for="entry in entries"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { crewApi } from "../../utils/api";
|
|
3
|
-
import { crewApplyNotice } from "../../utils/status";
|
|
4
|
-
import { computed, createError, errorMessage, navigateTo, ref, useAuthPages, useCrewLinks, useCrewTranslate, useFetch, useFormat, useHead, useModuleT, useRoute } from "#imports";
|
|
3
|
+
import { CREW_ME_KEY, crewApplyNotice } from "../../utils/status";
|
|
4
|
+
import { clearCachedFetch, computed, createError, errorMessage, navigateTo, ref, useAuthPages, useCrewLinks, useCrewTranslate, useFetch, useFormat, useHead, useModuleT, useRoute } from "#imports";
|
|
5
5
|
defineOptions({ name: "CrewApplyPage" });
|
|
6
6
|
const t = useModuleT("crew");
|
|
7
7
|
const tr = useCrewTranslate();
|
|
@@ -18,6 +18,7 @@ if (error.value?.statusCode === 401) {
|
|
|
18
18
|
const submitted = ref(false);
|
|
19
19
|
async function onSubmitted() {
|
|
20
20
|
submitted.value = true;
|
|
21
|
+
clearCachedFetch(CREW_ME_KEY);
|
|
21
22
|
await refresh();
|
|
22
23
|
}
|
|
23
24
|
const notice = computed(() => data.value?.state === "applied" ? crewApplyNotice(data.value.crewStatus, submitted.value) : null);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { crewApi } from "../../utils/api";
|
|
3
|
-
import {
|
|
3
|
+
import { CREW_ME_KEY } from "../../utils/status";
|
|
4
|
+
import { $fetch, clearCachedFetch, errorMessage, ref, useAction, useAuthPages, useCrewLinks, useCrewTranslate, useFetch, useHead, useModuleT, useRoute } from "#imports";
|
|
4
5
|
defineOptions({ name: "CrewInvitePage" });
|
|
5
6
|
const t = useModuleT("crew");
|
|
6
7
|
const tr = useCrewTranslate();
|
|
@@ -20,7 +21,9 @@ async function accept() {
|
|
|
20
21
|
throw error;
|
|
21
22
|
})
|
|
22
23
|
);
|
|
23
|
-
if (result)
|
|
24
|
+
if (!result) return;
|
|
25
|
+
joined.value = result;
|
|
26
|
+
clearCachedFetch(CREW_ME_KEY);
|
|
24
27
|
}
|
|
25
28
|
const failureTitle = () => {
|
|
26
29
|
const status = failure.value?.statusCode;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { authApi } from "@frigear-nu/auth/api";
|
|
3
3
|
import { teamsApi } from "@frigear-nu/teams/api";
|
|
4
|
+
import { userDisplayName } from "@frigear-nu/users/api";
|
|
4
5
|
import { crewRoleLabel, isEmptyTranslated, localToIso, toLocalInput } from "../utils/admin-crew";
|
|
5
6
|
import { crewApi } from "../../utils/api";
|
|
7
|
+
import { useCrewLocale } from "../composables/useCrewTranslate";
|
|
6
8
|
import { CREW_STATUSES, CREW_STATUS_LABELS } from "../../utils/status";
|
|
7
9
|
import { $fetch, computed, emptyCell, errorMessage, h, reactive, ref, resolveComponent, tableUi, useAction, useCopyToClipboard, useCrewActions, useCrewLinks, useCrewTranslate, useFetch, useFormat, useModuleT, useRequestURL, useRuntimeConfig, useTableQuery, useTableSort, watch } from "#imports";
|
|
8
10
|
defineOptions({ name: "CrewOperationTab" });
|
|
@@ -11,6 +13,7 @@ const props = defineProps({
|
|
|
11
13
|
});
|
|
12
14
|
const t = useModuleT("crew");
|
|
13
15
|
const tr = useCrewTranslate();
|
|
16
|
+
const locale = useCrewLocale();
|
|
14
17
|
const format = useFormat();
|
|
15
18
|
const links = useCrewLinks();
|
|
16
19
|
const actions = useCrewActions();
|
|
@@ -97,6 +100,11 @@ const RowMenu = resolveComponent("RowMenu");
|
|
|
97
100
|
const TableIdentity = resolveComponent("TableIdentity");
|
|
98
101
|
const StatusBadge = resolveComponent("StatusBadge");
|
|
99
102
|
const UIcon = resolveComponent("UIcon");
|
|
103
|
+
const mediaBadges = (member) => [
|
|
104
|
+
member.photoOptOut ? h(StatusBadge, { status: "noPhotos", colors: { nophotos: "warning" }, icon: "i-lucide-camera-off", size: "sm", label: t("admin.media.noPhotos", "No photos") }) : null,
|
|
105
|
+
member.tagOptOut ? h(StatusBadge, { status: "noTagging", colors: { notagging: "warning" }, icon: "i-lucide-tag", size: "sm", label: t("admin.media.noTagging", "No tagging") }) : null
|
|
106
|
+
].filter(Boolean);
|
|
107
|
+
const mediaExportUrl = computed(() => `${crewApi.admin.mediaOptOuts(operationId.value)}?locale=${encodeURIComponent(locale.value)}`);
|
|
100
108
|
const columns = computed(() => [
|
|
101
109
|
{
|
|
102
110
|
id: "select",
|
|
@@ -116,7 +124,11 @@ const columns = computed(() => [
|
|
|
116
124
|
{
|
|
117
125
|
id: "name",
|
|
118
126
|
header: header("name", t("admin.name", "Name")),
|
|
119
|
-
cell: ({ row }) => h(TableIdentity, {
|
|
127
|
+
cell: ({ row }) => h(TableIdentity, {
|
|
128
|
+
title: row.original.name ? userDisplayName(row.original) : `#${row.original.userId}`,
|
|
129
|
+
description: row.original.email ?? null,
|
|
130
|
+
avatar: row.original.avatar ? { src: row.original.avatar } : void 0
|
|
131
|
+
}, { badges: () => mediaBadges(row.original) })
|
|
120
132
|
},
|
|
121
133
|
{
|
|
122
134
|
id: "crewStatus",
|
|
@@ -206,7 +218,7 @@ async function createInvite() {
|
|
|
206
218
|
}
|
|
207
219
|
const NONE = "__none";
|
|
208
220
|
const form = reactive({
|
|
209
|
-
formId:
|
|
221
|
+
formId: void 0,
|
|
210
222
|
defaultTeamId: NONE,
|
|
211
223
|
capacity: void 0,
|
|
212
224
|
waitlist: true,
|
|
@@ -219,7 +231,7 @@ const form = reactive({
|
|
|
219
231
|
const emailsOpen = ref(false);
|
|
220
232
|
function fillForm(value) {
|
|
221
233
|
if (!value) return;
|
|
222
|
-
form.formId = value.formId ??
|
|
234
|
+
form.formId = value.formId ?? void 0;
|
|
223
235
|
form.defaultTeamId = value.defaultTeamId ?? NONE;
|
|
224
236
|
form.capacity = value.capacity ?? void 0;
|
|
225
237
|
form.waitlist = value.waitlist;
|
|
@@ -234,12 +246,6 @@ function fillForm(value) {
|
|
|
234
246
|
}]));
|
|
235
247
|
}
|
|
236
248
|
watch(settings, fillForm, { immediate: true });
|
|
237
|
-
const formOptions = computed(() => {
|
|
238
|
-
const items = (eligibleForms.value ?? []).map((item) => ({ label: item.name, value: item.id }));
|
|
239
|
-
const current = settings.value?.formId;
|
|
240
|
-
if (current && !items.some((item) => item.value === current)) items.push({ label: current, value: current });
|
|
241
|
-
return [{ label: t("admin.noForm", "No form (applications closed)"), value: NONE }, ...items];
|
|
242
|
-
});
|
|
243
249
|
const teamSettingOptions = computed(() => [
|
|
244
250
|
{ label: t("admin.automaticTeam", "Automatic (the first team)"), value: NONE },
|
|
245
251
|
...teams.value.map((team) => ({ label: tr(team.name), value: team.id }))
|
|
@@ -263,7 +269,7 @@ async function saveSettings() {
|
|
|
263
269
|
() => $fetch(crewApi.admin.settings(operationId.value), {
|
|
264
270
|
method: "PUT",
|
|
265
271
|
body: {
|
|
266
|
-
formId: form.formId
|
|
272
|
+
formId: form.formId || null,
|
|
267
273
|
defaultTeamId: form.defaultTeamId === NONE ? null : form.defaultTeamId,
|
|
268
274
|
capacity: form.capacity ?? null,
|
|
269
275
|
waitlist: form.waitlist,
|
|
@@ -345,19 +351,34 @@ function jumpToSettings() {
|
|
|
345
351
|
:refreshing="refreshing"
|
|
346
352
|
>
|
|
347
353
|
<template #actions>
|
|
348
|
-
<
|
|
354
|
+
<TooltipButton
|
|
349
355
|
v-if="selectedIds.length"
|
|
350
356
|
icon="i-lucide-user-check"
|
|
351
357
|
size="sm"
|
|
352
358
|
color="neutral"
|
|
353
359
|
variant="outline"
|
|
354
360
|
:label="t('admin.approveSelected', 'Approve {count} selected', { count: selectedIds.length })"
|
|
361
|
+
:tooltip="t('admin.approveSelectedHint', 'Approve them right away; anyone who cannot be is skipped')"
|
|
355
362
|
@click="approveSelected"
|
|
356
363
|
/>
|
|
357
|
-
<
|
|
364
|
+
<TooltipButton
|
|
365
|
+
v-if="pii"
|
|
366
|
+
icon="i-lucide-camera-off"
|
|
367
|
+
size="sm"
|
|
368
|
+
color="neutral"
|
|
369
|
+
variant="outline"
|
|
370
|
+
:to="mediaExportUrl"
|
|
371
|
+
external
|
|
372
|
+
download
|
|
373
|
+
:label="t('admin.exportMediaOptOuts', 'Export photo opt-outs')"
|
|
374
|
+
:tooltip="t('admin.exportMediaOptOutsHelp', 'A spreadsheet of everyone taking part who does not want to be photographed or tagged.')"
|
|
375
|
+
data-crew-export-media
|
|
376
|
+
/>
|
|
377
|
+
<TooltipButton
|
|
358
378
|
icon="i-lucide-user-plus"
|
|
359
379
|
size="sm"
|
|
360
380
|
:label="t('admin.addMember', 'Add crew member')"
|
|
381
|
+
:tooltip="t('admin.addMemberHint', 'Put someone on the crew, approved, without an application')"
|
|
361
382
|
data-crew-add-member
|
|
362
383
|
@click="addMember"
|
|
363
384
|
/>
|
|
@@ -414,10 +435,11 @@ function jumpToSettings() {
|
|
|
414
435
|
:loading="invitesStatus === 'pending' && !invites.length"
|
|
415
436
|
>
|
|
416
437
|
<template #actions>
|
|
417
|
-
<
|
|
438
|
+
<TooltipButton
|
|
418
439
|
icon="i-lucide-plus"
|
|
419
440
|
size="sm"
|
|
420
441
|
:label="t('admin.createInvite', 'Create invite')"
|
|
442
|
+
:tooltip="teams.length ? t('admin.createInviteHint', 'Make a link that puts whoever opens it on a team') : t('admin.noInviteTeams', 'Save the settings once to create the first team.')"
|
|
421
443
|
:disabled="!teams.length"
|
|
422
444
|
@click="createInvite"
|
|
423
445
|
/>
|
|
@@ -454,9 +476,10 @@ function jumpToSettings() {
|
|
|
454
476
|
:label="t('admin.form', 'Application form')"
|
|
455
477
|
:description="t('admin.formHelp', 'It must ask people to sign in and store its submissions. An operation uses its own form.')"
|
|
456
478
|
>
|
|
457
|
-
<
|
|
479
|
+
<FormSelectField
|
|
458
480
|
v-model="form.formId"
|
|
459
|
-
:items="
|
|
481
|
+
:items="eligibleForms ?? []"
|
|
482
|
+
:placeholder="t('admin.noForm', 'No form (applications closed)')"
|
|
460
483
|
class="w-full sm:max-w-sm"
|
|
461
484
|
/>
|
|
462
485
|
</FormRow>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { crewApi } from "../../utils/api";
|
|
3
|
-
import { CREW_STATUS_LABELS } from "../../utils/status";
|
|
4
|
-
import { computed, errorMessage, navigateTo, useAuthPages, useCrewLinks, useCrewTranslate, useFormat,
|
|
3
|
+
import { CREW_ME_KEY, CREW_STATUS_LABELS } from "../../utils/status";
|
|
4
|
+
import { computed, errorMessage, navigateTo, useAuthPages, useCachedFetch, useCrewLinks, useCrewTranslate, useFormat, useModuleT, useRoute, watch } from "#imports";
|
|
5
5
|
defineOptions({ name: "CrewHomeStatusTab" });
|
|
6
6
|
const t = useModuleT("crew");
|
|
7
7
|
const tr = useCrewTranslate();
|
|
8
8
|
const format = useFormat();
|
|
9
9
|
const links = useCrewLinks();
|
|
10
10
|
const route = useRoute();
|
|
11
|
-
const { data,
|
|
12
|
-
const
|
|
11
|
+
const { data, error, loading, refresh } = useCachedFetch(crewApi.me.crew, { key: CREW_ME_KEY, ttl: 0, lazy: true });
|
|
12
|
+
const list = computed(() => data.value ?? []);
|
|
13
13
|
watch(() => error.value?.statusCode, async (code) => {
|
|
14
14
|
if (code === 401) await navigateTo({ path: useAuthPages().login, query: { redirect: route.fullPath } });
|
|
15
15
|
}, { immediate: true });
|
|
16
16
|
const ORDER = { approved: 0, waitlisted: 1, applied: 2, rejected: 3, withdrawn: 4 };
|
|
17
|
-
const entries = computed(() => [...
|
|
17
|
+
const entries = computed(() => [...list.value].sort((a, b) => ORDER[a.crewStatus] - ORDER[b.crewStatus]));
|
|
18
18
|
const label = (value) => t(`admin.statuses.${value}`, CREW_STATUS_LABELS[value]);
|
|
19
19
|
const facts = (entry) => [
|
|
20
20
|
{ key: "team", label: t("admin.team", "Team"), value: tr(entry.teamName) },
|
|
@@ -37,14 +37,14 @@ const facts = (entry) => [
|
|
|
37
37
|
/>
|
|
38
38
|
</div>
|
|
39
39
|
<UEmpty
|
|
40
|
-
v-else-if="error && !
|
|
40
|
+
v-else-if="error && !list.length"
|
|
41
41
|
icon="i-lucide-circle-alert"
|
|
42
42
|
:title="t('status.loadFailed', 'Your crew status could not be loaded')"
|
|
43
43
|
:description="errorMessage(error, '')"
|
|
44
44
|
:actions="[{ label: t('tryAgain', 'Try again'), icon: 'i-lucide-rotate-ccw', color: 'neutral', variant: 'outline', onClick: () => refresh() }]"
|
|
45
45
|
/>
|
|
46
46
|
<UEmpty
|
|
47
|
-
v-else-if="!
|
|
47
|
+
v-else-if="!list.length"
|
|
48
48
|
icon="i-lucide-hand-heart"
|
|
49
49
|
:title="t('status.empty', 'You have not applied yet')"
|
|
50
50
|
:description="t('status.emptyDescription', 'When you apply to an operation, or join with an invite, it shows up here.')"
|
|
@@ -54,6 +54,11 @@ const facts = (entry) => [
|
|
|
54
54
|
class="flex flex-col gap-4"
|
|
55
55
|
data-crew-status
|
|
56
56
|
>
|
|
57
|
+
<!-- Offline or a failed refresh: the last data stays, with a quiet note. -->
|
|
58
|
+
<StaleDataNotice
|
|
59
|
+
:error="error"
|
|
60
|
+
:refresh="refresh"
|
|
61
|
+
/>
|
|
57
62
|
<div class="grid gap-4 md:grid-cols-2">
|
|
58
63
|
<SectionCard
|
|
59
64
|
v-for="entry in entries"
|
|
@@ -22,12 +22,13 @@ async function addToCrew() {
|
|
|
22
22
|
</script>
|
|
23
23
|
|
|
24
24
|
<template>
|
|
25
|
-
<
|
|
25
|
+
<TooltipButton
|
|
26
26
|
color="neutral"
|
|
27
27
|
variant="outline"
|
|
28
28
|
size="sm"
|
|
29
29
|
icon="i-lucide-hand-heart"
|
|
30
30
|
:label="t('admin.addToCrew', 'Add to crew')"
|
|
31
|
+
:tooltip="t('admin.addToCrewHint', 'Put this person straight onto an operation crew, approved')"
|
|
31
32
|
data-crew-add-to-crew
|
|
32
33
|
@click="addToCrew"
|
|
33
34
|
/>
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { DashboardItem } from '@frigear-nu/dashboard/types';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The dashboard crew adds its items to, and renders in the Overview tab of its home page (`/dashboard/crew`). The items
|
|
4
|
+
* go on the signed-in hub's dashboard too (`extendHubDashboard`).
|
|
5
|
+
*/
|
|
3
6
|
export declare const CREW_DASHBOARD = "crew.home";
|
|
4
7
|
/**
|
|
5
|
-
* The items crew adds to `crew.home
|
|
8
|
+
* The items crew adds to `crew.home` and the hub. `resolve` turns a path relative to `module.ts` into an absolute one. Kept apart
|
|
6
9
|
* from the module so a test can register them without a Nuxt build.
|
|
7
10
|
*/
|
|
8
11
|
export declare function crewDashboardItems(resolve: (path: string) => string): DashboardItem[];
|
|
@@ -8,6 +8,8 @@ export function crewDashboardItems(resolve) {
|
|
|
8
8
|
title: "My crew status",
|
|
9
9
|
titleKey: "crew.dashboard.status",
|
|
10
10
|
order: 10,
|
|
11
|
+
// A short list of operations with a status badge each.
|
|
12
|
+
size: { cols: 2, minCols: 1 },
|
|
11
13
|
permission: crewAccess.permissions.read
|
|
12
14
|
}
|
|
13
15
|
];
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
"crew": {
|
|
3
3
|
"admin": {
|
|
4
4
|
"addMember": "Tilføj crewmedlem",
|
|
5
|
+
"addMemberHint": "Sæt en person på crewet, godkendt, uden ansøgning",
|
|
5
6
|
"addMemberAction": "Tilføj crewmedlem",
|
|
6
7
|
"addMemberDescription": "Personen kommer på crewet som godkendt og får besked på e-mail eller push.",
|
|
7
8
|
"addMemberFailed": "Personen kunne ikke tilføjes",
|
|
8
9
|
"addToCrew": "Tilføj til crew",
|
|
10
|
+
"addToCrewHint": "Sæt personen direkte på et crew, godkendt",
|
|
9
11
|
"allStatuses": "Alle statusser",
|
|
10
12
|
"allTeams": "Alle teams",
|
|
11
13
|
"alreadyInCrew": "{name} er allerede på dette crew ({status}). Find personen i listen for at ændre status.",
|
|
@@ -17,6 +19,7 @@
|
|
|
17
19
|
"approveAction": "Godkend ansøgning",
|
|
18
20
|
"approveFailed": "Personen kunne ikke godkendes",
|
|
19
21
|
"approveSelected": "Godkend {count} valgte",
|
|
22
|
+
"approveSelectedHint": "Godkend dem med det samme; dem, der ikke kan godkendes, springes over",
|
|
20
23
|
"approved": "Godkendte {name}",
|
|
21
24
|
"approvedMany": "Godkendte {count} personer",
|
|
22
25
|
"automaticTeam": "Automatisk (det første team)",
|
|
@@ -27,8 +30,9 @@
|
|
|
27
30
|
"closesAt": "Lukker",
|
|
28
31
|
"closesAtHelp": "Lad stå tomt for at holde ansøgningerne åbne.",
|
|
29
32
|
"copyApplyLink": "Kopiér ansøgningslink",
|
|
30
|
-
"
|
|
33
|
+
"copyLinkHint": "Kopiér invitationslinket til udklipsholderen",
|
|
31
34
|
"createInvite": "Opret invitation",
|
|
35
|
+
"createInviteHint": "Lav et link, der sætter den, der åbner det, på et team",
|
|
32
36
|
"createInviteAction": "Opret invitation",
|
|
33
37
|
"createUserAction": "Opret bruger",
|
|
34
38
|
"customizeEmails": "Tilpas e-mails",
|
|
@@ -150,7 +154,19 @@
|
|
|
150
154
|
"withdrawDescription": "{name} er trådt ud: ansøgningen trækkes tilbage, og de får besked på e-mail.",
|
|
151
155
|
"withdrawAction": "Markér som trukket tilbage",
|
|
152
156
|
"withdrawnToast": "{name} er markeret som trukket tilbage",
|
|
153
|
-
"withdrawFailed": "Status kunne ikke ændres"
|
|
157
|
+
"withdrawFailed": "Status kunne ikke ændres",
|
|
158
|
+
"nickname": "Kaldenavn",
|
|
159
|
+
"exportMediaOptOuts": "Eksportér fravalg af fotos",
|
|
160
|
+
"exportMediaOptOutsHelp": "Et regneark med alle deltagere, der ikke vil fotograferes eller tagges.",
|
|
161
|
+
"media": {
|
|
162
|
+
"noPhotos": "Ingen fotos",
|
|
163
|
+
"noTagging": "Ingen tagging",
|
|
164
|
+
"photos": "Fotos",
|
|
165
|
+
"photosOptOut": "Må ikke fotograferes som hovedmotiv",
|
|
166
|
+
"tagging": "Tagging online",
|
|
167
|
+
"taggingOptOut": "Må ikke tagges i opslag eller på fotos",
|
|
168
|
+
"allowed": "Ingen indvendinger"
|
|
169
|
+
}
|
|
154
170
|
},
|
|
155
171
|
"apply": {
|
|
156
172
|
"alreadyApplied": "Du har allerede ansøgt",
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
"crew": {
|
|
3
3
|
"admin": {
|
|
4
4
|
"addMember": "Add crew member",
|
|
5
|
+
"addMemberHint": "Put someone on the crew, approved, without an application",
|
|
5
6
|
"addMemberAction": "Add crew member",
|
|
6
7
|
"addMemberDescription": "The person joins the crew approved, and is told by email or push.",
|
|
7
8
|
"addMemberFailed": "The person could not be added",
|
|
8
9
|
"addToCrew": "Add to crew",
|
|
10
|
+
"addToCrewHint": "Put this person straight onto an operation crew, approved",
|
|
9
11
|
"allStatuses": "All statuses",
|
|
10
12
|
"allTeams": "All teams",
|
|
11
13
|
"alreadyInCrew": "{name} is in this crew already ({status}). Find them in the list to change their status.",
|
|
@@ -17,6 +19,7 @@
|
|
|
17
19
|
"approveAction": "Approve application",
|
|
18
20
|
"approveFailed": "Could not approve the person",
|
|
19
21
|
"approveSelected": "Approve {count} selected",
|
|
22
|
+
"approveSelectedHint": "Approve them right away; anyone who cannot be is skipped",
|
|
20
23
|
"approved": "Approved {name}",
|
|
21
24
|
"approvedMany": "Approved {count} people",
|
|
22
25
|
"automaticTeam": "Automatic (the first team)",
|
|
@@ -27,8 +30,9 @@
|
|
|
27
30
|
"closesAt": "Closes",
|
|
28
31
|
"closesAtHelp": "Leave empty to keep applications open.",
|
|
29
32
|
"copyApplyLink": "Copy apply link",
|
|
30
|
-
"
|
|
33
|
+
"copyLinkHint": "Copy the invite link to your clipboard",
|
|
31
34
|
"createInvite": "Create invite",
|
|
35
|
+
"createInviteHint": "Make a link that puts whoever opens it on a team",
|
|
32
36
|
"createInviteAction": "Create invite",
|
|
33
37
|
"createUserAction": "Create user",
|
|
34
38
|
"customizeEmails": "Customize emails",
|
|
@@ -150,7 +154,19 @@
|
|
|
150
154
|
"withdrawDescription": "{name} stepped down: their application is withdrawn and they are told by email.",
|
|
151
155
|
"withdrawAction": "Mark as withdrawn",
|
|
152
156
|
"withdrawnToast": "Marked {name} as withdrawn",
|
|
153
|
-
"withdrawFailed": "Could not change the status"
|
|
157
|
+
"withdrawFailed": "Could not change the status",
|
|
158
|
+
"nickname": "Nickname",
|
|
159
|
+
"exportMediaOptOuts": "Export photo opt-outs",
|
|
160
|
+
"exportMediaOptOutsHelp": "A spreadsheet of everyone taking part who does not want to be photographed or tagged.",
|
|
161
|
+
"media": {
|
|
162
|
+
"noPhotos": "No photos",
|
|
163
|
+
"noTagging": "No tagging",
|
|
164
|
+
"photos": "Photos",
|
|
165
|
+
"photosOptOut": "Do not photograph as the main subject",
|
|
166
|
+
"tagging": "Tagging online",
|
|
167
|
+
"taggingOptOut": "Do not tag in posts or photos",
|
|
168
|
+
"allowed": "No objection"
|
|
169
|
+
}
|
|
154
170
|
},
|
|
155
171
|
"apply": {
|
|
156
172
|
"alreadyApplied": "You have applied already",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { idParams } from "@frigear-nu/module-kit/server";
|
|
3
|
+
import { crewAccess } from "../../../access.js";
|
|
4
|
+
const querySchema = z.object({
|
|
5
|
+
// The language of the team names; the request's language, else English.
|
|
6
|
+
locale: z.string().trim().regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/).max(20).optional()
|
|
7
|
+
});
|
|
8
|
+
export default defineEventHandler(async (event) => {
|
|
9
|
+
await authorize(event, crewAccess.permissions.manage);
|
|
10
|
+
await authorize(event, crewAccess.permissions.pii);
|
|
11
|
+
const { operationId } = await getValidatedRouterParams(event, idParams("operationId").parse);
|
|
12
|
+
const { locale } = await getValidatedQuery(event, querySchema.parse);
|
|
13
|
+
const operation = await getOperationOr404(operationId);
|
|
14
|
+
await authorize(event, crewAccess.permissions.manage, operation);
|
|
15
|
+
const rows = await crewMediaOptOuts(operation.id, (locale ?? crewRequestLocale(event) ?? "en").split("-")[0]);
|
|
16
|
+
setResponseHeaders(event, {
|
|
17
|
+
"content-type": "text/csv; charset=utf-8",
|
|
18
|
+
"content-disposition": `attachment; filename="photo-opt-outs-${operation.slug.replace(/[^\w-]/g, "_")}.csv"`,
|
|
19
|
+
"cache-control": "no-store"
|
|
20
|
+
});
|
|
21
|
+
return crewMediaOptOutsCsv(rows, { origin: getRequestURL(event).origin });
|
|
22
|
+
});
|
|
@@ -9,12 +9,18 @@ export type CrewTeamLite = {
|
|
|
9
9
|
name: Translated;
|
|
10
10
|
ownerId: string | null;
|
|
11
11
|
};
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* The user fields a crew DTO shows; `email` and `phone` are only copied with `pii`. The nickname and the media opt-outs
|
|
14
|
+
* (`users` columns) are for whoever plans photos and posts.
|
|
15
|
+
*/
|
|
13
16
|
export type CrewUserLite = {
|
|
14
17
|
name: string | null;
|
|
15
18
|
email: string | null;
|
|
16
19
|
avatar: string | null;
|
|
17
20
|
phone: string | null;
|
|
21
|
+
nickname?: string | null;
|
|
22
|
+
photoOptOut?: boolean | number | null;
|
|
23
|
+
tagOptOut?: boolean | number | null;
|
|
18
24
|
} | null | undefined;
|
|
19
25
|
/**
|
|
20
26
|
* A crew member from a membership row (with its crew columns). `pii` is whether the caller holds `crew:pii`: the email
|
|
@@ -8,8 +8,11 @@ export function toCrewMemberDto(input) {
|
|
|
8
8
|
teamName: team.name,
|
|
9
9
|
userId: member.userId,
|
|
10
10
|
name: user?.name ?? null,
|
|
11
|
+
nickname: user?.nickname ?? null,
|
|
11
12
|
avatar: user?.avatar ?? null,
|
|
12
13
|
...pii ? { email: user?.email ?? null, phone: user?.phone ?? null } : {},
|
|
14
|
+
photoOptOut: !!user?.photoOptOut,
|
|
15
|
+
tagOptOut: !!user?.tagOptOut,
|
|
13
16
|
role: member.role,
|
|
14
17
|
crewStatus: member.crewStatus,
|
|
15
18
|
waitlistPosition: member.waitlistPosition ?? null,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CrewMediaOptOutRow } from '../../../types.js';
|
|
2
|
+
/** The columns of the media opt-out export, in order. */
|
|
3
|
+
export declare const CREW_MEDIA_OPT_OUT_COLUMNS: readonly ["name", "nickname", "email", "avatar_url", "photo_opt_out", "tag_opt_out", "team"];
|
|
4
|
+
/**
|
|
5
|
+
* Everyone who takes part in an operation (`crewTakesPart`: approved crew and people added in teams) and opted out of
|
|
6
|
+
* photos or of tagging, one row per person (their teams joined), by name. For the people who take photos and post.
|
|
7
|
+
*/
|
|
8
|
+
export declare function crewMediaOptOuts(operationId: string, locale?: string): Promise<CrewMediaOptOutRow[]>;
|
|
9
|
+
/**
|
|
10
|
+
* The opt-outs as CSV (a header row, then one row per person, CRLF line ends), with a BOM so spreadsheets read UTF-8.
|
|
11
|
+
* `origin` is the app's public origin: an avatar uploaded to the app (a path on it) becomes an absolute URL there.
|
|
12
|
+
*/
|
|
13
|
+
export declare function crewMediaOptOutsCsv(rows: CrewMediaOptOutRow[], options?: {
|
|
14
|
+
origin?: string;
|
|
15
|
+
}): string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { db, schema } from "@nuxthub/db";
|
|
2
|
+
import { and, asc, eq, or } from "drizzle-orm";
|
|
3
|
+
import { absoluteUserAvatarUrl } from "@frigear-nu/users/api";
|
|
4
|
+
import { translate } from "../../utils/index.js";
|
|
5
|
+
import { crewTakesPart } from "./crew.js";
|
|
6
|
+
export const CREW_MEDIA_OPT_OUT_COLUMNS = ["name", "nickname", "email", "avatar_url", "photo_opt_out", "tag_opt_out", "team"];
|
|
7
|
+
export async function crewMediaOptOuts(operationId, locale = "en") {
|
|
8
|
+
const rows = await db.select({
|
|
9
|
+
userId: schema.users.id,
|
|
10
|
+
name: schema.users.name,
|
|
11
|
+
nickname: schema.users.nickname,
|
|
12
|
+
email: schema.users.email,
|
|
13
|
+
avatar: schema.users.avatar,
|
|
14
|
+
photoOptOut: schema.users.photoOptOut,
|
|
15
|
+
tagOptOut: schema.users.tagOptOut,
|
|
16
|
+
teamName: schema.teams.name
|
|
17
|
+
}).from(schema.teamMembers).innerJoin(schema.teams, eq(schema.teamMembers.teamId, schema.teams.id)).innerJoin(schema.users, eq(schema.users.id, schema.teamMembers.userId)).where(and(
|
|
18
|
+
eq(schema.teams.ownerType, "operation"),
|
|
19
|
+
eq(schema.teams.ownerId, operationId),
|
|
20
|
+
crewTakesPart(),
|
|
21
|
+
or(eq(schema.users.photoOptOut, true), eq(schema.users.tagOptOut, true))
|
|
22
|
+
)).orderBy(asc(schema.users.name), asc(schema.users.id), asc(schema.teams.id));
|
|
23
|
+
const byUser = /* @__PURE__ */ new Map();
|
|
24
|
+
for (const row of rows) {
|
|
25
|
+
const team = translate(row.teamName, locale);
|
|
26
|
+
const seen = byUser.get(row.userId);
|
|
27
|
+
if (seen) {
|
|
28
|
+
if (team && !seen.teams.includes(team)) seen.teams.push(team);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
byUser.set(row.userId, {
|
|
32
|
+
userId: row.userId,
|
|
33
|
+
name: row.name,
|
|
34
|
+
nickname: row.nickname ?? null,
|
|
35
|
+
email: row.email,
|
|
36
|
+
avatar: row.avatar ?? null,
|
|
37
|
+
photoOptOut: !!row.photoOptOut,
|
|
38
|
+
tagOptOut: !!row.tagOptOut,
|
|
39
|
+
teams: team ? [team] : []
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return [...byUser.values()];
|
|
43
|
+
}
|
|
44
|
+
const crewCsvCell = (value) => {
|
|
45
|
+
const text = typeof value === "boolean" ? String(value) : value ?? "";
|
|
46
|
+
const safe = /^[=+\-@\t\r]/.test(text) ? `'${text}` : text;
|
|
47
|
+
return /[",\r\n]/.test(safe) ? `"${safe.replace(/"/g, '""')}"` : safe;
|
|
48
|
+
};
|
|
49
|
+
export function crewMediaOptOutsCsv(rows, options = {}) {
|
|
50
|
+
const lines = [
|
|
51
|
+
CREW_MEDIA_OPT_OUT_COLUMNS.join(","),
|
|
52
|
+
...rows.map((row) => [row.name, row.nickname, row.email, absoluteUserAvatarUrl(row.avatar, options.origin), row.photoOptOut, row.tagOptOut, row.teams.join("; ")].map(crewCsvCell).join(","))
|
|
53
|
+
];
|
|
54
|
+
return `\uFEFF${lines.join("\r\n")}\r
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
@@ -482,7 +482,15 @@ export async function crewMembersPage(operation, query, scope) {
|
|
|
482
482
|
db.select({
|
|
483
483
|
member: schema.teamMembers,
|
|
484
484
|
team: { id: schema.teams.id, name: schema.teams.name, ownerId: schema.teams.ownerId },
|
|
485
|
-
user: {
|
|
485
|
+
user: {
|
|
486
|
+
name: schema.users.name,
|
|
487
|
+
email: schema.users.email,
|
|
488
|
+
avatar: schema.users.avatar,
|
|
489
|
+
phone: schema.users.phone,
|
|
490
|
+
nickname: schema.users.nickname,
|
|
491
|
+
photoOptOut: schema.users.photoOptOut,
|
|
492
|
+
tagOptOut: schema.users.tagOptOut
|
|
493
|
+
},
|
|
486
494
|
previous: previousFlag
|
|
487
495
|
}).from(schema.teamMembers).innerJoin(schema.teams, eq(schema.teamMembers.teamId, schema.teams.id)).leftJoin(schema.users, eq(schema.users.id, schema.teamMembers.userId)).where(where).orderBy(...orderByQuery({
|
|
488
496
|
appliedAt: schema.teamMembers.appliedAt,
|
|
@@ -36,6 +36,11 @@ export declare const crewApi: {
|
|
|
36
36
|
readonly users: "/api/admin/crew/users";
|
|
37
37
|
/** `GET` the forms an operation can recruit with (`?operationId=` keeps its own). */
|
|
38
38
|
readonly forms: "/api/admin/crew/forms";
|
|
39
|
+
/**
|
|
40
|
+
* `GET` (`?locale=`) a CSV of everyone taking part in the operation who opted out of photos or of tagging: name,
|
|
41
|
+
* nickname, email, avatar URL, the two opt-outs and their teams. Needs `crew:manage` and `crew:pii`.
|
|
42
|
+
*/
|
|
43
|
+
readonly mediaOptOuts: (operationId: string) => string;
|
|
39
44
|
/** `GET` / `POST` an operation's invite links. */
|
|
40
45
|
readonly invites: (operationId: string) => string;
|
|
41
46
|
/** `DELETE` (revoke) one invite. */
|
|
@@ -39,6 +39,11 @@ export const crewApi = {
|
|
|
39
39
|
users: `${ADMIN_BASE}/users`,
|
|
40
40
|
/** `GET` the forms an operation can recruit with (`?operationId=` keeps its own). */
|
|
41
41
|
forms: `${ADMIN_BASE}/forms`,
|
|
42
|
+
/**
|
|
43
|
+
* `GET` (`?locale=`) a CSV of everyone taking part in the operation who opted out of photos or of tagging: name,
|
|
44
|
+
* nickname, email, avatar URL, the two opt-outs and their teams. Needs `crew:manage` and `crew:pii`.
|
|
45
|
+
*/
|
|
46
|
+
mediaOptOuts: (operationId) => `${ADMIN_BASE}/operations/${enc(operationId)}/media-opt-outs`,
|
|
42
47
|
/** `GET` / `POST` an operation's invite links. */
|
|
43
48
|
invites: (operationId) => `${ADMIN_BASE}/operations/${enc(operationId)}/invites`,
|
|
44
49
|
/** `DELETE` (revoke) one invite. */
|
|
@@ -34,3 +34,5 @@ export type CrewApplyNotice = {
|
|
|
34
34
|
* when a place opens up), unless an operation turns that status's message off. `submitted`: the form was sent just now.
|
|
35
35
|
*/
|
|
36
36
|
export declare function crewApplyNotice(status: CrewStatus | null, submitted?: boolean): CrewApplyNotice;
|
|
37
|
+
/** The `useCachedFetch` key of `GET /api/crew/me` (the person's own crew statuses), shared by the views that show it. */
|
|
38
|
+
export declare const CREW_ME_KEY = "crew:me";
|
|
@@ -37,3 +37,4 @@ export function crewApplyNotice(status, submitted = false) {
|
|
|
37
37
|
description: status === "approved" ? { key: "apply.approved", fallback: "You are on the crew." } : { key: "apply.receivedDescription", fallback: "We have received your application. We will email you when something changes." }
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
+
export const CREW_ME_KEY = "crew:me";
|
package/dist/types.d.mts
CHANGED
|
@@ -2,4 +2,4 @@ export { type Translated } from '@frigear-nu/ui/translated'
|
|
|
2
2
|
|
|
3
3
|
export { default } from './module.mjs'
|
|
4
4
|
|
|
5
|
-
export { type CreatedCrewInviteDto, type CrewApplyDto, type CrewFormOptionDto, type CrewInviteDto, type CrewMemberContext, type CrewMemberDto, type CrewRolePreset, type CrewRuntimeConfig, type CrewSettingsDto, type CrewStatus, type CrewStatusEmail, type CrewStatusEmails, type CrewSubmissionDto, type CrewUserLookupDto, type ModuleOptions, type MyCrewDto, type PublicModuleOptions } from './module.mjs'
|
|
5
|
+
export { type CreatedCrewInviteDto, type CrewApplyDto, type CrewFormOptionDto, type CrewInviteDto, type CrewMediaOptOutRow, type CrewMemberContext, type CrewMemberDto, type CrewRolePreset, type CrewRuntimeConfig, type CrewSettingsDto, type CrewStatus, type CrewStatusEmail, type CrewStatusEmails, type CrewSubmissionDto, type CrewUserLookupDto, type ModuleOptions, type MyCrewDto, type PublicModuleOptions } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frigear-nu/crew",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Crew for the frigear ecosystem: applications, approvals and invites that turn people into an operation's crew, built on teams.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"frigear-module",
|
|
7
|
+
"nuxt-module"
|
|
8
|
+
],
|
|
5
9
|
"homepage": "https://docs.frigear.dev/modules/volunteering/crew",
|
|
6
10
|
"repository": {
|
|
7
11
|
"type": "git",
|
|
@@ -35,15 +39,15 @@
|
|
|
35
39
|
"playground"
|
|
36
40
|
],
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"@frigear-nu/auth": "^0.6.
|
|
39
|
-
"@frigear-nu/dashboard": "^0.1.
|
|
40
|
-
"@frigear-nu/forms": "^0.5.
|
|
41
|
-
"@frigear-nu/module-kit": "^1.3.
|
|
42
|
-
"@frigear-nu/notify": "^0.2
|
|
43
|
-
"@frigear-nu/operations": "^0.1.
|
|
44
|
-
"@frigear-nu/teams": "^0.1.
|
|
45
|
-
"@frigear-nu/ui": "^0.2.
|
|
46
|
-
"@frigear-nu/users": "^3.1.
|
|
42
|
+
"@frigear-nu/auth": "^0.6.9",
|
|
43
|
+
"@frigear-nu/dashboard": "^0.1.4",
|
|
44
|
+
"@frigear-nu/forms": "^0.5.6",
|
|
45
|
+
"@frigear-nu/module-kit": "^1.3.13",
|
|
46
|
+
"@frigear-nu/notify": "^0.3.2",
|
|
47
|
+
"@frigear-nu/operations": "^0.1.3",
|
|
48
|
+
"@frigear-nu/teams": "^0.1.4",
|
|
49
|
+
"@frigear-nu/ui": "^0.2.12",
|
|
50
|
+
"@frigear-nu/users": "^3.1.6",
|
|
47
51
|
"@libsql/client": "^0.18.0",
|
|
48
52
|
"@nuxt/kit": "^4.6.4",
|
|
49
53
|
"@vueuse/core": "^15.0.0",
|
|
@@ -53,11 +57,11 @@
|
|
|
53
57
|
"zod": "^4.6.7"
|
|
54
58
|
},
|
|
55
59
|
"peerDependencies": {
|
|
56
|
-
"@frigear-nu/admin": "^0.5.
|
|
57
|
-
"@frigear-nu/email-templates": "^0.1.
|
|
58
|
-
"@frigear-nu/menu": "^0.4.
|
|
59
|
-
"@frigear-nu/mobile": "^0.6.
|
|
60
|
-
"@frigear-nu/widget": "^0.4.
|
|
60
|
+
"@frigear-nu/admin": "^0.5.3",
|
|
61
|
+
"@frigear-nu/email-templates": "^0.1.6",
|
|
62
|
+
"@frigear-nu/menu": "^0.4.2",
|
|
63
|
+
"@frigear-nu/mobile": "^0.6.5",
|
|
64
|
+
"@frigear-nu/widget": "^0.4.4",
|
|
61
65
|
"@nuxt/ui": "^4.12.0",
|
|
62
66
|
"@nuxthub/core": "^0.10.12"
|
|
63
67
|
},
|
|
@@ -79,11 +83,11 @@
|
|
|
79
83
|
}
|
|
80
84
|
},
|
|
81
85
|
"devDependencies": {
|
|
82
|
-
"@frigear-nu/admin": "^0.5.
|
|
83
|
-
"@frigear-nu/email-templates": "^0.1.
|
|
84
|
-
"@frigear-nu/menu": "^0.4.
|
|
85
|
-
"@frigear-nu/mobile": "^0.6.
|
|
86
|
-
"@frigear-nu/widget": "^0.4.
|
|
86
|
+
"@frigear-nu/admin": "^0.5.3",
|
|
87
|
+
"@frigear-nu/email-templates": "^0.1.6",
|
|
88
|
+
"@frigear-nu/menu": "^0.4.2",
|
|
89
|
+
"@frigear-nu/mobile": "^0.6.5",
|
|
90
|
+
"@frigear-nu/widget": "^0.4.4",
|
|
87
91
|
"@nuxt/devtools": "^4.2.0",
|
|
88
92
|
"@nuxt/eslint-config": "^1.17.0",
|
|
89
93
|
"@nuxt/module-builder": "^1.0.4",
|