Skip to content

Commit

Permalink
feat: add space reactivation message in space settings
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Nov 16, 2023
1 parent c79d0f6 commit 1d2540c
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/components/MessageWarningHibernated.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ onMounted(async () => {
<template>
<BaseMessageBlock v-if="space.hibernated" level="warning" is-responsive>
{{ $t('create.errorSpaceHibernated') }}
<BaseLink link="https://docs.snapshot.org/user-guides/spaces/space-hibernation">
<BaseLink
link="https://docs.snapshot.org/user-guides/spaces/space-hibernation"
>
{{ $t('learnMore') }}
</BaseLink>

Expand Down
7 changes: 6 additions & 1 deletion src/locales/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"createASpace": "Create a space",
"getStarted": "Get started",
"skip": "Skip",
"reactivateSpace": "Reactivate the space",
"reactivateSpace": "Reactivate space",
"newSpaceNotice": {
"header": "Your space is live!",
"mainText": "You can change how voting power is calculated via strategies in your {settings}. Changes to your settings will only affect new proposals, existing proposals can not be changed.",
Expand Down Expand Up @@ -536,6 +536,11 @@
"delegationPortal": {
"title": "Delegation portal",
"information": "Please ensure your token adheres to a compatible delegation standard to enable delegate discovery and activity within your Snapshot space."
},
"reactivatingHibernatedSpace": {
"title": "Reactivating hibernated space",
"information": "Reactivate your space now to enable proposals creation again. Note that your space may be hibernated again if left inactive.",
"disabledInformation": "Your space contains invalid settings since your last update. Fix the errors below and your space will be reactivated automatically upon save."
}
},
"setup": {
Expand Down
53 changes: 46 additions & 7 deletions src/views/SpaceSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,6 @@ async function handleSubmit() {
}
}
onMounted(async () => {
populateForm(props.space);
await loadEnsOwner();
await loadSpaceController();
loaded.value = true;
});
const {
isRevealed: isConfirmLeaveOpen,
reveal: openConfirmLeave,
Expand All @@ -172,6 +165,17 @@ const isViewOnly = computed(() => {
return !(isSpaceController.value || isSpaceAdmin.value);
});
onMounted(async () => {
populateForm(props.space);
await loadEnsOwner();
await loadSpaceController();
loaded.value = true;
if (props.space.hibernated && !isViewOnly.value) {
showFormErrors.value = true;
}
});
onBeforeRouteLeave(async () => {
if (hasFormChanged.value && !isViewOnly.value) {
const { data } = await openConfirmLeave();
Expand All @@ -190,6 +194,41 @@ onBeforeRouteLeave(async () => {

<template v-else>
<div class="mt-3 space-y-3 sm:mt-0">
<BaseMessageBlock
v-if="space.hibernated && !isViewOnly"
level="warning"
is-responsive
>
<div class="mb-1 font-semibold text-skin-heading">
{{ t('settings.reactivatingHibernatedSpace.title') }}
</div>
<div class="flex items-center justify-between">
<div class="grow">
<div v-if="isValid">
{{ t('settings.reactivatingHibernatedSpace.information') }}
</div>

<div v-else>
{{
t(
'settings.reactivatingHibernatedSpace.disabledInformation'
)
}}
</div>
</div>
<div>
<BaseButton
:loading="isSending"
:disabled="!isValid"
class="ml-4 whitespace-nowrap"
@click="handleSubmit"
>
{{ $t('reactivateSpace') }}
</BaseButton>
</div>
</div>
</BaseMessageBlock>

<BaseMessageBlock
v-if="showFormErrors && Object.keys(validationErrors).length"
level="warning-red"
Expand Down

0 comments on commit 1d2540c

Please sign in to comment.