Skip to content

Commit ce87496

Browse files
authored
Merge pull request #491 from sinfo/lucas-ci
Draft: CI
2 parents d39f7f9 + 093644b commit ce87496

File tree

6 files changed

+119
-23
lines changed

6 files changed

+119
-23
lines changed

.github/workflows/lint.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Lint and Format on PR
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
frontend-lint:
8+
name: Frontend ESLint & Prettier
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: "23"
18+
cache: "npm"
19+
cache-dependency-path: frontend/package-lock.json
20+
21+
- name: Install frontend dependencies
22+
working-directory: frontend
23+
run: npm ci
24+
25+
- name: Run ESLint (auto-fix)
26+
working-directory: frontend
27+
run: npm run lint
28+
29+
- name: Run Prettier check
30+
working-directory: frontend
31+
run: npx prettier --check .
32+
33+
- name: Build frontend
34+
working-directory: frontend
35+
run: npm run build

frontend/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,5 @@
6161
"npx --yes eslint --ext .ts,.vue,.js,.json --fix",
6262
"npx --yes prettier --write"
6363
]
64-
},
65-
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
64+
}
6665
}

frontend/src/components/BulkEmailDialogTrigger.vue

Lines changed: 76 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -492,24 +492,83 @@ const showNoMemberContactWarning = computed(() => {
492492
return !hasMail || !hasPhone;
493493
});
494494
495-
// Use the appropriate composable based on entity type
496-
const bulkEmailComposable =
495+
// We MUST separate the composable usages here, otherwise TypeScript infers incompatible types.
496+
const companyBulk = useBulkCompanyEmails();
497+
const speakerBulk = useBulkSpeakerEmails();
498+
499+
const processBulkEmails = async (
500+
templateCategory: EmailTemplateCategory,
501+
statuses: ParticipationStatus[],
502+
entities: CompanyWithParticipation[] | SpeakerWithParticipation[],
503+
) => {
504+
if (props.entityType === "companies") {
505+
return companyBulk.processBulkEmails(
506+
templateCategory,
507+
statuses,
508+
entities as CompanyWithParticipation[],
509+
);
510+
}
511+
return speakerBulk.processBulkEmails(
512+
templateCategory,
513+
statuses,
514+
entities as SpeakerWithParticipation[],
515+
);
516+
};
517+
518+
const sendProcessedEmails = async () => {
519+
if (props.entityType === "companies") {
520+
return companyBulk.sendProcessedEmails();
521+
}
522+
return speakerBulk.sendProcessedEmails();
523+
};
524+
525+
const isProcessing = computed(() =>
526+
props.entityType === "companies"
527+
? companyBulk.isProcessing.value
528+
: speakerBulk.isProcessing.value,
529+
);
530+
531+
const isSending = computed(() =>
532+
props.entityType === "companies"
533+
? companyBulk.isSending.value
534+
: speakerBulk.isSending.value,
535+
);
536+
537+
const processResult = computed(() =>
538+
props.entityType === "companies"
539+
? companyBulk.processResult.value
540+
: speakerBulk.processResult.value,
541+
);
542+
543+
const result = computed(() =>
544+
props.entityType === "companies"
545+
? companyBulk.result.value
546+
: speakerBulk.result.value,
547+
);
548+
549+
const processedCount = computed(() =>
550+
props.entityType === "companies"
551+
? companyBulk.processedCount.value
552+
: speakerBulk.processedCount.value,
553+
);
554+
555+
const totalToProcess = computed(() =>
497556
props.entityType === "companies"
498-
? useBulkCompanyEmails()
499-
: useBulkSpeakerEmails();
500-
501-
const {
502-
processBulkEmails,
503-
sendProcessedEmails,
504-
isProcessing,
505-
isSending,
506-
processResult,
507-
result,
508-
processedCount,
509-
totalToProcess,
510-
sentCount,
511-
totalToSend,
512-
} = bulkEmailComposable;
557+
? companyBulk.totalToProcess.value
558+
: speakerBulk.totalToProcess.value,
559+
);
560+
561+
const sentCount = computed(() =>
562+
props.entityType === "companies"
563+
? companyBulk.sentCount.value
564+
: speakerBulk.sentCount.value,
565+
);
566+
567+
const totalToSend = computed(() =>
568+
props.entityType === "companies"
569+
? companyBulk.totalToSend.value
570+
: speakerBulk.totalToSend.value,
571+
);
513572
514573
const isDialogOpen = ref(false);
515574
const currentStep = ref(1);

frontend/src/components/Communications.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ interface CommunicationsProps {
325325
fetchCommunications: (
326326
id: string,
327327
) => Promise<{ data: ParticipationCommunications[] }>;
328-
postThreadMutation?: unknown;
328+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
329+
postThreadMutation?: any;
329330
}
330331
331332
type Author = Member | Speaker | Company;

frontend/src/components/companies/CompanyCommunications.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ postThreadMutation.companyId.value = props.company.id;
3333
const templates = computed(() =>
3434
companyTemplates.map((it) => ({
3535
template: it,
36-
variables: createCompanyTemplateVariables(it),
36+
variables: createCompanyTemplateVariables(),
3737
})),
3838
);
3939

frontend/src/composables/useBulkEmails.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ import { isEmailValid } from "@/lib/utils";
2222
import { Gender, Language } from "@/dto/contacts";
2323

2424
// Generic types for bulk emails
25-
type BulkEmailEntity = CompanyWithParticipation | SpeakerWithParticipation;
25+
export type BulkEmailEntity =
26+
| CompanyWithParticipation
27+
| SpeakerWithParticipation;
2628
function isSpeaker(
2729
entity: BulkEmailEntity,
2830
): entity is SpeakerWithParticipation {
@@ -225,7 +227,7 @@ export const useBulkEmails = <T extends BulkEmailEntity>(
225227
const processBulkEmails = async (
226228
templateCategory: EmailTemplateCategory,
227229
statuses: ParticipationStatus[],
228-
entities: BulkEmailEntity[],
230+
entities: T[],
229231
): Promise<BulkEmailProcessResult<T>> => {
230232
isProcessing.value = true;
231233
processedCount.value = 0;

0 commit comments

Comments
 (0)