@frigear-nu/crew 0.0.0-stage → 0.0.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.
Files changed (149) hide show
  1. package/README.md +39 -2
  2. package/dist/module.d.mts +244 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +155 -0
  5. package/dist/runtime/access.d.ts +1 -0
  6. package/dist/runtime/access.js +45 -0
  7. package/dist/runtime/app/components/CrewAddMemberSlideover.d.vue.ts +18 -0
  8. package/dist/runtime/app/components/CrewAddMemberSlideover.vue +198 -0
  9. package/dist/runtime/app/components/CrewAddMemberSlideover.vue.d.ts +18 -0
  10. package/dist/runtime/app/components/CrewInviteSlideover.d.vue.ts +14 -0
  11. package/dist/runtime/app/components/CrewInviteSlideover.vue +147 -0
  12. package/dist/runtime/app/components/CrewInviteSlideover.vue.d.ts +14 -0
  13. package/dist/runtime/app/components/CrewMemberSlideover.d.vue.ts +14 -0
  14. package/dist/runtime/app/components/CrewMemberSlideover.vue +126 -0
  15. package/dist/runtime/app/components/CrewMemberSlideover.vue.d.ts +14 -0
  16. package/dist/runtime/app/composables/index.d.ts +4 -0
  17. package/dist/runtime/app/composables/index.js +3 -0
  18. package/dist/runtime/app/composables/useCrewActions.d.ts +45 -0
  19. package/dist/runtime/app/composables/useCrewActions.js +122 -0
  20. package/dist/runtime/app/composables/useCrewLinks.d.ts +9 -0
  21. package/dist/runtime/app/composables/useCrewLinks.js +6 -0
  22. package/dist/runtime/app/composables/useCrewTranslate.d.ts +7 -0
  23. package/dist/runtime/app/composables/useCrewTranslate.js +15 -0
  24. package/dist/runtime/app/dashboard/CrewStatus.d.vue.ts +3 -0
  25. package/dist/runtime/app/dashboard/CrewStatus.vue +78 -0
  26. package/dist/runtime/app/dashboard/CrewStatus.vue.d.ts +3 -0
  27. package/dist/runtime/app/pages/apply.d.vue.ts +3 -0
  28. package/dist/runtime/app/pages/apply.vue +95 -0
  29. package/dist/runtime/app/pages/apply.vue.d.ts +3 -0
  30. package/dist/runtime/app/pages/home.d.vue.ts +3 -0
  31. package/dist/runtime/app/pages/home.vue +21 -0
  32. package/dist/runtime/app/pages/home.vue.d.ts +3 -0
  33. package/dist/runtime/app/pages/invite.d.vue.ts +3 -0
  34. package/dist/runtime/app/pages/invite.vue +86 -0
  35. package/dist/runtime/app/pages/invite.vue.d.ts +3 -0
  36. package/dist/runtime/app/pages/status.d.vue.ts +3 -0
  37. package/dist/runtime/app/pages/status.vue +82 -0
  38. package/dist/runtime/app/pages/status.vue.d.ts +3 -0
  39. package/dist/runtime/app/tabs/Crew.d.vue.ts +9 -0
  40. package/dist/runtime/app/tabs/Crew.vue +590 -0
  41. package/dist/runtime/app/tabs/Crew.vue.d.ts +9 -0
  42. package/dist/runtime/app/utils/admin-crew.d.ts +48 -0
  43. package/dist/runtime/app/utils/admin-crew.js +23 -0
  44. package/dist/runtime/app/widgets/InboxAddToCrew.d.vue.ts +13 -0
  45. package/dist/runtime/app/widgets/InboxAddToCrew.vue +34 -0
  46. package/dist/runtime/app/widgets/InboxAddToCrew.vue.d.ts +13 -0
  47. package/dist/runtime/dashboard.d.ts +8 -0
  48. package/dist/runtime/dashboard.js +14 -0
  49. package/dist/runtime/emails/crew-status-applied.d.vue.ts +16 -0
  50. package/dist/runtime/emails/crew-status-applied.vue +40 -0
  51. package/dist/runtime/emails/crew-status-applied.vue.d.ts +16 -0
  52. package/dist/runtime/emails/crew-status-approved.d.vue.ts +16 -0
  53. package/dist/runtime/emails/crew-status-approved.vue +40 -0
  54. package/dist/runtime/emails/crew-status-approved.vue.d.ts +16 -0
  55. package/dist/runtime/emails/crew-status-rejected.d.vue.ts +15 -0
  56. package/dist/runtime/emails/crew-status-rejected.vue +33 -0
  57. package/dist/runtime/emails/crew-status-rejected.vue.d.ts +15 -0
  58. package/dist/runtime/emails/crew-status-waitlisted.d.vue.ts +16 -0
  59. package/dist/runtime/emails/crew-status-waitlisted.vue +40 -0
  60. package/dist/runtime/emails/crew-status-waitlisted.vue.d.ts +16 -0
  61. package/dist/runtime/emails/crew-status-withdrawn.d.vue.ts +16 -0
  62. package/dist/runtime/emails/crew-status-withdrawn.vue +40 -0
  63. package/dist/runtime/emails/crew-status-withdrawn.vue.d.ts +16 -0
  64. package/dist/runtime/i18n/lang/da.json +237 -0
  65. package/dist/runtime/i18n/lang/en.json +237 -0
  66. package/dist/runtime/menus.d.ts +2 -0
  67. package/dist/runtime/menus.js +17 -0
  68. package/dist/runtime/notifications.d.ts +5 -0
  69. package/dist/runtime/notifications.js +10 -0
  70. package/dist/runtime/server/db/schema.postgresql.d.ts +433 -0
  71. package/dist/runtime/server/db/schema.postgresql.js +43 -0
  72. package/dist/runtime/server/db/schema.sqlite.d.ts +451 -0
  73. package/dist/runtime/server/db/schema.sqlite.js +43 -0
  74. package/dist/runtime/server/db/team-members.postgresql.d.ts +143 -0
  75. package/dist/runtime/server/db/team-members.postgresql.js +20 -0
  76. package/dist/runtime/server/db/team-members.sqlite.d.ts +151 -0
  77. package/dist/runtime/server/db/team-members.sqlite.js +20 -0
  78. package/dist/runtime/server/plugins/forms.d.ts +2 -0
  79. package/dist/runtime/server/plugins/forms.js +27 -0
  80. package/dist/runtime/server/plugins/participation.d.ts +2 -0
  81. package/dist/runtime/server/plugins/participation.js +16 -0
  82. package/dist/runtime/server/policies.d.ts +2 -0
  83. package/dist/runtime/server/policies.js +10 -0
  84. package/dist/runtime/server/routes/admin/forms.get.d.ts +2 -0
  85. package/dist/runtime/server/routes/admin/forms.get.js +8 -0
  86. package/dist/runtime/server/routes/admin/invite.delete.d.ts +2 -0
  87. package/dist/runtime/server/routes/admin/invite.delete.js +13 -0
  88. package/dist/runtime/server/routes/admin/invites.get.d.ts +2 -0
  89. package/dist/runtime/server/routes/admin/invites.get.js +14 -0
  90. package/dist/runtime/server/routes/admin/invites.post.d.ts +2 -0
  91. package/dist/runtime/server/routes/admin/invites.post.js +31 -0
  92. package/dist/runtime/server/routes/admin/member-approve.post.d.ts +2 -0
  93. package/dist/runtime/server/routes/admin/member-approve.post.js +10 -0
  94. package/dist/runtime/server/routes/admin/member-reject.post.d.ts +2 -0
  95. package/dist/runtime/server/routes/admin/member-reject.post.js +9 -0
  96. package/dist/runtime/server/routes/admin/member-submission.get.d.ts +2 -0
  97. package/dist/runtime/server/routes/admin/member-submission.get.js +17 -0
  98. package/dist/runtime/server/routes/admin/member-waitlist.post.d.ts +2 -0
  99. package/dist/runtime/server/routes/admin/member-waitlist.post.js +9 -0
  100. package/dist/runtime/server/routes/admin/member-withdraw.post.d.ts +2 -0
  101. package/dist/runtime/server/routes/admin/member-withdraw.post.js +9 -0
  102. package/dist/runtime/server/routes/admin/member.patch.d.ts +2 -0
  103. package/dist/runtime/server/routes/admin/member.patch.js +10 -0
  104. package/dist/runtime/server/routes/admin/members-approve.post.d.ts +2 -0
  105. package/dist/runtime/server/routes/admin/members-approve.post.js +12 -0
  106. package/dist/runtime/server/routes/admin/members.get.d.ts +2 -0
  107. package/dist/runtime/server/routes/admin/members.get.js +10 -0
  108. package/dist/runtime/server/routes/admin/members.post.d.ts +2 -0
  109. package/dist/runtime/server/routes/admin/members.post.js +30 -0
  110. package/dist/runtime/server/routes/admin/settings.get.d.ts +2 -0
  111. package/dist/runtime/server/routes/admin/settings.get.js +9 -0
  112. package/dist/runtime/server/routes/admin/settings.put.d.ts +2 -0
  113. package/dist/runtime/server/routes/admin/settings.put.js +12 -0
  114. package/dist/runtime/server/routes/admin/users.get.d.ts +2 -0
  115. package/dist/runtime/server/routes/admin/users.get.js +8 -0
  116. package/dist/runtime/server/routes/me/crew.get.d.ts +2 -0
  117. package/dist/runtime/server/routes/me/crew.get.js +5 -0
  118. package/dist/runtime/server/routes/public/apply.get.d.ts +2 -0
  119. package/dist/runtime/server/routes/public/apply.get.js +9 -0
  120. package/dist/runtime/server/routes/public/invite-accept.post.d.ts +2 -0
  121. package/dist/runtime/server/routes/public/invite-accept.post.js +7 -0
  122. package/dist/runtime/server/routes/public/member.get.d.ts +2 -0
  123. package/dist/runtime/server/routes/public/member.get.js +9 -0
  124. package/dist/runtime/server/routes/public/members.get.d.ts +2 -0
  125. package/dist/runtime/server/routes/public/members.get.js +11 -0
  126. package/dist/runtime/server/utils/crew-dto.d.ts +46 -0
  127. package/dist/runtime/server/utils/crew-dto.js +80 -0
  128. package/dist/runtime/server/utils/crew-emails.d.ts +43 -0
  129. package/dist/runtime/server/utils/crew-emails.js +139 -0
  130. package/dist/runtime/server/utils/crew-schemas.d.ts +121 -0
  131. package/dist/runtime/server/utils/crew-schemas.js +69 -0
  132. package/dist/runtime/server/utils/crew-send.d.ts +19 -0
  133. package/dist/runtime/server/utils/crew-send.js +20 -0
  134. package/dist/runtime/server/utils/crew-settings.d.ts +52 -0
  135. package/dist/runtime/server/utils/crew-settings.js +100 -0
  136. package/dist/runtime/server/utils/crew-tokens.d.ts +8 -0
  137. package/dist/runtime/server/utils/crew-tokens.js +9 -0
  138. package/dist/runtime/server/utils/crew.d.ts +172 -0
  139. package/dist/runtime/server/utils/crew.js +502 -0
  140. package/dist/runtime/utils/api.d.ts +44 -0
  141. package/dist/runtime/utils/api.js +47 -0
  142. package/dist/runtime/utils/index.d.ts +8 -0
  143. package/dist/runtime/utils/index.js +6 -0
  144. package/dist/runtime/utils/links.d.ts +25 -0
  145. package/dist/runtime/utils/links.js +14 -0
  146. package/dist/runtime/utils/status.d.ts +36 -0
  147. package/dist/runtime/utils/status.js +39 -0
  148. package/dist/types.d.mts +5 -0
  149. package/package.json +118 -3
@@ -0,0 +1,122 @@
1
+ import CrewAddMemberSlideover from "../components/CrewAddMemberSlideover.vue";
2
+ import CrewInviteSlideover from "../components/CrewInviteSlideover.vue";
3
+ import CrewMemberSlideover from "../components/CrewMemberSlideover.vue";
4
+ import { crewApi } from "../../utils/api.js";
5
+ import { canMoveCrew } from "../../utils/status.js";
6
+ import { $fetch, useAction, useConfirmDialog, useModuleT, useOverlay, useToast } from "#imports";
7
+ export function useCrewActions() {
8
+ const t = useModuleT("crew");
9
+ const overlay = useOverlay();
10
+ const confirm = useConfirmDialog();
11
+ const { run } = useAction();
12
+ const toast = useToast();
13
+ const nameOf = (member) => member.name ?? `#${member.userId}`;
14
+ async function approve(member) {
15
+ const approved = await run(
16
+ () => $fetch(crewApi.admin.approve(member.id), { method: "POST", body: {} }),
17
+ { success: t("admin.approved", "Approved {name}", { name: nameOf(member) }), error: t("admin.approveFailed", "Could not approve the person") }
18
+ );
19
+ return approved ?? false;
20
+ }
21
+ async function reject(member) {
22
+ const name = nameOf(member);
23
+ const confirmed = await confirm({
24
+ title: t("admin.rejectTitle", "Reject {name}?", { name }),
25
+ description: member.crewStatus === "approved" ? t("admin.rejectApprovedDescription", "{name} loses their place on the crew and is told by email. The next person on the waiting list may move up.", { name }) : t("admin.rejectDescription", "{name} is told by email that they did not get a place on the crew.", { name }),
26
+ confirmText: t("admin.rejectAction", "Reject application"),
27
+ destructive: true
28
+ });
29
+ if (!confirmed) return false;
30
+ const rejected = await run(
31
+ () => $fetch(crewApi.admin.reject(member.id), { method: "POST" }),
32
+ { success: t("admin.rejected", "Rejected {name}", { name }), error: t("admin.rejectFailed", "Could not reject the person") }
33
+ );
34
+ return rejected ?? false;
35
+ }
36
+ async function withdraw(member) {
37
+ const name = nameOf(member);
38
+ const confirmed = await confirm({
39
+ title: t("admin.withdrawTitle", "Mark {name} as withdrawn?", { name }),
40
+ description: member.crewStatus === "approved" ? t("admin.withdrawApprovedDescription", "{name} stepped down: they lose their place on the crew and are told by email. The next person on the waiting list may move up.", { name }) : t("admin.withdrawDescription", "{name} stepped down: their application is withdrawn and they are told by email.", { name }),
41
+ confirmText: t("admin.withdrawAction", "Mark as withdrawn"),
42
+ destructive: true
43
+ });
44
+ if (!confirmed) return false;
45
+ const withdrawn = await run(
46
+ () => $fetch(crewApi.admin.withdraw(member.id), { method: "POST" }),
47
+ { success: t("admin.withdrawnToast", "Marked {name} as withdrawn", { name }), error: t("admin.withdrawFailed", "Could not change the status") }
48
+ );
49
+ return withdrawn ?? false;
50
+ }
51
+ async function waitlist(member) {
52
+ const waitlisted = await run(
53
+ () => $fetch(crewApi.admin.waitlist(member.id), { method: "POST" }),
54
+ { success: t("admin.waitlisted", "Put {name} on the waiting list", { name: nameOf(member) }), error: t("admin.waitlistFailed", "Could not change the status") }
55
+ );
56
+ return waitlisted ?? false;
57
+ }
58
+ async function approveMany(operationId, ids) {
59
+ const result = await run(
60
+ () => $fetch(crewApi.admin.approveMany(operationId), { method: "POST", body: { ids } }),
61
+ { error: t("admin.approveFailed", "Could not approve the person") }
62
+ );
63
+ if (!result) return false;
64
+ const summary = { approved: result.approved.length, skipped: result.skipped.length };
65
+ toast.add({
66
+ title: t("admin.approvedMany", "Approved {count} people", { count: summary.approved }),
67
+ description: summary.skipped ? t("admin.skippedMany", "{count} could not be approved and were left as they are.", { count: summary.skipped }) : void 0,
68
+ color: summary.skipped ? "warning" : "success",
69
+ icon: "i-lucide-check"
70
+ });
71
+ return summary;
72
+ }
73
+ async function open(member, options) {
74
+ return await overlay.create(CrewMemberSlideover, { destroyOnClose: true, props: { member, teams: options.teams, ladders: options.ladders, pii: options.pii ?? false } }).open();
75
+ }
76
+ async function add(operationId, options = {}) {
77
+ return await overlay.create(CrewAddMemberSlideover, { destroyOnClose: true, props: { operationId, ...options } }).open();
78
+ }
79
+ async function createInvite(operationId, options) {
80
+ return await overlay.create(CrewInviteSlideover, { destroyOnClose: true, props: { operationId, teams: options.teams, ladders: options.ladders } }).open();
81
+ }
82
+ async function revokeInvite(invite) {
83
+ const confirmed = await confirm({
84
+ title: t("admin.revokeInviteTitle", "Revoke this invite?"),
85
+ description: t("admin.revokeInviteDescription", "The link stops working. People who joined with it stay on the crew."),
86
+ confirmText: t("admin.revokeInviteAction", "Revoke invite"),
87
+ destructive: true
88
+ });
89
+ if (!confirmed) return false;
90
+ const done = await run(
91
+ () => $fetch(crewApi.admin.invite(invite.id), { method: "DELETE" }).then(() => true),
92
+ { success: t("admin.inviteRevoked", "Revoked the invite"), error: t("admin.revokeInviteFailed", "Could not revoke the invite") }
93
+ );
94
+ return done === true;
95
+ }
96
+ function menu(member, options) {
97
+ const changed = async (result) => {
98
+ if (result) await options.onChanged?.();
99
+ };
100
+ const main = [{
101
+ label: t("admin.open", "Open application"),
102
+ icon: "i-lucide-arrow-right",
103
+ onSelect: async () => changed(await open(member, options))
104
+ }];
105
+ const moves = [];
106
+ if (canMoveCrew(member.crewStatus, "approved")) {
107
+ moves.push({ label: t("admin.approveAction", "Approve application"), icon: "i-lucide-user-check", onSelect: async () => changed(await approve(member)) });
108
+ }
109
+ if (canMoveCrew(member.crewStatus, "waitlisted")) {
110
+ moves.push({ label: t("admin.waitlistAction", "Move to waiting list"), icon: "i-lucide-hourglass", onSelect: async () => changed(await waitlist(member)) });
111
+ }
112
+ const destructive = [];
113
+ if (canMoveCrew(member.crewStatus, "withdrawn")) {
114
+ destructive.push({ label: t("admin.withdrawAction", "Mark as withdrawn"), icon: "i-lucide-log-out", color: "error", onSelect: async () => changed(await withdraw(member)) });
115
+ }
116
+ if (canMoveCrew(member.crewStatus, "rejected")) {
117
+ destructive.push({ label: t("admin.rejectAction", "Reject application"), icon: "i-lucide-user-x", color: "error", onSelect: async () => changed(await reject(member)) });
118
+ }
119
+ return [main, moves, destructive].filter((group) => group.length);
120
+ }
121
+ return { add, approve, reject, withdraw, waitlist, approveMany, open, createInvite, revokeInvite, menu };
122
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Locale-aware links to the crew pages (apply, status, invite). Always use these instead of building the path by hand:
3
+ * they keep the locale prefix and follow `crew.settings.pages`.
4
+ */
5
+ export declare function useCrewLinks(): {
6
+ apply: (operationSlug: string) => string;
7
+ status: () => string;
8
+ invite: (token: string) => string;
9
+ };
@@ -0,0 +1,6 @@
1
+ import { createCrewLinks } from "../../utils/links.js";
2
+ import { useLocaleLink, useRuntimeConfig } from "#imports";
3
+ export function useCrewLinks() {
4
+ const { localize } = useLocaleLink();
5
+ return createCrewLinks(useRuntimeConfig().public.crew?.pages, localize);
6
+ }
@@ -0,0 +1,7 @@
1
+ import type { Translated } from '../../../types.js';
2
+ /** Locale for translated texts: `@nuxtjs/i18n`'s when installed, otherwise `en`. */
3
+ export declare function useCrewLocale(): import("vue").ComputedRef<string>;
4
+ /** The site's default locale: shown for texts that have no translation in the current locale. */
5
+ export declare function useCrewFallbackLocale(): import("vue").ComputedRef<string>;
6
+ /** `tr(value)`: a translated text in the current locale, falling back to the default locale, then `en`, then any. */
7
+ export declare function useCrewTranslate(): (value: Translated | null | undefined) => string;
@@ -0,0 +1,15 @@
1
+ import { translate } from "../../utils/index.js";
2
+ import { computed, useNuxtApp } from "#imports";
3
+ export function useCrewLocale() {
4
+ const nuxtApp = useNuxtApp();
5
+ return computed(() => nuxtApp.$i18n?.locale?.value ?? "en");
6
+ }
7
+ export function useCrewFallbackLocale() {
8
+ const nuxtApp = useNuxtApp();
9
+ return computed(() => nuxtApp.$i18n?.defaultLocale ?? "en");
10
+ }
11
+ export function useCrewTranslate() {
12
+ const locale = useCrewLocale();
13
+ const fallback = useCrewFallbackLocale();
14
+ return (value) => translate(value, locale.value, fallback.value);
15
+ }
@@ -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,78 @@
1
+ <script setup>
2
+ import { crewApi } from "../../utils/api";
3
+ import { CREW_STATUS_LABELS } from "../../utils/status";
4
+ import { computed, surfaceClass, useCrewLinks, useCrewTranslate, useLazyFetch, useModuleT } from "#imports";
5
+ defineOptions({ name: "CrewStatusItem" });
6
+ const t = useModuleT("crew");
7
+ const tr = useCrewTranslate();
8
+ const links = useCrewLinks();
9
+ const { data, status, error } = useLazyFetch(crewApi.me.crew, {
10
+ key: "crew:dashboard:status",
11
+ default: () => [],
12
+ onResponseError: () => {
13
+ }
14
+ });
15
+ const loading = computed(() => status.value === "pending" && !data.value?.length);
16
+ const entries = computed(() => {
17
+ const all = data.value ?? [];
18
+ const open = all.filter((entry) => entry.crewStatus !== "withdrawn" && entry.crewStatus !== "rejected");
19
+ return (open.length ? open : all).slice(0, 4);
20
+ });
21
+ const label = (value) => t(`admin.statuses.${value}`, CREW_STATUS_LABELS[value]);
22
+ const color = (value) => ({ approved: "success", applied: "info", waitlisted: "neutral", rejected: "error", withdrawn: "neutral" })[value];
23
+ </script>
24
+
25
+ <template>
26
+ <div
27
+ v-if="loading"
28
+ :class="[surfaceClass, 'h-full space-y-3 p-4']"
29
+ >
30
+ <USkeleton class="h-4 w-2/3" />
31
+ <USkeleton class="h-4 w-1/3" />
32
+ </div>
33
+ <div
34
+ v-else-if="error && !data?.length"
35
+ :class="[surfaceClass, 'text-error h-full p-4 text-sm']"
36
+ >
37
+ {{ t("dashboard.statusFailed", "Could not load your crew status.") }}
38
+ </div>
39
+ <EmptyCard
40
+ v-else-if="!entries.length"
41
+ icon="i-lucide-hand-heart"
42
+ :title="t('dashboard.statusEmpty', 'You have not applied yet')"
43
+ :description="t('dashboard.statusEmptyDescription', 'When you apply to an operation, it shows up here.')"
44
+ />
45
+ <div
46
+ v-else
47
+ :class="[surfaceClass, 'flex h-full flex-col']"
48
+ >
49
+ <ul class="divide-default flex-1 divide-y px-4 text-sm [&>li]:py-2.5">
50
+ <li
51
+ v-for="entry in entries"
52
+ :key="entry.operationId"
53
+ class="flex items-center justify-between gap-3"
54
+ >
55
+ <div class="flex min-w-0 flex-col">
56
+ <span class="text-highlighted truncate font-medium">{{ tr(entry.operationName) }}</span>
57
+ <span class="text-muted truncate text-xs">{{ tr(entry.teamName) }} · {{ tr(entry.roleLabel) }}</span>
58
+ </div>
59
+ <UBadge
60
+ :color="color(entry.crewStatus)"
61
+ variant="subtle"
62
+ :label="label(entry.crewStatus)"
63
+ />
64
+ </li>
65
+ </ul>
66
+ <div class="border-default border-t px-4 py-2.5">
67
+ <UButton
68
+ :to="links.status()"
69
+ variant="link"
70
+ color="neutral"
71
+ size="xs"
72
+ class="p-0"
73
+ trailing-icon="i-lucide-arrow-right"
74
+ :label="t('dashboard.statusLink', 'My crew')"
75
+ />
76
+ </div>
77
+ </div>
78
+ </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;
@@ -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,95 @@
1
+ <script setup>
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";
5
+ defineOptions({ name: "CrewApplyPage" });
6
+ const t = useModuleT("crew");
7
+ const tr = useCrewTranslate();
8
+ const format = useFormat();
9
+ const links = useCrewLinks();
10
+ const route = useRoute();
11
+ const slug = computed(() => String(route.params.operationSlug));
12
+ const { data, error, refresh } = await useFetch(() => crewApi.apply(slug.value), { key: `crew:apply:${slug.value}` });
13
+ if (error.value?.statusCode === 401) {
14
+ await navigateTo({ path: useAuthPages().login, query: { redirect: route.path } });
15
+ } else if (error.value?.statusCode === 404) {
16
+ throw createError({ statusCode: 404, statusMessage: t("apply.notFound", "Operation not found"), fatal: true });
17
+ }
18
+ const submitted = ref(false);
19
+ async function onSubmitted() {
20
+ submitted.value = true;
21
+ await refresh();
22
+ }
23
+ const notice = computed(() => data.value?.state === "applied" ? crewApplyNotice(data.value.crewStatus, submitted.value) : null);
24
+ useHead({ title: computed(() => data.value ? t("apply.title", "Apply to {operation}", { operation: tr(data.value.operationName) }) : "") });
25
+ </script>
26
+
27
+ <template>
28
+ <UContainer>
29
+ <UPage>
30
+ <UPageHeader
31
+ v-if="data"
32
+ :title="t('apply.title', 'Apply to {operation}', { operation: tr(data.operationName) })"
33
+ :description="t('apply.description', 'Tell us a little about yourself to join the crew.')"
34
+ />
35
+ <UPageBody class="max-w-2xl">
36
+ <UEmpty
37
+ v-if="error && !data && error.statusCode !== 401"
38
+ icon="i-lucide-circle-alert"
39
+ :title="t('apply.loadFailed', 'The application could not be loaded')"
40
+ :description="errorMessage(error, '')"
41
+ :actions="[{ label: t('tryAgain', 'Try again'), icon: 'i-lucide-rotate-ccw', color: 'neutral', variant: 'outline', onClick: () => refresh() }]"
42
+ />
43
+
44
+ <template v-else-if="data">
45
+ <FormRenderer
46
+ v-if="data.state === 'open' && data.formSlug && !submitted"
47
+ :slug="data.formSlug"
48
+ @submitted="onSubmitted"
49
+ />
50
+
51
+ <UAlert
52
+ v-else-if="data.state === 'applied' && notice"
53
+ :icon="notice.icon"
54
+ :color="notice.color"
55
+ variant="subtle"
56
+ :title="t(notice.title.key, notice.title.fallback)"
57
+ :description="t(notice.description.key, notice.description.fallback)"
58
+ :actions="[{ label: t('apply.seeStatus', 'See your status'), to: links.status(), color: 'neutral', variant: 'outline' }]"
59
+ />
60
+ <UAlert
61
+ v-else-if="data.state === 'member'"
62
+ icon="i-lucide-users-round"
63
+ color="success"
64
+ variant="subtle"
65
+ :title="t('apply.member', 'You are on this crew already')"
66
+ :actions="[{ label: t('apply.seeStatus', 'See your status'), to: links.status(), color: 'neutral', variant: 'outline' }]"
67
+ />
68
+ <UAlert
69
+ v-else-if="data.state === 'rejected'"
70
+ icon="i-lucide-circle-x"
71
+ color="neutral"
72
+ variant="subtle"
73
+ :title="t('apply.rejected', 'Your application was not accepted')"
74
+ :description="t('apply.rejectedDescription', 'Thank you for applying. Contact the organisers if you have questions.')"
75
+ />
76
+ <UAlert
77
+ v-else-if="data.state === 'scheduled'"
78
+ icon="i-lucide-calendar-clock"
79
+ color="neutral"
80
+ variant="subtle"
81
+ :title="t('apply.scheduled', 'Applications are not open yet')"
82
+ :description="data.opensAt ? t('apply.opensAt', 'They open {date}.', { date: format.dateTime(data.opensAt) }) : void 0"
83
+ />
84
+ <UAlert
85
+ v-else
86
+ icon="i-lucide-calendar-x"
87
+ color="neutral"
88
+ variant="subtle"
89
+ :title="data.state === 'unavailable' ? t('apply.unavailable', 'This crew is not taking applications') : t('apply.closed', 'Applications are closed')"
90
+ />
91
+ </template>
92
+ </UPageBody>
93
+ </UPage>
94
+ </UContainer>
95
+ </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;
@@ -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,21 @@
1
+ <script setup>
2
+ import { useHead, useModuleT } from "#imports";
3
+ import { CREW_DASHBOARD } from "../../dashboard";
4
+ defineOptions({ name: "CrewHomePage" });
5
+ const t = useModuleT("crew");
6
+ useHead({ title: () => t("home.title", "Crew") });
7
+ </script>
8
+
9
+ <template>
10
+ <UContainer>
11
+ <UPage>
12
+ <UPageHeader
13
+ :title="t('home.title', 'Crew')"
14
+ :description="t('home.description', 'What is happening for you on the crew.')"
15
+ />
16
+ <UPageBody>
17
+ <Dashboard :name="CREW_DASHBOARD" />
18
+ </UPageBody>
19
+ </UPage>
20
+ </UContainer>
21
+ </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;
@@ -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,86 @@
1
+ <script setup>
2
+ import { crewApi } from "../../utils/api";
3
+ import { $fetch, errorMessage, ref, useAction, useAuthPages, useCrewLinks, useCrewTranslate, useFetch, useHead, useModuleT, useRoute } from "#imports";
4
+ defineOptions({ name: "CrewInvitePage" });
5
+ const t = useModuleT("crew");
6
+ const tr = useCrewTranslate();
7
+ const links = useCrewLinks();
8
+ const route = useRoute();
9
+ const { busy, run } = useAction();
10
+ const { error: sessionError } = await useFetch(crewApi.me.crew, { key: "crew:invite-session" });
11
+ const signedOut = sessionError.value?.statusCode === 401;
12
+ const loginTo = { path: useAuthPages().login, query: { redirect: route.path } };
13
+ const joined = ref();
14
+ const failure = ref();
15
+ async function accept() {
16
+ failure.value = void 0;
17
+ const result = await run(
18
+ () => $fetch(crewApi.acceptInvite(String(route.params.token)), { method: "POST" }).catch((error) => {
19
+ failure.value = error;
20
+ throw error;
21
+ })
22
+ );
23
+ if (result) joined.value = result;
24
+ }
25
+ const failureTitle = () => {
26
+ const status = failure.value?.statusCode;
27
+ if (status === 410) return t("invite.gone", "This invite link can no longer be used");
28
+ if (status === 409) return t("invite.alreadyMember", "You are on this team already");
29
+ if (status === 404) return t("invite.unknown", "This invite link is not valid");
30
+ return t("invite.failed", "The invite could not be accepted");
31
+ };
32
+ useHead({ title: () => t("invite.title", "Join the crew") });
33
+ </script>
34
+
35
+ <template>
36
+ <UContainer>
37
+ <UPage>
38
+ <UPageHeader
39
+ :title="t('invite.title', 'Join the crew')"
40
+ :description="t('invite.description', 'You were invited to join a crew.')"
41
+ />
42
+ <UPageBody class="max-w-2xl">
43
+ <UAlert
44
+ v-if="joined"
45
+ icon="i-lucide-circle-check"
46
+ color="success"
47
+ variant="subtle"
48
+ :title="t('invite.joined', 'Welcome to the crew of {operation}', { operation: tr(joined.operationName) })"
49
+ :description="t('invite.joinedDescription', 'You are on the team {team}.', { team: tr(joined.teamName) })"
50
+ :actions="[{ label: t('apply.seeStatus', 'See your status'), to: links.status(), color: 'neutral', variant: 'outline' }]"
51
+ />
52
+ <template v-else>
53
+ <UAlert
54
+ v-if="failure"
55
+ icon="i-lucide-circle-alert"
56
+ color="error"
57
+ variant="subtle"
58
+ class="mb-4"
59
+ :title="failureTitle()"
60
+ :description="errorMessage(failure, '')"
61
+ />
62
+ <SectionCard :title="t('invite.cardTitle', 'Accept the invite')">
63
+ <p class="text-muted text-sm">
64
+ {{ signedOut ? t("invite.signInFirst", "Sign in to join the crew. You will come back here afterwards.") : t("invite.explanation", "You join the team you were invited to, with the role in the invite.") }}
65
+ </p>
66
+ <template #footer>
67
+ <div class="flex justify-end gap-2">
68
+ <UButton
69
+ v-if="signedOut"
70
+ :to="loginTo"
71
+ :label="t('invite.signIn', 'Sign in')"
72
+ />
73
+ <UButton
74
+ v-else
75
+ :loading="busy"
76
+ :label="t('invite.accept', 'Join the crew')"
77
+ @click="accept"
78
+ />
79
+ </div>
80
+ </template>
81
+ </SectionCard>
82
+ </template>
83
+ </UPageBody>
84
+ </UPage>
85
+ </UContainer>
86
+ </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;
@@ -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,82 @@
1
+ <script setup>
2
+ import { crewApi } from "../../utils/api";
3
+ import { CREW_STATUS_LABELS } from "../../utils/status";
4
+ import { errorMessage, navigateTo, useAuthPages, useCrewLinks, useCrewTranslate, useFetch, useFormat, useHead, useModuleT, useRoute } from "#imports";
5
+ defineOptions({ name: "CrewStatusPage" });
6
+ 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
+ useHead({ title: () => t("status.title", "My crew") });
17
+ </script>
18
+
19
+ <template>
20
+ <UContainer>
21
+ <UPage>
22
+ <UPageHeader
23
+ :title="t('status.title', 'My crew')"
24
+ :description="t('status.description', 'Your applications and your places on a crew.')"
25
+ />
26
+ <UPageBody class="max-w-2xl">
27
+ <UEmpty
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>
79
+ </UPageBody>
80
+ </UPage>
81
+ </UContainer>
82
+ </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;
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ operation?: {
3
+ id: string;
4
+ slug?: string;
5
+ };
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;