SiteHeader.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <script setup lang="ts">
  2. import { useSystemStore } from '@/stores/system'
  3. /* Initialize System store. */
  4. const System = useSystemStore()
  5. let body
  6. let response
  7. response = await fetch('https://api.telr.io/v1/ticker/quote/BCH')
  8. // console.log('STATUS RESPONSE', response)
  9. body = await response.json()
  10. // console.log('BODY', body)
  11. /* Verify body (price) results. */
  12. if (body && body.price) {
  13. /* Set Bitcoin Cash quote. */
  14. System.quotes.BCH = body
  15. }
  16. // FIXME FOR DEV PURPOSES ONLY
  17. System.quotes.NEXA = { price: 0.00001 }
  18. </script>
  19. <template>
  20. <!--
  21. When the mobile menu is open, add `overflow-hidden` to the `body` element to prevent double scrollbars
  22. Menu open: "fixed inset-0 z-40 overflow-y-auto", Menu closed: ""
  23. -->
  24. <main class="bg-white shadow-sm lg:static lg:overflow-y-visible">
  25. <div class="w-full px-4 sm:px-6 lg:px-8">
  26. <div class="relative flex justify-between xl:grid xl:grid-cols-12 lg:gap-8">
  27. <div class="hidden lg:flex">
  28. <div class="flex-shrink-0 flex items-center cursor-pointer px-5" @click="toggleMenu">
  29. <svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path></svg>
  30. </div>
  31. </div>
  32. <div class="min-w-0 flex-1 md:px-8 lg:px-0 xl:col-span-6">
  33. <div class="flex items-center px-6 py-4 md:max-w-3xl md:mx-auto lg:max-w-none lg:mx-0 xl:px-0">
  34. <div class="w-full">
  35. <label for="search" class="sr-only">Search</label>
  36. <div class="relative">
  37. <div class="pointer-events-none absolute inset-y-0 left-0 pl-3 flex items-center">
  38. <!-- Heroicon name: solid/search -->
  39. <svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
  40. <path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
  41. </svg>
  42. </div>
  43. <input
  44. id="global-search"
  45. class="block w-full bg-white border border-gray-300 rounded-md py-2 pl-10 pr-3 text-sm placeholder-gray-500 focus:outline-none focus:text-gray-900 focus:placeholder-gray-400 focus:ring-1 focus:ring-rose-500 focus:border-rose-500 sm:text-sm"
  46. placeholder="What can I find for you Dev? ( use shortcut: Ctrl + K )"
  47. type="text"
  48. />
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <div class="flex items-center md:absolute md:right-0 md:inset-y-0 lg:hidden">
  54. <!-- Mobile menu button -->
  55. <button
  56. type="button"
  57. class="-mx-2 rounded-md p-2 inline-flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-rose-500"
  58. aria-expanded="false"
  59. >
  60. <span class="sr-only">Open menu</span>
  61. <!--
  62. Icon when menu is closed.
  63. Heroicon name: outline/menu
  64. Menu open: "hidden", Menu closed: "block"
  65. -->
  66. <svg class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
  67. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
  68. </svg>
  69. <!--
  70. Icon when menu is open.
  71. Heroicon name: outline/x
  72. Menu open: "block", Menu closed: "hidden"
  73. -->
  74. <svg class="hidden h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
  75. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
  76. </svg>
  77. </button>
  78. </div>
  79. <div class="hidden lg:flex lg:items-center lg:justify-end xl:col-span-4">
  80. <button class="text-2xl font-bold text-gray-400 text-center group" @click="openNetworkMenu">
  81. <span class="group-hover:text-indigo-400">
  82. {{displayPrice}}
  83. </span>
  84. <span class="block text-sm text-gray-300 group-hover:text-gray-400">
  85. BCH/USD
  86. </span>
  87. </button>
  88. <button class="ml-5 flex-shrink-0 bg-white rounded-full p-1 text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-rose-500">
  89. <span class="sr-only">View notifications</span>
  90. <!-- Heroicon name: outline/bell -->
  91. <svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
  92. <path
  93. stroke-linecap="round"
  94. stroke-linejoin="round"
  95. stroke-width="2"
  96. d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
  97. />
  98. </svg>
  99. </button>
  100. <!-- Profile dropdown -->
  101. <div class="flex-shrink-0 relative ml-5">
  102. <div>
  103. <button type="button" class="bg-white rounded-full flex focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-rose-500" id="user-menu-button" aria-expanded="false" aria-haspopup="true">
  104. <span class="sr-only">Open user menu</span>
  105. <img class="h-8 w-8 rounded-full" src="@/assets/img/cyber-hacker-icon.jpg" alt="" />
  106. </button>
  107. </div>
  108. <!--
  109. Dropdown menu, show/hide based on menu state.
  110. Entering: "transition ease-out duration-100"
  111. From: "transform opacity-0 scale-95"
  112. To: "transform opacity-100 scale-100"
  113. Leaving: "transition ease-in duration-75"
  114. From: "transform opacity-100 scale-100"
  115. To: "transform opacity-0 scale-95"
  116. -->
  117. <div
  118. class="hidden origin-top-right absolute z-10 right-0 mt-2 w-48 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 py-1 focus:outline-none"
  119. role="menu"
  120. aria-orientation="vertical"
  121. aria-labelledby="user-menu-button"
  122. tabindex="-1"
  123. >
  124. <!-- Active: "bg-gray-100", Not Active: "" -->
  125. <a href="javascript://" class="block py-2 px-4 text-sm text-gray-700" role="menuitem" tabindex="-1" id="user-menu-item-0">Your Profile</a>
  126. <a href="javascript://" class="block py-2 px-4 text-sm text-gray-700" role="menuitem" tabindex="-1" id="user-menu-item-1">Settings</a>
  127. <a href="javascript://" class="block py-2 px-4 text-sm text-gray-700" role="menuitem" tabindex="-1" id="user-menu-item-2">Sign out</a>
  128. </div>
  129. </div>
  130. <button
  131. class="flex-none ml-6 inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 uppercase"
  132. @click="connect"
  133. >
  134. Get Connected
  135. </button>
  136. </div>
  137. </div>
  138. </div>
  139. <!-- Mobile menu, show/hide based on menu state. -->
  140. <nav v-if="showMobileMenu" class="lg:hidden" aria-label="Global">
  141. <div class="max-w-3xl mx-auto px-2 pt-2 pb-3 space-y-1 sm:px-4">
  142. <!-- Current: "bg-gray-100 text-gray-900", Default: "hover:bg-gray-50" -->
  143. <a href="javascript://" aria-current="page" class="bg-gray-100 text-gray-900 block rounded-md py-2 px-3 text-base font-medium text-gray-900">
  144. Home
  145. </a>
  146. <a href="javascript://" class="hover:bg-gray-50 block rounded-md py-2 px-3 text-base font-medium text-gray-900">
  147. Popular
  148. </a>
  149. <a href="javascript://" class="hover:bg-gray-50 block rounded-md py-2 px-3 text-base font-medium text-gray-900">
  150. Communities
  151. </a>
  152. <a href="javascript://" class="hover:bg-gray-50 block rounded-md py-2 px-3 text-base font-medium text-gray-900">
  153. Trending
  154. </a>
  155. </div>
  156. <div class="border-t border-gray-200 pt-4">
  157. <div class="max-w-3xl mx-auto px-4 flex items-center sm:px-6">
  158. <div class="flex-shrink-0">
  159. <img class="h-10 w-10 rounded-full" src="https://images.unsplash.com/photo-1550525811-e5869dd03032?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="" />
  160. </div>
  161. <div class="ml-3">
  162. <div class="text-base font-medium text-gray-800">Chelsea Hagon</div>
  163. <div class="text-sm font-medium text-gray-500">[email protected]</div>
  164. </div>
  165. <button type="button" class="ml-auto flex-shrink-0 bg-white rounded-full p-1 text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-rose-500">
  166. <span class="sr-only">View notifications</span>
  167. <!-- Heroicon name: outline/bell -->
  168. <svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
  169. <path
  170. stroke-linecap="round"
  171. stroke-linejoin="round"
  172. stroke-width="2"
  173. d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
  174. />
  175. </svg>
  176. </button>
  177. </div>
  178. <div class="mt-3 max-w-3xl mx-auto px-2 space-y-1 sm:px-4">
  179. <a href="javascript://" class="block rounded-md py-2 px-3 text-base font-medium text-gray-500 hover:bg-gray-50 hover:text-gray-900">Your Profile</a>
  180. <a href="javascript://" class="block rounded-md py-2 px-3 text-base font-medium text-gray-500 hover:bg-gray-50 hover:text-gray-900">Settings</a>
  181. <a href="javascript://" class="block rounded-md py-2 px-3 text-base font-medium text-gray-500 hover:bg-gray-50 hover:text-gray-900">Sign out</a>
  182. </div>
  183. </div>
  184. <div class="mt-6 max-w-3xl mx-auto px-4 sm:px-6">
  185. <a href="javascript://" class="w-full flex items-center justify-center px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-rose-600 hover:bg-rose-700">
  186. New Post
  187. </a>
  188. <div class="mt-6 flex justify-center">
  189. <a href="javascript://" class="text-base font-medium text-gray-900 hover:underline">
  190. Go Premium
  191. </a>
  192. </div>
  193. </div>
  194. </nav>
  195. </main>
  196. </template>
  197. <script lang="ts">
  198. /* Import modules. */
  199. import numeral from 'numeral'
  200. export default {
  201. props: {
  202. pageId: String
  203. },
  204. data: () => {
  205. return {
  206. usd: null,
  207. showMobileMenu: null,
  208. }
  209. },
  210. computed: {
  211. displayPrice: function () {
  212. if (!this.usd) return '$0.00'
  213. return numeral(this.usd).format('$0.00')
  214. },
  215. title: function () {
  216. switch(this.pageId) {
  217. case 'dashboard':
  218. return 'Dashboard'
  219. case 'stats':
  220. return 'Bitcoin Statistics'
  221. case 'status':
  222. return 'Community & Network Status'
  223. case 'ver':
  224. return 'Ver: Node Virtual Assistant'
  225. case 'blockchains':
  226. return 'Blockchain Insights'
  227. case 'discuss':
  228. return 'Discuss'
  229. case 'events':
  230. return 'Event Calendar'
  231. case 'markets':
  232. return 'Market Insights'
  233. case 'privacy':
  234. return 'Privacy Insights'
  235. case 'news':
  236. return 'Headline News'
  237. /* Desktop */
  238. case 'file-mgr':
  239. return 'File Manager'
  240. case 'notebook':
  241. return 'Notebook'
  242. /* Profiles */
  243. case 'contributors':
  244. return 'Contributors'
  245. case 'profile':
  246. return 'Profile'
  247. /* Projects */
  248. case 'projects':
  249. case 'project-detail':
  250. return 'Projects'
  251. /* Workspaces */
  252. case 'code-editor':
  253. return 'Code Editor'
  254. case 'graphics-studio':
  255. return 'Graphics Studio'
  256. case 'sandbox':
  257. return 'Sandbox'
  258. /* Support */
  259. case 'buidling':
  260. return 'BUIDLing 101'
  261. case 'faq':
  262. return 'FAQ'
  263. case 'guides':
  264. return 'Guides & Tutorials'
  265. case 'matrix':
  266. return 'Matrix'
  267. case 'slack':
  268. return 'Slack'
  269. case 'tickets':
  270. return 'Support Tickets'
  271. default:
  272. return 'Unknown Page'
  273. }
  274. },
  275. },
  276. methods: {
  277. async init() {
  278. let body
  279. let response
  280. response = await fetch('https://api.telr.io/v1/ticker/quote/BCH')
  281. // console.log('STATUS RESPONSE', response)
  282. body = await response.json()
  283. // console.log('BODY', body)
  284. if (body.price) {
  285. this.usd = body.price
  286. }
  287. },
  288. /**
  289. * Go To
  290. *
  291. * Navigates to a page location (in the router).
  292. */
  293. goTo(_location) {
  294. this.$router.push(_location)
  295. },
  296. toggleMenu() {
  297. console.log('TOGGLE MENU')
  298. this.$emit('toggleMenu')
  299. },
  300. openNetworkMenu() {
  301. alert(`Choose a supported network:
  302. - Bitcoin Cash (BCH)
  303. - Bitcoin Lightning (BTC)
  304. - Dash (DASH)
  305. - eCash (XEC)
  306. - Ethereum (ETH)
  307. - Litecoin (LTC)
  308. - Monero (XMR)
  309. - Nexa (NEX)
  310. - Polygon (MATIC)
  311. - Tron (TRX)
  312. - Zcash (ZEC)
  313. `)
  314. },
  315. connect() {
  316. alert(`Choose a blockchain to manage your on-chain data:
  317. 1. Avalanche
  318. 2. Binance
  319. 3. Ethereum
  320. 4. Nexaverse
  321. 5. Polygon
  322. 6. Smart Bitcoin
  323. 7. Tron`)
  324. }
  325. },
  326. created: function () {
  327. this.usd = 0
  328. this.showMobileMenu = false
  329. /* Update USD. */
  330. this.init()
  331. },
  332. mounted: function () {
  333. //
  334. },
  335. }
  336. </script>