Skip to content

Commit

Permalink
Merge pull request #83 from anyone-protocol/leggo/phase-1/dev
Browse files Browse the repository at this point in the history
updates to the dashboard
  • Loading branch information
MarcoMandar committed Sep 26, 2024
2 parents d929c1a + 00c18e1 commit 51d7eaf
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
6 changes: 5 additions & 1 deletion components/DataTableMyRelays/DataTableMyRelays.vue
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ const handleUnlockClick = async (fingerprint: string) => {
icon: 'i-heroicons-circle-stack-20-solid',
label:
currentTab === 'claimable'
? 'No Claimable relays!'
? 'No claimable relays!'
: 'No pending claimable or verified relays!',
}"
>
Expand Down Expand Up @@ -574,6 +574,10 @@ const handleUnlockClick = async (fingerprint: string) => {
<span class="text-gray-800 dark:text-white">Claimed:</span> This
item has already been claimed. No further action is needed.
</div>
<div class="text-xs font-normal text-gray-600 dark:text-gray-300">
<span class="text-gray-800 dark:text-white">No Credit:</span>
Your lock was successful, but is not yet confirmed on Arweave.
</div>
<!-- <div class="text-xs font-normal text-gray-600 dark:text-gray-300">
<span class="text-gray-800 dark:text-white">Locked:</span> Your
lock tx is awaiting Arweave confirmation.
Expand Down
6 changes: 3 additions & 3 deletions constants/relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const RELAY_COLUMS: Record<
},
{
key: 'observedBandwidth',
label: 'Observed Bandwith',
label: 'Observed Bandwidth',
},
{
key: 'previousDistribution',
Expand All @@ -85,11 +85,11 @@ export const RELAY_COLUMS: Record<

export const TABS = [
{
label: 'All relays',
label: 'All Relays',
key: 'all',
},
{
label: 'Claimable relays',
label: 'Claimable Relays',
key: 'claimable',
},
{
Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default defineNuxtConfig({
supportWalletPublicKeyBase64:
'K3jnSGVyHj4kSzgce3+k8gJsfHvUoQeJMNPO8CcsO2s=',
commitHash: process.env.NUXT_PUBLIC_COMMIT_HASH || 'dev',
version: '1.2.4',
version: '1.2.5',
},
},
plugins: [{ src: '~/plugins/vue-query.client.ts', mode: 'client' }],
Expand Down
45 changes: 39 additions & 6 deletions pages/relays.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@click="registerModalOpen = true"
color="green"
variant="outline"
label="Register Relay"
label="Delegate Tokens"
/>
</div>
</div>
Expand All @@ -41,14 +41,14 @@
</h4>
<UContainer>
<p class="mb-[1rem] text-center">
Note: this is for you to register a relay for someone else.
Note: This is for you to delegate a token lock for someone else.
</p>
<div class="mb-6">
<UFormGroup label="EVM Address" class="mb-6">
<UFormGroup label="ETH Wallet Address" class="mb-6">
<UInput
v-model="ethAddress"
hint="EVM address associated with fingerprint"
placeholder="EVM Address"
hint="The ETH Wallet Address associated with the fingerprint"
placeholder="ETH Wallet Address"
:rules="[rules.required]"
:error="ethAddressError !== null"
persistent-hint
Expand All @@ -58,7 +58,7 @@
<UFormGroup label="Relay Fingerprint">
<UInput
v-model="fingerPrintRegister"
hint="Fingerprint associated with EVM Address"
hint="Fingerprint associated with the ETH Wallet Address"
placeholder="Relay Fingerprint"
:rules="[rules.required]"
:error="fingerPrintRegisterError !== null"
Expand All @@ -82,6 +82,7 @@
size="sm"
color="primary"
@click="handleLockRemote"
:loading="lockRemoteLoading"
>
Register
</UButton>
Expand All @@ -106,6 +107,7 @@ import { type RelayTabType } from '@/types/relay';
import Card from '~/components/ui-kit/Card.vue';
import { useMetricsStore } from '@/stores/useMetricsStore';
import { useMediaQuery } from '@vueuse/core';
import { lock } from 'ethers';
const isMobile = useMediaQuery('(max-width: 1024px)');
Expand Down Expand Up @@ -182,17 +184,34 @@ const ethAddress = ref('');
const ethAddressError = ref<string | null>(null);
const fingerPrintRegister = ref('');
const fingerPrintRegisterError = ref<string | null>(null);
const lockRemoteLoading = ref(false);
const rules = {
required: (value: string) => !!value || 'Required',
};
const toast = useToast();
const handleLockRemote = async () => {
lockRemoteLoading.value = true;
if (fingerPrintRegisterError.value || ethAddressError.value) {
lockRemoteLoading.value = false;
toast.add({
title: 'Error',
description: 'Please fill in all fields',
color: 'red',
});
return;
}
if (fingerPrintRegister.value == '' || ethAddress.value == '') {
lockRemoteLoading.value = false;
toast.add({
title: 'Error',
description: 'Please fill in all fields',
color: 'red',
});
return;
}
Expand All @@ -204,11 +223,25 @@ const handleLockRemote = async () => {
);
if (success != null && typeof success != typeof Error) {
registerModalOpen.value = false;
toast.add({
title: 'Success',
description: 'Fingerprint registered successfully',
color: 'green',
});
lockRemoteLoading.value = false;
} else {
// handle error
toast.add({
title: 'Error',
description: 'Error registering fingerprint',
color: 'red',
});
lockRemoteLoading.value = false;
}
} catch (error: any) {
// handle error
lockRemoteLoading.value = false;
}
};
</script>

0 comments on commit 51d7eaf

Please sign in to comment.