Skip to content

Commit 5a164e2

Browse files
committed
refactor: extract hibernation warning message to its own component
1 parent e113506 commit 5a164e2

File tree

3 files changed

+35
-22
lines changed

3 files changed

+35
-22
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<script setup lang="ts">
2+
import { ExtendedSpace } from '@/helpers/interfaces';
3+
4+
const props = defineProps<{
5+
space: ExtendedSpace;
6+
}>();
7+
8+
const { web3Account } = useWeb3();
9+
10+
function handleReactivateSpace() {
11+
window.open('https://tally.so', '_blank');
12+
}
13+
14+
const isAdmin = computed(() => {
15+
const admins = (props.space.admins || []).map(admin => admin.toLowerCase());
16+
return admins.includes(web3Account.value?.toLowerCase());
17+
});
18+
</script>
19+
20+
<template>
21+
<BaseMessageBlock v-if="space.hibernated" level="warning" is-responsive>
22+
{{ $t('create.errorSpaceHibernated') }}
23+
<BaseLink link="https://docs.snapshot.org/">
24+
{{ $t('learnMore') }}
25+
</BaseLink>
26+
27+
<p v-if="isAdmin" class="mt-3">
28+
<BaseButton @click="handleReactivateSpace">
29+
{{ $t('reactivateSpace') }}
30+
</BaseButton>
31+
</p>
32+
</BaseMessageBlock>
33+
</template>

src/components/SpaceCreateWarnings.vue

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ const { web3, web3Account } = useWeb3();
1313
const { isGnosisAndNotSpaceNetwork } = useGnosis(props.space);
1414
const { errorFetchingSnapshot } = useSnapshot();
1515
16-
function handleReactivateSpace() {
17-
window.open('https://tally.so', '_blank')
18-
}
19-
2016
const minScore = computed(
2117
() =>
2218
props.space?.validation?.params?.minScore ||
@@ -41,28 +37,11 @@ const strategySymbolsString = computed(() => {
4137
4238
return `(${symbols.join(', ')})`;
4339
});
44-
45-
const isAdmin = computed(() => {
46-
const admins = (props.space.admins || []).map(admin => admin.toLowerCase());
47-
return admins.includes(web3Account.value?.toLowerCase());
48-
});
4940
</script>
5041

5142
<template>
5243
<div class="mb-4 space-y-2">
53-
<BaseMessageBlock
54-
v-if="space.hibernated"
55-
level="warning"
56-
is-responsive
57-
>
58-
{{$t('create.errorSpaceHibernated')}}
59-
<BaseLink link="https://docs.snapshot.org/">
60-
{{ $t('learnMore') }}
61-
</BaseLink>
62-
<BaseButton v-if="isAdmin" class="mt-3" @click="handleReactivateSpace">
63-
{{$t('reactivateSpace')}}
64-
</BaseButton>
65-
</BaseMessageBlock>
44+
<MessageWarningHibernated v-if="space.hibernated" :space="space" />
6645

6746
<MessageWarningGnosisNetwork
6847
v-else-if="isGnosisAndNotSpaceNetwork"

src/views/SpaceProposals.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ watch(spaceProposals, () => {
186186

187187
<BaseNoResults v-else-if="spaceProposals.length < 1" />
188188
<div v-else class="mb-3 space-y-3">
189+
<MessageWarningHibernated v-if="space.hibernated" :space="space" />
189190
<template v-for="(proposal, i) in spaceProposals" :key="i">
190191
<BaseBlock slim class="transition-colors">
191192
<ProposalsItem

0 commit comments

Comments
 (0)