From 0f058c806948a719cca1af1061f8508db4309843 Mon Sep 17 00:00:00 2001 From: MarcoMandar Date: Tue, 23 Jul 2024 10:16:16 +0100 Subject: [PATCH 1/3] Relays Mobile version initial Signed-off-by: MarcoMandar --- .../DataTableMyRelays/DataTableMyRelays.vue | 1 + .../DataTableMyRelaysMobile.vue | 497 ++++++++++++++++++ .../DataTableMyRelays/FingerprintDisplay.vue | 51 ++ nuxt.config.ts | 2 +- pages/relays.vue | 50 +- 5 files changed, 592 insertions(+), 9 deletions(-) create mode 100644 components/DataTableMyRelays/DataTableMyRelaysMobile.vue create mode 100644 components/DataTableMyRelays/FingerprintDisplay.vue diff --git a/components/DataTableMyRelays/DataTableMyRelays.vue b/components/DataTableMyRelays/DataTableMyRelays.vue index 0867c8f..05b957c 100755 --- a/components/DataTableMyRelays/DataTableMyRelays.vue +++ b/components/DataTableMyRelays/DataTableMyRelays.vue @@ -7,6 +7,7 @@ import { type RelayRow, type RelayTabType } from '@/types/relay'; import { RELAY_COLUMS, TABS, VERBS } from '@/constants/relay'; import { useMetricsStore } from '@/stores/useMetricsStore'; import { useFacilitatorStore } from '@/stores/useFacilitatorStore'; +import FingerprintDisplay from './FingerprintDisplay.vue'; import Tabs from '../ui-kit/Tabs.vue'; import Tooltip from '../ui-kit/Tooltip.vue'; diff --git a/components/DataTableMyRelays/DataTableMyRelaysMobile.vue b/components/DataTableMyRelays/DataTableMyRelaysMobile.vue new file mode 100644 index 0000000..4799f90 --- /dev/null +++ b/components/DataTableMyRelays/DataTableMyRelaysMobile.vue @@ -0,0 +1,497 @@ + + + + + diff --git a/components/DataTableMyRelays/FingerprintDisplay.vue b/components/DataTableMyRelays/FingerprintDisplay.vue new file mode 100644 index 0000000..a2e339e --- /dev/null +++ b/components/DataTableMyRelays/FingerprintDisplay.vue @@ -0,0 +1,51 @@ + + + + + + diff --git a/nuxt.config.ts b/nuxt.config.ts index 3cfc48a..5ade907 100755 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -67,7 +67,7 @@ export default defineNuxtConfig({ supportWalletPublicKeyBase64: 'K3jnSGVyHj4kSzgce3+k8gJsfHvUoQeJMNPO8CcsO2s=', commitHash: process.env.NUXT_PUBLIC_COMMIT_HASH || 'dev', - version: '1.0.8', + version: '1.0.9', }, }, plugins: [{ src: '~/plugins/vue-query.client.ts', mode: 'client' }], diff --git a/pages/relays.vue b/pages/relays.vue index ad4c30e..5aab377 100755 --- a/pages/relays.vue +++ b/pages/relays.vue @@ -3,7 +3,10 @@
- +

Relays

@@ -15,16 +18,33 @@ />
- + +
+ +
-

+

Register Fingerprint

-

Note: this is for you to register a relay for someone else.

+

+ Note: this is for you to register a relay for someone else. +

- + Cancel - + Register
@@ -68,6 +98,7 @@ import { ref, onMounted, watch } from 'vue'; import { useUserStore } from '@/stores/useUserStore'; import DashboardMobileSection from '@/components/DashboardMobileSection.vue'; import DataTableMyRelays from '@/components/DataTableMyRelays/DataTableMyRelays.vue'; +import DataTableMyRelaysMobile from '@/components/DataTableMyRelays/DataTableMyRelaysMobile.vue'; import { initRegistrator, useRegistrator } from '@/composables/registrator'; import { initDistribution, useDistribution } from '@/composables/distribution'; import { initRelayRegistry } from '@/composables/relay-registry'; @@ -124,7 +155,10 @@ const handleLockRemote = async () => { try { const register = useRegistrator(); - const success = await register?.lock(fingerPrintRegister.value, ethAddress.value); + const success = await register?.lock( + fingerPrintRegister.value, + ethAddress.value + ); if (success != null && typeof success != typeof Error) { registerModalOpen.value = false; } else { @@ -134,4 +168,4 @@ const handleLockRemote = async () => { // handle error } }; - \ No newline at end of file + From a27ff8d542f3b00b662c15224f8f8e224103e38e Mon Sep 17 00:00:00 2001 From: MarcoMandar Date: Tue, 23 Jul 2024 11:07:50 +0100 Subject: [PATCH 2/3] update mobile Relay Signed-off-by: MarcoMandar --- .../DataTableMyRelaysMobile.vue | 93 ++++++++++++++++++- 1 file changed, 89 insertions(+), 4 deletions(-) diff --git a/components/DataTableMyRelays/DataTableMyRelaysMobile.vue b/components/DataTableMyRelays/DataTableMyRelaysMobile.vue index 4799f90..d576edd 100644 --- a/components/DataTableMyRelays/DataTableMyRelaysMobile.vue +++ b/components/DataTableMyRelays/DataTableMyRelaysMobile.vue @@ -44,6 +44,7 @@ const { address } = useAccount({ config }); const registerModalOpen = ref(false); onMounted(() => { + // refresh the locked relays every minute setInterval(() => { if (registrator) { if (userStore.userData.address) { @@ -55,11 +56,13 @@ onMounted(() => { const unwatch = watchAccount(config, { onChange(account) { + // account change userStore.createRelayCache(); }, }); unwatch(); +// Fetching and refreshing the relay data from Warp - stored in Pinia user store const { error: allRelaysError, pending: allRelaysPending } = await useAsyncData( 'verifiedRelays', () => userStore.createRelayCache(), @@ -99,11 +102,18 @@ const timestamp = computed( () => metricsStore.relays.timestamp && new Date(metricsStore.relays.timestamp) ); +// The user's relays const fingerprints = computed(() => { return allRelays.value.map((relay) => relay.fingerprint); }); - const relayAction = async (action: FunctionName, fingerprint: string) => { + //TODO: Sign the message + // See: The following resources + // https://academy.warp.cc/docs/sdk/advanced/plugins/signature + // https://github.com/brewlabs-code/ator/blob/main/composables/warp-signer.ts + // https://docs.google.com/document/d/1VLRd2bP96avNZksMwrf8WSDmcAwrcaQpYAd5SUGDhx0/edit?pli=1#heading=h.gtsv79v2cvnl + + // Apply style to the selected row const selectedRow = allRelays.value.find( (row) => row.fingerprint === fingerprint ); @@ -133,6 +143,7 @@ const relayAction = async (action: FunctionName, fingerprint: string) => { return; } + // Refresh the relays cache return userStore .createRelayCache() .then(() => userStore.getVerifiedRelays()) @@ -171,6 +182,8 @@ const relayAction = async (action: FunctionName, fingerprint: string) => { } }; +// Table columns and actions + const getVerifiedItems = (row: RelayRow) => [ [ { @@ -210,11 +223,13 @@ const handleLockRelay = async (fingerprint: string) => { } }; +// for modal const handleLockRemote = async () => { if (fingerPrintRegisterError.value || ethAddressError.value) { return; } + // check for empty if (fingerPrintRegister.value == '' || ethAddress.value == '') { toast.remove('invalid-evm-address'); toast.add({ @@ -299,6 +314,7 @@ const handleUnlockClick = async (fingerprint: string) => { const register = useRegistrator(); try { await register?.unlock(fingerprint, BigInt(100 * 1e18)); + // Refresh the relays await userStore.createRelayCache(); } catch (error) { } finally { @@ -377,7 +393,9 @@ const handleUnlockClick = async (fingerprint: string) => {
{
Relay Fingerprint
-
@@ -453,7 +470,16 @@ const handleUnlockClick = async (fingerprint: string) => {
-
Lock Status
+
+ Lock Status + + + +
{
Actions
{ userStore.isHardwareRelay(row.fingerprint) " /> + +
+
+
+ Owner + + + + +
+ + Owner + + Others
From 3a67c6c3f6d6f9f013e7cc1df0a0d7c8ac95c760 Mon Sep 17 00:00:00 2001 From: MarcoMandar Date: Tue, 23 Jul 2024 16:36:50 +0100 Subject: [PATCH 3/3] change border Signed-off-by: MarcoMandar --- components/DataTableMyRelays/DataTableMyRelaysMobile.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/DataTableMyRelays/DataTableMyRelaysMobile.vue b/components/DataTableMyRelays/DataTableMyRelaysMobile.vue index d576edd..73408f3 100644 --- a/components/DataTableMyRelays/DataTableMyRelaysMobile.vue +++ b/components/DataTableMyRelays/DataTableMyRelaysMobile.vue @@ -407,7 +407,7 @@ const handleUnlockClick = async (fingerprint: string) => {
Nickname