From b38f39393f0ae0ec10a302578fe25261f8c8b8d3 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Fri, 17 Jan 2025 04:32:36 +0400 Subject: [PATCH] feat: support offchain space creation --- .../components/EnsConfiguratorOffchain.vue | 157 ++++++++ apps/ui/src/components/FormController.vue | 2 +- .../ui/src/components/FormEnsRegistration.vue | 67 ++++ .../ui/src/components/FormSpaceStrategies.vue | 88 ++--- apps/ui/src/components/FormVoting.vue | 49 ++- .../components/Modal/SelectTokenStandard.vue | 51 +++ .../src/components/Modal/SelectValidation.vue | 33 +- .../ProposalValidationConfigurator.vue | 104 ++++++ .../SetupStrategiesConfiguratorOffchain.vue | 244 +++++++++++++ .../ui/src/components/SpaceCreateOffchain.vue | 335 +++++++++++++++++- apps/ui/src/components/SpaceCreateOnchain.vue | 198 +++++------ .../src/components/Ui/ContainerSettings.vue | 3 +- apps/ui/src/components/Ui/SelectorCard.vue | 59 +++ apps/ui/src/components/Ui/Stepper.vue | 35 +- .../components/VotingPrivacyConfigurator.vue | 52 +++ apps/ui/src/composables/useWalletEns.ts | 149 ++++++++ apps/ui/src/helpers/stamp.ts | 28 +- apps/ui/src/views/Create.vue | 96 +++-- 18 files changed, 1549 insertions(+), 201 deletions(-) create mode 100644 apps/ui/src/components/EnsConfiguratorOffchain.vue create mode 100644 apps/ui/src/components/FormEnsRegistration.vue create mode 100644 apps/ui/src/components/Modal/SelectTokenStandard.vue create mode 100644 apps/ui/src/components/ProposalValidationConfigurator.vue create mode 100644 apps/ui/src/components/SetupStrategiesConfiguratorOffchain.vue create mode 100644 apps/ui/src/components/Ui/SelectorCard.vue create mode 100644 apps/ui/src/components/VotingPrivacyConfigurator.vue create mode 100644 apps/ui/src/composables/useWalletEns.ts diff --git a/apps/ui/src/components/EnsConfiguratorOffchain.vue b/apps/ui/src/components/EnsConfiguratorOffchain.vue new file mode 100644 index 000000000..1428c0e14 --- /dev/null +++ b/apps/ui/src/components/EnsConfiguratorOffchain.vue @@ -0,0 +1,157 @@ + + + diff --git a/apps/ui/src/components/FormController.vue b/apps/ui/src/components/FormController.vue index d2ac51035..61289099d 100644 --- a/apps/ui/src/components/FormController.vue +++ b/apps/ui/src/components/FormController.vue @@ -2,7 +2,7 @@ import { validateForm } from '@/helpers/validation'; import { ChainId } from '@/types'; -const model = defineModel({ required: true }); +const model = defineModel(); const props = defineProps<{ title: string; diff --git a/apps/ui/src/components/FormEnsRegistration.vue b/apps/ui/src/components/FormEnsRegistration.vue new file mode 100644 index 000000000..19cc11e0f --- /dev/null +++ b/apps/ui/src/components/FormEnsRegistration.vue @@ -0,0 +1,67 @@ + + + diff --git a/apps/ui/src/components/FormSpaceStrategies.vue b/apps/ui/src/components/FormSpaceStrategies.vue index 17401cb0b..e2754499e 100644 --- a/apps/ui/src/components/FormSpaceStrategies.vue +++ b/apps/ui/src/components/FormSpaceStrategies.vue @@ -1,7 +1,7 @@ diff --git a/apps/ui/src/components/FormVoting.vue b/apps/ui/src/components/FormVoting.vue index eb4657454..10e88f782 100644 --- a/apps/ui/src/components/FormVoting.vue +++ b/apps/ui/src/components/FormVoting.vue @@ -1,11 +1,12 @@ + + diff --git a/apps/ui/src/components/Modal/SelectValidation.vue b/apps/ui/src/components/Modal/SelectValidation.vue index 920f1b948..2828fd1a4 100644 --- a/apps/ui/src/components/Modal/SelectValidation.vue +++ b/apps/ui/src/components/Modal/SelectValidation.vue @@ -27,14 +27,18 @@ const STRATEGIES_WITHOUT_PARAMS: ValidationDetails['key'][] = [ 'only-members' ]; -const props = defineProps<{ - open: boolean; - networkId: NetworkID; - defaultChainId: ChainId; - space: Space; - type: 'voting' | 'proposal'; - current?: Validation; -}>(); +const props = withDefaults( + defineProps<{ + open: boolean; + networkId: NetworkID; + defaultChainId: ChainId; + space?: Space; + type: 'voting' | 'proposal'; + current?: Validation; + skipMenu?: boolean; + }>(), + { skipMenu: false } +); const emit = defineEmits<{ (e: 'save', type: Validation); @@ -227,14 +231,23 @@ function handleApply() { watch( () => props.open, - value => { + async value => { if (value) { selectedValidation.value = null; - fetchValidations(); + await fetchValidations(); if (props.current) { form.value = clone(props.current.params); rawParams.value = JSON.stringify(props.current.params, null, 2); + + if (props.skipMenu) { + const selectedValidationDetail = filteredValidations.value.find( + v => v.key === props.current!.name + ); + if (selectedValidationDetail) { + handleSelect(selectedValidationDetail); + } + } } } }, diff --git a/apps/ui/src/components/ProposalValidationConfigurator.vue b/apps/ui/src/components/ProposalValidationConfigurator.vue new file mode 100644 index 000000000..8faf9789a --- /dev/null +++ b/apps/ui/src/components/ProposalValidationConfigurator.vue @@ -0,0 +1,104 @@ + + + diff --git a/apps/ui/src/components/SetupStrategiesConfiguratorOffchain.vue b/apps/ui/src/components/SetupStrategiesConfiguratorOffchain.vue new file mode 100644 index 000000000..b8f3d0099 --- /dev/null +++ b/apps/ui/src/components/SetupStrategiesConfiguratorOffchain.vue @@ -0,0 +1,244 @@ + + + + + diff --git a/apps/ui/src/components/SpaceCreateOffchain.vue b/apps/ui/src/components/SpaceCreateOffchain.vue index 5de04766a..48f093c46 100644 --- a/apps/ui/src/components/SpaceCreateOffchain.vue +++ b/apps/ui/src/components/SpaceCreateOffchain.vue @@ -1,20 +1,335 @@ diff --git a/apps/ui/src/components/SpaceCreateOnchain.vue b/apps/ui/src/components/SpaceCreateOnchain.vue index 12eafed7b..26f3b4db6 100644 --- a/apps/ui/src/components/SpaceCreateOnchain.vue +++ b/apps/ui/src/components/SpaceCreateOnchain.vue @@ -1,10 +1,11 @@