-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: World ID identity & requirement (#1468)
* feat: new `black` color scheme * feat: add `WORLD_ID` platform support * chore: upgrade the `@guildxyz/types` package * chore: upgrade the `@guildxyz/types` package * feat: `WORLD_ID_VERIFICATION` requirement * fix(Select): fine-tune styles * fix(useConnectPlatform): open World ID auth in the same window * cleanup: remove unnecessary `@ts-ignore` comments & revert type changes * chore: upgrade the `@guildxyz/types` package * fix: `next-env.d.ts` change * feat: add World Chain support * Revert "feat: add World Chain support" This reverts commit 2386f39. * fix: exclude `WORLD_ID` from `HandlerTypeAndParam`
- Loading branch information
1 parent
1e1ed88
commit 440feab
Showing
22 changed files
with
196 additions
and
64 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { FormControl, FormField, FormItem, FormLabel } from "@/components/ui/Form" | ||
import { | ||
Select, | ||
SelectContent, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue, | ||
} from "@/components/ui/Select" | ||
import { useFormContext } from "react-hook-form" | ||
import { RequirementFormProps } from "requirements/types" | ||
|
||
const VERIFICATION_LEVEL_OPTIONS = [ | ||
{ | ||
label: "Device", | ||
value: "device", | ||
}, | ||
{ | ||
label: "Orb", | ||
value: "orb", | ||
}, | ||
] as const | ||
|
||
const WorldIDForm = ({ baseFieldPath }: RequirementFormProps) => { | ||
const { control } = useFormContext() | ||
|
||
return ( | ||
<div className="flex flex-col items-start gap-4"> | ||
<FormField | ||
control={control} | ||
name={`${baseFieldPath}.data.verificationLevel`} | ||
render={({ field }) => ( | ||
<FormItem className="w-full"> | ||
<FormLabel>Verification level</FormLabel> | ||
<Select | ||
onValueChange={field.onChange} | ||
defaultValue={field.value} | ||
value={field.value} | ||
> | ||
<FormControl> | ||
<SelectTrigger> | ||
<SelectValue placeholder="Select one..." /> | ||
</SelectTrigger> | ||
</FormControl> | ||
<SelectContent> | ||
{VERIFICATION_LEVEL_OPTIONS.map(({ value, label }) => ( | ||
<SelectItem key={value} value={value}> | ||
{label} | ||
</SelectItem> | ||
))} | ||
</SelectContent> | ||
</Select> | ||
</FormItem> | ||
)} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
export default WorldIDForm |
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,23 @@ | ||
import ConnectRequirementPlatformButton from "components/[guild]/Requirements/components/ConnectRequirementPlatformButton" | ||
import { | ||
Requirement, | ||
RequirementProps, | ||
} from "components/[guild]/Requirements/components/Requirement" | ||
import { useRequirementContext } from "components/[guild]/Requirements/components/RequirementContext" | ||
import REQUIREMENTS from "requirements" | ||
|
||
const WorldIDRequirement = (props: RequirementProps) => { | ||
const { data } = useRequirementContext<"WORLD_ID_VERIFICATION">() | ||
|
||
return ( | ||
<Requirement | ||
image={REQUIREMENTS.WORLD_ID_VERIFICATION.icon as string} | ||
footer={<ConnectRequirementPlatformButton />} | ||
{...props} | ||
> | ||
{`Have a World ID account connected with ${data.verificationLevel === "orb" ? "Orb" : "Device"} verification level`} | ||
</Requirement> | ||
) | ||
} | ||
|
||
export default WorldIDRequirement |
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
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
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,13 @@ | ||
import { PlatformAsRewardRestrictions, RewardData } from "rewards/types" | ||
import WorldIDIcon from "static/icons/world-id.svg" | ||
|
||
export const worldIDData = { | ||
icon: WorldIDIcon, | ||
imageUrl: "", | ||
name: "World ID", | ||
colorScheme: "black", | ||
gatedEntity: "", | ||
autoRewardSetup: false, | ||
isPlatform: true, | ||
asRewardRestriction: PlatformAsRewardRestrictions.NOT_APPLICABLE, | ||
} satisfies RewardData |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Oops, something went wrong.