diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebdd425e6e..19e9c4d306 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -230,24 +230,37 @@ jobs: - name: Lint CSS run: pnpm lint:css - # FIXME: Identify a way to generate schema before we run typecheck - # typecheck: - # name: Typecheck - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 - # - name: Install pnpm - # uses: pnpm/action-setup@v4 - # - name: Install Node.js - # uses: actions/setup-node@v4 - # with: - # node-version: 20 - # cache: 'pnpm' - # - name: Install dependencies - # run: pnpm install - # - # - name: Typecheck - # run: pnpm typecheck + typecheck: + name: Typecheck + runs-on: ubuntu-latest + defaults: + run: + working-directory: app + needs: [ui] + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Install pnpm + uses: pnpm/action-setup@v4 + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + - name: Install dependencies + run: pnpm install + + - uses: actions/download-artifact@v4 + with: + name: ui-build + path: packages/ui/dist + + - name: Generate types + run: pnpm generate:type + + - name: Typecheck + run: pnpm typecheck typos: name: Spell Check with Typos diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..c46886159a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,8 @@ +[submodule "go-api"] + path = go-api + url = https://github.com/IFRCGo/go-api.git + branch = feature/schema-file +[submodule "risk-api"] + path = risk-api + url = https://github.com/IFRCGo/go-risk-module-api.git + branch = feature/schema-file diff --git a/app/package.json b/app/package.json index ce252dc90f..f5fe30d6bb 100644 --- a/app/package.json +++ b/app/package.json @@ -17,8 +17,8 @@ "initialize:type:go-api": "test -f ./generated/types.ts && true || cp types.stub.ts ./generated/types.ts", "initialize:type:risk-api": "test -f ./generated/riskTypes.ts && true || cp types.stub.ts ./generated/riskTypes.ts", "generate:type": "pnpm generate:type:go-api && pnpm generate:type:risk-api", - "generate:type:go-api": "dotenv -- cross-var openapi-typescript \"%APP_API_ENDPOINT%api-docs/\" -o ./generated/types.ts --alphabetize", - "generate:type:risk-api": "dotenv -- cross-var openapi-typescript \"%APP_RISK_API_ENDPOINT%api-docs/\" -o ./generated/riskTypes.ts --alphabetize", + "generate:type:go-api": "dotenv -- cross-var openapi-typescript ../go-api/openapi-schema.yaml -o ./generated/types.ts --alphabetize", + "generate:type:risk-api": "dotenv -- cross-var openapi-typescript ../risk-api/openapi-schema.yaml -o ./generated/riskTypes.ts --alphabetize", "prestart": "pnpm initialize:type", "start": "pnpm -F @ifrc-go/ui build && vite", "prebuild": "pnpm initialize:type", diff --git a/app/src/components/PerExportModal/index.tsx b/app/src/components/PerExportModal/index.tsx index df400901c1..a24efd574e 100644 --- a/app/src/components/PerExportModal/index.tsx +++ b/app/src/components/PerExportModal/index.tsx @@ -45,6 +45,7 @@ function PerExportModal(props: Props) { export_id: Number(perId), export_type: 'per' as const, per_country: Number(countryId), + is_pga: false, }), [perId, countryId], ); diff --git a/app/src/components/SelectOutput/index.tsx b/app/src/components/SelectOutput/index.tsx index 9f16ba9248..8df20fde36 100644 --- a/app/src/components/SelectOutput/index.tsx +++ b/app/src/components/SelectOutput/index.tsx @@ -3,7 +3,7 @@ import { TextOutput } from '@ifrc-go/ui'; import { isDefined } from '@togglecorp/fujs'; interface Props { - className: string; + className?: string; value: VALUE | undefined; options: OPTION[] | undefined; keySelector: (datum: OPTION) => VALUE; diff --git a/app/src/components/domain/DrefExportModal/index.tsx b/app/src/components/domain/DrefExportModal/index.tsx index 31b0b561a6..ec17823a0e 100644 --- a/app/src/components/domain/DrefExportModal/index.tsx +++ b/app/src/components/domain/DrefExportModal/index.tsx @@ -57,7 +57,8 @@ function DrefExportModal(props: Props) { export_id: id, export_type: type, selector: '#pdf-preview-ready', - per_country: undefined, // FIXME: typing is altered by the useRequest function + per_country: undefined, + is_pga: false, }; }, [id, applicationType], diff --git a/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx b/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx index 3f8119049d..c3741b88cf 100644 --- a/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx +++ b/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx @@ -142,6 +142,7 @@ function DrefTableActions(props: Props) { allocationRequested: response?.additional_allocation, previousAllocation: response?.dref_allocated_so_far ?? 0, totalDREFAllocation: response?.total_dref_allocation, + noOfPeopleTargeted: response?.number_of_people_targeted, toBeAllocatedFrom: response?.type_of_dref_display === 'Imminent' // FIXME: can't compare imminent with Anticipatory Pillar diff --git a/app/src/views/DrefOperationalUpdateForm/schema.ts b/app/src/views/DrefOperationalUpdateForm/schema.ts index cc7f94f220..54ef4c84f2 100644 --- a/app/src/views/DrefOperationalUpdateForm/schema.ts +++ b/app/src/views/DrefOperationalUpdateForm/schema.ts @@ -52,6 +52,7 @@ export type OpsUpdateRequestBody = GoApiBody<'/api/v2/dref-op-update/{id}/', 'PA }; type NeedIdentifiedResponse = NonNullable[number]; +type NsActionResponse = NonNullable[number]; type InterventionResponse = NonNullable[number]; type IndicatorResponse = NonNullable[number]; type RiskSecurityResponse = NonNullable[number]; @@ -59,6 +60,7 @@ type ImagesFileResponse = NonNullable[numbe type SourceInformationResponse = NonNullable[number]; type NeedIdentifiedFormFields = NeedIdentifiedResponse & { client_id: string }; +type NsActionFormFields = NsActionResponse & { client_id: string; } type InterventionFormFields = InterventionResponse & { client_id: string }; type IndicatorFormFields = IndicatorResponse & { client_id: string }; type SourceInformationFormFields = SourceInformationResponse & { client_id: string }; @@ -81,9 +83,13 @@ type OpsUpdateFormFields = ( DeepReplace< DeepReplace< DeepReplace< - OpsUpdateRequestBody, - NeedIdentifiedResponse, - NeedIdentifiedFormFields + DeepReplace< + OpsUpdateRequestBody, + NeedIdentifiedResponse, + NeedIdentifiedFormFields + >, + NsActionResponse, + NsActionFormFields >, InterventionResponse, InterventionFormFields diff --git a/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/index.tsx b/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/index.tsx index db02995de9..617fd0b7f8 100644 --- a/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/index.tsx +++ b/app/src/views/OperationalLearning/Sources/AllExtractsModal/Extract/index.tsx @@ -15,7 +15,7 @@ interface Props { emergencyName: string | null | undefined; appealDocumentURL: string; extract: string | null | undefined; - operationStartDate: string; + operationStartDate: string | null | undefined; } function Extract(props: Props) { const { diff --git a/app/src/views/OperationalLearning/Stats/OperationalLearningMap/index.tsx b/app/src/views/OperationalLearning/Stats/OperationalLearningMap/index.tsx index bc3b64b9f4..7e02c037e8 100644 --- a/app/src/views/OperationalLearning/Stats/OperationalLearningMap/index.tsx +++ b/app/src/views/OperationalLearning/Stats/OperationalLearningMap/index.tsx @@ -87,7 +87,7 @@ function OperationalLearningMap(props: Props) { } const features = learningByCountry - .map((value) => { + ?.map((value) => { const country = countriesMap?.[value.country_id]; if (isNotDefined(country)) { return undefined; diff --git a/app/src/views/SurgeCatalogueBasecampOffice/index.tsx b/app/src/views/SurgeCatalogueBasecampOffice/index.tsx index 289b2f0988..ce9a510a71 100644 --- a/app/src/views/SurgeCatalogueBasecampOffice/index.tsx +++ b/app/src/views/SurgeCatalogueBasecampOffice/index.tsx @@ -66,7 +66,6 @@ export function Component() { label={strings.compositionLabel} strongLabel /> -
{strings.compositionDescription}