Skip to content

Commit

Permalink
fix: fix broken space setting delegation portal
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Oct 9, 2024
1 parent 8059733 commit 234e35a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 6 deletions.
48 changes: 42 additions & 6 deletions src/components/SettingsDelegationBlock.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,60 @@
<script setup lang="ts">
import schemas from '@snapshot-labs/snapshot.js/src/schemas';
const delegationDefinition =
schemas.space.properties.delegationPortal.properties;
const props = defineProps<{
context: 'setup' | 'settings';
isViewOnly?: boolean;
}>();
const { form, validationErrors, addRef } = useFormSpaceSettings(props.context);
const delegationTypes = computed(() => {
return delegationDefinition.delegationType.anyOf.map((item: any) => ({
value: item.const,
name: item.title
}));
});
</script>

<template>
<BaseBlock :title="$t('settings.delegationPortal.title')">
<BaseMessageBlock level="info" class="mb-3">
{{ $t('settings.delegationPortal.information') }}
</BaseMessageBlock>
<TuneForm
:ref="addRef"
v-model="form.delegationPortal"
:definition="schemas.space.properties.delegationPortal"
:error="validationErrors?.delegationPortal || {}"
/>

<div class="space-y-2">
<TuneListbox
:ref="addRef"
:items="delegationTypes"
:model-value="form.delegationPortal.delegationType"
:definition="delegationDefinition.delegationType"
@update:model-value="
value => (form.delegationPortal.delegationType = value)
"
/>
<TuneInput
:ref="addRef"
v-model="form.delegationPortal.delegationContract"
:definition="delegationDefinition.delegationContract"
:error="validationErrors.delegationPortal?.delegationContract"
/>

<ComboboxNetwork
:ref="addRef"
label="Delegation network"
:hint="delegationDefinition.delegationContract.description"
:network="form.delegationPortal.delegationNetwork"
@select="value => (form.delegationPortal.delegationNetwork = value)"
/>
<TuneInput
:ref="addRef"
v-model="form.delegationPortal.delegationApi"
:definition="delegationDefinition.delegationApi"
:error="validationErrors.delegationPortal?.delegationApi"
/>
</div>
</BaseBlock>
</template>
1 change: 1 addition & 0 deletions src/composables/useFormSpaceSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const DEFAULT_VOTE_VALIDATION = { name: 'any', params: {} };
const DEFAULT_DELEGATION = {
delegationType: 'compound-governor',
delegationContract: '',
delegationNetwork: '1',
delegationApi: ''
};
const EMPTY_SPACE_FORM = {
Expand Down
1 change: 1 addition & 0 deletions src/helpers/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export interface ExtendedSpace {
export interface DelegatesConfig {
delegationType: DelegationTypes;
delegationContract: string;
delegationNetwork: string;
delegationApi: string;
}
export interface SpaceValidation {
Expand Down
1 change: 1 addition & 0 deletions src/helpers/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ export const SPACE_QUERY = gql`
delegationPortal {
delegationType
delegationContract
delegationNetwork
delegationApi
}
treasuries {
Expand Down

0 comments on commit 234e35a

Please sign in to comment.