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

Update Production #809

Merged
merged 7 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/antelope/stores/rex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export const useRexStore = defineStore(store_name, {
state.__rexData[label]?.period ?? null,
// translation function only takes the key name, without the path and adds the prefix
(key:string) => getAntelope().config.localizationHandler(`antelope.words.${key}`),
// force to show days instead of being dynamic,
'days',
// force to round the number
true,
),

},
Expand Down
12 changes: 6 additions & 6 deletions src/antelope/stores/utils/date-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,27 @@ export function dateIsWithinXMinutes(epochMs: number, minutes: number) {
* @param {function} $t translation function. Should accept a string (just the keyname without a path) and return a translated string
* @returns {string} plain english time period
*/
export function prettyTimePeriod(seconds: number|null, $t: (key: string) => string, round = false) {
export function prettyTimePeriod(seconds: number|null, $t: (key: string) => string, units = '', round = false) {
if (seconds === null) {
return '--';
}

let quantity;
let unit;

if (seconds < HOUR_SECONDS) {
if (seconds < HOUR_SECONDS || units === 'minutes') {
quantity = seconds / MINUTE_SECONDS;
unit = $t('minutes');
} else if (seconds < DAY_SECONDS) {
} else if (seconds < DAY_SECONDS || units === 'hours') {
quantity = seconds / HOUR_SECONDS;
unit = $t('hours');
} else if (seconds < WEEK_SECONDS) {
} else if (seconds < WEEK_SECONDS || units === 'days') {
quantity = seconds / DAY_SECONDS;
unit = $t('days');
} else if (seconds < MONTH_SECONDS) {
} else if (seconds < MONTH_SECONDS || units === 'weeks') {
quantity = seconds / WEEK_SECONDS;
unit = $t('weeks');
} else if (seconds < YEAR_SECONDS) {
} else if (seconds < YEAR_SECONDS || units === 'months') {
quantity = seconds / MONTH_SECONDS;
unit = $t('months');
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/components/ToolTip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function setTooltipVisibility(enable: boolean) {
height: 14px;

path {
fill: var(--accent-color);
fill: var(--q-accent);
}

&--warning {
Expand Down Expand Up @@ -122,6 +122,6 @@ function setTooltipVisibility(enable: boolean) {
.q-tooltip {
// equivalent to --site-gradient (with some alpha), defined here because the quasar tooltip component
// moves the tooltip element to be a sibling of <body>, where our CSS vars are defined
background: linear-gradient(0.4turn, rgba(#071033, 0.85), rgba(#6039A4, 0.85));
background: var(--toolbar-background-color);
}
</style>
37 changes: 33 additions & 4 deletions src/components/evm/AppNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ export default defineComponent({
}
},
},
beforeMount() {
const storedDarkMode = localStorage.getItem('darkModeEnabled');
if (storedDarkMode !== null) {
this.$q.dark.set(storedDarkMode === 'true');
} else {
// Use system preferences if there is no preference saved
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
this.$q.dark.set(prefersDark);
}
},
methods: {
openMenu() {
this.menuIsOpen = true;
Expand All @@ -109,6 +119,7 @@ export default defineComponent({
this.menuIsOpen = false;

if (accountStore.loggedAccount) {
this.$q.dark.set(false);
accountStore.logout();
} else {
this.showWalletOptions = true;
Expand Down Expand Up @@ -155,6 +166,10 @@ export default defineComponent({
const network = this.loggedAccount.network;
window.open(chainStore.getBridgeUrl(network), '_blank');
},
toggleDarkMode() {
this.$q.dark.toggle();
localStorage.setItem('darkModeEnabled', this.$q.dark.isActive.toString());
},
},
});
</script>
Expand All @@ -180,7 +195,6 @@ export default defineComponent({
round
dense
icon="menu"
color="black"
aria-haspopup="menu"
:aria-label="$t('nav.open_menu')"
:tabindex="menuIsOpen ? '-1' : '0'"
Expand All @@ -204,6 +218,16 @@ export default defineComponent({
v-if="showUserInfo"
:account="loggedAccount"
/>

<q-btn
v-if="showUserInfo"
class="c-app-nav__theme-toggle"
flat
dense
:icon="$q.dark.isActive ? 'light_mode' : 'dark_mode'"
@click="toggleDarkMode"
/>

</div>

<div
Expand Down Expand Up @@ -475,6 +499,10 @@ export default defineComponent({
}
}

&__theme-toggle {
color: var(--text-default-contrast);
}

&__menu-container {
position: fixed;
top: 0;
Expand Down Expand Up @@ -504,9 +532,10 @@ export default defineComponent({
left: 0;
display: flex;
justify-content: space-between;
color: var(--header-text-color);
padding: 16px 24px;
background-color: var(--accent-color-5);
color: var(--text-color);
background: var(--header-background-color);
// border-bottom: 1px solid var(--border-color);
z-index: $z-index--header-toolbar;

@include md-and-up {
Expand Down Expand Up @@ -559,7 +588,7 @@ export default defineComponent({
&__apy-box {
@include text--small;
background-color: rgba(255, 255, 255, 0.1);
color: var(--bg-color);
color: $white;
padding: 4px 8px;
border-radius: 4px;
display: inline-block;
Expand Down
100 changes: 98 additions & 2 deletions src/components/evm/AppPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export default defineComponent({
<template>
<q-page class="c-app-page">
<div class="c-app-page__header">

<div class="c-app-page__header-background-top">
<div class="c-app-page__header-background-circle c-app-page__header-background-circle--1"></div>
<div class="c-app-page__header-background-circle c-app-page__header-background-circle--2"></div>
</div>

<div class="c-app-page__header-content">
<slot name="header"></slot>
</div>
Expand Down Expand Up @@ -99,19 +105,107 @@ export default defineComponent({
flex-direction: column;

&__tab-panels {
background: var(--bg-color);
color: var(--text-high-contrast);
margin-top: 24px;
flex-grow: 1;
}

&__header {
color: var(--header-text-color);
background: var(--accent-color-5);
color: var(--text-color);
background: var(--header-background-color);

padding-top: 24px;
position: relative;

&-background-top {
display: var(--display-telos-branding-bg);
z-index: 0;
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-position: center center;
background-size: 100% auto;
background-repeat: no-repeat;
}

&-background-top {
overflow: hidden;
background-image:
radial-gradient(circle at 0% 170%, var(--q-secondary), transparent 45%),
radial-gradient(circle at 100% 130%, var(--q-secondary), transparent 30%),
radial-gradient(circle at 100% 0%, var(--q-primary), transparent 30%),
radial-gradient(circle at 50% 20%, var(--q-accent), transparent 70%);

@media screen and (min-width: $breakpoint-sm-min) {
background-image:
radial-gradient(circle at 0% 170%, var(--q-secondary), transparent 45%),
radial-gradient(circle at 100% 130%, var(--q-secondary), transparent 30%),
radial-gradient(circle at 100% 0%, var(--q-primary), transparent 30%),
radial-gradient(circle at 50% 20%, var(--q-accent), transparent 70%)
}

@media screen and (min-width: $breakpoint-md-min) {
background-image:
radial-gradient(circle at 0% 170%, var(--q-secondary), transparent 45%),
radial-gradient(circle at 100% 130%, var(--q-secondary), transparent 30%),
radial-gradient(circle at 100% 0%, var(--q-primary), transparent 30%),
radial-gradient(circle at 50% 20%, var(--q-accent), transparent 70%)
}

@media screen and (min-width: $breakpoint-lg-min) {
background-image:
radial-gradient(circle at 0% 170%, var(--q-secondary), transparent 40%),
radial-gradient(circle at 100% 140%, var(--q-secondary), transparent 20%),
radial-gradient(circle at 100% 0%, var(--q-primary), transparent 20%),
radial-gradient(circle at 50% 20%, var(--q-accent), transparent 90%)
}
}

&-background-circle {
position: absolute;
content: "";
border-radius: 100%;
border: 32px solid var(--faint-circle-color);

&--1 {
top: -11vh;
right: -26vh;
width: 45vh;
height: 45vh;

@media screen and (min-width: $breakpoint-lg-min) {
top: -12vh;
right: -16vh;
width: 45vh;
height: 45vh;
}

}

&--2 {
display: none;

@media screen and (min-width: $breakpoint-lg-min) {
display: block;
top: -75%;
right: 0;
left: 0;
width: 45vh;
height: 45vh;
margin: 0 auto;
}
}
}

}

&__header-content {
z-index: 1;
position: relative;
display: flex;
justify-content: center;
padding: 0 24px 24px;
Expand All @@ -122,6 +216,8 @@ export default defineComponent({
}

&__tabs {
z-index: 1;
position: relative;
flex-grow: 1;
color: var(--header-text-color);

Expand Down
2 changes: 1 addition & 1 deletion src/components/evm/CollapsibleAside.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function handleExpansionItemUpdate() {

&__expansion-item {
border-radius: 4px;
border: 2px solid var(--accent-color-5);
border: 2px solid var(--border-color);
margin-bottom: 8px;
height: fit-content;

Expand Down
2 changes: 1 addition & 1 deletion src/components/evm/ScrollableInfoCards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const props = defineProps<{


&__card {
background-color: var(--bg-color);
background-color: var(--card-background-color);
padding: 12px;
border-radius: 4px;
border: 2px solid var(--header-item-outline-color);
Expand Down
1 change: 1 addition & 0 deletions src/css/components/_inputs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@
outline: none;
background: none;
width: 98%;
color: var(--text-color);
}
}
2 changes: 2 additions & 0 deletions src/css/components/_notification.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.c-notify {
--bg-color: #FFF;
--text-color: #000;
width: 100%;
max-width: 400px;
margin: 1rem;
Expand Down
Loading
Loading