Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: socket IO port login and signup #125

Merged
merged 1 commit into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/atoms/InputWarningText/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface InputWarningTextProps extends HTMLAttributes<HTMLHeadingElement> {

export default function InputWarningText({ children, className = '', ...rest }: InputWarningTextProps) {
return (
<span className={`text-red-500 font-normal ${className}`} {...rest}>
<span className={`text-red-500 font-normal text-2xs py-1 ${className}`} {...rest}>
{children}
</span>
)
Expand Down
11 changes: 8 additions & 3 deletions src/components/atoms/SelectUniversityDropDown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,17 @@ const SelectUniversityDropdown = ({ onChange, value, placeholder, icon, search =
<div
className={`${
key === 0 ? '' : 'border-t'
} border-neutral-300 text-sm text-neutral-900 p-2 cursor-pointer hover:bg-gray-200 flex gap-2 items-center`}
} border-neutral-300 text-sm text-neutral-900 p-2 cursor-pointer hover:bg-gray-200 flex gap-3 items-center`}
onClick={() => handleSelect(item)}
key={key}
>
<img className="rounded-full" width={40} height={40} alt="logo" src={item?.logos?.[0] || (ImagePlaceholder as unknown as string)} />
<p> {item?.name}</p>
<img
className="rounded-full"
style={{ width: '40px', height: '40px' }}
alt="logo"
src={item?.logos?.[0] || (ImagePlaceholder as unknown as string)}
/>
<p className="text-2xs"> {item?.name}</p>
</div>
))
) : isFetching ? (
Expand Down
12 changes: 7 additions & 5 deletions src/components/organism/Login/LoginBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const LoginBox = () => {
Password
</label>
<InputBox
placeholder="*******************"
placeholder="*********"
type={showPassword ? 'text' : 'password'}
{...registerLogin('password', { required: true })}
err={!!loginErrors.password}
Expand All @@ -95,14 +95,16 @@ const LoginBox = () => {
)}
</div>
{loginErrors.password && <InputWarningText>Please enter your password!</InputWarningText>}
<label className="text-neutral-500 text-xs">Forgot Password?</label>
<label className="w-fit text-neutral-500 text-xs cursor-pointer hover:text-primary hover:underline">Forgot Password?</label>
</div>

<div className="flex gap-2 items-center">
{/*<div className="flex gap-2 items-center">
<input className="w-4 h-4 border-neutral-300" type="checkbox" />
<p className="text-neutral-900 text-sm">Remember device for 30 days</p>
</div>
<Button variant="primary">{isPending ? <Spinner /> : 'Log in'}</Button>
</div>*/}
<Button disabled={isPending} variant="primary">
{isPending ? <Spinner /> : 'Log in'}
</Button>
<InputWarningText>{isAxiosError(error) && error.response?.data?.message}</InputWarningText>
</form>
</div>
Expand Down
31 changes: 16 additions & 15 deletions src/components/organism/Register/forms/AccountCreationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const AccountCreationForm = ({ isPending }: Props) => {
<Title>Join Our Community</Title>
<SupportingText>Enter your credentials to create an account</SupportingText>
</div>
<div className="w-10/12 flex flex-col gap-2 ">
<div className="w-10/12 flex flex-col gap-3 ">
<div className="w-full flex flex-col">
<InputBox
placeholder="Email Address"
Expand Down Expand Up @@ -88,7 +88,7 @@ const AccountCreationForm = ({ isPending }: Props) => {
</InputWarningText>
)}
</div>
<div className="relative w-full flex flex-col gap-2">
<div className="relative w-full flex flex-col">
<InputBox
placeholder="Create password"
type={showPassword ? 'text' : 'password'}
Expand All @@ -110,7 +110,7 @@ const AccountCreationForm = ({ isPending }: Props) => {
{/* <PasswordToggleIcon showPassword={showPassword} onClick={(value: any) => setShowPassword(value)} /> */}
</div>
{password?.length ? (
<div className="flex w-full gap-1 ">
<div className="flex w-full gap-1 py-2 ">
{[1, 2, 3, 4].map((item) => (
<span
key={item}
Expand All @@ -129,7 +129,7 @@ const AccountCreationForm = ({ isPending }: Props) => {
registerFormErrors.password && <InputWarningText>Please enter your password!</InputWarningText>
)}
</div>
<div className="relative w-full flex flex-col gap-2">
<div className="relative w-full flex flex-col">
<InputBox
placeholder="Confirm password"
type={showConfirmPassword ? 'text' : 'password'}
Expand All @@ -147,25 +147,26 @@ const AccountCreationForm = ({ isPending }: Props) => {
<InputWarningText>{registerFormErrors.confirmpassword.message?.toString() || 'Please enter your password'}</InputWarningText>
)}

<label className="text-neutral-500 text-xs">must be at least 8 characters</label>
<label className="text-neutral-500 text-xs py-1">must be at least 8 characters</label>
</div>
</div>
<div className="w-10/12 flex flex-col gap-2">
<div className="w-10/12 flex flex-col gap-4">
<Button disabled={isPending} variant="primary">
{isPending ? <Spinner /> : ' Create an account'}
</Button>
<Button type="button" variant="border" className="flex items-center justify-center gap-2 h-10">
<Image src={googleIcon} alt="go" /> Sign up with Google
</Button>
</div>
<div className="mt-4 mx-auto">
<p>
Already have an account?{' '}
<span onClick={() => router.push('/login')} className="text-primary-500 cursor-pointer">
{' '}
Log in
</span>
</p>

<div className="mx-auto">
<p>
Already have an account?{' '}
<span onClick={() => router.push('/login')} className="text-primary-500 cursor-pointer">
{' '}
Log in
</span>
</p>
</div>
</div>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const ProfileFacultyForm = () => {
{ProfileFormErrors.department && <InputWarningText>{ProfileFormErrors?.department?.message?.toString()}</InputWarningText>}
</div>
</div>
<div className="w-10/12 xl:wGender-9/12 flex flex-col gap-2">
<div className="w-10/12 xl:w-9/12 flex flex-col gap-2">
<Button variant="primary">Next Step</Button>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ProfileSetupForm = () => {
<Title>Profile Setup</Title>
<SupportingText>Enter your profile information for networking</SupportingText>
</div>
<div className="w-10/12 xl:w-9/12 flex flex-col gap-2 ">
<div className="w-10/12 xl:w-9/12 flex flex-col gap-3 ">
<div className="w-full flex flex-col">
<InputBox
placeholder="First Name"
Expand Down
8 changes: 4 additions & 4 deletions src/components/organism/Register/forms/ProfileStudentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const ProfileStudentForm = () => {
<Title>University Setup</Title>
<SupportingText>Enter your university information for networking</SupportingText>
</div>
<div className="w-10/12 xl:w-9/12 flex flex-col gap-2 ">
<div className="w-10/12 xl:w-9/12 flex flex-col gap-3 ">
<div className="w-full flex flex-col relative">
<Controller
name="universityName"
Expand All @@ -62,13 +62,13 @@ const ProfileStudentForm = () => {
<Controller
name="year"
control={control}
rules={{ required: 'Year is required!' }}
rules={{ required: 'year is required!' }}
render={({ field }) => (
<SelectDropdown
options={currYear}
value={field.value}
onChange={field.onChange}
placeholder="year"
placeholder="Year"
icon={'single'}
err={!!ProfileFormErrors.year}
/>
Expand Down Expand Up @@ -117,7 +117,7 @@ const ProfileStudentForm = () => {
{ProfileFormErrors.major && <InputWarningText>{ProfileFormErrors?.major?.message?.toString()}</InputWarningText>}
</div>
</div>
<div className="w-10/12 xl:wGender-9/12 flex flex-col gap-2">
<div className="w-10/12 xl:w-9/12 flex flex-col gap-2">
<Button variant="primary">Next Step</Button>
</div>

Expand Down
3 changes: 1 addition & 2 deletions src/store/socketSlice/socketSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ export const createSocketSlice: StateCreator<SocketSlice> = (set, get) => ({
...initialState,

initializeSocket: (userId, refetchUserData, refetchNotification, refetchUserProfileData, refetchMessageNotification, isRouteMessage) => {
const newSocket = io('http://localhost:8000')
// console.log('url', process.env.NEXT_PUBLIC_API_BASE_URL)
const newSocket = io(process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8000')

newSocket.on('connect', () => {
console.log('Connected to the server')
Expand Down
4 changes: 2 additions & 2 deletions src/types/RegisterForm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export enum userTypeEnum {
}

export enum userCheckError {
emailNotAvailable = 'Email is already taken',
userNameNotAvailable = 'userName Already taken',
emailNotAvailable = 'email is already taken',
userNameNotAvailable = 'username already taken',
}

export const badgeData = [
Expand Down
Loading