diff --git a/.gitignore b/.gitignore index 5ef6a52..9c8a03f 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,5 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +.vercel diff --git a/app/(auth)/register/page.tsx b/app/(auth)/register/page.tsx index 7a44260..93192d3 100644 --- a/app/(auth)/register/page.tsx +++ b/app/(auth)/register/page.tsx @@ -22,13 +22,17 @@ export default function RegisterPage() { const { setToken } = useAuth(); const router = useRouter(); const [form, setForm] = useState({ - name: "", - institution: "", - sscRoll: "", - hscRoll: "", + full_name: "", + username: "", email: "", - phone: "", password: "", + phone_number: "", + ssc_roll: 0, + ssc_board: "", + hsc_roll: 0, + hsc_board: "", + college: "", + preparation_unit: "", }); const [error, setError] = useState(null); @@ -44,8 +48,8 @@ export default function RegisterPage() { }; const validateForm = () => { - const { sscRoll, hscRoll, password } = form; - if (sscRoll === hscRoll) { + const { ssc_roll, hsc_roll, password } = form; + if (ssc_roll === hsc_roll) { return "SSC Roll and HSC Roll must be unique."; } const passwordRegex = @@ -93,11 +97,11 @@ export default function RegisterPage() { return (
-
+
Logo
+

Personal Info

setForm({ ...form, name: value })} - /> - - - setForm({ ...form, institution: value }) + setForm({ ...form, full_name: value }) } /> - - setForm({ ...form, sscRoll: value }) + setForm({ ...form, username: value }) } /> - - setForm({ ...form, hscRoll: value }) + setForm({ ...form, phone_number: value }) } /> - setForm({ ...form, email: value })} /> - setForm({ ...form, phone: value })} - /> - +

Educational Background

+ + + setForm({ ...form, college: value }) + } + /> + + setForm({ ...form, preparation_unit: value }) + } + /> +
+ + setForm({ ...form, ssc_board: value }) + } + /> + + + setForm({ ...form, ssc_roll: Number(value) }) + } + className="max-w-26" + /> +
+ +
+ + setForm({ ...form, hsc_board: value }) + } + /> + + setForm({ ...form, hsc_roll: Number(value) }) + } + className="max-w-26" + /> +
{error && } diff --git a/app/(tabs)/paper/page.tsx b/app/(tabs)/paper/page.tsx index 26ce11e..3e8123b 100644 --- a/app/(tabs)/paper/page.tsx +++ b/app/(tabs)/paper/page.tsx @@ -2,7 +2,7 @@ import { useSearchParams } from "next/navigation"; import { useRouter } from "next/navigation"; -import { Suspense, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import Header from "@/components/Header"; import DestructibleAlert from "@/components/DestructibleAlert"; import BackgroundWrapper from "@/components/BackgroundWrapper"; @@ -14,8 +14,7 @@ interface Mock { title: string; rating: number; } - -function PaperPageContent() { +export default function PaperScreen() { const router = useRouter(); const searchParams = useSearchParams(); const name = searchParams.get("name") || ""; @@ -23,6 +22,7 @@ function PaperPageContent() { const [questions, setQuestions] = useState(null); const [errorMsg, setErrorMsg] = useState(null); const [refreshing, setRefreshing] = useState(false); + const [componentKey, setComponentKey] = useState(0); async function fetchMocks() { try { @@ -44,29 +44,31 @@ function PaperPageContent() { const onRefresh = async () => { setRefreshing(true); + await fetchMocks(); + setComponentKey((prevKey) => prevKey + 1); + setTimeout(() => { + setRefreshing(false); + }, 1000); }; if (errorMsg) { return ( -
-
-
-
- -
-
- -
+
+
+
+ +
+
+
- {/* */}
); @@ -118,20 +120,3 @@ function PaperPageContent() { ); } - -export default function PaperScreen() { - -
-
-
-

Loading...

-
-
- - } - > - -
; -} diff --git a/bun.lockb b/bun.lockb index ff2e50d..df87449 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/capacitor.config.ts b/capacitor.config.ts new file mode 100644 index 0000000..0d0821a --- /dev/null +++ b/capacitor.config.ts @@ -0,0 +1,9 @@ +import type { CapacitorConfig } from "@capacitor/cli"; + +const config: CapacitorConfig = { + appId: "com.examjam.solanine", + appName: "ExamJam", + webDir: "public", +}; + +export default config; diff --git a/components/FormField.tsx b/components/FormField.tsx index 9d5fdcc..4d86f25 100644 --- a/components/FormField.tsx +++ b/components/FormField.tsx @@ -1,23 +1,32 @@ -import React, { useState, InputHTMLAttributes } from "react"; +import React, { useState, useId, InputHTMLAttributes } from "react"; -interface FormFieldProps extends InputHTMLAttributes { +interface FormFieldProps + extends Omit, "value" | "onChange"> { title: string; + value: string | number; placeholder?: string; - value: string; handleChangeText: (value: string) => void; } -const FormField = ({ +const FormField: React.FC = ({ title, - placeholder, value, + placeholder, handleChangeText, + type, ...props -}: FormFieldProps) => { +}) => { const [showPassword, setShowPassword] = useState(false); - const isPasswordField = title.toLowerCase().includes("password"); + const inputId = useId(); - const inputId = `input-${title.replace(/\s+/g, "-").toLowerCase()}`; + const isPasswordField = + type === "password" || title.toLowerCase().includes("password"); + + const inputType = isPasswordField + ? showPassword + ? "text" + : "password" + : type || "text"; return (
@@ -31,9 +40,10 @@ const FormField = ({
handleChangeText(e.target.value)} className="flex-1 bg-transparent outline-none border-none text-blue-950 text-[16px] font-inherit" {...props} @@ -43,8 +53,9 @@ const FormField = ({ diff --git a/package.json b/package.json index b13ab8c..be800ec 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "next lint" }, "dependencies": { + "@capacitor/android": "^7.4.2", "@capacitor/core": "^7.4.2", "@radix-ui/react-avatar": "^1.1.10", "@radix-ui/react-label": "^2.1.7", diff --git a/types/auth.d.ts b/types/auth.d.ts index 7bba937..0705609 100644 --- a/types/auth.d.ts +++ b/types/auth.d.ts @@ -8,13 +8,17 @@ export interface UserData { } export interface RegisterForm { - name: string; - institution: string; - sscRoll: string; - hscRoll: string; + full_name: string; + username: string; email: string; - phone: string; password: string; + phone_number: string; + ssc_roll: number; + ssc_board: string; + hsc_roll: number; + hsc_board: string; + college: string; + preparation_unit: "Science" | "Arts" | "Commerce" | string; } export interface LoginForm {