Skip to content

Commit

Permalink
legacy: Minor proposals UX improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgcramos committed Jun 24, 2022
1 parent d05c571 commit 42e4ea1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion .prettierrc
Expand Up @@ -6,7 +6,6 @@
"useTabs": false,
"jsxSingleQuote": false,
"bracketSpacing": true,
"jsxBracketSameLine": true,
"arrowParens": "always",
"endOfLine": "lf",
"trailingComma": "none"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Proposal/Proposal.jsx
Expand Up @@ -354,7 +354,7 @@ const Proposal = React.memo(function Proposal({
) : (
!showEditedDate && (
<span data-testid="proposal-published-timestamp">
<Event event="published" timestamp={timestamp} />
<Event event="submitted" timestamp={timestamp} />
</span>
)
)}
Expand Down
9 changes: 8 additions & 1 deletion src/components/ProposalForm/ProposalForm.jsx
Expand Up @@ -209,6 +209,13 @@ const ProposalForm = React.memo(function ProposalForm({
const hasError = errors && errors.global;
useScrollTo("record-submission-error-message", hasError);

function getEndDateMinTimestamp() {
return values.startDate
? // One day from startDate in ms
(convertObjectToUnixTimestamp(values.startDate) + 86400) * 1000
: sumNowAndDuration(startdatemin);
}

return (
<form onSubmit={handleSubmit}>
<Message kind="warning" className="margin-bottom-m">
Expand Down Expand Up @@ -331,7 +338,7 @@ const ProposalForm = React.memo(function ProposalForm({
tabIndex={1}
className={classNames(styles.endDate, "margin-bottom-m")}
value={values.endDate}
minTimestamp={sumNowAndDuration(startdatemin)}
minTimestamp={getEndDateMinTimestamp()}
maxTimestamp={sumNowAndDuration(enddatemax)}
name="endDate"
placeholder="End Date"
Expand Down

0 comments on commit 42e4ea1

Please sign in to comment.