Skip to content

Commit 7d60a2e

Browse files
committed
feat: added toast message inplace of alerts
1 parent 753ba9f commit 7d60a2e

File tree

4 files changed

+50
-13
lines changed

4 files changed

+50
-13
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
A Platform to connect with like minded people and create peer group using AI chat with advance algorithm and LLM.
44

5+
Students from colleges and universities often face significant challenges when it comes to finding peers with similar interests, skills, and knowledge for collaboration on projects, hackathons, and other academic or extracurricular activities. This difficulty in connecting with like-minded individuals can hinder their ability to form effective teams, share knowledge, and achieve their full potential in these activities.
6+
7+
we aim to address these challenges by providing a comprehensive platform where students can easily find and connect with peers who share their interests and possess complementary skills. By leveraging advanced AI technology, DevHub-AI will facilitate intelligent matchmaking and personalized recommendations, ensuring that students can form effective teams and engage in meaningful collaborations. The platform will provide a structured and user-friendly environment for networking, learning, and growth, ultimately enhancing the academic and professional experiences of college students.
8+
59
## TechStacks
610

711
Backend - Flask<br>

client/src/components/Auth/user-auth-form-login.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
// UserAuthForm.tsx
21
"use client"
32

43
import React, { useState } from 'react';
54
import axios from 'axios';
65
import { useNavigate } from 'react-router-dom';
7-
import { toast } from "sonner"; // Import sonner toast
6+
import { toast } from "sonner";
87

98
import { cn } from "@/lib/utils";
109
import { Icons } from "@/components/ui/icons";

client/src/components/Auth/user-auth-form-signup.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import React, { useState, useEffect } from 'react';
44
import axios from 'axios';
5-
import { useNavigate } from 'react-router-dom'; // Ensure this is imported
6-
import { toast } from "sonner"; // Import sonner toast
5+
import { useNavigate } from 'react-router-dom';
6+
import { toast } from "sonner";
77

88
import { cn } from "@/lib/utils";
99
import { Icons } from "@/components/ui/icons";

client/src/pages/EditProfileForm.tsx

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Button } from "@/components/ui/button";
55
import { Input } from "@/components/ui/input";
66
import { Label } from "@/components/ui/label";
77
import TagInput from "@/components/MultiSelect/TagInput";
8+
import { toast } from "sonner";
89

910
const backendUrl = import.meta.env.VITE_BACKEND_URL || 'http://localhost:5000';
1011

@@ -93,10 +94,14 @@ const EditProfileForm: React.FC<EditProfileFormProps> = ({ onProjectAdded }) =>
9394

9495
try {
9596
await axios.put(`${backendUrl}/profile/${username}`, profileData, { withCredentials: true });
96-
alert('Profile updated successfully');
97+
toast.success("Profile updated successfully");
98+
// alert('Profile updated successfully');
9799
} catch (error) {
98100
console.error('Failed to update profile:', error);
99-
alert('Failed to update profile');
101+
toast.error("Failed to update profile", {
102+
description: "Please check your details and try again.",
103+
});
104+
// alert('Failed to update profile');
100105
} finally {
101106
setIsLoading(false);
102107
}
@@ -116,7 +121,8 @@ const EditProfileForm: React.FC<EditProfileFormProps> = ({ onProjectAdded }) =>
116121
tags: tagsString,
117122
}, { withCredentials: true });
118123
if(response.status === 200)
119-
console.log("Project added successfully:", response.data);
124+
// console.log("Project added successfully:", );
125+
toast.success("Project added successfully");
120126
const addedProject = response.data.project;
121127

122128
if (addedProject) {
@@ -130,11 +136,17 @@ const EditProfileForm: React.FC<EditProfileFormProps> = ({ onProjectAdded }) =>
130136
setNewProjectMode(false);
131137
} else {
132138
console.error('Project was not added correctly:', response.data);
133-
alert('Failed to add project. Please try again.');
139+
toast.error("Failed to add project", {
140+
action: {
141+
label: "Try again",
142+
onClick: () => console.log("Try again clicked"),
143+
},
144+
});
145+
// alert('Failed to add project. Please try again.');
134146
}
135147
} catch (error) {
136148
console.error('Failed to add project:', error);
137-
alert('Failed to add project. Please try again.');
149+
// alert('Failed to add project. Please try again.');
138150
}
139151
};
140152

@@ -153,7 +165,14 @@ const EditProfileForm: React.FC<EditProfileFormProps> = ({ onProjectAdded }) =>
153165
}
154166
} catch (error) {
155167
console.error('Failed to update project:', error);
156-
alert('Failed to update project');
168+
toast.error("Failed to update project", {
169+
description: "There was a problem with your request.",
170+
action: {
171+
label: "Try again",
172+
onClick: () => console.log("Try again clicked"),
173+
},
174+
});
175+
// alert('Failed to update project');
157176
}
158177
};
159178

@@ -167,17 +186,32 @@ const EditProfileForm: React.FC<EditProfileFormProps> = ({ onProjectAdded }) =>
167186
...prevData,
168187
projects: prevData.projects.filter((project: Project) => project.title !== projectTitle),
169188
}));
170-
alert('Project deleted successfully');
189+
// alert('Project deleted successfully');
190+
toast.success("Project deleted successfully");
171191
if (selectedProject && selectedProject.title === projectTitle) {
172192
setSelectedProject(null);
173193
}
174194
} else {
175195
console.log(response.status);
176-
alert('Failed to delete project');
196+
toast.error("Failed to delete project", {
197+
description: "There was a problem with your request.",
198+
action: {
199+
label: "Try again",
200+
onClick: () => console.log("Try again clicked"),
201+
},
202+
});
203+
// alert('Failed to delete project');
177204
}
178205
} catch (error) {
179206
console.error('Failed to delete project:', error);
180-
alert('Failed to delete project');
207+
// alert('Failed to delete project');
208+
toast.error("Failed to delete project", {
209+
description: "There was a problem with your request.",
210+
action: {
211+
label: "Try again",
212+
onClick: () => console.log("Try again clicked"),
213+
},
214+
});
181215
}
182216
};
183217

0 commit comments

Comments
 (0)