Skip to content

Commit

Permalink
updated registry and fixed title on deployment page
Browse files Browse the repository at this point in the history
  • Loading branch information
hardyjosh committed Feb 15, 2025
1 parent a71fec3 commit 2c11704
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 7 deletions.
25 changes: 25 additions & 0 deletions packages/ui-components/src/__tests__/DeploymentSteps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,11 @@ describe('DeploymentSteps', () => {
render(DeploymentSteps, {
props: {
dotrain,
strategyDetail: {
name: 'SFLR<>WFLR on Flare',
description: 'Rotate sFLR (Sceptre staked FLR) and WFLR on Flare.',
short_description: 'Rotate sFLR (Sceptre staked FLR) and WFLR on Flare.'
},
deployment: mockDeployment,
wagmiConfig: mockWagmiConfigStore,
wagmiConnected: mockConnectedStore,
Expand Down Expand Up @@ -661,6 +666,11 @@ describe('DeploymentSteps', () => {
render(DeploymentSteps, {
props: {
dotrain,
strategyDetail: {
name: 'SFLR<>WFLR on Flare',
description: 'Rotate sFLR (Sceptre staked FLR) and WFLR on Flare.',
short_description: 'Rotate sFLR (Sceptre staked FLR) and WFLR on Flare.'
},
deployment: mockDeployment,
wagmiConfig: mockWagmiConfigStore,
wagmiConnected: mockConnectedStore,
Expand Down Expand Up @@ -690,6 +700,11 @@ describe('DeploymentSteps', () => {
render(DeploymentSteps, {
props: {
dotrain,
strategyDetail: {
name: 'SFLR<>WFLR on Flare',
description: 'Rotate sFLR (Sceptre staked FLR) and WFLR on Flare.',
short_description: 'Rotate sFLR (Sceptre staked FLR) and WFLR on Flare.'
},
deployment: mockDeployment,
wagmiConfig: mockWagmiConfigStore,
wagmiConnected: mockConnectedStore,
Expand Down Expand Up @@ -730,6 +745,11 @@ describe('DeploymentSteps', () => {
render(DeploymentSteps, {
props: {
dotrain,
strategyDetail: {
name: 'SFLR<>WFLR on Flare',
description: 'Rotate sFLR (Sceptre staked FLR) and WFLR on Flare.',
short_description: 'Rotate sFLR (Sceptre staked FLR) and WFLR on Flare.'
},
deployment: mockDeployment,
wagmiConfig: mockWagmiConfigStore,
wagmiConnected: mockConnectedStore,
Expand Down Expand Up @@ -768,6 +788,11 @@ describe('DeploymentSteps', () => {
render(DeploymentSteps, {
props: {
dotrain,
strategyDetail: {
name: 'SFLR<>WFLR on Flare',
description: 'Rotate sFLR (Sceptre staked FLR) and WFLR on Flare.',
short_description: 'Rotate sFLR (Sceptre staked FLR) and WFLR on Flare.'
},
deployment: mockDeployment,
wagmiConfig: mockWagmiConfigStore,
wagmiConnected: mockConnectedStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
type GuiFieldDefinition,
type GuiDeployment,
type OrderIO,
type SelectTokens
type SelectTokens,
type NameAndDescription
} from '@rainlanguage/orderbook/js_api';
import { fade } from 'svelte/transition';
import { Button, Toggle, Spinner } from 'flowbite-svelte';
Expand Down Expand Up @@ -46,6 +47,7 @@
export let settings: Writable<ConfigSource>;
export let dotrain: string;
export let deployment: GuiDeployment;
export let strategyDetail: NameAndDescription;
export let handleDeployModal: (args: DeploymentArgs) => void;
export let handleDisclaimerModal: (args: Omit<ComponentProps<DisclaimerModal>, 'open'>) => void;
Expand Down Expand Up @@ -284,7 +286,7 @@
{#if deployment}
<div class="mt-8 flex max-w-2xl flex-col gap-4 text-start">
<h1 class=" text-3xl font-semibold text-gray-900 lg:text-6xl dark:text-white">
{deployment.name}
{strategyDetail.name}
</h1>
<p class="text-xl text-gray-600 lg:text-2xl dark:text-gray-400">
{deployment.description}
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const REGISTRY_URL =
'https://raw.githubusercontent.com/rainlanguage/rain.strategies/refs/heads/main/ports/registry';
'https://raw.githubusercontent.com/rainlanguage/rain.strategies/78ac82f2a6c74381ef4b79a67784281935c8d840/ports/registry';
13 changes: 10 additions & 3 deletions packages/webapp/src/routes/deploy/[strategyName]/+layout.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
import type { LayoutLoad } from './$types';
import { redirect } from '@sveltejs/kit';

import type { NameAndDescription } from '@rainlanguage/orderbook/js_api';
export const load: LayoutLoad = async ({ params, parent }) => {
const { strategyName } = params;
const { registryDotrains } = await parent();
const { registryDotrains, strategyDetails } = await parent();

let dotrain: string;
let strategyDetail: NameAndDescription;

try {
const _dotrain = registryDotrains.find((dotrain) => dotrain.name === strategyName)?.dotrain;
if (!_dotrain) {
throw redirect(307, '/deploy');
}
dotrain = _dotrain;
const _strategyDetail = strategyDetails.find((detail) => detail.name === strategyName)?.details;
if (!_strategyDetail) {
throw redirect(307, '/deploy');
}
strategyDetail = _strategyDetail;
} catch {
throw redirect(307, '/deploy');
}

return {
dotrain,
strategyName
strategyName,
strategyDetail
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { handleDeployModal, handleDisclaimerModal } from '$lib/services/modal';
import { handleUpdateGuiState } from '$lib/services/handleUpdateGuiState';
const { settings } = $page.data.stores;
const { dotrain, deployment } = $page.data;
const { dotrain, deployment, strategyDetail } = $page.data;
if (!dotrain || !deployment) {
setTimeout(() => {
Expand All @@ -24,6 +24,7 @@
<div>Deployment not found. Redirecting to deployments page...</div>
{:else}
<DeploymentSteps
{strategyDetail}
{dotrain}
{deployment}
{wagmiConfig}
Expand Down

0 comments on commit 2c11704

Please sign in to comment.