diff --git a/README.md b/README.md index eba8f1a..52f962b 100644 --- a/README.md +++ b/README.md @@ -75,4 +75,7 @@ cargo run ## Design File -Here is the Figma design file: https://www.figma.com/file/qwBWs4i7pJMpFbcjMffDZU/Jury-(Gavel-Plus)?node-id=8%3A100&t=xYwfPwRAUeJw9jNr-1 \ No newline at end of file +Here is the Figma design file: https://www.figma.com/file/qwBWs4i7pJMpFbcjMffDZU/Jury-(Gavel-Plus)?node-id=8%3A100&t=xYwfPwRAUeJw9jNr-1 + +## Backend Routes + diff --git a/client/package.json b/client/package.json index ed9e1fa..3e22832 100644 --- a/client/package.json +++ b/client/package.json @@ -17,6 +17,7 @@ "universal-cookie": "^4.0.4" }, "devDependencies": { + "@tailwindcss/forms": "^0.5.3", "esbuild": "^0.17.8", "tailwindcss": "^3.2.6" }, diff --git a/client/src/admin/AddJudges.tsx b/client/src/admin/AddJudges.tsx new file mode 100644 index 0000000..7043c05 --- /dev/null +++ b/client/src/admin/AddJudges.tsx @@ -0,0 +1,13 @@ +import JuryHeader from '../components/JuryHeader'; +import AddJudgesPanel from '../components/admin/add-judges/AddJudgesPanel'; + +const AddJudges = () => { + return ( + <> + + + + ); +}; + +export default AddJudges; diff --git a/client/src/admin/add-projects.tsx b/client/src/admin/AddProjects.tsx similarity index 100% rename from client/src/admin/add-projects.tsx rename to client/src/admin/AddProjects.tsx diff --git a/client/src/admin/add-judges.tsx b/client/src/admin/add-judges.tsx deleted file mode 100644 index 51d1a36..0000000 --- a/client/src/admin/add-judges.tsx +++ /dev/null @@ -1,9 +0,0 @@ -const AddJudges = () => { - return ( -
-

Add Judges

-
- ); -}; - -export default AddJudges; diff --git a/client/src/components/admin/add-judges/AddJudgeStat.tsx b/client/src/components/admin/add-judges/AddJudgeStat.tsx new file mode 100644 index 0000000..b68136e --- /dev/null +++ b/client/src/components/admin/add-judges/AddJudgeStat.tsx @@ -0,0 +1,12 @@ +import { twMerge } from 'tailwind-merge'; + +const AddJudgeStat = (props: { name: string; value: string | number; className?: string }) => { + return ( +
+
{props.value}
+
{props.name}
+
+ ); +}; + +export default AddJudgeStat; diff --git a/client/src/components/admin/add-judges/AddJudgeStatsPanel.tsx b/client/src/components/admin/add-judges/AddJudgeStatsPanel.tsx new file mode 100644 index 0000000..613847c --- /dev/null +++ b/client/src/components/admin/add-judges/AddJudgeStatsPanel.tsx @@ -0,0 +1,15 @@ +import AddJudgeStat from './AddJudgeStat'; + +const AddJudgeStatsPanel = () => { + return ( +
+
+ + + +
+
+ ); +}; + +export default AddJudgeStatsPanel; diff --git a/client/src/components/admin/add-judges/AddJudgesPanel.tsx b/client/src/components/admin/add-judges/AddJudgesPanel.tsx new file mode 100644 index 0000000..a46b0d1 --- /dev/null +++ b/client/src/components/admin/add-judges/AddJudgesPanel.tsx @@ -0,0 +1,18 @@ +import AddJudgeStatsPanel from './AddJudgeStatsPanel'; +import UploadCSVForm from './UploadCSVForm'; +import NewJudgeForm from './NewJudgeForm'; + +const AddJudgesPanel = () => { + return ( +
+

Add Judges

+ +
+ + +
+
+ ); +}; + +export default AddJudgesPanel; diff --git a/client/src/components/admin/add-judges/NewJudgeForm.tsx b/client/src/components/admin/add-judges/NewJudgeForm.tsx new file mode 100644 index 0000000..34e3fcd --- /dev/null +++ b/client/src/components/admin/add-judges/NewJudgeForm.tsx @@ -0,0 +1,68 @@ +import { useState } from 'react'; + +const NewJudgeForm = () => { + const [name, setName] = useState(''); + const [email, setEmail] = useState(''); + const [notes, setNotes] = useState(''); + + const [isSubmitting, setIsSubmitting] = useState(false); + + const AddJudge = async (e: React.FormEvent) => { + e.preventDefault(); + setIsSubmitting(true); + try { + await fetch(`${process.env.REACT_APP_JURY_URL}/judge/new`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ name, email, notes }), + credentials: 'include', + }); + } catch (err) { + console.log(err); + setIsSubmitting(false); + } + + alert('Judge Added'); + setName(''); + setEmail(''); + setNotes(''); + setIsSubmitting(false); + }; + + return ( + <> +
+
+

Add New Judges

+
+
+ setName(e.target.value)} + /> + setEmail(e.target.value)} + /> +
+