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 Oct 12, 2023
1 parent 81458a5 commit 782c9f1
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 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,25 @@ export const LeftSection: FC = () => {
{isConnected ? 'Deploy' : 'Connect Stacks Wallet'}
</Button>
</Stack>
<Stack mt={'10px'}>
<Button
color={'textBody'}
variant="outline"
_hover={{ background: '#F9F9FA' }}
bg={'bg'}
rightIcon={<FiExternalLink />}
onClick={() => {
const paramsBase64 = { name: contractName, sourceCode: codeBody };
const state = btoa(JSON.stringify(paramsBase64));

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

View check run for this annotation

Codecov / codecov/patch

src/app/sandbox/deploy/LeftSection.tsx#L105-L107

Added lines #L105 - L107 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 110 in src/app/sandbox/deploy/LeftSection.tsx

View check run for this annotation

Codecov / codecov/patch

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

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

0 comments on commit 782c9f1

Please sign in to comment.