Settings.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <script setup>
  2. import moment from 'moment'
  3. /* Initialize stores. */
  4. import { useProfileStore } from '@/stores/profile'
  5. import { useSystemStore } from '@/stores/system'
  6. import { useWalletStore } from '@/stores/wallet'
  7. const Profile = useProfileStore()
  8. const System = useSystemStore()
  9. const Wallet = useWalletStore()
  10. const isShowingSaveGamesOptions = ref(false)
  11. const isShowingMnemonic = ref(false)
  12. const currency = ref(null)
  13. const setNEXA = () => {
  14. if (currency.value !== 'NEXA') {
  15. currency.value = 'NEXA'
  16. // amount.value = ((amount.value / props.usd) * 1000000).toFixed(2)
  17. }
  18. }
  19. const setUSD = () => {
  20. if (currency.value !== 'USD') {
  21. currency.value = 'USD'
  22. // amount.value = ((amount.value * props.usd) / 1000000).toFixed(2)
  23. }
  24. }
  25. /**
  26. * Destroy Wallet
  27. */
  28. const destroyWallet = () => {
  29. if (window.confirm(`Are you really sure you want to destroy your wallet?`)) {
  30. Wallet.destroy()
  31. }
  32. }
  33. /* Set (default) currency. */
  34. currency.value = 'USD'
  35. // onMounted(() => {
  36. // console.log('Mounted!')
  37. // // Now it's safe to perform setup operations.
  38. // })
  39. // onBeforeUnmount(() => {
  40. // console.log('Before Unmount!')
  41. // // Now is the time to perform all cleanup operations.
  42. // })
  43. </script>
  44. <template>
  45. <main class="flex flex-col gap-4">
  46. <div class="flex items-center justify-between gap-4">
  47. <span class="flex flex-grow flex-col">
  48. <span class="text-sm font-medium leading-6 text-gray-900" id="availability-label">
  49. Expert Play Mode
  50. </span>
  51. <span class="text-sm text-gray-500" id="availability-description">
  52. Fully control the <strong>SPEED</strong> of gameplay w/ advanced wallet features.
  53. </span>
  54. </span>
  55. <!-- Enabled: "bg-indigo-600", Not Enabled: "bg-gray-200" -->
  56. <button type="button" class="bg-gray-200 relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2" role="switch" aria-checked="false" aria-labelledby="availability-label" aria-describedby="availability-description">
  57. <!-- Enabled: "translate-x-5", Not Enabled: "translate-x-0" -->
  58. <span aria-hidden="true" class="translate-x-0 pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"></span>
  59. </button>
  60. </div>
  61. <fieldset class="hidden">
  62. <legend class="block text-sm font-medium leading-6 text-gray-900">
  63. Choose a THEME Color
  64. </legend>
  65. <div class="mt-4 flex items-center space-x-3">
  66. <!--
  67. Active and Checked: "ring ring-offset-1"
  68. Not Active and Checked: "ring-2"
  69. -->
  70. <label class="relative -m-0.5 flex cursor-pointer items-center justify-center rounded-full p-0.5 focus:outline-none ring-pink-500">
  71. <input type="radio" name="color-choice" value="Pink" class="sr-only" aria-labelledby="color-choice-0-label">
  72. <span id="color-choice-0-label" class="sr-only">Pink</span>
  73. <span aria-hidden="true" class="h-8 w-8 bg-pink-500 rounded-full border border-black border-opacity-10"></span>
  74. </label>
  75. <!--
  76. Active and Checked: "ring ring-offset-1"
  77. Not Active and Checked: "ring-2"
  78. -->
  79. <label class="relative -m-0.5 flex cursor-pointer items-center justify-center rounded-full p-0.5 focus:outline-none ring-purple-500">
  80. <input type="radio" name="color-choice" value="Purple" class="sr-only" aria-labelledby="color-choice-1-label">
  81. <span id="color-choice-1-label" class="sr-only">Purple</span>
  82. <span aria-hidden="true" class="h-8 w-8 bg-purple-500 rounded-full border border-black border-opacity-10"></span>
  83. </label>
  84. <!--
  85. Active and Checked: "ring ring-offset-1"
  86. Not Active and Checked: "ring-2"
  87. -->
  88. <label class="relative -m-0.5 flex cursor-pointer items-center justify-center rounded-full p-0.5 focus:outline-none ring-blue-500">
  89. <input type="radio" name="color-choice" value="Blue" class="sr-only" aria-labelledby="color-choice-2-label">
  90. <span id="color-choice-2-label" class="sr-only">Blue</span>
  91. <span aria-hidden="true" class="h-8 w-8 bg-blue-500 rounded-full border border-black border-opacity-10"></span>
  92. </label>
  93. <!--
  94. Active and Checked: "ring ring-offset-1"
  95. Not Active and Checked: "ring-2"
  96. -->
  97. <label class="relative -m-0.5 flex cursor-pointer items-center justify-center rounded-full p-0.5 focus:outline-none ring-green-500">
  98. <input type="radio" name="color-choice" value="Green" class="sr-only" aria-labelledby="color-choice-3-label">
  99. <span id="color-choice-3-label" class="sr-only">Green</span>
  100. <span aria-hidden="true" class="h-8 w-8 bg-green-500 rounded-full border border-black border-opacity-10"></span>
  101. </label>
  102. <!--
  103. Active and Checked: "ring ring-offset-1"
  104. Not Active and Checked: "ring-2"
  105. -->
  106. <label class="relative -m-0.5 flex cursor-pointer items-center justify-center rounded-full p-0.5 focus:outline-none ring-yellow-500">
  107. <input type="radio" name="color-choice" value="Yellow" class="sr-only" aria-labelledby="color-choice-4-label">
  108. <span id="color-choice-4-label" class="sr-only">Yellow</span>
  109. <span aria-hidden="true" class="h-8 w-8 bg-yellow-500 rounded-full border border-black border-opacity-10"></span>
  110. </label>
  111. </div>
  112. </fieldset>
  113. <div>
  114. <label for="combobox" class="block text-sm font-medium leading-6 text-gray-900">
  115. Save My Games
  116. </label>
  117. <div class="relative mt-2">
  118. <input
  119. id="combobox"
  120. type="text"
  121. class="w-full rounded-md border-0 bg-white py-1.5 pl-3 pr-12 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
  122. role="combobox"
  123. aria-controls="options"
  124. aria-expanded="false"
  125. value="Forever">
  126. <button type="button" class="absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-none">
  127. <svg class="h-5 w-5 text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
  128. <path fill-rule="evenodd" d="M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z" clip-rule="evenodd" />
  129. </svg>
  130. </button>
  131. <ul v-if="isShowingSaveGamesOptions" class="absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm" id="options" role="listbox">
  132. <!--
  133. Combobox option, manage highlight styles based on mouseenter/mouseleave and keyboard navigation.
  134. Active: "text-white bg-indigo-600", Not Active: "text-gray-900"
  135. -->
  136. <li class="relative cursor-default select-none py-2 pl-3 pr-9 text-gray-900" id="option-0" role="option" tabindex="-1">
  137. <!-- Selected: "font-semibold" -->
  138. <span class="block truncate">Daily</span>
  139. <!--
  140. Checkmark, only display for selected option.
  141. Active: "text-white", Not Active: "text-indigo-600"
  142. -->
  143. <span class="absolute inset-y-0 right-0 flex items-center pr-4 text-white">
  144. <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
  145. <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
  146. </svg>
  147. </span>
  148. </li>
  149. <li class="relative cursor-default select-none py-2 pl-3 pr-9 text-gray-900" id="option-0" role="option" tabindex="-1">
  150. <!-- Selected: "font-semibold" -->
  151. <span class="block truncate">1 Week</span>
  152. <!--
  153. Checkmark, only display for selected option.
  154. Active: "text-white", Not Active: "text-indigo-600"
  155. -->
  156. <span class="absolute inset-y-0 right-0 flex items-center pr-4 text-white">
  157. <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
  158. <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
  159. </svg>
  160. </span>
  161. </li>
  162. <li class="relative cursor-default select-none py-2 pl-3 pr-9 text-gray-900" id="option-0" role="option" tabindex="-1">
  163. <!-- Selected: "font-semibold" -->
  164. <span class="block truncate">1 Month</span>
  165. <!--
  166. Checkmark, only display for selected option.
  167. Active: "text-white", Not Active: "text-indigo-600"
  168. -->
  169. <span class="absolute inset-y-0 right-0 flex items-center pr-4 text-white">
  170. <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
  171. <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
  172. </svg>
  173. </span>
  174. </li>
  175. <li class="relative cursor-default select-none py-2 pl-3 pr-9 text-gray-900" id="option-0" role="option" tabindex="-1">
  176. <!-- Selected: "font-semibold" -->
  177. <span class="block truncate font-semibold">Forever</span>
  178. <!--
  179. Checkmark, only display for selected option.
  180. Active: "text-white", Not Active: "text-indigo-600"
  181. -->
  182. <span class="absolute inset-y-0 right-0 flex items-center pr-4 text-indigo-600">
  183. <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
  184. <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
  185. </svg>
  186. </span>
  187. </li>
  188. <!-- More items... -->
  189. </ul>
  190. </div>
  191. </div>
  192. <section v-if="Wallet.mnemonic" class="mt-20 mb-5 p-5 bg-red-300 border-2 border-red-500 rounded-lg shadow">
  193. <div class="rounded-md bg-amber-50 p-4">
  194. <div class="flex">
  195. <div class="flex-shrink-0">
  196. <svg class="h-5 w-5 text-amber-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
  197. <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" />
  198. </svg>
  199. </div>
  200. <div class="ml-3">
  201. <h3 class="text-sm font-medium text-amber-800">
  202. Mnemonic Seed Phrase
  203. </h3>
  204. <div class="mt-2 text-sm text-amber-700">
  205. <div v-if="isShowingMnemonic">
  206. <h3 class="text-xl font-medium">{{Wallet.mnemonic}}</h3>
  207. <p class="px-2 py-1 text-gray-500 font-medium">
  208. Backup the words shown above to a safe place in order to recovery your Wallet.
  209. </p>
  210. </div>
  211. <p v-else>... ... ... ... ... ... ... ... ... ... ... ...</p>
  212. </div>
  213. <div class="mt-4">
  214. <div class="-mx-2 -my-1.5 flex">
  215. <button v-if="isShowingMnemonic" @click="isShowingMnemonic = false" type="button" class="ml-3 rounded-md bg-amber-50 px-2 py-1.5 text-sm font-medium text-amber-800 hover:bg-amber-100 focus:outline-none focus:ring-2 focus:ring-amber-600 focus:ring-offset-2 focus:ring-offset-amber-50">Hide Secret</button>
  216. <button v-else @click="isShowingMnemonic = true" type="button" class="rounded-md bg-amber-50 px-2 py-1.5 text-sm font-medium text-amber-800 hover:bg-amber-100 focus:outline-none focus:ring-2 focus:ring-amber-600 focus:ring-offset-2 focus:ring-offset-amber-50">Show Secret</button>
  217. </div>
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. <p class="py-5 text-center font-bold">
  223. BE CAREFUL!
  224. THIS CANNOT BE UNDONE.
  225. YOU'RE WALLET WILL BE PERMANENTLY ERASED!
  226. </p>
  227. <button @click="destroyWallet" class="w-full px-3 py-1 bg-red-500 border-2 border-red-700 text-2xl font-medium rounded-lg">
  228. Destroy Wallet
  229. </button>
  230. </section>
  231. </main>
  232. </template>