@frigear-nu/crew 0.0.0 → 0.1.0
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 +9 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +23 -6
- package/dist/runtime/app/composables/useCrewLinks.d.ts +1 -0
- package/dist/runtime/app/pages/home.vue +21 -5
- package/dist/runtime/app/pages/status.vue +4 -65
- package/dist/runtime/app/tabs/HomeOverview.d.vue.ts +3 -0
- package/dist/runtime/app/tabs/HomeOverview.vue +8 -0
- package/dist/runtime/app/tabs/HomeOverview.vue.d.ts +3 -0
- package/dist/runtime/app/tabs/HomeStatus.d.vue.ts +3 -0
- package/dist/runtime/app/tabs/HomeStatus.vue +90 -0
- package/dist/runtime/app/tabs/HomeStatus.vue.d.ts +3 -0
- package/dist/runtime/dashboard.d.ts +1 -1
- package/dist/runtime/i18n/lang/da.json +8 -4
- package/dist/runtime/i18n/lang/en.json +8 -4
- package/dist/runtime/menus.js +11 -9
- package/dist/runtime/server/utils/crew-emails.js +2 -2
- package/dist/runtime/utils/links.d.ts +28 -4
- package/dist/runtime/utils/links.js +14 -1
- package/package.json +13 -13
package/dist/module.d.mts
CHANGED
|
@@ -31,13 +31,19 @@ type ModuleOptions = {
|
|
|
31
31
|
settings?: {
|
|
32
32
|
pages?: {
|
|
33
33
|
/**
|
|
34
|
-
* The crew member's home page: the `crew.home` dashboard
|
|
35
|
-
*
|
|
34
|
+
* The crew member's home page: the `crew.dashboard` tabs (Overview, the `crew.home` dashboard with every module's
|
|
35
|
+
* items for the signed-in person; My crew; shifts' My shifts and Swaps). On by default: `/dashboard/crew` (below
|
|
36
|
+
* the signed-in hub of `@frigear-nu/dashboard`, in its layout and `dashboard` menu), `/crew` when the hub is off.
|
|
37
|
+
* `false` turns it off.
|
|
36
38
|
*/
|
|
37
39
|
home?: string | boolean;
|
|
38
40
|
/** The page volunteers apply on, with the operation's form; must contain an `:operationSlug` param. On by default (`/crew/apply/:operationSlug`), `false` turns it off. */
|
|
39
41
|
apply?: string | boolean;
|
|
40
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* A volunteer's crew status per operation and how to step down. In the hub it is the My crew tab of the home page
|
|
44
|
+
* (`/crew/status` redirects to it) unless set to a path, which adds a page of its own; without the hub (or with
|
|
45
|
+
* `@frigear-nu/mobile`, whose Crew tab opens it) it is also a page at `/crew/status`. `false` turns both off.
|
|
46
|
+
*/
|
|
41
47
|
status?: string | boolean;
|
|
42
48
|
/** The page that accepts an invite link; must contain a `:token` param. On by default (`/crew/invite/:token`), `false` turns it off. */
|
|
43
49
|
invite?: string | boolean;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addServerImportsDir, addServerPlugin, addImports, addComponentsDir
|
|
2
|
-
import { registerModule, registerTailwindSource, registerLocales, resolvePagePath, registerDatabaseTable, extendDatabaseTable, addModuleRoutes, inlineModuleRuntime, addModulePages, addOptionalMenuSource } from '@frigear-nu/module-kit/utils';
|
|
1
|
+
import { defineNuxtModule, createResolver, hasNuxtModule, addServerImportsDir, addServerPlugin, 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';
|
|
3
3
|
import { registerAccess, addPolicies, guardPages } from '@frigear-nu/auth/utils';
|
|
4
4
|
import { crewAccess } from '../dist/runtime/access.js';
|
|
5
|
-
import { CREW_DEFAULT_PAGES } from '../dist/runtime/utils/links.js';
|
|
5
|
+
import { resolveCrewHomePath, CREW_DEFAULT_PAGES, CREW_HOME_TABS, CREW_HOME_TAB, crewHomeTab } from '../dist/runtime/utils/links.js';
|
|
6
6
|
import { extendDashboard } from '@frigear-nu/dashboard/utils';
|
|
7
7
|
import { CREW_DASHBOARD, crewDashboardItems } from '../dist/runtime/dashboard.js';
|
|
8
8
|
import { extendNotificationTopics } from '@frigear-nu/notify/utils';
|
|
@@ -47,9 +47,13 @@ const module$1 = defineNuxtModule({
|
|
|
47
47
|
registerTailwindSource(nuxt, resolver.resolve("./runtime/app"));
|
|
48
48
|
registerLocales(nuxt, resolver.resolve("./runtime/i18n/lang"));
|
|
49
49
|
const settings = options.settings ?? {};
|
|
50
|
-
const
|
|
50
|
+
const hub = resolveDashboardHubPath(nuxt, { dependency: true });
|
|
51
|
+
const homePath = resolveCrewHomePath(settings.pages?.home, hub);
|
|
52
|
+
const inDashboard = !!(hub && homePath && isPathUnder(homePath, hub));
|
|
53
|
+
const tabsOnly = inDashboard && !hasNuxtModule("@frigear-nu/mobile");
|
|
54
|
+
const statusSetting = settings.pages?.status ?? true;
|
|
55
|
+
const statusPath = tabsOnly && typeof statusSetting !== "string" ? void 0 : resolvePagePath(statusSetting, CREW_DEFAULT_PAGES.status);
|
|
51
56
|
const applyPath = resolvePagePath(settings.pages?.apply ?? true, CREW_DEFAULT_PAGES.apply);
|
|
52
|
-
const statusPath = resolvePagePath(settings.pages?.status ?? true, CREW_DEFAULT_PAGES.status);
|
|
53
57
|
const invitePath = resolvePagePath(settings.pages?.invite ?? true, CREW_DEFAULT_PAGES.invite);
|
|
54
58
|
const i18nOptions = nuxt.options.i18n;
|
|
55
59
|
const i18nLocales = (i18nOptions?.locales ?? []).map((locale) => typeof locale === "string" ? locale : locale.code);
|
|
@@ -114,6 +118,19 @@ const module$1 = defineNuxtModule({
|
|
|
114
118
|
{ name: "crew-invite", path: invitePath, file: "./runtime/app/pages/invite.vue" }
|
|
115
119
|
]);
|
|
116
120
|
if (homePath) guardPages(nuxt, [homePath]);
|
|
121
|
+
if (homePath) {
|
|
122
|
+
const { extendTabs } = await import('@frigear-nu/widget/utils');
|
|
123
|
+
extendTabs(nuxt, CREW_HOME_TABS, [
|
|
124
|
+
{ id: CREW_HOME_TAB.overview, component: resolver.resolve("./runtime/app/tabs/HomeOverview.vue"), order: 0, label: "Overview", labelKey: "crew.home.tabs.overview", icon: "i-lucide-layout-dashboard" },
|
|
125
|
+
...statusSetting === false ? [] : [{ id: CREW_HOME_TAB.status, component: resolver.resolve("./runtime/app/tabs/HomeStatus.vue"), order: 10, label: "My crew", labelKey: "crew.home.tabs.status", icon: "i-lucide-hand-heart", permission: crewAccess.permissions.read }]
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
128
|
+
if (tabsOnly && homePath) {
|
|
129
|
+
addPageRedirects(nuxt, {
|
|
130
|
+
...homePath !== CREW_DEFAULT_PAGES.home ? { [CREW_DEFAULT_PAGES.home]: homePath } : {},
|
|
131
|
+
...statusSetting === true ? { [CREW_DEFAULT_PAGES.status]: crewHomeTab(homePath, CREW_HOME_TAB.status) } : {}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
117
134
|
if (settings.operationsTab !== false && hasNuxtModule("@frigear-nu/widget") && hasNuxtModule("@frigear-nu/admin")) {
|
|
118
135
|
const { extendTabs } = await import('@frigear-nu/widget/utils');
|
|
119
136
|
extendTabs(nuxt, "admin.operations", {
|
|
@@ -148,7 +165,7 @@ const module$1 = defineNuxtModule({
|
|
|
148
165
|
}
|
|
149
166
|
extendNotificationTopics(nuxt, crewNotificationTopics);
|
|
150
167
|
extendDashboard(nuxt, CREW_DASHBOARD, crewDashboardItems((path) => resolver.resolve(path)));
|
|
151
|
-
addOptionalMenuSource(nuxt, { file: resolver.resolve("./runtime/menus"), menu: "
|
|
168
|
+
addOptionalMenuSource(nuxt, { file: resolver.resolve("./runtime/menus"), menu: "dashboard" });
|
|
152
169
|
}
|
|
153
170
|
});
|
|
154
171
|
|
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { CREW_HOME_TABS } from "../../utils/links";
|
|
3
|
+
import { computed, useHead, useModuleT, useRuntimeConfig } from "#imports";
|
|
4
4
|
defineOptions({ name: "CrewHomePage" });
|
|
5
5
|
const t = useModuleT("crew");
|
|
6
|
+
const config = useRuntimeConfig().public;
|
|
7
|
+
const inHub = computed(() => {
|
|
8
|
+
const hub = config.dashboard?.pages?.home;
|
|
9
|
+
const home = config.crew?.pages?.home;
|
|
10
|
+
return !!(hub && home && (hub === "/" || home === hub || home.startsWith(`${hub}/`)));
|
|
11
|
+
});
|
|
6
12
|
useHead({ title: () => t("home.title", "Crew") });
|
|
7
13
|
</script>
|
|
8
14
|
|
|
9
15
|
<template>
|
|
10
|
-
<
|
|
16
|
+
<div
|
|
17
|
+
v-if="inHub"
|
|
18
|
+
class="flex flex-col gap-4"
|
|
19
|
+
>
|
|
20
|
+
<PageHeading
|
|
21
|
+
:title="t('home.title', 'Crew')"
|
|
22
|
+
:description="t('home.description', 'Your crew places, your shifts and what is happening for you.')"
|
|
23
|
+
/>
|
|
24
|
+
<WidgetTabs :name="CREW_HOME_TABS" />
|
|
25
|
+
</div>
|
|
26
|
+
<UContainer v-else>
|
|
11
27
|
<UPage>
|
|
12
28
|
<UPageHeader
|
|
13
29
|
:title="t('home.title', 'Crew')"
|
|
14
|
-
:description="t('home.description', '
|
|
30
|
+
:description="t('home.description', 'Your crew places, your shifts and what is happening for you.')"
|
|
15
31
|
/>
|
|
16
32
|
<UPageBody>
|
|
17
|
-
<
|
|
33
|
+
<WidgetTabs :name="CREW_HOME_TABS" />
|
|
18
34
|
</UPageBody>
|
|
19
35
|
</UPage>
|
|
20
36
|
</UContainer>
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { errorMessage, navigateTo, useAuthPages, useCrewLinks, useCrewTranslate, useFetch, useFormat, useHead, useModuleT, useRoute } from "#imports";
|
|
2
|
+
import HomeStatus from "../tabs/HomeStatus.vue";
|
|
3
|
+
import { useHead, useModuleT } from "#imports";
|
|
5
4
|
defineOptions({ name: "CrewStatusPage" });
|
|
6
5
|
const t = useModuleT("crew");
|
|
7
|
-
const tr = useCrewTranslate();
|
|
8
|
-
const format = useFormat();
|
|
9
|
-
const links = useCrewLinks();
|
|
10
|
-
const route = useRoute();
|
|
11
|
-
const { data, error, refresh } = await useFetch(crewApi.me.crew, { key: "crew:me", default: () => [] });
|
|
12
|
-
if (error.value?.statusCode === 401) {
|
|
13
|
-
await navigateTo({ path: useAuthPages().login, query: { redirect: route.path } });
|
|
14
|
-
}
|
|
15
|
-
const label = (status) => t(`admin.statuses.${status}`, CREW_STATUS_LABELS[status]);
|
|
16
6
|
useHead({ title: () => t("status.title", "My crew") });
|
|
17
7
|
</script>
|
|
18
8
|
|
|
@@ -23,59 +13,8 @@ useHead({ title: () => t("status.title", "My crew") });
|
|
|
23
13
|
:title="t('status.title', 'My crew')"
|
|
24
14
|
:description="t('status.description', 'Your applications and your places on a crew.')"
|
|
25
15
|
/>
|
|
26
|
-
<UPageBody
|
|
27
|
-
<
|
|
28
|
-
v-if="error && !data.length && error.statusCode !== 401"
|
|
29
|
-
icon="i-lucide-circle-alert"
|
|
30
|
-
:title="t('status.loadFailed', 'Your crew status could not be loaded')"
|
|
31
|
-
:description="errorMessage(error, '')"
|
|
32
|
-
:actions="[{ label: t('tryAgain', 'Try again'), icon: 'i-lucide-rotate-ccw', color: 'neutral', variant: 'outline', onClick: () => refresh() }]"
|
|
33
|
-
/>
|
|
34
|
-
<UEmpty
|
|
35
|
-
v-else-if="!data.length"
|
|
36
|
-
icon="i-lucide-hand-heart"
|
|
37
|
-
:title="t('status.empty', 'You have not applied yet')"
|
|
38
|
-
:description="t('status.emptyDescription', 'When you apply to an operation, or join with an invite, it shows up here.')"
|
|
39
|
-
/>
|
|
40
|
-
<div
|
|
41
|
-
v-else
|
|
42
|
-
class="flex flex-col gap-4"
|
|
43
|
-
>
|
|
44
|
-
<SectionCard
|
|
45
|
-
v-for="entry in data"
|
|
46
|
-
:key="entry.operationId"
|
|
47
|
-
:title="tr(entry.operationName)"
|
|
48
|
-
>
|
|
49
|
-
<template #actions>
|
|
50
|
-
<StatusBadge
|
|
51
|
-
:status="entry.crewStatus"
|
|
52
|
-
:label="label(entry.crewStatus)"
|
|
53
|
-
/>
|
|
54
|
-
</template>
|
|
55
|
-
<DescriptionList
|
|
56
|
-
:items="[
|
|
57
|
-
{ key: 'team', label: t('admin.team', 'Team'), value: tr(entry.teamName) },
|
|
58
|
-
...entry.crewStatus === 'approved' ? [{ key: 'role', label: t('admin.role', 'Role'), value: tr(entry.roleLabel) }] : [],
|
|
59
|
-
...entry.crewStatus === 'waitlisted' && entry.waitlistPosition ? [{ key: 'position', label: t('status.position', 'Place on the waiting list'), value: String(entry.waitlistPosition) }] : [],
|
|
60
|
-
{ key: 'applied', label: t('admin.applied', 'Applied'), value: entry.appliedAt ? format.dateTime(entry.appliedAt) : null }
|
|
61
|
-
]"
|
|
62
|
-
/>
|
|
63
|
-
<template
|
|
64
|
-
v-if="entry.crewStatus === 'withdrawn'"
|
|
65
|
-
#footer
|
|
66
|
-
>
|
|
67
|
-
<div class="flex justify-end gap-2">
|
|
68
|
-
<UButton
|
|
69
|
-
:to="links.apply(entry.operationSlug)"
|
|
70
|
-
:label="t('status.applyAgain', 'Apply again')"
|
|
71
|
-
/>
|
|
72
|
-
</div>
|
|
73
|
-
</template>
|
|
74
|
-
</SectionCard>
|
|
75
|
-
<p class="text-muted text-sm">
|
|
76
|
-
{{ t("status.stepDown", "Need to step down? Contact your coordinator.") }}
|
|
77
|
-
</p>
|
|
78
|
-
</div>
|
|
16
|
+
<UPageBody>
|
|
17
|
+
<HomeStatus />
|
|
79
18
|
</UPageBody>
|
|
80
19
|
</UPage>
|
|
81
20
|
</UContainer>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { crewApi } from "../../utils/api";
|
|
3
|
+
import { CREW_STATUS_LABELS } from "../../utils/status";
|
|
4
|
+
import { computed, errorMessage, navigateTo, useAuthPages, useCrewLinks, useCrewTranslate, useFormat, useLazyFetch, useModuleT, useRoute, watch } from "#imports";
|
|
5
|
+
defineOptions({ name: "CrewHomeStatusTab" });
|
|
6
|
+
const t = useModuleT("crew");
|
|
7
|
+
const tr = useCrewTranslate();
|
|
8
|
+
const format = useFormat();
|
|
9
|
+
const links = useCrewLinks();
|
|
10
|
+
const route = useRoute();
|
|
11
|
+
const { data, status, error, refresh } = useLazyFetch(crewApi.me.crew, { key: "crew:me", default: () => [] });
|
|
12
|
+
const loading = computed(() => status.value === "pending" && !data.value.length);
|
|
13
|
+
watch(() => error.value?.statusCode, async (code) => {
|
|
14
|
+
if (code === 401) await navigateTo({ path: useAuthPages().login, query: { redirect: route.fullPath } });
|
|
15
|
+
}, { immediate: true });
|
|
16
|
+
const ORDER = { approved: 0, waitlisted: 1, applied: 2, rejected: 3, withdrawn: 4 };
|
|
17
|
+
const entries = computed(() => [...data.value].sort((a, b) => ORDER[a.crewStatus] - ORDER[b.crewStatus]));
|
|
18
|
+
const label = (value) => t(`admin.statuses.${value}`, CREW_STATUS_LABELS[value]);
|
|
19
|
+
const facts = (entry) => [
|
|
20
|
+
{ key: "team", label: t("admin.team", "Team"), value: tr(entry.teamName) },
|
|
21
|
+
...entry.crewStatus === "approved" ? [{ key: "role", label: t("admin.role", "Role"), value: tr(entry.roleLabel) }] : [],
|
|
22
|
+
...entry.crewStatus === "waitlisted" && entry.waitlistPosition ? [{ key: "position", label: t("status.position", "Place on the waiting list"), value: String(entry.waitlistPosition) }] : [],
|
|
23
|
+
{ key: "applied", label: t("admin.applied", "Applied"), value: entry.appliedAt ? format.dateTime(entry.appliedAt) : null }
|
|
24
|
+
];
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<div
|
|
29
|
+
v-if="loading"
|
|
30
|
+
class="grid gap-4 md:grid-cols-2"
|
|
31
|
+
aria-busy="true"
|
|
32
|
+
>
|
|
33
|
+
<SectionCard
|
|
34
|
+
v-for="index in 2"
|
|
35
|
+
:key="index"
|
|
36
|
+
loading
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
<UEmpty
|
|
40
|
+
v-else-if="error && !data.length"
|
|
41
|
+
icon="i-lucide-circle-alert"
|
|
42
|
+
:title="t('status.loadFailed', 'Your crew status could not be loaded')"
|
|
43
|
+
:description="errorMessage(error, '')"
|
|
44
|
+
:actions="[{ label: t('tryAgain', 'Try again'), icon: 'i-lucide-rotate-ccw', color: 'neutral', variant: 'outline', onClick: () => refresh() }]"
|
|
45
|
+
/>
|
|
46
|
+
<UEmpty
|
|
47
|
+
v-else-if="!data.length"
|
|
48
|
+
icon="i-lucide-hand-heart"
|
|
49
|
+
:title="t('status.empty', 'You have not applied yet')"
|
|
50
|
+
:description="t('status.emptyDescription', 'When you apply to an operation, or join with an invite, it shows up here.')"
|
|
51
|
+
/>
|
|
52
|
+
<div
|
|
53
|
+
v-else
|
|
54
|
+
class="flex flex-col gap-4"
|
|
55
|
+
data-crew-status
|
|
56
|
+
>
|
|
57
|
+
<div class="grid gap-4 md:grid-cols-2">
|
|
58
|
+
<SectionCard
|
|
59
|
+
v-for="entry in entries"
|
|
60
|
+
:key="entry.operationId"
|
|
61
|
+
:title="tr(entry.operationName)"
|
|
62
|
+
icon="i-lucide-hand-heart"
|
|
63
|
+
>
|
|
64
|
+
<template #actions>
|
|
65
|
+
<StatusBadge
|
|
66
|
+
:status="entry.crewStatus"
|
|
67
|
+
:label="label(entry.crewStatus)"
|
|
68
|
+
:colors="{ applied: 'info', waitlisted: 'warning', withdrawn: 'neutral' }"
|
|
69
|
+
/>
|
|
70
|
+
</template>
|
|
71
|
+
<DescriptionList :items="facts(entry)" />
|
|
72
|
+
<template
|
|
73
|
+
v-if="entry.crewStatus === 'withdrawn'"
|
|
74
|
+
#footer
|
|
75
|
+
>
|
|
76
|
+
<div class="flex justify-end">
|
|
77
|
+
<UButton
|
|
78
|
+
:to="links.apply(entry.operationSlug)"
|
|
79
|
+
icon="i-lucide-rotate-ccw"
|
|
80
|
+
:label="t('status.applyAgain', 'Apply again')"
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
84
|
+
</SectionCard>
|
|
85
|
+
</div>
|
|
86
|
+
<p class="text-muted text-sm">
|
|
87
|
+
{{ t("status.stepDown", "Need to step down? Contact your coordinator.") }}
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DashboardItem } from '@frigear-nu/dashboard/types';
|
|
2
|
-
/** The dashboard crew adds its items to, and renders
|
|
2
|
+
/** The dashboard crew adds its items to, and renders in the Overview tab of its home page (`/dashboard/crew`). */
|
|
3
3
|
export declare const CREW_DASHBOARD = "crew.home";
|
|
4
4
|
/**
|
|
5
5
|
* The items crew adds to `crew.home`. `resolve` turns a path relative to `module.ts` into an absolute one. Kept apart
|
|
@@ -195,9 +195,9 @@
|
|
|
195
195
|
"unknown": "Dette invitationslink er ikke gyldigt"
|
|
196
196
|
},
|
|
197
197
|
"menu": {
|
|
198
|
-
"
|
|
199
|
-
"
|
|
200
|
-
"
|
|
198
|
+
"home": {
|
|
199
|
+
"label": "Crew",
|
|
200
|
+
"description": "Dine crewpladser, dine vagter og bytninger."
|
|
201
201
|
}
|
|
202
202
|
},
|
|
203
203
|
"mobile": {
|
|
@@ -231,7 +231,11 @@
|
|
|
231
231
|
"tryAgain": "Prøv igen",
|
|
232
232
|
"home": {
|
|
233
233
|
"title": "Crew",
|
|
234
|
-
"description": "
|
|
234
|
+
"description": "Dine crewpladser, dine vagter og det, der sker for dig.",
|
|
235
|
+
"tabs": {
|
|
236
|
+
"overview": "Overblik",
|
|
237
|
+
"status": "Mit crew"
|
|
238
|
+
}
|
|
235
239
|
}
|
|
236
240
|
}
|
|
237
241
|
}
|
|
@@ -195,9 +195,9 @@
|
|
|
195
195
|
"unknown": "This invite link is not valid"
|
|
196
196
|
},
|
|
197
197
|
"menu": {
|
|
198
|
-
"
|
|
199
|
-
"
|
|
200
|
-
"
|
|
198
|
+
"home": {
|
|
199
|
+
"label": "Crew",
|
|
200
|
+
"description": "Your crew places, your shifts and swaps."
|
|
201
201
|
}
|
|
202
202
|
},
|
|
203
203
|
"mobile": {
|
|
@@ -231,7 +231,11 @@
|
|
|
231
231
|
"tryAgain": "Try again",
|
|
232
232
|
"home": {
|
|
233
233
|
"title": "Crew",
|
|
234
|
-
"description": "
|
|
234
|
+
"description": "Your crew places, your shifts and what is happening for you.",
|
|
235
|
+
"tabs": {
|
|
236
|
+
"overview": "Overview",
|
|
237
|
+
"status": "My crew"
|
|
238
|
+
}
|
|
235
239
|
}
|
|
236
240
|
}
|
|
237
241
|
}
|
package/dist/runtime/menus.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { defineMenuItem, defineMenuSource, extendMenuItem } from "@frigear-nu/menu/utils";
|
|
2
2
|
import { useRuntimeConfig } from "#imports";
|
|
3
|
+
import { crewAccess } from "./access.js";
|
|
3
4
|
export default defineMenuSource(() => {
|
|
4
5
|
const config = useRuntimeConfig().public.crew;
|
|
5
|
-
if (config?.pages?.
|
|
6
|
-
extendMenuItem("
|
|
7
|
-
id: "crew
|
|
8
|
-
label: "
|
|
9
|
-
labelKey: "crew.menu.
|
|
10
|
-
description: "Your
|
|
11
|
-
descriptionKey: "crew.menu.
|
|
6
|
+
if (config?.pages?.home) {
|
|
7
|
+
extendMenuItem("dashboard", defineMenuItem({
|
|
8
|
+
id: "crew",
|
|
9
|
+
label: "Crew",
|
|
10
|
+
labelKey: "crew.menu.home.label",
|
|
11
|
+
description: "Your crew places, your shifts and swaps.",
|
|
12
|
+
descriptionKey: "crew.menu.home.description",
|
|
12
13
|
icon: "i-lucide-hand-heart",
|
|
13
|
-
to: config.pages.
|
|
14
|
-
|
|
14
|
+
to: config.pages.home,
|
|
15
|
+
permission: crewAccess.permissions.read,
|
|
16
|
+
order: 20
|
|
15
17
|
}));
|
|
16
18
|
}
|
|
17
19
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { localizePath } from "@frigear-nu/module-kit/server";
|
|
2
|
-
import { CREW_STATUS_LABELS, translate } from "../../utils/index.js";
|
|
2
|
+
import { CREW_STATUS_LABELS, crewStatusPath, translate } from "../../utils/index.js";
|
|
3
3
|
import { crewSend } from "./crew-send.js";
|
|
4
4
|
const escapeHtml = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
5
5
|
const TEXTS = {
|
|
@@ -129,7 +129,7 @@ export async function crewSendStatusEmail(event, input) {
|
|
|
129
129
|
try {
|
|
130
130
|
const { userId, ...rest } = input;
|
|
131
131
|
const config = useRuntimeConfig(event).public.crew;
|
|
132
|
-
const statusPath = config?.pages
|
|
132
|
+
const statusPath = crewStatusPath(config?.pages);
|
|
133
133
|
const statusUrl = statusPath ? `${configuredAuthSiteOrigin(event) ?? getRequestURL(event).origin}${localizePath(statusPath, rest.locale, config?.i18n)}` : void 0;
|
|
134
134
|
const notification = buildCrewStatusEmail({ ...rest, statusUrl });
|
|
135
135
|
if (notification) await crewSend(event, userId, notification);
|
|
@@ -1,25 +1,49 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The configured page paths (`public.crew.pages`): `apply` with an `:operationSlug` param, `invite` with a `:token`
|
|
3
|
+
* param. `home` is the crew home, whose tabs (`crew.dashboard`) stand in for a page that is not there.
|
|
4
|
+
*/
|
|
2
5
|
export type CrewPages = {
|
|
6
|
+
home?: string;
|
|
3
7
|
apply?: string;
|
|
4
8
|
status?: string;
|
|
5
9
|
invite?: string;
|
|
6
10
|
};
|
|
7
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* The default page paths, as `true` resolves them. With the signed-in hub of `@frigear-nu/dashboard` the home page is
|
|
13
|
+
* `<hub>/crew` instead (`/dashboard/crew`), and My crew is a tab of it rather than a page.
|
|
14
|
+
*/
|
|
8
15
|
export declare const CREW_DEFAULT_PAGES: {
|
|
9
16
|
readonly home: "/crew";
|
|
10
17
|
readonly apply: "/crew/apply/:operationSlug";
|
|
11
18
|
readonly status: "/crew/status";
|
|
12
19
|
readonly invite: "/crew/invite/:token";
|
|
13
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* The crew home's path from its `pages.home` option: a string as is, `false` none, otherwise `<hub>/crew` below the
|
|
23
|
+
* signed-in hub of `@frigear-nu/dashboard` (`hub`, when there is one) or `/crew`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveCrewHomePath(setting: string | boolean | undefined, hub: string | undefined): string | undefined;
|
|
26
|
+
/** The tab area of the crew home page: crew adds Overview and My crew, shifts My shifts and Swaps. */
|
|
27
|
+
export declare const CREW_HOME_TABS = "crew.dashboard";
|
|
28
|
+
/** The ids of crew's own tabs on the crew home page (`?tab=status`). The first tab, `overview`, is the default. */
|
|
29
|
+
export declare const CREW_HOME_TAB: {
|
|
30
|
+
readonly overview: "overview";
|
|
31
|
+
readonly status: "status";
|
|
32
|
+
};
|
|
33
|
+
/** A tab of the crew home page: `<home>?tab=<id>`, or the home page itself for the default tab. */
|
|
34
|
+
export declare const crewHomeTab: (home: string, tab: string) => string;
|
|
14
35
|
/**
|
|
15
36
|
* Builds every link to a crew page. All of them go through `localize` (the active locale's prefix, see `useLocaleLink`
|
|
16
|
-
* of `@frigear-nu/ui`).
|
|
17
|
-
* to show it from `pages`.
|
|
37
|
+
* of `@frigear-nu/ui`). My crew is the status page when there is one, else the My crew tab of the home page. A page that
|
|
38
|
+
* is turned off still gets a link on its default path, so a caller decides whether to show it from `pages`.
|
|
18
39
|
*/
|
|
19
40
|
export declare function createCrewLinks(pages: CrewPages | undefined, localize: (path: string) => string): {
|
|
41
|
+
home: (tab?: string) => string;
|
|
20
42
|
apply: (operationSlug: string) => string;
|
|
21
43
|
status: () => string;
|
|
22
44
|
invite: (token: string) => string;
|
|
23
45
|
};
|
|
46
|
+
/** Where a person sees their crew status: the status page, else the My crew tab of the home page (`undefined`: neither). */
|
|
47
|
+
export declare function crewStatusPath(pages: CrewPages | undefined): string | undefined;
|
|
24
48
|
/** How long an invite link lasts when staff set no expiry: 30 days. */
|
|
25
49
|
export declare const CREW_INVITE_DEFAULT_DAYS = 30;
|
|
@@ -4,11 +4,24 @@ export const CREW_DEFAULT_PAGES = {
|
|
|
4
4
|
status: "/crew/status",
|
|
5
5
|
invite: "/crew/invite/:token"
|
|
6
6
|
};
|
|
7
|
+
export function resolveCrewHomePath(setting, hub) {
|
|
8
|
+
if (setting === false) return void 0;
|
|
9
|
+
if (typeof setting === "string") return setting;
|
|
10
|
+
return hub ? `${hub.replace(/\/+$/, "")}/crew` : CREW_DEFAULT_PAGES.home;
|
|
11
|
+
}
|
|
12
|
+
export const CREW_HOME_TABS = "crew.dashboard";
|
|
13
|
+
export const CREW_HOME_TAB = { overview: "overview", status: "status" };
|
|
14
|
+
export const crewHomeTab = (home, tab) => tab === CREW_HOME_TAB.overview ? home : `${home}?tab=${encodeURIComponent(tab)}`;
|
|
7
15
|
export function createCrewLinks(pages, localize) {
|
|
8
16
|
return {
|
|
17
|
+
home: (tab) => localize(tab ? crewHomeTab(pages?.home || CREW_DEFAULT_PAGES.home, tab) : pages?.home || CREW_DEFAULT_PAGES.home),
|
|
9
18
|
apply: (operationSlug) => localize((pages?.apply || CREW_DEFAULT_PAGES.apply).replace(":operationSlug", encodeURIComponent(operationSlug))),
|
|
10
|
-
status: () => localize(pages
|
|
19
|
+
status: () => localize(crewStatusPath(pages) || CREW_DEFAULT_PAGES.status),
|
|
11
20
|
invite: (token) => localize((pages?.invite || CREW_DEFAULT_PAGES.invite).replace(":token", encodeURIComponent(token)))
|
|
12
21
|
};
|
|
13
22
|
}
|
|
23
|
+
export function crewStatusPath(pages) {
|
|
24
|
+
if (pages?.status) return pages.status;
|
|
25
|
+
return pages?.home ? crewHomeTab(pages.home, CREW_HOME_TAB.status) : void 0;
|
|
26
|
+
}
|
|
14
27
|
export const CREW_INVITE_DEFAULT_DAYS = 30;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frigear-nu/crew",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Crew for the frigear ecosystem: applications, approvals and invites that turn people into an operation's crew, built on teams.",
|
|
5
5
|
"homepage": "https://docs.frigear.dev/modules/volunteering/crew",
|
|
6
6
|
"repository": {
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@frigear-nu/auth": "^0.6.4",
|
|
39
|
-
"@frigear-nu/dashboard": "^0.
|
|
40
|
-
"@frigear-nu/forms": "^0.5.
|
|
41
|
-
"@frigear-nu/module-kit": "^1.3.
|
|
39
|
+
"@frigear-nu/dashboard": "^0.1.0",
|
|
40
|
+
"@frigear-nu/forms": "^0.5.1",
|
|
41
|
+
"@frigear-nu/module-kit": "^1.3.8",
|
|
42
42
|
"@frigear-nu/notify": "^0.2.6",
|
|
43
|
-
"@frigear-nu/operations": "^0.
|
|
44
|
-
"@frigear-nu/teams": "^0.
|
|
45
|
-
"@frigear-nu/ui": "^0.2.
|
|
43
|
+
"@frigear-nu/operations": "^0.1.0",
|
|
44
|
+
"@frigear-nu/teams": "^0.1.0",
|
|
45
|
+
"@frigear-nu/ui": "^0.2.8",
|
|
46
46
|
"@frigear-nu/users": "^3.1.2",
|
|
47
47
|
"@libsql/client": "^0.18.0",
|
|
48
48
|
"@nuxt/kit": "^4.6.4",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"zod": "^4.6.7"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@frigear-nu/admin": "^0.5.
|
|
57
|
-
"@frigear-nu/email-templates": "^0.1.
|
|
56
|
+
"@frigear-nu/admin": "^0.5.1",
|
|
57
|
+
"@frigear-nu/email-templates": "^0.1.2",
|
|
58
58
|
"@frigear-nu/menu": "^0.4.0",
|
|
59
59
|
"@frigear-nu/mobile": "^0.6.2",
|
|
60
|
-
"@frigear-nu/widget": "^0.4.
|
|
60
|
+
"@frigear-nu/widget": "^0.4.1",
|
|
61
61
|
"@nuxt/ui": "^4.12.0",
|
|
62
62
|
"@nuxthub/core": "^0.10.12"
|
|
63
63
|
},
|
|
@@ -79,11 +79,11 @@
|
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@frigear-nu/admin": "^0.5.
|
|
83
|
-
"@frigear-nu/email-templates": "^0.1.
|
|
82
|
+
"@frigear-nu/admin": "^0.5.1",
|
|
83
|
+
"@frigear-nu/email-templates": "^0.1.2",
|
|
84
84
|
"@frigear-nu/menu": "^0.4.0",
|
|
85
85
|
"@frigear-nu/mobile": "^0.6.2",
|
|
86
|
-
"@frigear-nu/widget": "^0.4.
|
|
86
|
+
"@frigear-nu/widget": "^0.4.1",
|
|
87
87
|
"@nuxt/devtools": "^4.2.0",
|
|
88
88
|
"@nuxt/eslint-config": "^1.17.0",
|
|
89
89
|
"@nuxt/module-builder": "^1.0.4",
|