Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

refactor: simplify blurred modal backdrop & ui tweaks #1638

Merged
merged 19 commits into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
57 changes: 10 additions & 47 deletions src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,11 @@
<AppSidemenu
v-if="hasAnyProfile"
:is-horizontal="true"
:class="{
'blur': hasBlurFilter
}"
class="block md:hidden z-1"
/>
<section
:style="background ? `backgroundImage: url('${assets_loadImage(background)}')` : ''"
:class="{
'blur': hasBlurFilter
}"
class="App__main flex flex-col items-center px-6 pb-6 pt-2 lg:pt-6 w-screen-adjusted h-screen-adjusted overflow-hidden -m-2"
class="App__main flex flex-col items-center px-4 pb-4 lg:pt-4 w-screen h-screen-adjusted overflow-hidden"
>
<div
:class="{ 'ml-6': !hasAnyProfile }"
Expand Down Expand Up @@ -73,32 +67,19 @@
/>

<PortalTarget
:slot-props="{ setPortalHasContent }"
name="modal"
multiple
@change="onPortalChange('modal', ...arguments)"
/>

<PortalTarget
:slot-props="{ setPortalHasContent }"
name="updater"
@change="onPortalChange('updater', ...arguments)"
/>
<PortalTarget name="updater" />

<PortalTarget
name="loading"
@change="onPortalChange('loading', ...arguments)"
/>
<PortalTarget name="loading" />

<PortalTarget
name="qr-scan"
@change="onPortalChange('qr-scan', ...arguments)"
/>
<PortalTarget name="qr-scan" />

<PortalTarget
name="button-dropdown"
multiple
:slot-props="{ hasBlurFilter }"
/>

<AlertMessage />
Expand Down Expand Up @@ -134,13 +115,6 @@ export default {
data: () => ({
isReady: false,
isUriTransactionOpen: false,
forceBlurFilter: false,
portalHasContent: {
modal: false,
update: false,
loading: false,
'qr-scan': false
},
uriTransactionSchema: {},
aliveRouteComponents: []
}),
Expand All @@ -154,9 +128,6 @@ export default {
}),

computed: {
hasBlurFilter () {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm getting the message on my devtools console: Property or method "hasBlurFilter" is not defined on the instance but referenced during render. Because of hasBlurFilter here:

:slot-props="{ hasBlurFilter }"

Copy link
Contributor Author

@dated dated Feb 11, 2020

Choose a reason for hiding this comment

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

Looks like the button-dropdown portal got added in one of the merges, I'll need to take a look at how it uses the blur class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, looks like the blur on the button dropdown can be safely removed. Strangely the button dropdown wasn't positioned correctly for me during development (this.$refs.buttonDropdown always being undefined) while it displays correctly on 2.8.0, therefore I added a resize handler to also reposition the dropdown while it is open. @alexbarnsley could you have a look at this also? In particular 85700dc which adds the resize handler.

return Object.values(this.portalHasContent).some(hasContent => !!hasContent)
},
background () {
return this.$store.getters['session/background'] || `wallpapers/${this.hasSeenIntroduction ? 1 : 2}Default.png`
},
Expand Down Expand Up @@ -342,10 +313,6 @@ export default {
ipcRenderer.send('splashscreen:app-ready')
},

onPortalChange (portal, isActive) {
this.setPortalHasContent(portal, isActive)
},

__watchProcessURL () {
ipcRenderer.on('process-url', (_, url) => {
const uri = new URIHandler(url)
Expand All @@ -372,10 +339,6 @@ export default {
this.uriTransactionSchema = {}
},

setPortalHasContent (portal, isActive) {
this.portalHasContent[portal] = isActive
},

setIntroDone () {
this.$store.dispatch('app/setHasSeenIntroduction', true)
this.$router.push({ name: 'profile-new' })
Expand Down Expand Up @@ -431,19 +394,19 @@ export default {
.App__main {
transition: .1s filter linear;
}
.App__container {
max-width: 1400px;
}
.App__main.h-screen-adjusted {
height: calc(100vh + 1rem);
height: calc(100vh - 80px);
}
.App__main.w-screen-adjusted {
width: calc(100vw + 1rem);
.App__container {
max-width: 1400px;
}
@media (min-width: 768px) {
.App__page {
@apply .min-h-full;
max-height: calc(100vh - 5rem);
}
.App__main.h-screen-adjusted {
@apply h-screen;
}
}
</style>
16 changes: 9 additions & 7 deletions src/renderer/components/App/AppSidemenu/AppSidemenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
v-model="activeItem"
:class="{
'AppSidemenu--horizontal': isHorizontal,
'AppSidemenu--vertical': !isHorizontal
'AppSidemenu--vertical mr-3 lg:mx-6': !isHorizontal
}"
class="AppSidemenu relative bg-transparent"
class="AppSidemenu"
>
<div
class="AppSidemenu__container flexify w-full md:h-full justify-between"
Expand Down Expand Up @@ -232,18 +232,20 @@ export default {
</script>

<style lang="postcss" scoped>
.AppSidemenu { @apply relative bg-transparent }
.AppSidemenu__container__scrollable .flexify { @apply flex-none }
.AppSidemenu__logo { transition: opacity 0.5s; }

.AppSidemenu__avatar__container {
transition: opacity 0.5s;
}

.AppSidemenu--horizontal .AppSidemenu__item { @apply w-16 }
.AppSidemenu--horizontal { @apply h-full }
.AppSidemenu--horizontal .flexify { @apply flex flex-row }
.AppSidemenu--horizontal .AppSidemenu__container { @apply bg-theme-feature }
.AppSidemenu--horizontal .AppSidemenu__item { @apply w-16 h-full }
.AppSidemenu--horizontal .AppSidemenu__logo { @apply p-4 }
.AppSidemenu--horizontal .AppSidemenu__logo img { @apply h-12 }
.AppSidemenu--horizontal .flexify { @apply flex flex-row }
.AppSidemenu--horizontal { @apply h-18; }
.AppSidemenu--horizontal .AppSidemenu__avatar__dots {
@apply absolute p-2 rounded-full bg-theme-feature;
right: 0.1rem;
Expand All @@ -252,12 +254,12 @@ export default {
height: 1.5rem;
}

.AppSidemenu--vertical { @apply w-22 h-full rounded-lg }
.AppSidemenu--vertical .flexify { @apply flex flex-col }
.AppSidemenu--vertical .AppSidemenu__container__scrollable { @apply rounded-lg py-2 }
.AppSidemenu--vertical .AppSidemenu__item { @apply h-16 }
.AppSidemenu--vertical .AppSidemenu__logo { @apply rounded-lg mb-3 p-5 }
.AppSidemenu--vertical .AppSidemenu__logo img { @apply w-18 }
.AppSidemenu--vertical .flexify { @apply flex flex-col }
.AppSidemenu--vertical { @apply w-22 mx-6 rounded-lg }
.AppSidemenu--vertical .AppSidemenu__avatar__dots {
@apply absolute p-2 rounded-full bg-theme-feature shadow;
right: 1rem;
Expand Down
51 changes: 31 additions & 20 deletions src/renderer/components/Button/ButtonDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,8 @@
>
<div
v-show="showDropdown"
slot-scope="app"
class="ButtonDropdown__list transition"
:style="dropdownStyle"
:class="{
'blur': app.hasBlurFilter
}"
>
<div
v-for="(item, key) of items"
Expand Down Expand Up @@ -103,7 +99,8 @@ export default {

data () {
return {
showDropdown: false
showDropdown: false,
dropdownStyle: ''
}
},

Expand All @@ -129,24 +126,17 @@ export default {
}

return '0 -2 12 16'
},

dropdownStyle () {
const buttonDropdown = this.$refs.buttonDropdown
}
},

if (!buttonDropdown) {
return ''
}
mounted () {
this.setDropdownStyle()

const height = buttonDropdown.clientHeight
const position = buttonDropdown.getBoundingClientRect()
window.addEventListener('resize', this.handleResize)
},

return [
`top: ${position.top + height}px`,
`left: ${position.left}px`,
'z-index: 10'
].join(';')
}
destroyed () {
window.removeEventListener('resize', this.handleResize)
},

methods: {
Expand All @@ -156,6 +146,27 @@ export default {

triggerClose () {
this.showDropdown = false
},

handleResize () {
this.setDropdownStyle()
},

setDropdownStyle () {
const buttonDropdown = this.$refs.buttonDropdown

if (buttonDropdown) {
const height = buttonDropdown.clientHeight
const position = buttonDropdown.getBoundingClientRect()

this.dropdownStyle = [
`top: ${position.top + height}px`,
`left: ${position.left}px`,
'z-index: 10'
].join(';')
} else {
this.dropdownStyle = ''
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/Modal/ModalCloseConfirmation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export default {
left: 0;
background-color: rgba(0, 0, 0, .5);
transition: opacity .3s ease;
backdrop-filter: blur(4px);
}

.ModalCloseConfirmation__container__content{
Expand Down
12 changes: 5 additions & 7 deletions src/renderer/components/Modal/ModalWindow.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<template>
<Portal :to="portalTarget">
<div
slot-scope="{ setPortalHasContent }"
class="ModalWindow"
:class="{
'ModalWindow--maximized': isMaximized,
Expand Down Expand Up @@ -30,7 +29,7 @@
:icon-name="isMaximized ? 'minus' : 'resize'"
icon-class="text-grey"
class="ModalWindow__resize-button p-6"
@click="toggleMaximized(setPortalHasContent)"
@click="toggleMaximized()"
/>
</span>

Expand Down Expand Up @@ -83,7 +82,6 @@

<script>
import { ButtonClose } from '@/components/Button'
import { isFunction } from 'lodash'
import ModalCloseConfirmation from './ModalCloseConfirmation'

export default {
Expand Down Expand Up @@ -163,9 +161,8 @@ export default {
},

methods: {
toggleMaximized (callback) {
toggleMaximized () {
this.isMaximized = !this.isMaximized
isFunction(callback) && callback(this.portalTarget, this.isMaximized)
},

onBackdropClick () {
Expand Down Expand Up @@ -222,8 +219,9 @@ export default {
display: table;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
transition: opacity 0.3s ease;
background-color: rgba(0, 0, 0, .5);
transition: opacity .3s ease;
backdrop-filter: blur(4px);
}

.ModalWindow--maximized .ModalWindow__wrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<MenuTab
ref="menutab"
v-model="currentTab"
:class="{ 'rounded-bl-lg' : !isDelegatesTab || !isOwned }"
class="flex-1"
:class="{ 'rounded-b-lg lg:rounded-br-none' : !isDelegatesTab || !isOwned }"
class="flex-1 overflow-y-auto"
>
<MenuTabItem
key="BackItem"
Expand Down Expand Up @@ -44,7 +44,7 @@
</MenuTab>
<div
v-if="isDelegatesTab && isOwned"
class="bg-theme-feature px-5 flex flex-row rounded-bl-lg"
class="bg-theme-feature px-5 flex flex-row rounded-b-lg lg:rounded-br-none"
>
<div
class="WalletDetails__button rounded-l"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div
:class="justifyClass"
class="WalletHeading flex px-10 py-8 w-full bg-theme-heading-background rounded-tl-lg h-40 overflow-hidden"
class="WalletHeading flex px-10 py-8 w-full bg-theme-heading-background rounded-t-lg lg:rounded-tr-none h-40 overflow-hidden"
>
<WalletHeadingInfo
v-if="!secondaryButtonsVisible"
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/pages/Wallet/WalletShow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<WalletDetails
v-if="wallet"
ref="WalletDetails"
class="h-full flex-1"
class="flex-1"
:class="{
'w-2/3': isSidebarExpanded,
'w-7/8': !isSidebarExpanded
Expand Down
6 changes: 0 additions & 6 deletions src/renderer/styles/_general.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ img {
transform: rotate(180deg);
}

.modal-backdrop {
@apply .fixed .z-50 .pin-t .pin-l .table .w-full .h-full;
background-color: rgba(0, 0, 0, 0.5);
transition: opacity 0.3s ease;
}

.instructions-text {
@apply .mt-16 .mx-16 .w-1/2 .p-4 .rounded-lg .text-theme-page-instructions-text .bg-theme-page-instructions-background
}
Expand Down