diff --git a/README.md b/README.md index 5abe647..a235897 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ ## An app that allows you rate companies based on their diversity & company culture. +Kinfolx: An app that allows you rate companies based on their diversity & company culture. + +Make sure to use npm install to install all Dependencies. + View our app live : https://kinfolx-production.up.railway.app/ ## Instructions to run the code locally diff --git a/server/controllers/company.js b/server/controllers/company.js index 2610e0b..3c1c1ab 100644 --- a/server/controllers/company.js +++ b/server/controllers/company.js @@ -4,15 +4,15 @@ const companyController = { //fetches all companies: MIGHT NOT WORK WITHOUT FRONT END? getAllCompanies: async (req, res, next) => { try { - const companies = await Company.find({}) - console.log(companies) + const companies = await Company.find() res.json({ companies }) } catch (error) { next(error) } }, - - //fetches a specfic company (and all of its data): + + //fetches a specific company (and all of its data): + getCompany: async (req, res, next) => { try { const { id } = req.params // Get the company ID from the route parameters diff --git a/server/controllers/user.js b/server/controllers/user.js index 2887311..9788ef8 100644 --- a/server/controllers/user.js +++ b/server/controllers/user.js @@ -33,6 +33,21 @@ const userController = { next(error) } }, + addFavoriteCompany: async (req, res, next) => { + try { + } catch (error) { + next(error) + } + }, + getFavoritesCompanies: async (req, res, next) => { + try { + const favorites = await User.find({ + clerkId: req.auth.userId, + }).select('favoriteCompanies') + } catch (error) { + next(error) + } + }, } export default userController diff --git a/server/routes/user.js b/server/routes/user.js index 77b9261..ba8c160 100644 --- a/server/routes/user.js +++ b/server/routes/user.js @@ -5,5 +5,7 @@ const userRouter = express.Router() userRouter.post('/', userController.addUser) userRouter.get('/', userController.getAllUsers) +userRouter.get('/favorites', userController.getFavoritesCompanies) +userRouter.post('/favorites', userController.addFavoriteCompany) export default userRouter diff --git a/src/components/ReviewList/ReviewList.jsx b/src/components/ReviewList/ReviewList.jsx index 90fbf8a..d1767d9 100644 --- a/src/components/ReviewList/ReviewList.jsx +++ b/src/components/ReviewList/ReviewList.jsx @@ -4,97 +4,141 @@ import './reviewList.css'; const categories = [ "accountability", "representation", - "work-life-balance", - "career-growth", - "diversity-scale", - "company-culture", + "workLifeBalance", + "careerGrowth", + "diversityScale", + "companyCulture", "salaries", ]; -const ReviewList = (props) => { - const [ratings, setRatings] = useState({}); - const [comment, setComment] = useState(""); - const [newCompany, setNewCompany] = useState(""); - - const handleMouseOver = (category, value) => { - setRatings((prev) => ({ - ...prev, - [`${category}-hover`]: value, - })); - }; - - const handleMouseLeave = (category) => { - setRatings((prev) => ({ - ...prev, - [`${category}-hover`]: undefined, - })); - }; - - const handleClick = (category, value) => { - setRatings((prev) => ({ - ...prev, - [category]: value, - })); - }; - - const handleSubmit = () => { - const companyName = props.company; - - if (!companyName) { - alert("Please select or add a company name."); - return; + +const ReviewList = (props) => { + const [ratings, setRatings] = useState({}) + const [comment, setComment] = useState('') + // const [newCompany, setNewCompany] = useState(""); + + console.log(ratings) + + const handleMouseOver = (category, value) => { + setRatings((prev) => ({ + ...prev, + [`${category}-hover`]: value, + })) + } + + const handleMouseLeave = (category) => { + setRatings((prev) => ({ + ...prev, + [`${category}-hover`]: undefined, + })) } - if (categories.some((category) => !ratings[category])) { - alert("Please rate all categories before submitting."); - return; + const handleClick = (category, value) => { + setRatings((prev) => ({ + ...prev, + [category]: value, + })) } - console.log({ companyName, ratings, comment }); - alert("Review submitted successfully!"); - }; - - - return ( -