Skip to content

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

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

fix: layout fixes #782

wants to merge 6 commits into from

Conversation

S-FrontendDev
Copy link
Collaborator

No description provided.

@S-FrontendDev S-FrontendDev requested a review from a team as a code owner April 30, 2025 18:47
Copy link

vercel bot commented Apr 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
adamant-im ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 5:09am

@S-FrontendDev
Copy link
Collaborator Author

Copy link

github-actions bot commented Apr 30, 2025

Deployed to https://msg-adamant-pr-782.surge.sh 🚀

@@ -104,6 +104,9 @@ export default {
}
},
methods: {
Copy link
Collaborator

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

/>
</container>
</v-row>
</component>
</template>

<script>
Copy link
Collaborator

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],
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

props: {
sidebarLayoutRef: {
type: Object,
required: false,
Copy link
Collaborator

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

Comment on lines 230 to 242
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)
},
Copy link
Member

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?

Copy link
Collaborator Author

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

Comment on lines 348 to 355
onCheckStayLoggedIn() {
if (!this.stayLoggedIn) {
isIDBSupported
.then(() => {
this.passwordDialog = true

window.addEventListener('keydown', this.onKeydownHandler, true)
})
Copy link
Member

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?

Copy link
Collaborator Author

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

@adamantmm
Copy link
Member

@S-FrontendDev
Please update.

@@ -56,64 +56,68 @@
</v-dialog>
</template>

<script>
<script setup>
Copy link
Collaborator

Choose a reason for hiding this comment

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

to TypeScript

@adamant-al adamant-al requested review from dvelikiy and a team May 8, 2025 18:31
Comment on lines 226 to 255
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
})
}
},
Copy link
Member

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
Copy link
Member

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.

Copy link
Collaborator Author

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

@adamantmm
Copy link
Member

@bludnic @dvelikiy
Please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants