Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add button to save contract to Hiro platform #1295

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 { 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 @@
pr="84px"
color={'textBody'}
/>
<Flex position="absolute" right="8px">
<Flex position="absolute" right="44px">
<IconButton
color={'textBody'}
onClick={() => {
Expand All @@ -68,8 +69,6 @@
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 @@
/>
</Tooltip>
</Box>
</Flex>
<Stack alignItems="center" justifyContent={'center'} isInline spacing="8px" mt="20px">
<Button
onClick={() =>
isConnected
Expand All @@ -94,6 +95,25 @@
{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>
</>
);
};
Loading