-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ryanwolhuter <[email protected]>
- Loading branch information
1 parent
9794df5
commit ee3e203
Showing
4 changed files
with
95 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script setup lang="ts"> | ||
import { GnosisSafe } from '../../types'; | ||
import ModalSafe from '../TransactionBuilder/ModalSafe.vue'; | ||
defineProps<{ | ||
safes: GnosisSafe[]; | ||
selectedSafe: GnosisSafe | null; | ||
}>(); | ||
const emit = defineEmits<{ | ||
updateSafe: [safe: GnosisSafe]; | ||
}>(); | ||
const isModalOpen = ref(false); | ||
</script> | ||
|
||
<template> | ||
<div class="mb-2"> | ||
<TuneButtonSelect | ||
:model-value=" | ||
safes.find(safe => safe.safeAddress === selectedSafe?.safeAddress) | ||
?.safeName || 'Select Safe' | ||
" | ||
@select="isModalOpen = true" | ||
/> | ||
<teleport to="#modal"> | ||
<ModalSafe | ||
:selected="selectedSafe" | ||
:open="isModalOpen" | ||
:safes="safes" | ||
@update-safe="emit('updateSafe', $event)" | ||
@close="isModalOpen = false" | ||
/> | ||
</teleport> | ||
</div> | ||
</template> |
47 changes: 47 additions & 0 deletions
47
src/plugins/oSnap/components/TransactionBuilder/ModalSafe.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<script setup lang="ts"> | ||
import { GnosisSafe } from '../../types'; | ||
import networks from '@snapshot-labs/snapshot.js/src/networks.json'; | ||
defineProps<{ | ||
open: boolean; | ||
safes: GnosisSafe[] | ||
selected: GnosisSafe | null; | ||
}>(); | ||
const emit = defineEmits<{ | ||
updateSafe: [type: GnosisSafe]; | ||
close: []; | ||
}>(); | ||
function select(type: GnosisSafe) { | ||
emit('updateSafe', type); | ||
emit('close'); | ||
} | ||
function makeSafeDescription(safe: GnosisSafe) { | ||
const networkDetails = networks[safe.network]; | ||
return `${safe.safeAddress} (${networkDetails?.name})`; | ||
} | ||
</script> | ||
|
||
<template> | ||
<BaseModal :open="open" @close="$emit('close')"> | ||
<template #header> | ||
<h3>Select Safe</h3> | ||
</template> | ||
<div class="mx-0 my-4 flex flex-col space-y-3 md:mx-4"> | ||
<button | ||
v-for="(safe, key) in safes" | ||
:key="key" | ||
@click="select(safe)" | ||
> | ||
<BaseModalSelectItem | ||
:selected="safe.safeAddress === selected?.safeAddress" | ||
:title="safe.safeName" | ||
:description="makeSafeDescription(safe)" | ||
/> | ||
</button> | ||
</div> | ||
</BaseModal> | ||
</template> |