Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add ts on views where missing #4395

Merged
merged 10 commits into from
Dec 7, 2023
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script setup lang="ts">
const { domain } = useApp();
const { init, isReady, showSidebar } = useApp();
const route = useRoute();
Expand Down
2 changes: 1 addition & 1 deletion src/components/BaseUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { domain } = useApp();

const props = defineProps<{
address: string;
space?: ExtendedSpace;
space?: Partial<ExtendedSpace>;
proposal?: Proposal;
profile?: Profile;
hideAvatar?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/components/PopoverHoverProfile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defineProps<{
address: string;
profile?: Profile;
proposal?: Proposal;
space?: ExtendedSpace;
space?: Partial<ExtendedSpace>;
}>();

const { domain } = useApp();
Expand Down
30 changes: 15 additions & 15 deletions src/views/DelegateView.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script setup lang="ts">
import { debouncedWatch } from '@vueuse/core';
import { isAddress } from '@ethersproject/address';
import networks from '@snapshot-labs/snapshot.js/src/networks.json';
Expand All @@ -23,14 +23,14 @@ const currentId = ref('');
const currentDelegate = ref('');
const loaded = ref(false);
const delegatesLoading = ref(false);
const delegates = ref([]);
const delegatesWithScore = ref([]);
const delegators = ref([]);
const delegates = ref<any[]>([]);
const delegatesWithScore = ref<any[]>([]);
const delegators = ref<any[]>([]);
const specifySpaceChecked = ref(false);
const space = ref({});
const space = ref();
const form = ref({
address: route.params.to || '',
id: route.params.key || ''
address: (route.params.to as string) || '',
id: (route.params.key as string) || ''
});

const { profiles, loadProfiles } = useProfiles();
Expand All @@ -44,11 +44,11 @@ const isEnsOwnedByWeb3Account = computed(() =>

const validateSpaceInput = computed(() => {
if (space.value === null) return t('delegate.noValidSpaceId');
return false;
return '';
});

const validateToInput = computed(() => {
if (form.value.address === '') return false;
if (form.value.address === '') return '';
const address = form.value.address;
if (!isValidEnsDomain(address) && !isAddress(address)) {
if (address.includes('.'))
Expand All @@ -60,7 +60,7 @@ const validateToInput = computed(() => {
if (address.toLowerCase() === web3Account.value.toLowerCase())
return t('delegate.delegateToSelf');
if (isEnsOwnedByWeb3Account.value) return t('delegate.delegateToSelfAddress');
return false;
return '';
});

watch(
Expand Down Expand Up @@ -126,7 +126,7 @@ async function getDelegatesWithScore() {

delegatesLoading.value = true;
try {
const delegations = await getDelegatesBySpace(
const delegations: any = await getDelegatesBySpace(
space.value.network,
space.value.id,
'latest'
Expand Down Expand Up @@ -285,8 +285,8 @@ onMounted(async () => {
<div
v-for="(delegate, i) in delegates"
:key="i"
:style="i === 0 && 'border: 0 !important;'"
class="flex border-t px-4 py-3"
:class="{ '!border-0': i !== 0 }"
>
<BaseUser
:address="delegate.delegate"
Expand All @@ -313,7 +313,7 @@ onMounted(async () => {
<div
v-for="(delegator, i) in delegators"
:key="i"
:style="i === 0 && 'border: 0 !important;'"
:class="{ '!border-0': i === 0 }"
class="flex border-t px-4 py-3"
>
<BaseUser
Expand All @@ -336,13 +336,13 @@ onMounted(async () => {
<div
v-for="(delegate, i) in delegatesWithScore"
:key="i"
:style="i === 0 && 'border: 0 !important;'"
:class="{ '!border-0': i === 0 }"
class="flex border-t px-4 py-3"
>
<BaseUser
:profile="profiles[delegate.delegate]"
:address="delegate.delegate"
:space="{ network: networkKey }"
:address="delegate.delegate"
class="w-[160px]"
/>
<div
Expand Down
4 changes: 2 additions & 2 deletions src/views/ExploreView.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script setup lang="ts">
import { useInfiniteScroll } from '@vueuse/core';

useMeta({
Expand Down Expand Up @@ -55,7 +55,7 @@ const { env } = useApp();
const onlyMainnetNetworks = n => (env === 'production' ? !n.testnet : true);

const items = computed(() => {
const q = route.query.q || '';
const q = (route.query.q as string) || '';
if (isStrategies.value) return filterStrategies(q);
if (isNetworks.value) return filterNetworks(q).filter(onlyMainnetNetworks);
if (isPlugins.value) return filterPlugins(q);
Expand Down
12 changes: 8 additions & 4 deletions src/views/StrategyView.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script setup lang="ts">
const route = useRoute();

const { getExtendedStrategy, extendedStrategy: strategy } = useStrategies();
Expand All @@ -7,7 +7,7 @@ useMeta({
title: {
key: 'metaInfo.strategy.title',
params: {
strategy: route.params.name
strategy: route.params.name as string
}
},
description: {
Expand All @@ -16,7 +16,7 @@ useMeta({
});

onMounted(async () => {
await getExtendedStrategy(route.params.name);
await getExtendedStrategy(route.params.name as string);
});
</script>

Expand All @@ -41,7 +41,11 @@ onMounted(async () => {
class="text-skin-text"
v-text="`In ${strategy.spacesCount} space(s)`"
/>
<BaseMarkdown :body="strategy.about" class="mb-6 mt-4" />
<BaseMarkdown
v-if="strategy.about"
:body="strategy.about"
class="mb-6 mt-4"
/>
</div>
</template>
<template #sidebar-right>
Expand Down