Skip to content

Commit

Permalink
Merge pull request #53 from ATOR-Development/leggo/phase-1/dev
Browse files Browse the repository at this point in the history
fixed footer ui tweak and removed console log
  • Loading branch information
SuchJitter authored Jul 17, 2024
2 parents c212db9 + a570f1b commit 1da8fe3
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 71 deletions.
4 changes: 2 additions & 2 deletions components/ChainSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const { chainId } = useAccount({ config });
const unwatch = watchAccount(config, {
onChange(data) {
console.log('Account changed!', data);
// changed account
},
});
const unwatchChainId = watchChainId(config, {
onChange(data) {
console.log('Chain ID changed!', data);
// changed chainID
},
});
unwatch();
Expand Down
18 changes: 14 additions & 4 deletions components/DashboardFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { ref } from 'vue';
const config = useRuntimeConfig();
const version = config.public.version;
const commitHash = config.public.commitHash || 'dev';
// const commitHash = config.public.commitHash || 'dev';
const commitHash = "c212db9c662690d1dde8ab41566277960998bec7";
const contractLinks = [
{
Expand Down Expand Up @@ -53,12 +54,17 @@ const getLink = (address: string, type: string) => {
}
};
const openCommitUrl = () => {
const url = `https://github.com/ATOR-Development/ator-relay-dashboard/commit/${commitHash}`;
window.open(url, '_blank');
}
const isOpen = ref(false);
</script>

<template>
<footer
class="bg-gradient-to-t from-slate-100 to-teal-50 dark:from-zinc-900 dark:via-gray-900 py-4 px-6 mt-auto flex justify-between lg:justify-end items-end flex-col rounded-xl"
class="bg-gradient-to-t max-w-[100vw] from-slate-100 to-teal-50 dark:from-zinc-900 dark:via-gray-900 py-4 px-6 mt-auto flex justify-between lg:justify-end items-end flex-col rounded-xl"
>
<UModal v-model="isOpen">
<UCard class="bg-white dark:bg-gray-800 rounded-lg shadow-lg">
Expand Down Expand Up @@ -115,9 +121,13 @@ const isOpen = ref(false);
</div>
</div>
<div
class="text-sm text-gray-600 dark:text-gray-300 justify-self-center margin-auto w-[50%]"
@click="openCommitUrl"
class="text-sm text-gray-600 dark:text-gray-300 justify-self-center margin-auto"
>
Version: {{ version }} | Commit: {{ commitHash }}
Version: {{ version }} | Commit:
<a href="https://github.com/ATOR-Development/ator-relay-dashboard/commit/${{commitHash}}">
{{ commitHash.slice(0,7) }}...
</a>
</div>
</div>
</footer>
Expand Down
5 changes: 0 additions & 5 deletions components/DataTableMyRelays/DataTableMyRelays.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ const relayAction = async (action: FunctionName, fingerprint: string) => {
return;
}
console.log('Relay action', action, fingerprint);
// Refresh the relays cache
return userStore
.createRelayCache()
Expand Down Expand Up @@ -180,7 +178,6 @@ const relayAction = async (action: FunctionName, fingerprint: string) => {
} catch (error) {
selectedRow!.class = '';
selectedRow!.isWorking = false;
console.error(error);
}
};
Expand Down Expand Up @@ -288,7 +285,6 @@ const filterUniqueRelays = (relays: RelayRow[]) => {
};
const getTableData = (tab: RelayTabType) => {
// console.log(filterUniqueRelays(allRelays.value));
switch (tab) {
case 'all':
return filterUniqueRelays(allRelays.value);
Expand Down Expand Up @@ -320,7 +316,6 @@ const handleUnlockClick = async (fingerprint: string) => {
// Refresh the relays
await userStore.createRelayCache();
} catch (error) {
console.error('Error unlocking relay:', error);
} finally {
isUnlocking.value = false;
}
Expand Down
2 changes: 0 additions & 2 deletions composables/warp-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const useWarpSigner = async () => {
provider = initializeBrowserProvider();
}
if (!(provider instanceof BrowserProvider)) {
console.error('Provider is not instanceof BrowserProvider');
return null;
}
try {
Expand All @@ -63,7 +62,6 @@ export const useWarpSigner = async () => {

return warpSigner;
} catch (error) {
console.error('Error creating warp signer', error);
return null;
}
};
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default defineNuxtConfig({
supportWalletPublicKeyBase64:
'K3jnSGVyHj4kSzgce3+k8gJsfHvUoQeJMNPO8CcsO2s=',
commitHash: process.env.NUXT_PUBLIC_COMMIT_HASH || 'dev',
version: '1.0.6',
version: '1.0.7',
},
},
plugins: [{ src: '~/plugins/vue-query.client.ts', mode: 'client' }],
Expand Down
55 changes: 0 additions & 55 deletions stores/useUserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ export const useUserStore = defineStore('user', {
token,
address: this.userData.address as `0x${string}`,
});
console.log(
this.tokenBalance,
'tokenBalance',
token,
'token',
this.userData.address,
'userAddress'
);
},
// Get ANON balance in USD using price store
async getUsdTokenBalance() {
Expand All @@ -78,10 +70,8 @@ export const useUserStore = defineStore('user', {

const relayCache = useRelayCache();
if (!forceRefresh) {
console.log('Fetching verified relays from cache');
const cachedData = await relayCache.getRelayData();
if (cachedData) {
console.log('Using cached verified relays', cachedData);
this.verifiedRelays = cachedData.verified;
return;
}
Expand All @@ -91,7 +81,6 @@ export const useUserStore = defineStore('user', {
if (verified.status === 200) {
const relays = await verified.json();
this.verifiedRelays = relays.relays;
console.log('Saving verified relays to cache', this.verifiedRelays);
await relayCache.saveRelayDataWithKey('verified', this.verifiedRelays);
} else if (verified.status === 500) {
this.verifiedRelays = [];
Expand All @@ -100,18 +89,15 @@ export const useUserStore = defineStore('user', {
},

async getClaimableRelaysOld(forceRefresh = false) {
console.log('forcerefresh', forceRefresh);
if (!this.userData.address) {
this.claimableRelays = [];
return;
}

const relayCache = useRelayCache();
if (!forceRefresh) {
console.log('Fetching claimable relays from cache');
const cachedData = await relayCache.getRelayData();
if (cachedData) {
console.log('Using cached claimable relays', cachedData);
this.claimableRelays = cachedData.claimable;
return;
}
Expand All @@ -121,7 +107,6 @@ export const useUserStore = defineStore('user', {
if (claimable.status === 200) {
const relays = await claimable.json();
this.claimableRelays = relays.relays;
console.log('Saving claimable relays to cache', this.claimableRelays);
await relayCache.saveRelayDataWithKey(
'claimable',
this.claimableRelays
Expand All @@ -139,10 +124,8 @@ export const useUserStore = defineStore('user', {
}

const relayCache = useRelayCache();
console.log('Fetching verified relays from cache');
const cachedData = await relayCache.getRelayData(forceRefresh);
if (cachedData) {
console.log('Using cached verified relays');
this.verifiedRelays = cachedData.verified;
return;
} else {
Expand All @@ -158,58 +141,25 @@ export const useUserStore = defineStore('user', {
}

const relayCache = useRelayCache();
console.log('Fetching claimable relays from cache');
const cachedData = await relayCache.getRelayData(forceRefresh);
if (cachedData) {
console.log('Using cached claimable relays');
this.claimableRelays = cachedData.claimable;
return;
} else {
// build cache
await this.createRelayCache();
}
},
// async claimRelayRefresh(forceRefresh = false) {
// console.log('forcerefresh', forceRefresh);

// let error = true;
// const toast = useToast();
// while (error) {
// try {
// await this.getClaimableRelays(forceRefresh);
// error = false;
// toast.remove('claimable-relays-error');
// } catch (e) {
// await new Promise((resolve) => setTimeout(resolve, 15000));
// }
// }
// },
// async verifiedRelaysRefresh(forceRefresh = false) {
// let error = true;
// const toast = useToast();
// while (error) {
// try {
// await this.getVerifiedRelays(forceRefresh);
// error = false;
// toast.remove('verified-relays-error');
// } catch (e) {
// await new Promise((resolve) => setTimeout(resolve, 15000));
// }
// }
// },
async createRelayCache() {
if (!this.userData.address) {
return;
}

const data = await getAllRelays(this.userData.address);
if (!data) {
console.log('Failed to get relays');
return;
}

console.log(data);

this.nickNames = data.data.nicknames;
// refresh the relays
this.verifiedRelays = data.data.verified.map((relay) => ({
Expand All @@ -236,9 +186,6 @@ export const useUserStore = defineStore('user', {

this.registrationCredits = data.data.registrationCredits;

console.log('verified relays', this.verifiedRelays);
console.log('claimable relays', this.claimableRelays);

// save to cache
const relayCache = useRelayCache();
await relayCache.saveRelayData(data.data);
Expand All @@ -250,10 +197,8 @@ export const useUserStore = defineStore('user', {
}

const relayCache = useRelayCache();
console.log('Fetching registration credits from cache');
const cachedData = await relayCache.getRelayData(forceRefresh);
if (cachedData) {
console.log('Using cached verified relays');
this.registrationCredits = cachedData.registrationCredits;
return this.registrationCredits.includes(fingerprint);
} else {
Expand Down
2 changes: 0 additions & 2 deletions utils/warp.read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export const readNickNames = async (): Promise<Record<

resolve(result?.cachedValue?.state?.nicknames);
} catch (error) {
console.log(error);
resolve(null);
}
});
Expand Down Expand Up @@ -238,7 +237,6 @@ export const getAllRelays = async (
},
};
} catch (error) {
console.error('Failed to get all relays:', error);
return undefined;
}
};

0 comments on commit 1da8fe3

Please sign in to comment.