Skip to content

Commit

Permalink
feat: Production banner to advertise electron app (#583)
Browse files Browse the repository at this point in the history
Co-authored-by: Abdelrhman Farag <[email protected]>
Co-authored-by: Valia Fetisov <[email protected]>
  • Loading branch information
3 people authored Mar 7, 2023
1 parent 7d8aa83 commit 6887469
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 28 deletions.
14 changes: 9 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ data:
value_from_secret: auction-ui/main.auction-ui.k8s.sidestream.tech/frontend/contact_email
- key: STAGING_BANNER_URL
value_from_secret: auction-ui/main.auction-ui.k8s.sidestream.tech/frontend/staging_banner_url
- key: PRODUCTION_BANNER_URL
value_from_secret: auction-ui/main.auction-ui.k8s.sidestream.tech/frontend/production_banner_url
- key: HEAPIO_ID
value_from_secret: auction-ui/main.auction-ui.k8s.sidestream.tech/frontend/heapio_id
- key: FRONTEND_ORIGIN
Expand Down Expand Up @@ -130,6 +132,8 @@ data:
value_from_secret: auction-ui/production.auction-ui.k8s.sidestream.tech/frontend/heapio_id
- key: FRONTEND_ORIGIN
value_from_secret: auction-ui/production.auction-ui.k8s.sidestream.tech/frontend/frontend_origin
- key: PRODUCTION_BANNER_URL
value_from_secret: auction-ui/main.auction-ui.k8s.sidestream.tech/frontend/production_banner_url
tags_to_cache_from:
- "main"
trigger:
Expand Down Expand Up @@ -214,8 +218,8 @@ data:
aws_target_eks_cluster_name: eks-cluster-sidestream
aws_ssm_path_to_base64_encoded_secrets_yaml: auction-ui/secrets.yaml
value_files:
- values.yaml
- values.override_main.auction-ui.k8s.sidestream.tech.yaml
- values.yaml
- values.override_main.auction-ui.k8s.sidestream.tech.yaml
target_namespace: "auction-ui-main"
release_name: "auction-ui"
values_to_set:
Expand All @@ -234,8 +238,8 @@ data:
aws_target_eks_cluster_name: eks-cluster-sidestream
aws_ssm_path_to_base64_encoded_secrets_yaml: auction-ui/secrets.yaml
value_files:
- values.yaml
- values.override_unified-auctions.makerdao.com.yaml
- values.yaml
- values.override_unified-auctions.makerdao.com.yaml
target_namespace: "auction-ui-production"
release_name: "auction-ui"
values_to_set:
Expand Down Expand Up @@ -299,7 +303,7 @@ data:
- npm run test

services:
- name: hardhat-service # named with 'service' to avoid duplication with the default value
- name: hardhat-service # named with 'service' to avoid duplication with the default value
image: ghcr.io/sidestream-tech/unified-auctions-ui/core-hardhat:pr-${DRONE_PULL_REQUEST}
expose: 8545

Expand Down
2 changes: 2 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ ARG CONTACT_EMAIL
ENV CONTACT_EMAIL=${CONTACT_EMAIL}
ARG STAGING_BANNER_URL
ENV STAGING_BANNER_URL=${STAGING_BANNER_URL}
ARG PRODUCTION_BANNER_URL
ENV PRODUCTION_BANNER_URL=${PRODUCTION_BANNER_URL}
ARG HEAPIO_ID
ENV HEAPIO_ID=${HEAPIO_ID}
ARG FRONTEND_ORIGIN
Expand Down
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="isStagingEnvironment ? 'SplitLayoutStagingContainer' : 'SplitLayoutContainer'">
<div :class="doShowBanner ? 'SplitLayoutBannerPrependedContainer' : 'SplitLayoutContainer'">
<SplitLayout :step.sync="step">
<template #step0>
<div v-if="isExplanationsShown" class="h-1/2">
Expand Down Expand Up @@ -216,8 +216,8 @@ export default Vue.extend({
}
return null;
},
isStagingEnvironment(): boolean {
return !!process.env.STAGING_BANNER_URL;
doShowBanner(): boolean {
return !!process.env.STAGING_BANNER_URL || !!process.env.PRODUCTION_BANNER_URL;
},
collateralVatBalance(): BigNumber | undefined {
if (!this.collateralVatBalanceStore || !this.selectedAuction) {
Expand Down Expand Up @@ -273,7 +273,7 @@ export default Vue.extend({
height: calc(100vh - 4rem);
}
.SplitLayoutStagingContainer {
.SplitLayoutBannerPrependedContainer {
margin-top: 2.3rem;
height: calc(100vh - 6.3rem);
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/components/auction/debt/DebtFlow.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="isStagingEnvironment ? 'SplitLayoutStagingContainer' : 'SplitLayoutContainer'">
<div :class="doShowBanner ? 'SplitLayoutBannerPrependedContainer' : 'SplitLayoutContainer'">
<SplitLayout :step.sync="step">
<template #step0>
<div v-if="isExplanationsShown" class="h-1/2">
Expand Down Expand Up @@ -185,8 +185,8 @@ export default Vue.extend({
selectedAuctionActionState(): string | undefined {
return this.auctionActionState[this.selectedAuctionId] || undefined;
},
isStagingEnvironment(): boolean {
return !!process.env.STAGING_BANNER_URL;
doShowBanner(): boolean {
return !!process.env.STAGING_BANNER_URL || !!process.env.PRODUCTION_BANNER_URL;
},
walletDai(): BigNumber | undefined {
return this.walletBalances?.walletDAI || undefined;
Expand Down Expand Up @@ -235,7 +235,7 @@ export default Vue.extend({
height: calc(100vh - 4rem);
}
.SplitLayoutStagingContainer {
.SplitLayoutBannerPrependedContainer {
margin-top: 2.3rem;
height: calc(100vh - 6.3rem);
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/components/auction/surplus/SurplusFlow.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="isStagingEnvironment ? 'SplitLayoutStagingContainer' : 'SplitLayoutContainer'">
<div :class="doShowBanner ? 'SplitLayoutBannerPrependedContainer' : 'SplitLayoutContainer'">
<SplitLayout :step.sync="step">
<template #step0>
<div v-if="isExplanationsShown" class="h-1/2">
Expand Down Expand Up @@ -190,8 +190,8 @@ export default Vue.extend({
selectedAuctionActionState(): string | undefined {
return this.auctionActionState[this.selectedAuctionId] || undefined;
},
isStagingEnvironment(): boolean {
return !!process.env.STAGING_BANNER_URL;
doShowBanner(): boolean {
return !!process.env.STAGING_BANNER_URL || !!process.env.PRODUCTION_BANNER_URL;
},
walletMKR(): BigNumber | undefined {
return this.walletBalances?.walletMKR || undefined;
Expand Down Expand Up @@ -237,7 +237,7 @@ export default Vue.extend({
height: calc(100vh - 4rem);
}
.SplitLayoutStagingContainer {
.SplitLayoutBannerPrependedContainer {
margin-top: 2.3rem;
height: calc(100vh - 6.3rem);
}
Expand Down
15 changes: 12 additions & 3 deletions frontend/components/layout/Header.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,37 @@ 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"
/>`,
}))
.add('With Production header', () => ({
...common,
template: `<Header
type="unified"
:isExplanationsShown.sync="isExplanationsShown"
productionBannerUrl='https://github.com'
@update:isExplanationsShown="updateIsExplanationsShown"
/>`,
}))
.add('Surplus Auctions Page', () => ({
...common,
template: `<Header
Expand Down
7 changes: 7 additions & 0 deletions frontend/components/layout/Header.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div>
<StagingBanner v-if="stagingBannerUrl" :url="stagingBannerUrl" />
<ProductionBannerElectron v-if="productionBannerUrl" :url="productionBannerUrl" />
<header class="bg-primary dark:bg-primary-dark">
<nav class="flex items-center py-2 px-4 md:px-10">
<HeaderLogo :network="network" :page-name="pageName" />
Expand Down Expand Up @@ -54,6 +55,7 @@
import Vue, { PropType } from 'vue';
import { NetworkConfig } from 'auctions-core/src/types';
import StagingBanner from './StagingBanner.vue';
import ProductionBannerElectron from './ProductionBannerElectron.vue';
import HeaderLogo from './HeaderLogo.vue';
import BaseSwitch from '~/components/common/inputs/BaseSwitch.vue';
import NetworkSelector from '~/components/layout/NetworkSelector.vue';
Expand All @@ -69,6 +71,7 @@ export default Vue.extend({
BaseSwitch,
NetworkSelector,
WalletSelector,
ProductionBannerElectron,
},
props: {
type: {
Expand Down Expand Up @@ -107,6 +110,10 @@ export default Vue.extend({
type: String,
default: undefined,
},
productionBannerUrl: {
type: String,
default: undefined,
},
networks: {
type: Array as PropType<NetworkConfig[]>,
default: () => [] as NetworkConfig[],
Expand Down
25 changes: 25 additions & 0 deletions frontend/components/layout/ProductionBannerElectron.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<Alert 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>
</template>

<script lang="ts">
import Vue from 'vue';
import { Alert } from 'ant-design-vue';
export default Vue.extend({
name: 'ProductionHeaderElectrong',
components: { Alert },
props: {
url: {
type: String,
required: true,
},
},
});
</script>
8 changes: 4 additions & 4 deletions frontend/components/vault/VaultFlow.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="isStagingEnvironment ? 'SplitLayoutStagingContainer' : 'SplitLayoutContainer'">
<div :class="doShowHeader ? 'SplitLayoutBannerPrependedContainer' : 'SplitLayoutContainer'">
<SplitLayout :step.sync="step">
<template #step0>
<div v-if="isExplanationsShown" class="h-1/2">
Expand Down Expand Up @@ -140,8 +140,8 @@ export default Vue.extend({
) || null
);
},
isStagingEnvironment(): boolean {
return !!process.env.STAGING_BANNER_URL;
doShowHeader(): boolean {
return !!process.env.STAGING_BANNER_URL || !!process.env.PRODUCTION_BANNER_URL;
},
},
watch: {
Expand Down Expand Up @@ -183,7 +183,7 @@ export default Vue.extend({
height: calc(100vh - 4rem);
}
.SplitLayoutStagingContainer {
.SplitLayoutBannerPrependedContainer {
margin-top: 2.3rem;
height: calc(100vh - 6.3rem);
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/containers/UnifiedContainer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="isStagingEnvironment ? 'UnifiedStagingContainer' : 'UnifiedContainer'">
<div :class="doShowHeader ? 'UnifiedHeaderPrependedContainer' : 'UnifiedContainer'">
<UnifiedAuctionsView :is-explanations-shown.sync="isExplanationsShown" />
</div>
</template>
Expand All @@ -21,8 +21,8 @@ export default Vue.extend({
this.$store.dispatch('preferences/setExplanationsAction', newIsExplanationsShown);
},
},
isStagingEnvironment(): boolean {
return !!process.env.STAGING_BANNER_URL;
doShowHeader(): boolean {
return !!process.env.STAGING_BANNER_URL || !!process.env.PRODUCTION_BANNER_URL;
},
},
});
Expand All @@ -33,7 +33,7 @@ export default Vue.extend({
min-height: calc(100vh - 9.8rem);
}
.UnifiedStagingContainer {
.UnifiedHeaderPrependedContainer {
margin-top: 2.3rem;
min-height: calc(100vh - 12.1rem);
}
Expand Down
4 changes: 4 additions & 0 deletions frontend/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:is-wallet-loading="isWalletLoading"
:has-accepted-terms="hasAcceptedTerms"
:staging-banner-url="stagingBannerURL"
:production-banner-url="productionBannerURL"
:networks="networks"
:is-changing-network="isChangingNetwork"
@changeWalletType="changeWalletType"
Expand Down Expand Up @@ -139,6 +140,9 @@ export default Vue.extend({
stagingBannerURL() {
return process.env.STAGING_BANNER_URL;
},
productionBannerURL() {
return process.env.PRODUCTION_BANNER_URL;
},
pageName(): string {
return this.$route?.name || '';
},
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

0 comments on commit 6887469

Please sign in to comment.