mirror of
https://github.com/tornadocash/trusted-setup-server.git
synced 2024-11-22 01:46:52 +01:00
add loading to authorize page
-disable fields if successful on the authorize page
This commit is contained in:
parent
431b06ca52
commit
a979220830
@ -189,8 +189,6 @@
|
|||||||
|
|
||||||
fieldset[disabled] {
|
fieldset[disabled] {
|
||||||
.box {
|
.box {
|
||||||
opacity: .5;
|
|
||||||
cursor: not-allowed;
|
|
||||||
background-color: $primary-invert;
|
background-color: $primary-invert;
|
||||||
border-color: #393939;
|
border-color: #393939;
|
||||||
|
|
||||||
@ -602,6 +600,15 @@ fieldset {
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&[disabled] {
|
||||||
|
opacity: .5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
|
||||||
|
label {
|
||||||
|
cursor: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.form {
|
.form {
|
||||||
|
27
components/Loading.vue
Normal file
27
components/Loading.vue
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<template>
|
||||||
|
<b-loading :active.sync="loading">
|
||||||
|
<div class="loading-container">
|
||||||
|
<div class="loading-tornado"></div>
|
||||||
|
<div class="loading-message">{{ message }}...</div>
|
||||||
|
</div>
|
||||||
|
</b-loading>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
message: 'Loading'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.$root.$on('enableLoading', (msg = 'Loading') => {
|
||||||
|
this.loading = true
|
||||||
|
this.message = msg
|
||||||
|
})
|
||||||
|
this.$root.$on('disableLoading', () => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -6,15 +6,18 @@
|
|||||||
<nuxt />
|
<nuxt />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<Loading />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Navbar from '@/components/Navbar'
|
import Navbar from '@/components/Navbar'
|
||||||
|
import Loading from '@/components/Loading'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Navbar
|
Navbar,
|
||||||
|
Loading
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<h2 class="subtitle">
|
<h2 class="subtitle">
|
||||||
Do you want to authorize your contribution #{{ contributionIndex }}? Please sign in.
|
Do you want to authorize your contribution #{{ contributionIndex }}? Please sign in.
|
||||||
</h2>
|
</h2>
|
||||||
<fieldset class="authorize">
|
<fieldset :disabled="hideSaveBtn" class="authorize">
|
||||||
<Form />
|
<Form />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div class="buttons is-centered">
|
<div class="buttons is-centered">
|
||||||
@ -60,6 +60,7 @@ export default {
|
|||||||
...mapGetters('user', ['isLoggedIn', 'hasErrorName'])
|
...mapGetters('user', ['isLoggedIn', 'hasErrorName'])
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
this.$root.$emit('enableLoading')
|
||||||
await this.getUserData()
|
await this.getUserData()
|
||||||
this.token = this.$route.query.token
|
this.token = this.$route.query.token
|
||||||
if (!this.token) {
|
if (!this.token) {
|
||||||
@ -68,6 +69,9 @@ export default {
|
|||||||
// TODO try to load contribution data. May be it's already authorized
|
// TODO try to load contribution data. May be it's already authorized
|
||||||
// also set `contributionIndex`
|
// also set `contributionIndex`
|
||||||
}
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$root.$emit('disableLoading')
|
||||||
|
}, 800)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('user', ['getUserData', 'makeTweet']),
|
...mapActions('user', ['getUserData', 'makeTweet']),
|
||||||
|
@ -56,13 +56,6 @@
|
|||||||
If you don’t trust binaries, we encorage you to follow this <a href="">instruction</a> to
|
If you don’t trust binaries, we encorage you to follow this <a href="">instruction</a> to
|
||||||
contribute by compiling from source code. It is very easy!
|
contribute by compiling from source code. It is very easy!
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<b-loading :active.sync="loading">
|
|
||||||
<div class="loading-container">
|
|
||||||
<div class="loading-tornado"></div>
|
|
||||||
<div :class="status.type" class="loading-message">{{ status.msg }}...</div>
|
|
||||||
</div>
|
|
||||||
</b-loading>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -84,8 +77,7 @@ export default {
|
|||||||
status: {
|
status: {
|
||||||
type: '',
|
type: '',
|
||||||
msg: ''
|
msg: ''
|
||||||
},
|
}
|
||||||
loading: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -131,12 +123,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.loading = true
|
this.$root.$emit('enableLoading')
|
||||||
this.status.msg = 'Loading'
|
|
||||||
this.status.type = ''
|
|
||||||
await this.getUserData()
|
await this.getUserData()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.loading = false
|
this.$root.$emit('disableLoading')
|
||||||
}, 800)
|
}, 800)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -144,20 +134,20 @@ export default {
|
|||||||
async makeContribution({ retry = 0 } = {}) {
|
async makeContribution({ retry = 0 } = {}) {
|
||||||
try {
|
try {
|
||||||
this.isContributeBtnSnown = true
|
this.isContributeBtnSnown = true
|
||||||
this.loading = true
|
this.status.msg = ''
|
||||||
this.status.msg = 'Downloading last contribution'
|
|
||||||
this.status.type = ''
|
this.status.type = ''
|
||||||
|
this.$root.$emit('enableLoading', 'Downloading last contribution')
|
||||||
let data = await fetch('api/challenge')
|
let data = await fetch('api/challenge')
|
||||||
data = new Uint8Array(await data.arrayBuffer())
|
data = new Uint8Array(await data.arrayBuffer())
|
||||||
|
|
||||||
this.status.msg = 'Generating random contribution'
|
this.$root.$emit('enableLoading', 'Generating random contribution')
|
||||||
await timeout(100) // allow UI to update before freezing in wasm
|
await timeout(100) // allow UI to update before freezing in wasm
|
||||||
console.log('Source params', data)
|
console.log('Source params', data)
|
||||||
const contribute = await this.$contribute()
|
const contribute = await this.$contribute()
|
||||||
const result = contribute(data)
|
const result = contribute(data)
|
||||||
console.log('Updated params', result)
|
console.log('Updated params', result)
|
||||||
|
|
||||||
this.status.msg = 'Uploading and verifying your contribution'
|
this.$root.$emit('enableLoading', 'Uploading and verifying your contribution')
|
||||||
console.log('this.user.name', this.userName, this.userHandle, this.userCompany)
|
console.log('this.user.name', this.userName, this.userHandle, this.userCompany)
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append('response', new Blob([result], { type: 'application/octet-stream' }))
|
formData.append('response', new Blob([result], { type: 'application/octet-stream' }))
|
||||||
@ -197,7 +187,7 @@ export default {
|
|||||||
this.status.type = 'is-danger'
|
this.status.type = 'is-danger'
|
||||||
this.isContributeBtnSnown = false
|
this.isContributeBtnSnown = false
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false
|
this.$root.$emit('disableLoading')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onAnonymousHandler() {
|
onAnonymousHandler() {
|
||||||
|
Loading…
Reference in New Issue
Block a user