Skip to content

Commit

Permalink
feat(Header): show local or staging suffix if not in prod. ref #876
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Oct 22, 2024
1 parent 7ec6a3e commit c5b88b6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VITE_OPEN_PRICES_ENV = "local"
VITE_OPEN_PRICES_APP_URL = "http://127.0.0.1:8000"
VITE_OPEN_PRICES_API_URL = "http://127.0.0.1:8000/api/v1"
VITE_MANIFEST_PATH = "/manifest.local.json"
Expand Down
1 change: 1 addition & 0 deletions .env.preprod
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VITE_OPEN_PRICES_ENV = "staging"
VITE_OPEN_PRICES_APP_URL = "https://prices.openfoodfacts.net"
VITE_OPEN_PRICES_API_URL = "https://prices.openfoodfacts.net/api/v1"
VITE_MANIFEST_PATH = "/manifest.preprod.json"
Expand Down
1 change: 1 addition & 0 deletions .env.prod
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VITE_OPEN_PRICES_ENV = "prod"
VITE_OPEN_PRICES_APP_URL = "https://prices.openfoodfacts.org"
VITE_OPEN_PRICES_API_URL = "https://prices.openfoodfacts.org/api/v1"
VITE_MANIFEST_PATH = "/manifest.prod.json"
Expand Down
2 changes: 2 additions & 0 deletions src/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<span style="cursor:pointer" @click="$router.push('/')">
<img src="/favicon.svg" height="28" width="28" style="vertical-align:bottom">
{{ APP_NAME }}
<span v-if="ENV !== 'prod'" class="text-caption">{{ ENV }}</span>
</span>
</v-app-bar-title>
<v-btn v-if="!$vuetify.display.smAndUp" icon="mdi-magnify" to="/search" :aria-label="$t('Common.Search')" />
Expand Down Expand Up @@ -62,6 +63,7 @@ export default {
data() {
return {
APP_NAME: constants.APP_NAME,
ENV: import.meta.env.VITE_OPEN_PRICES_ENV,
showDrawerMenu: false,
showProfileMenu: false,
}
Expand Down
10 changes: 5 additions & 5 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ const LOCATION_TYPE_ONLINE_ICON = 'mdi-web'

export default {
APP_NAME: 'Open Prices',
APP_URL: 'https://prices.openfoodfacts.org',
APP_API_URL: 'https://prices.openfoodfacts.org/api/docs',
APP_URL: import.meta.env.VITE_OPEN_PRICES_APP_URL,
APP_API_URL: `${import.meta.env.VITE_OPEN_PRICES_APP_URL}/api/docs`,
APP_USER_AGENT: 'Open Prices Web App',
APP_DUMP_PRICES_URL: 'https://prices.openfoodfacts.org/data/prices.jsonl.gz',
APP_DUMP_PROOFS_URL: 'https://prices.openfoodfacts.org/data/proofs.jsonl.gz',
APP_DUMP_LOCATIONS_URL: 'https://prices.openfoodfacts.org/data/locations.jsonl.gz',
APP_DUMP_PRICES_URL: `${import.meta.env.VITE_OPEN_PRICES_APP_URL}/data/prices.jsonl.gz`,
APP_DUMP_PROOFS_URL: `${import.meta.env.VITE_OPEN_PRICES_APP_URL}/data/proofs.jsonl.gz`,
APP_DUMP_LOCATIONS_URL: `${import.meta.env.VITE_OPEN_PRICES_APP_URL}/data/locations.jsonl.gz`,
APP_GITHUB_FRONTEND_URL: 'https://github.com/openfoodfacts/open-prices-frontend',
OFF_NAME: OFF_NAME,
OFF_URL: 'https://world.openfoodfacts.org',
Expand Down

0 comments on commit c5b88b6

Please sign in to comment.