Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Banner for production #583

Merged
merged 12 commits into from
Mar 7, 2023
1 change: 1 addition & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Help on both things is given in the linked resources above.
- `PRODUCTION_DOMAIN`: (optional) Required in order to enable [plausible.io statistics](https://github.com/moritzsternemann/vue-plausible#configuration). In addition to adding it here, the domain (e.g. `auctions.makerdao.network`) should also be registered within [plausible dashboard](https://plausible.io/).
- `CONTACT_EMAIL`: (optional) Required in order to display contact link in the footer. This email should be able to accept and manage bug reports and other contact requests.
- `STAGING_BANNER_URL`: (optional) When set a banner will be displayed, warning the user that they are using a staging version. The text will use `STAGING_BANNER_URL` as a link to production UI.
- `PRODUCTION_BANNER_URL`: (optional) When set a banner will be displayed, notifying the user that they can also use an electron app. The text will use `PRODUCTION_BANNER_URL` as a link the electron app.
- `MAX_PRIORITY_FEE_PER_GAS_WEI`: (optional, default can be found in core/src/gas.ts) – [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) `max_priority_fee_per_gas` value
- `HEAPIO_ID`: (optional) [HeapIO analytics](https://heapanalytics.com/) Project's Environment ID. Required for tracking analytics.
- `FRONTEND_ORIGIN`: (optional, default empty) – public url of the frontend, eg `https://unified-auctions.makerdao.com`. Used to correctly specify open graph meta tags
Expand Down
7 changes: 7 additions & 0 deletions frontend/components/layout/ElectronUpdateBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
>. Current version: v{{ version }}.
</template>
</Alert>
<Alert v-else-if="status === 'production'" type="info" show-icon banner closable class="text-center">
<template #message>
You can now run the Unified Auctions UI locally as a desktop application. Please see its release at
<a class="underline" :href="url" target="_blank">{{ url }}</a
>.
</template>
</Alert>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it has to do with the ElectronUpdateBanner or its states? Please move it back to its dedicated component and just use closable Alert

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My logic was that it is an electron-related topic, so instead of editing multiple components, just use an existing one that follows the same pattern.

</template>

<script lang="ts">
Expand Down
6 changes: 3 additions & 3 deletions frontend/components/layout/Header.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ storiesOf('Layout/Header', module)
.add('Unified Auctions Page', () => ({
...common,
template: `<Header
type="unified"
type="unified"
:isExplanationsShown.sync="isExplanationsShown"
@update:isExplanationsShown="updateIsExplanationsShown"
/>`,
}))
.add('Minimal', () => ({
...common,
template: `<Header
type="minimal"
type="minimal"
:isExplanationsShown.sync="isExplanationsShown"
@update:isExplanationsShown="updateIsExplanationsShown"
/>`,
}))
.add('With Staging Banner', () => ({
...common,
template: `<Header
type="unified"
type="unified"
:isExplanationsShown.sync="isExplanationsShown"
stagingBannerUrl="https://example.com/"
@update:isExplanationsShown="updateIsExplanationsShown"
Expand Down
6 changes: 6 additions & 0 deletions frontend/containers/ElectronUpdateBannerContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ export default Vue.extend({
// should never be the case
message.error(`Cannot check for updates for unknown reason`);
}
} else if (process.env.PRODUCTION_BANNER_URL) {
this.result = {
status: 'production',
url: process.env.PRODUCTION_BANNER_URL,
version: '',
};
}
},
});
Expand Down
1 change: 1 addition & 0 deletions frontend/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default {
CONTACT_EMAIL: process.env.CONTACT_EMAIL || undefined,
GITHUB_URL: pkg.repository.url,
STAGING_BANNER_URL: process.env.STAGING_BANNER_URL || undefined,
PRODUCTION_BANNER_URL: process.env.PRODUCTION_BANNER_URL || undefined,
HEAPIO_ID: process.env.HEAPIO_ID || undefined,
APPLICATION_VERSION: uuidv4(), // hardcoded this during build
},
Expand Down