From 697c9fad4314e0077b3c0479dbb0573f2c8382f0 Mon Sep 17 00:00:00 2001 From: Abishek Bashyal Date: Thu, 5 Oct 2023 16:42:47 +0545 Subject: [PATCH] feat: pr changes done --- .../chat/CreateGroup/AddCriteria.tsx | 32 ++-- .../chat/CreateGroup/CreateGroupType.tsx | 38 ++--- .../components/chat/CreateGroup/Criteria.tsx | 153 ------------------ .../chat/CreateGroup/DefineCondition.tsx | 44 ++--- .../chat/CreateGroup/MultipleCriterias.tsx | 124 -------------- .../CreateGroup/SingleAndMultipleCriteria.tsx | 10 -- .../lib/components/chat/CreateGroup/Type.ts | 11 +- .../chat/helpers/tokenGatedGroup.ts | 25 +++ 8 files changed, 69 insertions(+), 368 deletions(-) delete mode 100644 packages/uiweb/src/lib/components/chat/CreateGroup/Criteria.tsx delete mode 100644 packages/uiweb/src/lib/components/chat/CreateGroup/MultipleCriterias.tsx delete mode 100644 packages/uiweb/src/lib/components/chat/CreateGroup/SingleAndMultipleCriteria.tsx create mode 100644 packages/uiweb/src/lib/components/chat/helpers/tokenGatedGroup.ts diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/AddCriteria.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/AddCriteria.tsx index 73693e722..77e245a17 100644 --- a/packages/uiweb/src/lib/components/chat/CreateGroup/AddCriteria.tsx +++ b/packages/uiweb/src/lib/components/chat/CreateGroup/AddCriteria.tsx @@ -262,9 +262,7 @@ const AddCriteria = ({ setQuantity({ ...quantity, value: e.target.value }); }; - const verifyAndDoNext = ()=>{ - const _type = dropdownTypeValues[selectedTypeValue].value as 'PUSH' | 'GUILD' const category:string = _type === "PUSH" ? (dropdownCategoryValues[_type] as DropdownValueType[])[ selectedCategoryValue @@ -301,11 +299,10 @@ const AddCriteria = ({ // GUILD type return { id:guildId, - role:specificRoleId, comparison:guildComparison, + role:guildComparison === 'specific' ? specificRoleId : "*", } } - } const rule:Rule = { @@ -315,9 +312,10 @@ const AddCriteria = ({ data: getData(_type, category), } - // alert(JSON.stringify(rule)) entryCriteria.addNewRule(rule) + // alert(`${JSON.stringify(rule)}`) + if(handlePrevious){ handlePrevious() } @@ -364,19 +362,17 @@ const AddCriteria = ({ } }else{ // guild condition + alert(`${JSON.stringify(oldValue.data)}`) setGuildId((oldValue.data as GuildData).id) setSpecificRoleId((oldValue.data as GuildData).role) - setGuildComparison((oldValue.data as GuildData).comparison) + setGuildComparison((oldValue.data as GuildData).comparison) } setSelectedTypeValue( dropdownTypeValues.findIndex(obj => obj.value === oldValue.type) ) - - - // TODO: reverse the form fill } - },[0]) + },[]) return (
- setSpecificRoleId(e.target.value)} - placeholder="e.g. 4687" - /> + {guildComparison === "specific" && + setSpecificRoleId(e.target.value)} + placeholder="e.g. 4687" + /> + } + + )}