-
-
Notifications
You must be signed in to change notification settings - Fork 65
fix: layout fixes #782
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
base: dev
Are you sure you want to change the base?
fix: layout fixes #782
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Deployed to https://msg-adamant-pr-782.surge.sh 🚀 |
src/components/BuyTokensDialog.vue
Outdated
@@ -104,6 +104,9 @@ export default { | |||
} | |||
}, | |||
methods: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be convert this file to composition? It seems like it's going to be fast
src/views/Login.vue
Outdated
/> | ||
</container> | ||
</v-row> | ||
</component> | ||
</template> | ||
|
||
<script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too, doesn't seem hard to convert to composition
@@ -206,7 +207,13 @@ export default { | |||
CurrencySwitcher, | |||
PasswordSetDialog | |||
}, | |||
mixins: [scrollPosition], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You transported the scrollbar position logic to mounted
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scrollPosition mixin didn't work at all, so I created new scroll position logic
src/views/Options.vue
Outdated
props: { | ||
sidebarLayoutRef: { | ||
type: Object, | ||
required: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need in required
here
src/views/Options.vue
Outdated
mounted() { | ||
nextTick(() => { | ||
if (this.sidebarLayoutRef) { | ||
const scrollTopValue = Number(localStorage.getItem('optionsScrollTop')) || 0 | ||
this.sidebarLayoutRef.scrollTo({ | ||
top: scrollTopValue | ||
}) | ||
} | ||
}) | ||
}, | ||
beforeUnmount() { | ||
localStorage.setItem('optionsScrollTop', this.sidebarLayoutRef?.scrollTop || 0) | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you store the scroll position in the LocalStorage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to vuex store already
src/views/Options.vue
Outdated
onCheckStayLoggedIn() { | ||
if (!this.stayLoggedIn) { | ||
isIDBSupported | ||
.then(() => { | ||
this.passwordDialog = true | ||
|
||
window.addEventListener('keydown', this.onKeydownHandler, true) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like workaround. Can you explain why you put the listener here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, it's better to move it inside dialog component
@S-FrontendDev |
src/components/BuyTokensDialog.vue
Outdated
@@ -56,64 +56,68 @@ | |||
</v-dialog> | |||
</template> | |||
|
|||
<script> | |||
<script setup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to TypeScript
src/views/Options.vue
Outdated
mounted() { | ||
nextTick(() => { | ||
if (this.sidebarLayoutRef && this.scrollTopPosition) { | ||
this.sidebarLayoutRef.scrollTo({ | ||
top: this.scrollTopPosition | ||
}) | ||
} | ||
}) | ||
}, | ||
beforeUnmount() { | ||
if (this.sidebarLayoutRef) { | ||
this.scrollTopPosition = this.sidebarLayoutRef.scrollTop || 0 | ||
} | ||
}, | ||
computed: { | ||
className: () => 'settings-view', | ||
stayLoggedIn() { | ||
return this.$store.state.options.stayLoggedIn | ||
}, | ||
scrollTopPosition: { | ||
get() { | ||
return this.$store.state.options.scrollTopPosition | ||
}, | ||
set(value) { | ||
this.$store.commit('options/updateOption', { | ||
key: 'scrollTopPosition', | ||
value | ||
}) | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move the scroll position logic into a hook and reuse it in every View where it's needed? @S-FrontendDev
@@ -12,11 +12,13 @@ const state = () => ({ | |||
currentWallet: Cryptos.ADM, // current Wallet Tab on Account view (this is not an option) | |||
useSocketConnection: true, | |||
suppressWarningOnAddressesNotification: false, | |||
currentRate: Rates.USD | |||
currentRate: Rates.USD, | |||
scrollTopPosition: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem right to store the scroll position here. That's a common prop for every page, not just Settings.vue. I suggest to store that value inside the router
instance.
This is how it worked before using mixins:
https://github.com/Adamant-im/adamant-im/blob/dev/src/mixins/scrollPosition.js#L3-L10
Try to replicate that logic, but using hooks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did it ever work this way? I've tried multiple ways to use $route.meta to store scroll positions, but the router/scrollBehavior console logs clearly show that when navigating to the page, only the original meta (defined during router initialization) is being used
No description provided.