-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1045 from near-daos/feature/custom-fc-registry
feat(custom templates): add custom fc templates registry
- Loading branch information
Showing
45 changed files
with
1,883 additions
and
18 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
astro_2.0/features/ViewProposal/components/SaveFcTemplate/SaveFcTemplate.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@import 'styles/mixins'; | ||
|
||
.root { | ||
align-items: center; | ||
background-color: var(--color-primary-50); | ||
border-radius: 4px 4px 0 0; | ||
color: var(--color-white); | ||
display: flex; | ||
justify-content: center; | ||
margin-left: 12px; | ||
padding: 0; | ||
} | ||
|
||
.control.control { | ||
@include centralize; | ||
color: var(--color-white); | ||
} | ||
|
||
.loading { | ||
margin-left: 8px; | ||
margin-right: 0; | ||
} | ||
|
||
.icon.icon { | ||
color: var(--color-white); | ||
margin-left: 8px; | ||
width: 24px; | ||
} |
53 changes: 53 additions & 0 deletions
53
astro_2.0/features/ViewProposal/components/SaveFcTemplate/SaveFcTemplate.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { FC, useCallback } from 'react'; | ||
import { useAsyncFn } from 'react-use'; | ||
import { useWalletContext } from 'context/WalletContext'; | ||
import { SputnikHttpService } from 'services/sputnik'; | ||
|
||
import { Icon } from 'components/Icon'; | ||
import { Button } from 'components/button/Button'; | ||
import { useModal } from 'components/modal'; | ||
import { SaveFcTemplateModal } from 'astro_2.0/features/ViewProposal/components/SaveFcTemplate/components/SaveFcTemplateModal'; | ||
import { LoadingIndicator } from 'astro_2.0/components/LoadingIndicator'; | ||
|
||
import { ProposalFeedItem } from 'types/proposal'; | ||
|
||
import styles from './SaveFcTemplate.module.scss'; | ||
|
||
interface Props { | ||
proposal: ProposalFeedItem; | ||
} | ||
|
||
export const SaveFcTemplate: FC<Props> = ({ proposal }) => { | ||
const { accountId } = useWalletContext(); | ||
|
||
const [{ loading }, getDaosList] = useAsyncFn(async () => { | ||
return SputnikHttpService.getAccountDaos(accountId); | ||
}, [accountId]); | ||
|
||
const [showModal] = useModal(SaveFcTemplateModal); | ||
|
||
const handleClick = useCallback(async () => { | ||
const accountDaos = await getDaosList(); | ||
|
||
await showModal({ accountDaos, proposal }); | ||
}, [getDaosList, proposal, showModal]); | ||
|
||
return ( | ||
<div className={styles.root}> | ||
<Button | ||
size="small" | ||
variant="tertiary" | ||
capitalize | ||
className={styles.control} | ||
onClick={handleClick} | ||
> | ||
<span className={styles.label}>Save template</span> | ||
{loading ? ( | ||
<LoadingIndicator className={styles.loading} /> | ||
) : ( | ||
<Icon name="bookmark" className={styles.icon} /> | ||
)} | ||
</Button> | ||
</div> | ||
); | ||
}; |
63 changes: 63 additions & 0 deletions
63
.../components/SaveFcTemplate/components/SaveFcTemplateModal/SaveFcTemplateModal.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
@import 'styles/typography'; | ||
@import 'styles/mixins'; | ||
|
||
.modalRoot { | ||
overflow: visible; | ||
} | ||
|
||
.root { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.desc { | ||
@extend %subtitle4; | ||
margin: 0 0 24px; | ||
} | ||
|
||
.inputWrapper { | ||
align-items: center; | ||
display: flex; | ||
margin-bottom: 24px; | ||
|
||
.suffix { | ||
margin-left: 12px; | ||
} | ||
} | ||
|
||
.input.input { | ||
height: unset; | ||
padding: 6.5px 6px; | ||
|
||
@include placeholder { | ||
@extend %body2; | ||
} | ||
} | ||
|
||
.listItem { | ||
@extend %caption1; | ||
} | ||
|
||
.selectedItem.selectedItem { | ||
@extend %body2; | ||
display: flex; | ||
justify-content: flex-start; | ||
margin-right: 8px; | ||
max-width: 140px; | ||
overflow: hidden; | ||
} | ||
|
||
.menuClassName { | ||
width: 100%; | ||
} | ||
|
||
.ellipsed { | ||
@include ellipse-text; | ||
} | ||
|
||
.footer { | ||
align-items: center; | ||
display: flex; | ||
justify-content: space-between; | ||
margin: 24px 0 12px; | ||
} |
Oops, something went wrong.