-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SOV-3237: Proposal creation - Proposal Overview (#637)
* SOV-3237: Proposal creation - Proposal Overview * Create violet-dogs-kick.md * rebuild * chore: updates from comments --------- Co-authored-by: Victor Creed <[email protected]>
- Loading branch information
1 parent
f04e64b
commit ac60e47
Showing
12 changed files
with
340 additions
and
70 deletions.
There are no files selected for viewing
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,6 @@ | ||
--- | ||
"frontend": patch | ||
--- | ||
|
||
SOV-3237: Proposal creation - Proposal Overview | ||
|
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
89 changes: 89 additions & 0 deletions
89
...s/BitocracyPage/components/NewProposalForm/components/PreviewProposal/PreviewProposal.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,89 @@ | ||
import React, { FC, useCallback } from 'react'; | ||
|
||
import { t } from 'i18next'; | ||
|
||
import { | ||
Button, | ||
ButtonStyle, | ||
Heading, | ||
Paragraph, | ||
ParagraphSize, | ||
} from '@sovryn/ui'; | ||
|
||
import { TxIdWithNotification } from '../../../../../../2_molecules/TxIdWithNotification/TransactionIdWithNotification'; | ||
import { useAccount } from '../../../../../../../hooks/useAccount'; | ||
import { translations } from '../../../../../../../locales/i18n'; | ||
import { ProposalInfo } from '../../../../../ProposalPage/components/ProposalInfo/ProposalInfo'; | ||
import { useProposalContext } from '../../../../contexts/NewProposalContext'; | ||
import { ProposalCreationStep } from '../../../../contexts/ProposalContext.types'; | ||
|
||
const pageTranslations = translations.proposalPage; | ||
|
||
export const PreviewProposal: FC = () => { | ||
const { details, submit, type, setStep } = useProposalContext(); | ||
|
||
const { account } = useAccount(); | ||
|
||
const handleSubmit = useCallback(() => { | ||
submit(); | ||
}, [submit]); | ||
|
||
const handleClose = useCallback(() => { | ||
setStep(ProposalCreationStep.Details); | ||
}, [setStep]); | ||
|
||
return ( | ||
<> | ||
<div className="w-full flex flex-col md:flex-row gap-20 text-left text-gray-10 mb-5 mt-2 pb-14"> | ||
<div className="w-full flex flex-col gap-6 sm:max-h-[35rem] overflow-auto"> | ||
<div className="md:px-6 md:pb-6"> | ||
<Heading className="text-base sm:text-2xl font-medium break-all"> | ||
{details.title} | ||
</Heading> | ||
<div className="mt-2.5 sm:mt-3 font-medium text-gray-30 break-words"> | ||
{details.summary} | ||
</div> | ||
<div className="mt-2.5 sm:mt-6 text-xs font-medium text-gray-30 flex justify-between md:justify-start"> | ||
<span className="inline-block min-w-20"> | ||
{t(pageTranslations.proposedBy)} | ||
</span> | ||
|
||
{account && ( | ||
<TxIdWithNotification | ||
href="" | ||
value={account} | ||
dataAttribute="proposal-proposer-address-id" | ||
/> | ||
)} | ||
</div> | ||
<Paragraph | ||
size={ParagraphSize.base} | ||
className="mt-1 text-xs font-medium text-gray-30 flex justify-between md:justify-start" | ||
> | ||
<span className="inline-block min-w-20"> | ||
{t(pageTranslations.proposalID)} | ||
</span> | ||
<span className="text-gray-10">{`${type}-001`}</span> | ||
</Paragraph> | ||
</div> | ||
|
||
<ProposalInfo link={details.link} description={details.text} /> | ||
</div> | ||
</div> | ||
|
||
<div className="flex items-center gap-4 bg-sovryn-black p-6 pb-10 border-t sm:border-none border-gray-60 justify-center sm:absolute fixed bottom-0 left-0 right-0 z-10"> | ||
<Button | ||
text={t(translations.common.buttons.back)} | ||
onClick={handleClose} | ||
style={ButtonStyle.secondary} | ||
className="flex-1 max-w-44" | ||
/> | ||
<Button | ||
text={t(translations.common.buttons.confirm)} | ||
onClick={handleSubmit} | ||
className="flex-1 max-w-44" | ||
/> | ||
</div> | ||
</> | ||
); | ||
}; |
34 changes: 34 additions & 0 deletions
34
...age/components/NewProposalForm/components/PreviewProposalDialog/PreviewProposalDialog.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,34 @@ | ||
import React, { FC, useCallback } from 'react'; | ||
|
||
import { t } from 'i18next'; | ||
|
||
import { Dialog, DialogBody, DialogHeader, DialogSize } from '@sovryn/ui'; | ||
|
||
import { translations } from '../../../../../../../locales/i18n'; | ||
import { useProposalContext } from '../../../../contexts/NewProposalContext'; | ||
import { ProposalCreationStep } from '../../../../contexts/ProposalContext.types'; | ||
import { PreviewProposal } from '../PreviewProposal/PreviewProposal'; | ||
|
||
const pageTranslations = translations.bitocracyPage; | ||
|
||
export const PreviewProposalDialog: FC = () => { | ||
const { setStep } = useProposalContext(); | ||
const onClose = useCallback(() => { | ||
setStep(ProposalCreationStep.Details); | ||
}, [setStep]); | ||
|
||
return ( | ||
<Dialog | ||
isOpen={true} | ||
dataAttribute="preview-proposal-dialog" | ||
width={DialogSize.xl3} | ||
disableFocusTrap | ||
> | ||
<DialogHeader | ||
title={t(pageTranslations.proposalPreview.title)} | ||
onClose={onClose} | ||
/> | ||
<DialogBody children={<PreviewProposal />} /> | ||
</Dialog> | ||
); | ||
}; |
4 changes: 4 additions & 0 deletions
4
...Page/components/NewProposalForm/components/ProposalDataForm/ProposalDataForm.constants.ts
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,4 @@ | ||
export const MAXIMUM_TITLE_LENGTH = 140; | ||
export const MAXIMUM_SUMMARY_LENGTH = 140; | ||
export const MAXIMUM_DISCUSSION_URL_LENGTH = 500; | ||
export const MAXIMUM_PROPOSAL_TEXT_LENGTH = 30000; |
Oops, something went wrong.