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

feat: Add osnap plugin #4312

Merged
merged 146 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
2d362ff
add activate osnap button
ryanwolhuter Aug 23, 2023
14205b4
bubble emits up
ryanwolhuter Aug 23, 2023
b19db70
add is osnap enabled prop
ryanwolhuter Aug 23, 2023
ca822d2
add safe app link
ryanwolhuter Aug 24, 2023
3443ba3
add disclaimer
ryanwolhuter Aug 24, 2023
c2b0c7d
reduce text size
ryanwolhuter Aug 24, 2023
e6f4525
update safe app url
ryanwolhuter Aug 24, 2023
88ac0c4
fix tailwind mistake
ryanwolhuter Aug 24, 2023
af54369
use params object
ryanwolhuter Aug 24, 2023
9bcef7a
feat: add osnap buttons for enabling disabling in treasury
daywiss Aug 24, 2023
beb8a2c
add is osnap enabled check
ryanwolhuter Aug 25, 2023
b1131c1
add new osnap plugin
ryanwolhuter Aug 25, 2023
aa07dc6
use presence of plugin to determine if is enabled
ryanwolhuter Aug 28, 2023
bcca536
move enable osnap logic out of settings
ryanwolhuter Aug 28, 2023
bcb39f7
switch to composition api
ryanwolhuter Aug 28, 2023
2f03b70
update types
ryanwolhuter Aug 30, 2023
2ecf085
remove batch logic from transactions
ryanwolhuter Aug 31, 2023
c89884e
remove multisend from contract interaction
ryanwolhuter Sep 5, 2023
006fc03
remove multisend from transfer funds
ryanwolhuter Sep 5, 2023
7dfc735
add correct token type
ryanwolhuter Sep 6, 2023
da37389
refactor transfer nft
ryanwolhuter Sep 6, 2023
9bfa582
refactor raw transaction input
ryanwolhuter Sep 6, 2023
2942b5b
add model value and config types
ryanwolhuter Sep 6, 2023
87c9a4f
add model value types
ryanwolhuter Sep 11, 2023
9428152
add transactions by treasury address type
ryanwolhuter Sep 12, 2023
0bd22f8
add high level interface types
ryanwolhuter Sep 13, 2023
34c7732
remove batches logic
ryanwolhuter Sep 20, 2023
bd3ed9b
wire up module address query
ryanwolhuter Sep 20, 2023
9ddc894
refactor raw transaction
ryanwolhuter Sep 21, 2023
eb55b4f
refactor contract interaction
ryanwolhuter Sep 21, 2023
2a7abf0
only allow one safe
ryanwolhuter Sep 22, 2023
733ff63
refactor proposal component
ryanwolhuter Sep 22, 2023
7334473
rename prop for clarity
ryanwolhuter Sep 22, 2023
7af76d1
auto select safe on mount
ryanwolhuter Sep 22, 2023
7464f3f
fix reference error
ryanwolhuter Sep 22, 2023
16da265
fix collectable fetch bug
ryanwolhuter Sep 22, 2023
3d8d9c2
fix short name in type
ryanwolhuter Sep 22, 2023
2e9d674
remove redundant labels
ryanwolhuter Sep 22, 2023
ad45c5f
add types for token fetch logic
ryanwolhuter Sep 28, 2023
6d0da5f
fix typo
ryanwolhuter Sep 28, 2023
4704830
use update for event name
ryanwolhuter Sep 28, 2023
ad566f6
add update transaction event to raw
ryanwolhuter Sep 28, 2023
63f6a57
add placeholder data display
ryanwolhuter Sep 28, 2023
063416b
add types for transfer nft
ryanwolhuter Sep 29, 2023
f38c14c
rename is proposal to is read only
ryanwolhuter Oct 2, 2023
7997a52
add contract interaction validation
ryanwolhuter Oct 3, 2023
cd40bf8
clear parameter on method change
ryanwolhuter Oct 3, 2023
1d2e0e1
add individual parameter examples
ryanwolhuter Oct 3, 2023
6981320
use disabled inputs for read only
ryanwolhuter Oct 3, 2023
1b77f8e
remove unused files
ryanwolhuter Oct 3, 2023
8af0637
remove legacy function code
ryanwolhuter Oct 3, 2023
9c84436
organize exports
ryanwolhuter Oct 3, 2023
e9fdf4b
rename for clarity
ryanwolhuter Oct 3, 2023
a6218ae
use method name instead of index
ryanwolhuter Oct 3, 2023
ed448d1
use existing data if it exists
ryanwolhuter Oct 3, 2023
a80b302
use list of one collectable when is read only
ryanwolhuter Oct 4, 2023
07cbdba
re-add activate osnap button
ryanwolhuter Oct 4, 2023
7bf1af0
only show osnap button when plugin is present
ryanwolhuter Oct 4, 2023
c1b0114
handle undefined assets
ryanwolhuter Oct 4, 2023
052fe96
make transaction fields possibly undefined
ryanwolhuter Oct 4, 2023
372f798
disable dropdown when read only
ryanwolhuter Oct 4, 2023
ad85182
add loading safes state
ryanwolhuter Oct 4, 2023
22a40d3
use modal select for transaction type
ryanwolhuter Oct 5, 2023
da18b25
add transaction builder styles
ryanwolhuter Oct 5, 2023
9d5bf72
add style variant for proposal
ryanwolhuter Oct 5, 2023
d79bc0f
re-add osnap modal
ryanwolhuter Oct 5, 2023
4ef7ed9
use separate page for read only
ryanwolhuter Oct 6, 2023
bce625b
fix import error
ryanwolhuter Oct 6, 2023
f93cc9a
make address required
ryanwolhuter Oct 6, 2023
ab5ea57
use transfer funds as default
ryanwolhuter Oct 6, 2023
787b1aa
add legacy plugin warning
ryanwolhuter Oct 9, 2023
c33870f
update is osnap enabled on window focus
ryanwolhuter Oct 9, 2023
9794df5
extract safe link logic
ryanwolhuter Oct 9, 2023
ee3e203
use modal for safe select
ryanwolhuter Oct 9, 2023
e563146
add comments for types
ryanwolhuter Oct 10, 2023
dde174e
remove redundant functions
ryanwolhuter Oct 10, 2023
6f5960f
rename for clarity
ryanwolhuter Oct 10, 2023
ece6aeb
remove weird thing
ryanwolhuter Oct 10, 2023
38633b0
apply formatting
ryanwolhuter Oct 10, 2023
c532087
revert original changes
ryanwolhuter Oct 10, 2023
3a25c86
undo old changes
ryanwolhuter Oct 11, 2023
20630fb
add end newlines to match old
ryanwolhuter Oct 11, 2023
93d26f8
update import
ryanwolhuter Oct 11, 2023
d949d9f
undo accidental rename
ryanwolhuter Oct 11, 2023
c94d259
handle legacy plugin
ryanwolhuter Oct 11, 2023
66652c0
add no safes warning
ryanwolhuter Oct 12, 2023
05fe67e
undo wrong change
ryanwolhuter Oct 12, 2023
51d8aa3
remove old redundant styles
ryanwolhuter Oct 12, 2023
fdc31c0
add doc comments for functions
ryanwolhuter Oct 12, 2023
27ae6cc
add proposal details types
ryanwolhuter Oct 13, 2023
13b0913
add comments
ryanwolhuter Oct 13, 2023
df2a95c
add address input types
ryanwolhuter Oct 13, 2023
d7bc0fb
add amount input types
ryanwolhuter Oct 13, 2023
e3ed541
rename component for clarity
ryanwolhuter Oct 13, 2023
d967812
add tokens modal types
ryanwolhuter Oct 13, 2023
1a71938
add tokens modal item types
ryanwolhuter Oct 13, 2023
4c329cd
rename for clarity
ryanwolhuter Oct 13, 2023
9d71c70
extract submit proposal modal to component
ryanwolhuter Oct 16, 2023
f995c80
add error notifications
ryanwolhuter Oct 16, 2023
9add05c
simplify proposal state
ryanwolhuter Oct 16, 2023
7f28a19
split steps into components
ryanwolhuter Oct 17, 2023
7e133e2
remove redundant action button state
ryanwolhuter Oct 17, 2023
5c47f29
use shared header
ryanwolhuter Oct 17, 2023
6762b3c
don't format amount on change
ryanwolhuter Oct 17, 2023
5c91513
add assertion failed in oo state
ryanwolhuter Oct 18, 2023
c8c6795
remove balance logic from details query
ryanwolhuter Oct 19, 2023
7b57dda
separate proposal details chain call
ryanwolhuter Oct 19, 2023
e6a36fb
refactor proposal state fetching
ryanwolhuter Oct 20, 2023
a9d5fb8
warn about disputed proposals
ryanwolhuter Oct 24, 2023
5ed4cd4
run prettier
ryanwolhuter Oct 25, 2023
711c37b
remove unused types
ryanwolhuter Oct 25, 2023
b30f797
move get paged events to events
ryanwolhuter Oct 25, 2023
4ab1e68
add doc comments
ryanwolhuter Oct 25, 2023
be564cf
rename for clarity
ryanwolhuter Oct 25, 2023
eda8f12
do not show edit plugin modal when is osnap
ryanwolhuter Oct 25, 2023
18498e3
add readme
ryanwolhuter Oct 25, 2023
83e7d0c
Merge remote-tracking branch 'origin/master' into add-osnap-plugin
ryanwolhuter Oct 27, 2023
ff199d4
apply formatting
ryanwolhuter Oct 27, 2023
fe12f03
fix wrong function interface
ryanwolhuter Oct 31, 2023
01c8cd4
Merge remote-tracking branch 'origin/master' into add-osnap-plugin
ryanwolhuter Oct 31, 2023
84711c1
format
ryanwolhuter Oct 31, 2023
8b84600
merge latest from origin
daywiss Nov 3, 2023
10c08e0
Merge remote-tracking branch 'upstream/master' into add-osnap-plugin
daywiss Nov 3, 2023
080b9c3
Merge remote-tracking branch 'upstream/master' into add-osnap-plugin
daywiss Nov 7, 2023
d5e8d6d
fix network id interpretation, and crash when in space.members
daywiss Nov 7, 2023
3f783d0
update changes from master
daywiss Nov 13, 2023
adbc4f3
Merge remote-tracking branch 'upstream/master' into add-osnap-plugin
daywiss Nov 13, 2023
d63fa29
fix: spacing changes on outcomes page for osnap plugin (#103)
gsteenkamp89 Nov 20, 2023
2fae6d7
feat: improve look and feel of transaction builder in osnap (#104)
gsteenkamp89 Nov 21, 2023
583b1bc
Merge remote-tracking branch 'upstream/master' into temp
daywiss Nov 21, 2023
3164b29
fix: formatting
daywiss Nov 21, 2023
f8e2d58
fix: reset to snapshot's standard 42px height (#105)
gsteenkamp89 Nov 22, 2023
8cbb6e2
feat: uma 1936 add dark mode osnap buttons (#106)
gsteenkamp89 Nov 23, 2023
b9253fa
fix: cosmetic issues (#107)
gsteenkamp89 Nov 23, 2023
f1bb2d6
fix: remove extra spacing (#108)
gsteenkamp89 Nov 27, 2023
56bc0e0
fix: change osnap activated to use snapshot's primary blue color (#109)
gsteenkamp89 Nov 27, 2023
32963eb
fix: font colors in configure osnap modal (#111)
gsteenkamp89 Nov 27, 2023
aab1910
fix: simplify osnap transactions (#112)
gsteenkamp89 Nov 27, 2023
b5f250f
fix: shorten module address in snapshot proposal transaction (#110)
gsteenkamp89 Nov 27, 2023
1830349
Merge remote-tracking branch 'upstream/master' into add-osnap-plugin
daywiss Nov 27, 2023
c0c426c
fix: change osnap opt in instructions container and checkbox (#113)
gsteenkamp89 Nov 27, 2023
858f2a7
fix: remove View on IPFS link (#114)
gsteenkamp89 Nov 28, 2023
ea96165
fix: show pending notification on signed tx (#115)
gsteenkamp89 Nov 28, 2023
6c0a1fd
fix: remove custom inactive osnap button styles (#116)
gsteenkamp89 Nov 28, 2023
994f55f
Merge remote-tracking branch 'upstream/master' into add-osnap-plugin
daywiss Nov 28, 2023
ad26b98
fix: remove request transaction execution warning message (#117)
gsteenkamp89 Nov 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion snapshot-spaces
2 changes: 1 addition & 1 deletion src/components/BaseModalSelectItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ defineProps<{
/>
<BasePill>{{ tag }}</BasePill>
</div>
<span class="text-skin-text" v-text="description" />
<span class="break-all text-skin-text" v-text="description" />
</div>
<i-ho-check v-if="selected" class="absolute right-0 text-md" />
</div>
Expand Down
62 changes: 62 additions & 0 deletions src/components/ModalOsnap.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<script setup lang="ts">
import { TreasuryWallet } from '@/helpers/interfaces';
import { Network } from '@/plugins/oSnap/types';
import { makeConfigureOsnapUrl } from '@/plugins/oSnap/utils/getters';

const props = defineProps<{
open: boolean;
isOsnapEnabled: boolean;
treasury: TreasuryWallet;
spaceName: string;
}>();
defineEmits<{
(e: 'close'): void;
}>();
const spaceUrl = window.location.href.replace('/settings', '');
const href = computed(() =>
makeConfigureOsnapUrl({
spaceUrl,
spaceName: props.spaceName,
safeAddress: props.treasury.address,
network: props.treasury.network as Network
})
);
</script>

<template>
<BaseModal :open="open" @close="$emit('close')">
<template #header>
<h3 v-text="'Configure oSnap'" />
</template>
<div class="m-4 grid grid-cols-[auto,auto] gap-2">
<i-ho-information-circle class="mt-1 text-sm" />
<p class="text-sm">
oSnap seamlessly integrates with Snapshot and your treasury,
automatically executing governance votes on-chain. Bypass the need for
privileged signers to create a DAO that's more efficient and truly
decentralized.
<BaseLink class="mt-1 block text-skin-link" link="https://uma.xyz/osnap"
>Learn more</BaseLink
>
</p>
</div>

<template #footer>
<a
:href="href"
target="_blank"
class="block w-full rounded-full py-[12px] text-white"
:class="
isOsnapEnabled ? 'bg-[hsl(349,65%,52%)]' : 'bg-[hsl(240,83%,58%)]'
"
@click.stop="$emit('close')"
>
{{ isOsnapEnabled ? 'Deactivate' : 'Activate' }} oSnap
<i-ho-external-link class="mb-[2px] ml-1 inline-block text-xs" />
</a>
<p class="mt-2 text-xs text-skin-text">
Note that the deactivation process takes place in the Safe app
</p>
</template>
</BaseModal>
</template>
3 changes: 3 additions & 0 deletions src/components/SettingsPluginsBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const modalPluginsOpen = ref(false);

function handleEditPlugins(name: string) {
if (props.isViewOnly) return;
// the oSnap plugin does not require any configuration
// so we don't need to open the modal
if (name === 'oSnap') return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should handle it like we do when selecting the plugin in the modal, when the plugin doesn't have defaults defined

https://github.com/snapshot-labs/snapshot/blob/335f6f2d59546023c96c17c4a763c8765fce02a9/src/components/ModalPlugins.vue#L32

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you go into more detail? i dont understand if you want me to remove the changes in the handleEditPlugins and instetad put it in the selectPlugin function instead, or move the default checking from selectPlugin to handleEditPlugins function

currentPlugin.value = {};
currentPlugin.value[name] = clone(form.value.plugins[name]);
modalPluginsOpen.value = true;
Expand Down
50 changes: 46 additions & 4 deletions src/components/SettingsTreasuriesBlock.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script setup lang="ts">
import { ExtendedSpace, TreasuryWallet } from '@/helpers/interfaces';
import { clone } from '@snapshot-labs/snapshot.js/src/utils';
import { TreasuryWallet } from '@/helpers/interfaces';

const props = defineProps<{
context: 'setup' | 'settings';
space: ExtendedSpace;
error: string | Record<string, any>;
isViewOnly?: boolean;
}>();
Expand All @@ -17,16 +18,21 @@ const treasuryObj = {
};

const modalTreasuryOpen = ref(false);
const modalOsnapOpen = ref(false);
const currentTreasuryIndex = ref<number | null>(null);
const currentTreasury = ref<TreasuryWallet>(clone(treasuryObj));
const hasOsnapPlugin = computed(() => {
return Object.keys(props.space.plugins).includes('oSnap');
});
const isOsnapEnabledOnCurrentTreasury = ref(false);

function handleRemoveTreasury(i) {
function handleRemoveTreasury(i: number) {
form.value.treasuries = form.value.treasuries.filter(
(treasury, index) => index !== i
);
}

function handleEditTreasury(i) {
function handleEditTreasury(i: number) {
if (props.isViewOnly) return;
currentTreasuryIndex.value = i;
currentTreasury.value = clone(form.value.treasuries[i]);
Expand All @@ -39,7 +45,7 @@ function handleAddTreasury() {
modalTreasuryOpen.value = true;
}

function handleSubmitTreasury(treasury) {
function handleSubmitTreasury(treasury: TreasuryWallet) {
if (currentTreasuryIndex.value !== null) {
const treasuriesClone = clone(form.value.treasuries);
treasuriesClone[currentTreasuryIndex.value] = treasury;
Expand All @@ -48,16 +54,44 @@ function handleSubmitTreasury(treasury) {
form.value.treasuries = form.value.treasuries.concat(treasury);
}
}

function handleOpenConfigureOsnapModal(
treasuryIndex: number,
isEnabled: boolean
) {
if (props.isViewOnly || !hasOsnapPlugin.value) return;
currentTreasuryIndex.value = treasuryIndex;
currentTreasury.value = clone(form.value.treasuries[treasuryIndex]);
isOsnapEnabledOnCurrentTreasury.value = isEnabled;
modalOsnapOpen.value = true;
}

function handleCloseConfigureOsnapModal() {
modalOsnapOpen.value = false;
isOsnapEnabledOnCurrentTreasury.value = false;
}
</script>

<template>
<BaseBlock :title="$t('settings.treasuries.label')">
<div v-if="hasOsnapPlugin && form.treasuries.length === 0" class="mb-3">
<h2>Warning: no treasuries</h2>
<p>
You have installed the oSnap plugin, but you don't have any treasuries.
</p>
<p>
Please add a Safe as a treasury and enable oSnap on it to use the oSnap
plugin.
</p>
</div>
<div v-if="form.treasuries.length" class="mb-3 grid gap-3">
<SettingsTreasuriesBlockItem
:treasuries="form.treasuries"
:is-view-only="isViewOnly"
:has-osnap-plugin="hasOsnapPlugin"
@edit-treasury="i => handleEditTreasury(i)"
@remove-treasury="i => handleRemoveTreasury(i)"
@configure-osnap="handleOpenConfigureOsnapModal"
/>
</div>

Expand All @@ -78,6 +112,14 @@ function handleSubmitTreasury(treasury) {
@close="modalTreasuryOpen = false"
@add="handleSubmitTreasury"
/>
<ModalOsnap
v-if="hasOsnapPlugin"
:open="modalOsnapOpen"
:treasury="currentTreasury"
:space-name="form.name"
:is-osnap-enabled="isOsnapEnabledOnCurrentTreasury"
@close="handleCloseConfigureOsnapModal"
/>
</teleport>
</BaseBlock>
</template>
36 changes: 15 additions & 21 deletions src/components/SettingsTreasuriesBlockItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,26 @@ import { TreasuryWallet } from '@/helpers/interfaces';
defineProps<{
treasuries: TreasuryWallet[];
isViewOnly?: boolean;
hasOsnapPlugin: boolean;
}>();

const emit = defineEmits(['removeTreasury', 'editTreasury']);
const emit = defineEmits<{
removeTreasury: [index: number];
editTreasury: [index: number];
configureOsnap: [index: number, isEnabled: boolean];
}>();
</script>

<template>
<div
<SettingsTreasuriesBlockItemButton
v-for="(treasury, i) in treasuries"
:key="i"
class="flex h-full truncate"
@click="emit('editTreasury', i)"
>
<button
class="flex w-full items-center justify-between rounded-md border p-4"
:class="{ 'cursor-default': isViewOnly }"
>
<div class="flex items-center gap-2 truncate pr-[20px] text-left">
<h4 class="truncate">{{ treasury.name }}</h4>
</div>
<BaseButtonIcon
v-show="!isViewOnly"
class="-mr-2"
@click.stop="emit('removeTreasury', i)"
>
<BaseIcon name="close" size="14" />
</BaseButtonIcon>
</button>
</div>
:treasury="treasury"
:treasury-index="i"
:is-view-only="!!isViewOnly"
:has-osnap-plugin="hasOsnapPlugin"
@edit-treasury="i => emit('editTreasury', i)"
@remove-treasury="i => emit('removeTreasury', i)"
@configure-osnap="(i, isEnabled) => emit('configureOsnap', i, isEnabled)"
/>
</template>
65 changes: 65 additions & 0 deletions src/components/SettingsTreasuriesBlockItemButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<script setup lang="ts">
import { TreasuryWallet } from '@/helpers/interfaces';
import { Network } from '@/plugins/oSnap/types';
import { getIsOsnapEnabled } from '@/plugins/oSnap/utils/getters';

const props = defineProps<{
treasury: TreasuryWallet;
treasuryIndex: number;
isViewOnly?: boolean;
hasOsnapPlugin: boolean;
}>();

const emit = defineEmits<{
removeTreasury: [index: number];
editTreasury: [index: number];
configureOsnap: [index: number, isEnabled: boolean];
}>();

const isOsnapEnabled = ref(false);

async function updateIsOsnapEnabled() {
if (!props.hasOsnapPlugin) return;
isOsnapEnabled.value = await getIsOsnapEnabled(
props.treasury.network as Network,
props.treasury.address
);
}

onMounted(async () => {
await updateIsOsnapEnabled();
window.addEventListener('focus', updateIsOsnapEnabled);
});

onUnmounted(() => {
window.removeEventListener('focus', updateIsOsnapEnabled);
});
</script>

<template>
<button
class="flex h-full w-full items-center justify-between truncate rounded-md border p-4"
:class="{ 'cursor-default': isViewOnly }"
@click="emit('editTreasury', treasuryIndex)"
>
<div class="flex items-center gap-2 truncate pr-[20px] text-left">
<h4 class="truncate">{{ treasury.name }}</h4>
</div>
<div class="ml-auto mr-3">
<SettingsTreasuryActivateOsnapButton
v-show="hasOsnapPlugin"
:is-osnap-enabled="isOsnapEnabled"
@click.stop="
!isViewOnly && emit('configureOsnap', treasuryIndex, isOsnapEnabled)
"
/>
</div>
<BaseButtonIcon
v-show="!isViewOnly"
class="-mr-2"
@click.stop="emit('removeTreasury', treasuryIndex)"
>
<BaseIcon name="close" size="14" />
</BaseButtonIcon>
</button>
</template>
21 changes: 21 additions & 0 deletions src/components/SettingsTreasuryActivateOsnapButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script setup lang="ts">
defineProps<{
isOsnapEnabled: boolean;
}>();
</script>

<template>
<button
v-if="isOsnapEnabled"
class="flex items-center gap-2 rounded-full px-3 py-2 bg-skin-primary text-white"
>
<span class="block h-[6px] w-[6px] rounded-full bg-green" />oSnap activated
</button>
<button
v-else
class="bg-skin-link text-skin-bg flex items-center gap-2 rounded-full px-3 py-2"
>
<span class="block h-[6px] w-[6px] rounded-full bg-skin-bg opacity-30" />
Activate oSnap
</button>
</template>
50 changes: 50 additions & 0 deletions src/components/SpaceCreateLegacyOsnap.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<script setup lang="ts">
import { ExtendedSpace } from '@/helpers/interfaces';

defineProps<{
space: ExtendedSpace | undefined;
legacyOsnap: { selection: boolean };
}>();

defineEmits<{
(event: 'legacyOsnapToggle'): void;
}>();
</script>

<template>
<div class="mb-4">
<div v-if="space?.voting?.type && space.voting.type !== 'basic'">
<h6>Where is oSnap?</h6>
<p class="mb-3">
oSnap is currently disabled because your space's voting settings
disallow the basic voting type which is a requirement for oSnap to work
properly.
</p>
<p>
Have your admin visit your
<a :href="`#/${space.id}/settings`">settings page</a> under Voting ->
Type, and make sure either "Any" or "Basic Voting" is selected. This
will allow you to create oSnap proposals.
</p>
</div>
<div v-else>
<h6>oSnap Proposal</h6>
<p>
Are you planning for this proposal to initiate a transaction that your
organizations Safe will execute if approved? (Remember, oSnap enables
trustless and permissionless execution)
</p>
<br />
<input
id="toggleOsnap"
type="checkbox"
:checked="legacyOsnap.selection"
@change="$emit('legacyOsnapToggle')"
/>
<label for="toggleOsnap">
Yes, use oSnap for transactions (this will restrict voting type to
Basic).
</label>
</div>
</div>
</template>
Loading