-
Notifications
You must be signed in to change notification settings - Fork 1
/
page.tsx
92 lines (87 loc) · 2.94 KB
/
page.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
"use client";
import React, { useState } from 'react';
import { useParams } from 'next/navigation';
import { useClaimRequest } from '@/contexts/ClaimRequestContext';
const ClaimRequestForm = () => {
const [groupId, setGroupId] = useState('');
const { addClaimRequest } = useClaimRequest();
const [claimType, setClaimType] = useState('GTE');
const [value, setValue] = useState('');
const [isOptional, setIsOptional] = useState(false);
const [isSelectableByUser, setIsSelectableByUser] = useState(false);
const { protocol } = useParams();
const handleClaimRequest = () => {
// Create a claim request object with the form inputs
const claimRequest = {
groupId,
claimType,
value: parseInt(value),
isOptional,
isSelectableByUser,
};
// Do something with the claim request object
addClaimRequest(protocol, claimRequest);
};
return (
<div className="p-4">
<h2 className="text-2xl font-bold mb-4">Custom zkproof Requests for {protocol} users</h2>
<form className="space-y-4">
<div>
<label className="block text-white-700">Group ID:</label>
<input
type="text"
value={groupId}
onChange={(e) => setGroupId(e.target.value)}
className="border text-black rounded-md py-2 px-3 w-full"
/>
</div>
<div>
<label className="block text-white-700">Claim Type:</label>
<select
value={claimType}
onChange={(e) => setClaimType(e.target.value)}
className="border text-blue-700 rounded-md py-2 px-3 w-full"
>
<option value="GTE">Greater Than or Equal (GTE)</option>
<option value="EQ">Equal (EQ)</option>
</select>
</div>
<div>
<label className="block text-white-700">Value:</label>
<input
type="number"
value={value}
onChange={(e) => setValue(e.target.value)}
className="border text-black rounded-md py-2 px-3 w-full"
/>
</div>
<div>
<label className="block text-white-700">Optional:</label>
<input
type="checkbox"
checked={isOptional}
onChange={() => setIsOptional(!isOptional)}
className="form-checkbox text-blue-500"
/>
</div>
<div>
<label className="block text-white-700">Selectable by User:</label>
<input
type="checkbox"
checked={isSelectableByUser}
onChange={() => setIsSelectableByUser(!isSelectableByUser)}
className="form-checkbox text-blue-500"
/>
</div>
<button
type="button"
onClick={handleClaimRequest}
className="bg-blue-500 text-white rounded-md py-2 px-4 hover:bg-blue-700"
>
Request Claim
</button>
</form>
</div>
);
};
export default ClaimRequestForm;