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/package.json b/package.json index 944b071..6288d63 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,8 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite --host", + "dev": "vite --host --mode dev", "run:functionaltest": "vite --host --mode functionaltest", - "build:production": "tsc && vite build", - "build:staging": "tsc && vite build --mode staging", - "build:testing": "tsc && vite build --mode testing", - "build:development": "tsc && vite build --mode development", "build:functionaltest": "tsc && vite build --mode functionaltest", "build:cicd": "./cicd/build.sh", "lint": "eslint ./src", diff --git a/src/Routes.tsx b/src/Routes.tsx index 1119a65..9e3b1bd 100644 --- a/src/Routes.tsx +++ b/src/Routes.tsx @@ -88,7 +88,7 @@ export default function Routes() { }, ], { - basename: '/pwa-mobile', + basename: '/mobile-app', } ) ); diff --git a/src/helpers/api/endpoints/biocollect.ts b/src/helpers/api/endpoints/biocollect.ts index 8aa6d97..b3c09ed 100644 --- a/src/helpers/api/endpoints/biocollect.ts +++ b/src/helpers/api/endpoints/biocollect.ts @@ -17,7 +17,7 @@ const filterActiveSurveys = (surveys: BioCollectSurvey[]) => ({ 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/layout/Header.tsx b/src/layout/Header.tsx index f79c5b2..805baaa 100644 --- a/src/layout/Header.tsx +++ b/src/layout/Header.tsx @@ -7,6 +7,7 @@ import { UnstyledButton, Badge, Loader, + ThemeIcon, } from '@mantine/core'; import { Link } from 'react-router-dom'; import { useAuth } from 'react-oidc-context'; @@ -18,6 +19,8 @@ import { IconFileUpload, IconUser, IconSettings, + IconPlugConnected, + IconPlugConnectedX, } from '@tabler/icons-react'; import jwtDecode from 'jwt-decode'; @@ -74,11 +77,17 @@ export default function Header() { } /> - - - {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 || @@ -159,7 +168,7 @@ 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', });