-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/near-everything/app
- Loading branch information
Showing
10 changed files
with
118 additions
and
295 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,94 @@ | ||
import { useState } from "react"; | ||
import Select from "react-select"; | ||
import { toast } from "react-toastify"; | ||
import { useAuth } from "../../context/AuthContext"; | ||
import { useCreateFeedback } from "../../features/feedback/feedbackApi"; | ||
import Button from "../Button"; | ||
import TextArea from "../TextArea"; | ||
|
||
const typeOptions = [ | ||
{ | ||
label: "I have a question", | ||
value: "QUESTION", | ||
}, | ||
{ | ||
label: "I have a concern", | ||
value: "CONCERN", | ||
}, | ||
{ | ||
label: "I have an idea", | ||
value: "IDEA", | ||
}, | ||
{ | ||
label: "Offer to help", | ||
value: "HELP", | ||
}, | ||
{ | ||
label: "Other...", | ||
value: "OTHER", | ||
}, | ||
]; | ||
|
||
function ContactForm() { | ||
const [type, setType] = useState(""); | ||
const [description, setDescription] = useState(""); | ||
const { user } = useAuth(); | ||
const createFeedback = useCreateFeedback(); | ||
|
||
const handleSubmit = () => { | ||
createFeedback.mutate( | ||
{ | ||
type: type.value, | ||
description: description, | ||
userId: user.uid, | ||
}, | ||
{ | ||
onSuccess: () => { | ||
toast.success("Feedback successfully submitted. Thank you!"); | ||
setDescription(""); | ||
setType({}); | ||
}, | ||
onError: () => { | ||
toast.error("Error submitting feedback."); | ||
}, | ||
} | ||
); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className="flex flex-col gap-2"> | ||
<span className="font-semibold text-2xl">Contact us</span> | ||
<Select | ||
id="feedback_select" | ||
className="basic-single text-black" | ||
classNamePrefix={"select"} | ||
defaultValue={type} | ||
name="type" | ||
options={typeOptions} | ||
onChange={setType} | ||
placeholder="Reason for contact..." | ||
/> | ||
<TextArea | ||
name="feedback_question" | ||
className="h-32" | ||
placeholder="" | ||
onChange={(e) => { | ||
setDescription(e.target.value); | ||
}} | ||
value={description} | ||
disabled={type === ""} | ||
/> | ||
<Button | ||
className="w-full h-16" | ||
onClick={handleSubmit} | ||
disabled={description === "" || type === ""} | ||
> | ||
Submit | ||
</Button> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default ContactForm; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.
92b3e5d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
app – ./
website-rho-ruby.vercel.app
app-everythinglabs.vercel.app
app-git-main-everythinglabs.vercel.app
everything.dev
www.everything.dev