diff --git a/.github/workflows/upload-pwa-builds.yml b/.github/workflows/upload-pwa-builds.yml
index b466205..559f758 100644
--- a/.github/workflows/upload-pwa-builds.yml
+++ b/.github/workflows/upload-pwa-builds.yml
@@ -1,11 +1,11 @@
name: Build BioCollect PWA Artifacts
on:
- release:
- types: [created]
push:
branches:
- 'feature/**'
+ - 'main'
+ - 'testing'
jobs:
build-and-attach:
@@ -26,34 +26,26 @@ jobs:
- name: Build app for CICD
run: npm run build:cicd
- - name: Upload build assets
- if: github.event_name == 'release'
- run: gh release upload "${{ github.event.release.tag_name }}" ./dist/app-production.zip ./dist/app-staging.zip ./dist/app-testing.zip ./dist/app-development.zip --clobber
-
- name: Upload production artifact
- if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
- name: app-production
- path: dist/app-production.zip
+ name: app-prod
+ path: dist/app-prod.zip
- name: Upload staging artifact
- if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: app-staging
path: dist/app-staging.zip
- name: Upload testing artifact
- if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
- name: app-testing
- path: dist/app-testing.zip
+ name: app-test
+ path: dist/app-test.zip
- name: Upload development artifact
- if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
- name: app-development
- path: dist/app-development.zip
+ name: app-dev
+ path: dist/app-dev.zip
diff --git a/cicd/build.sh b/cicd/build.sh
index a8189f2..886c03a 100755
--- a/cicd/build.sh
+++ b/cicd/build.sh
@@ -1,15 +1,16 @@
#!/usr/bin/env bash
-tsc && for mode in production staging testing development; do
+tsc && for mode in prod staging test dev; do
outDir="./dist/app-$mode"
- zipFile="./dist/app-$mode.zip"
-
+
# If the mode is production, you may not need to specify the --mode flag
- if [ "$mode" = "production" ]; then
+ if [ "$mode" = "prod" ]; then
vite build --outDir "$outDir"
else
vite build --mode "$mode" --outDir "$outDir"
fi
- zip -r "$zipFile" "$outDir"
+ cd "./dist/app-$mode"
+ zip -r "../app-$mode.zip" . *
+ cd ../..
done
\ No newline at end of file
diff --git a/config/.env.development b/config/.env.dev
similarity index 74%
rename from config/.env.development
rename to config/.env.dev
index d6142fa..51b4dc3 100644
--- a/config/.env.development
+++ b/config/.env.dev
@@ -3,10 +3,10 @@
# VITE_AUTH_CLIENT_ID=7hrtrc4d6q4v6kkficnu7l43ob
VITE_AUTH_AUTHORITY=https://auth.ala.org.au/cas/oidc/.well-known
VITE_AUTH_CLIENT_ID=biocollect-pwa-prod
-VITE_AUTH_REDIRECT_URI=https://biocollect-dev.ala.org.au/pwa-mobile
-# VITE_AUTH_REDIRECT_URI=http://localhost:5173/pwa-mobile
+VITE_AUTH_REDIRECT_URI=https://biocollect-dev.ala.org.au/mobile-app
# VITE_AUTH_END_SESSION_URI=https://auth-secure.auth.ap-southeast-2.amazoncognito.com/logout
-# VITE_AUTH_SCOPE="ala"
+# VITE_AUTH_SCOPE="email openid profile ala/attrs ala/roles"
+VITE_AUTH_SCOPE="openid profile ala roles"
VITE_AUTH_TOKEN_REFRESH_INTERVAL=300000
# API
diff --git a/config/.env.functionaltest b/config/.env.functionaltest
index d286942..91ab940 100644
--- a/config/.env.functionaltest
+++ b/config/.env.functionaltest
@@ -1,7 +1,7 @@
# Authentication
VITE_AUTH_AUTHORITY=http://localhost:8018/cas/oidc/.well-known
VITE_AUTH_CLIENT_ID=oidcId
-VITE_AUTH_REDIRECT_URI=http://localhost:5173/pwa-mobile
+VITE_AUTH_REDIRECT_URI=http://localhost:5173/mobile-app
# VITE_AUTH_END_SESSION_URI=ENTER-HERE
VITE_AUTH_SCOPE="openid profile ala roles"
VITE_AUTH_TOKEN_REFRESH_INTERVAL=300000
diff --git a/config/.env.production b/config/.env.prod
similarity index 70%
rename from config/.env.production
rename to config/.env.prod
index c39a9e0..0b0a202 100644
--- a/config/.env.production
+++ b/config/.env.prod
@@ -1,12 +1,12 @@
# Authentication
VITE_AUTH_AUTHORITY=https://auth.ala.org.au/cas/oidc/.well-known
VITE_AUTH_CLIENT_ID=biocollect-pwa-prod
-VITE_AUTH_REDIRECT_URI=https://biocollect-dev.ala.org.au/pwa-mobile
+VITE_AUTH_REDIRECT_URI=https://biocollect.ala.org.au/mobile-app
# VITE_AUTH_END_SESSION_URI=ENTER-HERE
VITE_AUTH_SCOPE="openid profile ala roles"
VITE_AUTH_TOKEN_REFRESH_INTERVAL=300000
# API
VITE_API_TIMEOUT=0
-VITE_API_BIOCOLLECT=https://biocollect-dev.ala.org.au
+VITE_API_BIOCOLLECT=https://biocollect.ala.org.au
VITE_API_BIOCOLLECT_HUB=acsa
\ No newline at end of file
diff --git a/config/.env.staging b/config/.env.staging
index 4500184..7b24482 100644
--- a/config/.env.staging
+++ b/config/.env.staging
@@ -1,9 +1,9 @@
# Authentication
-VITE_AUTH_AUTHORITY=ENTER-HERE
-VITE_AUTH_CLIENT_ID=ENTER-HERE
-VITE_AUTH_REDIRECT_URI=ENTER-HERE
-VITE_AUTH_END_SESSION_URI=ENTER-HERE
-VITE_AUTH_SCOPE=ENTER-HERE
+VITE_AUTH_AUTHORITY=https://auth.ala.org.au/cas/oidc/.well-known
+VITE_AUTH_CLIENT_ID=biocollect-pwa-prod
+VITE_AUTH_REDIRECT_URI=https://biocollect-staging.ala.org.au/mobile-app
+# VITE_AUTH_END_SESSION_URI=ENTER-HERE
+VITE_AUTH_SCOPE="openid profile ala roles"
VITE_AUTH_TOKEN_REFRESH_INTERVAL=300000
# API
diff --git a/config/.env.test b/config/.env.test
new file mode 100644
index 0000000..9de3365
--- /dev/null
+++ b/config/.env.test
@@ -0,0 +1,14 @@
+# Authentication
+VITE_AUTH_AUTHORITY=https://cognito-idp.ap-southeast-2.amazonaws.com/ap-southeast-2_OOXU9GW39
+VITE_AUTH_CLIENT_ID=7hrtrc4d6q4v6kkficnu7l43ob
+# VITE_AUTH_AUTHORITY=https://auth-test.ala.org.au/cas/oidc/.well-known
+# VITE_AUTH_CLIENT_ID=biocollect-pwa-test
+VITE_AUTH_REDIRECT_URI=https://biocollect-test.ala.org.au/mobile-app
+VITE_AUTH_END_SESSION_URI=https://auth-secure.auth.ap-southeast-2.amazoncognito.com/logout
+VITE_AUTH_SCOPE="email openid profile ala/attrs ala/roles"
+VITE_AUTH_TOKEN_REFRESH_INTERVAL=300000
+
+# API
+VITE_API_TIMEOUT=10000
+VITE_API_BIOCOLLECT=https://biocollect-test.ala.org.au
+VITE_API_BIOCOLLECT_HUB=acsa
\ No newline at end of file
diff --git a/config/.env.testing b/config/.env.testing
deleted file mode 100644
index d96da63..0000000
--- a/config/.env.testing
+++ /dev/null
@@ -1,14 +0,0 @@
-# Authentication
-# VITE_AUTH_AUTHORITY=https://cognito-idp.ap-southeast-2.amazonaws.com/ap-southeast-2_OOXU9GW39
-# VITE_AUTH_CLIENT_ID=7hrtrc4d6q4v6kkficnu7l43ob
-VITE_AUTH_AUTHORITY=https://auth-test.ala.org.au/cas/oidc/.well-known
-VITE_AUTH_CLIENT_ID=biocollect-pwa-test
-VITE_AUTH_REDIRECT_URI=https://biocollect-pwa.test.ala.org.au
-# VITE_AUTH_END_SESSION_URI=https://auth-secure.auth.ap-southeast-2.amazoncognito.com/logout
-VITE_AUTH_SCOPE=ENTER-HERE
-VITE_AUTH_TOKEN_REFRESH_INTERVAL=300000
-
-# API
-VITE_API_TIMEOUT=10000
-VITE_API_BIOCOLLECT=https://biocollect-test.ala.org.au
-VITE_API_BIOCOLLECT_HUB=acsa
\ No newline at end of file
diff --git a/index.html b/index.html
index 98230ea..892626f 100644
--- a/index.html
+++ b/index.html
@@ -5,19 +5,19 @@
({ startDate, endDate, published }) =>
new Date(startDate).getTime() <= Date.now() &&
(!endDate || new Date(endDate).getTime() >= Date.now()) &&
- published
+ (published !== undefined ? published : true)
) || [];
const formatProjects = (projects: BioCollectProject[]) => {
diff --git a/src/helpers/api/provider.tsx b/src/helpers/api/provider.tsx
index f448d85..0a6bc81 100644
--- a/src/helpers/api/provider.tsx
+++ b/src/helpers/api/provider.tsx
@@ -23,7 +23,7 @@ const APIProvider = (props: PropsWithChildren<{}>): ReactElement => {
} else {
delete axios.defaults.headers['Authorization'];
}
- }, [auth.isAuthenticated]);
+ }, [auth.isAuthenticated, auth.user, auth]);
return (
-
-
- {onLine ? 'online' : 'offline'}
-
-
+
+ {onLine ? (
+
+ ) : (
+
+ )}
+
@@ -94,7 +103,7 @@ export default function Header() {
const { user, isAuthenticated } = auth;
if (!isAuthenticated) return ;
-
+
// Use the given name from the profile field, otherwise fallback to the JWT
const given_name =
user?.profile.given_name ||
@@ -152,14 +161,14 @@ export default function Header() {
}
>
Help
}
disabled={auth.isLoading || !onLine}
diff --git a/src/layout/InstallButton.tsx b/src/layout/InstallButton.tsx
index 2428ce8..62c61d6 100644
--- a/src/layout/InstallButton.tsx
+++ b/src/layout/InstallButton.tsx
@@ -114,7 +114,7 @@ export function InstallButton() {
)
}
>
- {install ? 'Install' : 'Installation Instructions'}
+ {install ? 'Install' : 'Install Instructions'}
{
const params = new URLSearchParams(window.location.search);
diff --git a/src/views/Home/index.tsx b/src/views/Home/index.tsx
index 1d8dcd8..4d9b4ac 100644
--- a/src/views/Home/index.tsx
+++ b/src/views/Home/index.tsx
@@ -61,7 +61,7 @@ export function Home() {
(getNumber('page', 1, params) - 1) * paramMax,
paramMax,
getString('pSort', 'dateCreatedSort', params),
- getBool('isUserPage', false, params),
+ getBool('isUserPage', true, params),
getString('search', undefined, params),
getBool('offline', !onLine, params)
);
diff --git a/vite.config.ts b/vite.config.ts
index d67fa61..1f11e41 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -88,7 +88,7 @@ const pwaOptions: Partial = {
// https://vitejs.dev/config/
export default defineConfig({
- base: '/pwa-mobile',
+ base: '/mobile-app',
plugins: [react(), tsconfigPaths(), visualizer() as any, VitePWA(pwaOptions)],
envDir: './config',
});