Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
Polls: unlocked by tokens creation
Browse files Browse the repository at this point in the history
  • Loading branch information
dkildar committed May 2, 2024
1 parent 541802e commit 4dfca6d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/common/features/polls/components/polls-creation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
UilPlus,
UilQuestionCircle,
UilSave,
UilTrash
UilTrash,
UilTrashAlt
} from "@iconscout/react-unicons";
import { Button } from "@ui/button";
import { format } from "date-fns";
Expand Down Expand Up @@ -61,7 +62,8 @@ export function PollsCreation({
setHideVotes,
voteChange,
setVoteChange,
isExpiredEndDate
isExpiredEndDate,
clearAll
} = usePollsCreationManagement(existingPoll);

const formatDate = useMemo(() => format(endDate ?? new Date(), "yyyy-MM-dd"), [endDate]);
Expand Down Expand Up @@ -176,6 +178,15 @@ export function PollsCreation({
checked={!!hideVotes}
onChange={(e: boolean) => setHideVotes(e)}
/>
<Button
onClick={() => clearAll()}
outline={true}
size="sm"
icon={<UilTrashAlt />}
className="mt-4"
>
{_t("g.reset-form")}
</Button>
</div>
</ModalBody>
<ModalFooter sticky={true}>
Expand Down Expand Up @@ -212,7 +223,6 @@ export function PollsCreation({
hasEmptyOrDuplicatedChoices ||
!title ||
typeof accountAge !== "number" ||
interpretation === "tokens" ||
isExpiredEndDate
}
iconPlacement="left"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ export function usePollsCreationManagement(poll?: PollSnapshot) {
setHideVotes,
voteChange,
setVoteChange,
isExpiredEndDate
isExpiredEndDate,
clearAll: () => {
clearTitle();
clearChoices();
clearAccountAge();
clearEndDate();
}
};
}
3 changes: 2 additions & 1 deletion src/common/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"actions": "Actions",
"restore": "Restore",
"success": "Success",
"error": "Error"
"error": "Error",
"reset-form": "Reset form"
},
"confirm": {
"title": "Are you sure?",
Expand Down
1 change: 1 addition & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ module.exports = {
"green-040": "#e3fceb",
warning: {
default: "#fcc920",
"020": "#c39f2a",
"030": "#ffe08a",
"040": "#fff0c7",
"046": "#fffcf2"
Expand Down

0 comments on commit 4dfca6d

Please sign in to comment.