Skip to content

Commit

Permalink
fix: add button to save contract to Hiro platform
Browse files Browse the repository at this point in the history
  • Loading branch information
beguene committed Sep 26, 2023
1 parent 81458a5 commit ce7596a
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/app/sandbox/deploy/LeftSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React, { FC, useState } from 'react';
import { RiCloseLine } from 'react-icons/ri';
import { TbTools } from 'react-icons/tb';
import { useQueryClient } from '@tanstack/react-query';
import { FiExternalLink } from 'react-icons/fi';

Check warning on line 11 in src/app/sandbox/deploy/LeftSection.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/sandbox/deploy/LeftSection.tsx#L11

Added line #L11 was not covered by tests

import { openContractDeploy } from '@stacks/connect';

Expand Down Expand Up @@ -57,7 +58,7 @@ export const LeftSection: FC = () => {
pr="84px"
color={'textBody'}
/>
<Flex position="absolute" right="8px">
<Flex position="absolute" right="44px">
<IconButton
color={'textBody'}
onClick={() => {
Expand All @@ -68,8 +69,6 @@ export const LeftSection: FC = () => {
size={'30px'}
/>
</Flex>
</Flex>
<Stack alignItems="center" justifyContent={'center'} isInline spacing="8px" mt="20px">
<Box onClick={() => dispatch(toggleCodeToolbar())}>
<Tooltip label="Contract tools">
<IconButton
Expand All @@ -79,6 +78,8 @@ export const LeftSection: FC = () => {
/>
</Tooltip>
</Box>
</Flex>
<Stack alignItems="center" justifyContent={'center'} isInline spacing="8px" mt="20px">
<Button
onClick={() =>
isConnected
Expand All @@ -94,6 +95,24 @@ export const LeftSection: FC = () => {
{isConnected ? 'Deploy' : 'Connect Stacks Wallet'}
</Button>
</Stack>
<Stack mt={'10px'}>
<Button
color={'textBody'}
variant="outline"
bg={'bg'}
rightIcon={<FiExternalLink />}
onClick={() => {
const paramsBase64 = { name: contractName, sourceCode: codeBody };
const state = btoa(JSON.stringify(paramsBase64));

Check warning on line 106 in src/app/sandbox/deploy/LeftSection.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/sandbox/deploy/LeftSection.tsx#L104-L106

Added lines #L104 - L106 were not covered by tests

// 'state' param is used by Auth0 to forward the params after the login portal
window.open(`https://platform.hiro.so/projects/import?state=${state}`);

Check warning on line 109 in src/app/sandbox/deploy/LeftSection.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/sandbox/deploy/LeftSection.tsx#L109

Added line #L109 was not covered by tests
}}
width="100%"
>
Save Contract in Hiro Platform
</Button>
</Stack>
</>
);
};

0 comments on commit ce7596a

Please sign in to comment.