From 4dfca6d3e3fc410735a7127869bfd5368b87180e Mon Sep 17 00:00:00 2001 From: "ildar.timerbaev" Date: Fri, 3 May 2024 00:24:23 +0600 Subject: [PATCH] Polls: unlocked by tokens creation --- .../features/polls/components/polls-creation.tsx | 16 +++++++++++++--- .../polls/hooks/use-polls-creation-management.ts | 8 +++++++- src/common/i18n/locales/en-US.json | 3 ++- tailwind.config.js | 1 + 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/common/features/polls/components/polls-creation.tsx b/src/common/features/polls/components/polls-creation.tsx index 4cd1ab46d78..2cd1c5bf30c 100644 --- a/src/common/features/polls/components/polls-creation.tsx +++ b/src/common/features/polls/components/polls-creation.tsx @@ -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"; @@ -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]); @@ -176,6 +178,15 @@ export function PollsCreation({ checked={!!hideVotes} onChange={(e: boolean) => setHideVotes(e)} /> + @@ -212,7 +223,6 @@ export function PollsCreation({ hasEmptyOrDuplicatedChoices || !title || typeof accountAge !== "number" || - interpretation === "tokens" || isExpiredEndDate } iconPlacement="left" diff --git a/src/common/features/polls/hooks/use-polls-creation-management.ts b/src/common/features/polls/hooks/use-polls-creation-management.ts index 324fd0b842a..aa24341336d 100644 --- a/src/common/features/polls/hooks/use-polls-creation-management.ts +++ b/src/common/features/polls/hooks/use-polls-creation-management.ts @@ -79,6 +79,12 @@ export function usePollsCreationManagement(poll?: PollSnapshot) { setHideVotes, voteChange, setVoteChange, - isExpiredEndDate + isExpiredEndDate, + clearAll: () => { + clearTitle(); + clearChoices(); + clearAccountAge(); + clearEndDate(); + } }; } diff --git a/src/common/i18n/locales/en-US.json b/src/common/i18n/locales/en-US.json index 168627dddc5..29712665844 100644 --- a/src/common/i18n/locales/en-US.json +++ b/src/common/i18n/locales/en-US.json @@ -90,7 +90,8 @@ "actions": "Actions", "restore": "Restore", "success": "Success", - "error": "Error" + "error": "Error", + "reset-form": "Reset form" }, "confirm": { "title": "Are you sure?", diff --git a/tailwind.config.js b/tailwind.config.js index 0ed5c6a07cf..a22476f93cf 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -253,6 +253,7 @@ module.exports = { "green-040": "#e3fceb", warning: { default: "#fcc920", + "020": "#c39f2a", "030": "#ffe08a", "040": "#fff0c7", "046": "#fffcf2"