11<script setup>
22import { ref , computed } from ' vue' ;
33import { useStore } from ' ../store' ;
4- import { CheckIcon , SelectorIcon , CheckCircleIcon , ExternalLinkIcon } from ' @heroicons/vue/solid' ;
4+ import { CheckIcon , SelectorIcon , CheckCircleIcon , ExternalLinkIcon , RefreshIcon } from ' @heroicons/vue/solid' ;
55import { Combobox , ComboboxButton , ComboboxInput , ComboboxLabel , ComboboxOption , ComboboxOptions } from ' @headlessui/vue' ;
66import { Listbox , ListboxButton , ListboxLabel , ListboxOption , ListboxOptions } from ' @headlessui/vue' ;
77import AModal from ' ./base/AModal.vue' ;
@@ -31,6 +31,7 @@ const emojis = [
3131const open = ref (false );
3232const loading = ref (false );
3333const hash = ref (null );
34+ const bePatient = ref (false );
3435const wave = ref ({ message: ' Hello!' , emoji: ' 👋' });
3536const query = ref (' ' );
3637const filtered = computed (() =>
@@ -43,6 +44,7 @@ const filtered = computed(() =>
4344
4445async function sendWave () {
4546 loading .value = true ;
47+ setTimeout (() => bePatient .value = true , 10000 );
4648 hash .value = await store .sendWave (wave .value );
4749 loading .value = false ;
4850}
@@ -52,12 +54,6 @@ async function sendWave() {
5254 <div class =" w-full" >
5355 <button v-if =" store.isWrongNetwork" class =" w-full wave-button cursor-not-allowed bg-gray-300 rounded font-semibold h-10 mb-2" >Wave at me!</button >
5456 <button v-else @click =" open = true" class =" w-full wave-button bg-white rounded font-semibold h-10 mb-2 transition ease-in-out delay-150 hover:scale-105" >Wave at me!</button >
55- <span v-if =" store.isWrongNetwork" class =" flex justify-center items-center px-2 py-0.5 rounded text-xs font-medium bg-purple-100 text-purple-800" >
56- <svg class =" mr-1.5 h-2 w-2 text-purple-400" fill =" currentColor" viewBox =" 0 0 8 8" >
57- <circle cx =" 4" cy =" 4" r =" 3" />
58- </svg >
59- <span >Switch network to goerli</span >
60- </span >
6157 <AModal title =" Wave at me" :open =" open" @close =" open = false" :hide =" loading || hash" >
6258 <div v-if =" !loading && !hash" class =" w-full flex flex-col space-y-4 pt-4" >
6359 <Listbox as =" div" v-model =" wave.emoji" >
@@ -116,13 +112,17 @@ async function sendWave() {
116112 <div v-if =" !hash" class =" flex flex-col items-center space-y-3" >
117113 <ALoading is-large />
118114 <p class =" text-white text-lg" >Mining transaction...</p >
115+ <p v-if =" bePatient" class =" text-gray-300" >Hang in there, almost done</p >
119116 </div >
120117 <div v-else class =" flex flex-col items-center space-y-3" >
121118 <CheckCircleIcon class =" h-12 w-12 text-green-600" />
122119 <p class =" text-white text-lg" >Transaction successful!</p >
123120 <a :href =" `https://goerli.etherscan.io/tx/${hash}`" target =" _blank" >
124121 <p class =" text-white underline inline-flex" >View Transaction<ExternalLinkIcon class =" w-4 h-4 mr-2 mt-1" /></p >
125122 </a >
123+ <p @click =" window.location.reload()" class =" inline-flex text-gray-300 text-xs cursor-pointer" >
124+ <RefreshIcon class =" w-3 h-3 mt-0.5 mr-1" />Reload to view wave
125+ </p >
126126 </div >
127127 </div >
128128 </AModal >
0 commit comments