Skip to content

Commit

Permalink
Merge pull request #163 from IFRCGo/project/phase-2-dummy-pages
Browse files Browse the repository at this point in the history
Project/subscription and historical alerts
  • Loading branch information
barshathakuri authored Dec 6, 2024
2 parents 9427a6f + d3864a3 commit 889066b
Show file tree
Hide file tree
Showing 107 changed files with 6,047 additions and 333 deletions.
1 change: 1 addition & 0 deletions .unimportedrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"ignoreUnimported": ["**/*.d.ts", "**/*.test.*", "**/generated/**"],
"ignoreUnused": [
"@apollo/client",
"@types/geojson",
"@graphql-codegen/introspection",
"@graphql-codegen/typescript-operations",
"patch-package",
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN git config --global --add safe.directory /code
FROM dev AS builder

COPY ./package.json ./pnpm-lock.yaml /code/
COPY ./patches /code/patches/

# TODO: patches are not working with this?
RUN pnpm install
Expand All @@ -33,6 +34,7 @@ ENV APP_ENVIRONMENT=APP_ENVIRONMENT_PLACEHOLDER
ENV APP_MAPBOX_ACCESS_TOKEN=APP_MAPBOX_ACCESS_TOKEN_PLACEHOLDER

Check warning on line 34 in Dockerfile

View workflow job for this annotation

GitHub Actions / Publish Docker Image

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "APP_MAPBOX_ACCESS_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV APP_GOOGLE_ANALYTICS_ID=APP_GOOGLE_ANALYTICS_ID_PLACEHOLDER
ENV APP_GRAPHQL_API_ENDPOINT=https://APP-GRAPHQL-API-ENDPOINT-PLACEHOLDER.COM/
ENV APP_HCAPTCHA_SITEKEY=APP_HCAPTCHA_SITEKEY_PLACEHOLDER

# Build variables (Requires backend pulled)
ENV APP_GRAPHQL_CODEGEN_ENDPOINT=./backend/schema.graphql
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@ docker-compose up
└── index.tsx (Defines root layout and requests fetched for DomainContext)
```

## IFRC Alert Hub backend
The backend that serves the frontend application is maintained in a separate [repository](https://github.com/IFRCGo/alert-hub-backend).

## External facing API
Here is the documentation for [Alert Hub GraphQL Client Usage Guide](./APIDOCS.md)
2 changes: 1 addition & 1 deletion backend
Submodule backend updated 139 files
5 changes: 5 additions & 0 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ x-server: &base_server_setup
# Static, Media configs
DJANGO_STATIC_URL: ${DJANGO_STATIC_URL:-/dj-static/}
DJANGO_MEDIA_URL: ${DJANGO_MEDIA_URL-/dj-media/}
# Misc
HCAPTCHA_SECRET: ${HCAPTCHA_SECRET?error}
HCAPTCHA_SITEKEY: ${HCAPTCHA_SITEKEY?error}
volumes:
- ./geographical_data/:/code/apps/cap_feed/geographical/ifrc-go-admin1-geojson/
- backend_data:/data/
Expand Down Expand Up @@ -98,6 +101,8 @@ services:
APP_GRAPHQL_API_ENDPOINT: ${FRONTEND_APP_GRAPHQL_API_ENDPOINT?error}
APP_MAPBOX_ACCESS_TOKEN: ${FRONTEND_APP_MAPBOX_ACCESS_TOKEN?error}
APP_GRAPHQL_CODEGEN_ENDPOINT: ${FRONTEND_APP_GRAPHQL_CODEGEN_ENDPOINT?error}
env_file:
- .env
command: |
sh -c 'pnpm generate && pnpm build && rm -rf /client-build/* ; cp -r build/* /client-build/'
volumes:
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ x-server: &base_server_setup
# Redis config
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis:6379/0}
CACHE_REDIS_URL: ${CACHE_REDIS_URL:-redis://redis:6379/1}
TEST_CACHE_REDIS_URL: ${TEST_CACHE_REDIS_URL:-redis://redis:6379/11}
# Email config
EMAIL_HOST: ${EMAIL_HOST:-mailpit}
EMAIL_PORT: ${EMAIL_PORT:-1025}
EMAIL_HOST_USER: ${EMAIL_HOST_USER:-mailpit}
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD:-mailpit}
DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL:-alert-hub-dev <[email protected]>}
# Misc
HCAPTCHA_SECRET: ${HCAPTCHA_SECRET:-0x0000000000000000000000000000000000000000}
HCAPTCHA_SITEKEY: ${HCAPTCHA_SITEKEY:-10000000-ffff-ffff-ffff-000000000001}
volumes:
- ./backend/:/code
- backend_data:/data/
Expand Down
3 changes: 2 additions & 1 deletion env.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { defineConfig, Schema } from '@julr/vite-plugin-validate-env';

// TODO: Integrate .env for CI and remove optional() call on required fields
export default defineConfig({
// Used in vite
APP_GOOGLE_ANALYTICS_ID: Schema.string.optional(),
Expand All @@ -23,6 +22,8 @@ export default defineConfig({
APP_GRAPHQL_API_ENDPOINT: Schema.string({ format: 'url', protocol: true, tld: false }),
APP_MAPBOX_ACCESS_TOKEN: Schema.string(),

APP_HCAPTCHA_SITEKEY: Schema.string.optional(),

// Used in codegen
APP_GRAPHQL_CODEGEN_ENDPOINT: Schema.string(), // NOTE: this is both url and file path

Expand Down
2 changes: 2 additions & 0 deletions nginx-serve/apply-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<APP_ENVIRONMENT_PLACEHOL
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<APP_MAPBOX_ACCESS_TOKEN_PLACEHOLDER\>|$APP_MAPBOX_ACCESS_TOKEN|g" {} +
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<APP_GOOGLE_ANALYTICS_ID_PLACEHOLDER\>|$APP_GOOGLE_ANALYTICS_ID|g" {} +
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<https://APP-GRAPHQL-API-ENDPOINT-PLACEHOLDER.COM/|$APP_GRAPHQL_API_ENDPOINT|g" {} +
find "$DESTINATION_DIRECTORY" -type f -exec sed -i "s|\<APP_HCAPTCHA_SITEKEY_PLACEHOLDER|$APP_HCAPTCHA_SITEKEY|g" {} +


# Show diffs (Useful to debug issues)
set +xe
Expand Down
1 change: 1 addition & 0 deletions nginx-serve/helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ data:
APP_MAPBOX_ACCESS_TOKEN: {{ required "env.APP_MAPBOX_ACCESS_TOKEN" .Values.env.APP_MAPBOX_ACCESS_TOKEN | quote }}
APP_GOOGLE_ANALYTICS_ID: {{ .Values.env.APP_GOOGLE_ANALYTICS_ID | quote }}
APP_GRAPHQL_API_ENDPOINT: {{ required "env.APP_GRAPHQL_API_ENDPOINT" .Values.env.APP_GRAPHQL_API_ENDPOINT | quote }}
APP_HCAPTCHA_SITEKEY: {{ required "env.APP_HCAPTCHA_SITEKEY" .Values.env.APP_HCAPTCHA_SITEKEY | quote }}
4 changes: 2 additions & 2 deletions nginx-serve/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ spec:
replicas: 1
selector:
matchLabels:
app: {{ template "ifrcgo-web-app.name" . }}
app: {{ template "ifrcgo-web-app.fullname" . }}
release: {{ .Release.Name }}
run: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "ifrcgo-web-app.name" . }}
app: {{ template "ifrcgo-web-app.fullname" . }}
release: {{ .Release.Name }}
run: {{ .Release.Name }}
spec:
Expand Down
4 changes: 2 additions & 2 deletions nginx-serve/helm/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ kind: Service
metadata:
name: {{ template "ifrcgo-web-app.fullname" . }}-svc
labels:
app: {{ template "ifrcgo-web-app.name" . }}
app: {{ template "ifrcgo-web-app.fullname" . }}
environment: {{ .Values.environment }}
release: {{ .Release.Name }}
spec:
type: ClusterIP
selector:
app: {{ template "ifrcgo-web-app.name" . }}
app: {{ template "ifrcgo-web-app.fullname" . }}
release: {{ .Release.Name }}
run: {{ .Release.Name }}
ports:
Expand Down
1 change: 1 addition & 0 deletions nginx-serve/helm/values-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ env:
APP_ENVIRONMENT: ALPHA-1
APP_MAPBOX_ACCESS_TOKEN: pk.ab.xy
APP_GRAPHQL_API_ENDPOINT: https://alert-hub-1.ifrc-go.org/graphql/
APP_HCAPTCHA_SITEKEY:
1 change: 1 addition & 0 deletions nginx-serve/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ env:
APP_MAPBOX_ACCESS_TOKEN:
APP_GOOGLE_ANALYTICS_ID:
APP_GRAPHQL_API_ENDPOINT: https://alerthub-api.ifrc.org/graphql/
APP_HCAPTCHA_SITEKEY:
17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,19 @@
},
"dependencies": {
"@apollo/client": "^3.9.9",
"@graphql-codegen/introspection": "^4.0.3",
"@graphql-codegen/typescript-operations": "^4.2.0",
"@hcaptcha/react-hcaptcha": "^1.11.0",
"@ifrc-go/icons": "^1.3.3",
"@ifrc-go/ui": "^1.1.2",
"@ifrc-go/ui": "^1.2.1",
"@mapbox/mapbox-gl-draw": "^1.4.3",
"@placemarkio/geo-viewport": "^1.0.2",
"@sentry/react": "^7.81.1",
"@togglecorp/fujs": "^2.1.1",
"@togglecorp/re-map": "^0.2.0-beta-6",
"@togglecorp/toggle-form": "^2.0.4",
"@turf/bbox": "^7.1.0",
"@turf/circle": "^7.1.0",
"graphql": "^16.8.1",
"mapbox-gl": "^1.13.0",
"patch-package": "^8.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3"
Expand All @@ -42,6 +41,8 @@
"@eslint/eslintrc": "^3.0.2",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/client-preset": "^4.2.5",
"@graphql-codegen/introspection": "^4.0.3",
"@graphql-codegen/typescript-operations": "^4.2.0",
"@graphql-typed-document-node/core": "^3.2.0",
"@julr/vite-plugin-validate-env": "^1.0.1",
"@parcel/watcher": "^2.4.1",
Expand Down Expand Up @@ -69,6 +70,7 @@
"eslint-plugin-simple-import-sort": "^12.0.0",
"fast-glob": "^3.3.0",
"happy-dom": "^14.3.8",
"patch-package": "^8.0.0",
"postcss": "^8.4.38",
"postcss-nested": "^6.0.1",
"postcss-normalize": "^10.0.1",
Expand All @@ -92,5 +94,10 @@
"vite-tsconfig-paths": "^4.2.2",
"vitest": "^1.1.0"
},
"packageManager": "[email protected]+sha1.71f9126a20cd3d00fa47c188f956918858180e54"
"packageManager": "[email protected]+sha1.71f9126a20cd3d00fa47c188f956918858180e54",
"pnpm": {
"patchedDependencies": {
"@ifrc-go/[email protected]": "patches/@[email protected]"
}
}
}
47 changes: 47 additions & 0 deletions patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
diff --git a/dist/components/Chip/index.d.ts b/dist/components/Chip/index.d.ts
index 7345249eaad9a8fb959fe0330639292354032909..ceba3ed438c7fa0b687d07f7591bab624aff06bc 100644
--- a/dist/components/Chip/index.d.ts
+++ b/dist/components/Chip/index.d.ts
@@ -2,7 +2,7 @@ export type ChipVariant = 'primary' | 'secondary' | 'tertiary';
export interface Props<N> {
className?: string;
name: N;
- label: string;
+ label: React.ReactNode;
variant?: ChipVariant;
onDelete?: (name: N, e: React.MouseEvent<HTMLButtonElement>) => void;
}
diff --git a/package.json b/package.json
index 999e201527e87de45a377344ca40f13212549f61..8ce9c9c085e950405fb0d0f888d5c57876b5e080 100644
--- a/package.json
+++ b/package.json
@@ -97,5 +97,10 @@
"vite-plugin-lib-inject-css": "^1.3.0",
"vite-tsconfig-paths": "^4.2.3",
"vitest": "^1.1.1"
+ },
+ "pnpm": {
+ "patchedDependencies": {
+ "@ifrc-go/[email protected]": "patches/@[email protected]"
+ }
}
}
diff --git a/patches/@[email protected] b/patches/@[email protected]
new file mode 100644
index 0000000000000000000000000000000000000000..31603365255a6e1aa30c140c96b27fa3e93cd7fa
--- /dev/null
+++ b/patches/@[email protected]
@@ -0,0 +1,13 @@
+diff --git a/dist/components/Chip/index.d.ts b/dist/components/Chip/index.d.ts
+index 7345249eaad9a8fb959fe0330639292354032909..ceba3ed438c7fa0b687d07f7591bab624aff06bc 100644
+--- a/dist/components/Chip/index.d.ts
++++ b/dist/components/Chip/index.d.ts
+@@ -2,7 +2,7 @@ export type ChipVariant = 'primary' | 'secondary' | 'tertiary';
+ export interface Props<N> {
+ className?: string;
+ name: N;
+- label: string;
++ label: React.ReactNode;
+ variant?: ChipVariant;
+ onDelete?: (name: N, e: React.MouseEvent<HTMLButtonElement>) => void;
+ }
Loading

0 comments on commit 889066b

Please sign in to comment.