Skip to content

Commit

Permalink
feat: link SafeSnap executions to old interface (#1064)
Browse files Browse the repository at this point in the history
We currently do not support SafeSnap executions, so when detected
we link to v1 UI.
  • Loading branch information
Sekhmet authored Dec 20, 2024
1 parent 5ebcc3c commit 9cb71d0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
3 changes: 3 additions & 0 deletions apps/ui/src/networks/offchain/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ function formatProposal(proposal: ApiProposal, networkId: NetworkID): Proposal {
} catch (e) {
console.warn('failed to parse oSnap execution', e);
}
} else if (proposal.plugins.safeSnap) {
executions = [];
executionType = 'safeSnap';
}

if (proposal.plugins.readOnlyExecution) {
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/networks/offchain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const HUB_URLS: Partial<Record<NetworkID, string | undefined>> = {
s: 'https://hub.snapshot.org/graphql',
's-tn': 'https://testnet.hub.snapshot.org/graphql'
};
const SNAPSHOT_URLS: Partial<Record<NetworkID, string | undefined>> = {
export const SNAPSHOT_URLS: Partial<Record<NetworkID, string | undefined>> = {
s: 'https://v1.snapshot.box',
's-tn': 'https://testnet.v1.snapshot.box'
};
Expand Down
27 changes: 26 additions & 1 deletion apps/ui/src/views/Proposal/Overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
shortenAddress
} from '@/helpers/utils';
import { offchainNetworks } from '@/networks';
import { SNAPSHOT_URLS } from '@/networks/offchain';
import { Proposal } from '@/types';
const props = defineProps<{
Expand Down Expand Up @@ -455,12 +456,36 @@ onBeforeUnmount(() => destroyAudio());
<UiLinkPreview :url="discussion" :show-default="true" />
</a>
</div>
<div v-if="proposal.executions && proposal.executions.length > 0">
<div
v-if="
(proposal.executions && proposal.executions.length > 0) ||
proposal.execution_strategy_type === 'safeSnap'
"
>
<h4 class="mb-3 eyebrow flex items-center gap-2">
<IH-play />
<span>Execution</span>
</h4>
<div class="mb-4">
<UiAlert
v-if="proposal.execution_strategy_type === 'safeSnap'"
type="warning"
>
<div>
This proposal uses SafeSnap execution which is currently not
supported on the new interface. You can view execution details on
the
<a
:href="`${SNAPSHOT_URLS[proposal.network]}/#/${proposal.space.id}/proposal/${proposal.id}`"
target="_blank"
class="inline-flex items-center font-bold"
>
previous interface
<IH-arrow-sm-right class="inline-block -rotate-45" />
</a>
.
</div>
</UiAlert>
<ProposalExecutionsList
:proposal="proposal"
:executions="proposal.executions"
Expand Down

0 comments on commit 9cb71d0

Please sign in to comment.