Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
42af509
CHE-139 added nickName to profileModel & added type to IProfile
serenahromano May 16, 2024
dcba37c
Merge pull request #113 from Code-Hammers/CHE-139/subtask/Add-Nicknam…
brok3turtl3 May 16, 2024
78bacb4
CHE-147 Micahs first commit
Mnelson98 May 21, 2024
1bcf229
Merge branch 'dev' into CHE-113/story/Profiles-Improvements
brok3turtl3 May 22, 2024
acb58f3
CHE-148 Updated EditProfilePage handleSubmit dispatch and userprofile…
brok3turtl3 May 22, 2024
480289f
CHE-147 updated style for account button within the header
Mnelson98 May 22, 2024
a7cafa1
CHE-147 restyled buttons on the edit profile page
Mnelson98 May 22, 2024
fd565ba
Merge pull request #122 from Code-Hammers/CHE-148/subtask/Update-Edit…
brok3turtl3 May 24, 2024
9d09264
Merge branch 'CHE-113/story/Profiles-Improvements' into CHE-147/subta…
Mnelson98 May 24, 2024
88fc5d7
removed unecessary comment and updated css styling for header accoun…
Mnelson98 May 24, 2024
39d8e13
Restyle all header classes to meet style guide requirements
Mnelson98 May 24, 2024
938d89e
udpate all classes in the EditProfilePage to meet style guide require…
Mnelson98 May 24, 2024
9bae8b2
added nickname to EditProfile form
Mnelson98 May 24, 2024
295c8aa
updated class style order in the header
Mnelson98 May 24, 2024
1a9f11a
Merge pull request #124 from Code-Hammers/CHE-147/subtask/Restyle-But…
brok3turtl3 May 24, 2024
f8ee042
Added first and last name to edit profile page
Mnelson98 May 26, 2024
826012f
Merge branch 'CHE-113/story/Profiles-Improvements' into CHE-126/subta…
Mnelson98 May 26, 2024
b9c1d18
Added Cohort and LinkedIn to edit profile page
Mnelson98 May 26, 2024
d92c740
Edited skills field in profile schema to enable the desired add and …
Mnelson98 May 26, 2024
8f9f8ce
#1 - added skills add and delete functionality. Created the skills fi…
Mnelson98 May 26, 2024
08de18c
#2 updated styling for skills and updated the skills section of the p…
Mnelson98 May 27, 2024
2bae176
removed unnecessary skills path
Mnelson98 Jun 1, 2024
82ef8bf
removed first and last name from the form
Mnelson98 Jun 1, 2024
c308ff1
added nickname to profile controller and built functionality for edit…
Mnelson98 Jun 1, 2024
d6ad7f9
updated to be camelCased where used
Mnelson98 Jun 1, 2024
ce91cda
restyled personalBio box to be expandable and set a character limit
Mnelson98 Jun 1, 2024
c94a018
added GitHub to user profile
Mnelson98 Jun 1, 2024
905ba59
matching GitHub references
Mnelson98 Jun 2, 2024
8fc205d
updated GitHub typing
Mnelson98 Jun 2, 2024
08d7b21
adding nickname and GitHub typing to FE
Mnelson98 Jun 2, 2024
7499d4f
destructuring specilizations in profile controller and created specia…
Mnelson98 Jun 2, 2024
075338a
built specialization add and remove functionality
Mnelson98 Jun 2, 2024
d9ed0c3
removed comments
Mnelson98 Jun 2, 2024
fc76aba
stopping specialization from being removed when it is selected twice
Mnelson98 Jun 2, 2024
872f38e
added current company and title to the page
Mnelson98 Jun 2, 2024
2504ed5
added socialMedia to profileController update function
Mnelson98 Jun 3, 2024
fad04fe
added twitter and blog links
Mnelson98 Jun 3, 2024
64e2df9
added networking availability to the form
Mnelson98 Jun 3, 2024
d179ca7
removing comments and console.logs
Mnelson98 Jun 3, 2024
bd75fbe
rearranged event handlers
Mnelson98 Jun 3, 2024
6280c8b
refactored class names
Mnelson98 Jun 3, 2024
bc58a0e
dev merge
brok3turtl3 Jun 7, 2024
9e18940
Merge pull request #134 from Code-Hammers/CHE-merge-dev-Profiles-Impr…
brok3turtl3 Jun 7, 2024
3f01780
CHE-125 added email field to create method
emmagawd Jun 7, 2024
4d06a88
Merged with latest story branch, CHE-113
Mnelson98 Jun 8, 2024
124bb14
Removed unecessary import and first name from editProfilePage
Mnelson98 Jun 8, 2024
a2608ac
Stopped skills from being added to specializations when hitting remov…
Mnelson98 Jun 8, 2024
a7f2d2d
Added case check to skills input and refactored networking box for sc…
Mnelson98 Jun 8, 2024
0b935dc
validating skill before calling the setFormData function
Mnelson98 Jun 8, 2024
2a99fc7
removed first and last name from profileController and moved the skil…
Mnelson98 Jun 8, 2024
0c77aa6
cleaned up formatting
Mnelson98 Jun 8, 2024
13d0a22
added userID to useEffect array
Mnelson98 Jun 8, 2024
f455fc8
created and utilizing reusable component for editProfile inputs
Mnelson98 Jun 8, 2024
0c20ccf
CHE-126 Formatting updates for prettier
brok3turtl3 Jun 8, 2024
36197fe
Merge branch 'CHE-113/story/Profiles-Improvements' into CHE-125/subta…
brok3turtl3 Jun 8, 2024
97efce5
Merge pull request #137 from Code-Hammers/CHE-125/subtask/Auto-Popula…
brok3turtl3 Jun 8, 2024
c4e62bc
refactored updateProfile tests
Mnelson98 Jun 9, 2024
741b03c
Merge branch 'CHE-113/story/Profiles-Improvements' into CHE-126/subta…
Mnelson98 Jun 9, 2024
005bb2d
Fix formatting issues in profileController.test.ts
Mnelson98 Jun 9, 2024
94b9343
refactored form data
Mnelson98 Jun 9, 2024
552d668
consolidated input handlers
Mnelson98 Jun 9, 2024
4e359de
removed console logs
Mnelson98 Jun 9, 2024
aea6002
fixed formating
Mnelson98 Jun 10, 2024
241a3df
refactored handler functions to avoid using any
Mnelson98 Jun 10, 2024
2d788fe
fixed formatting
Mnelson98 Jun 10, 2024
f2a552f
refactored profile input component
Mnelson98 Jun 14, 2024
639c8df
removed keys within child elements
Mnelson98 Jun 14, 2024
e26ffed
renamed element keys
Mnelson98 Jun 14, 2024
b7137eb
fixed spelling errors
Mnelson98 Jun 14, 2024
caa149e
updated key name
Mnelson98 Jun 14, 2024
d260ed4
linting
Mnelson98 Jun 14, 2024
8c6d0f0
fixed payload error
Mnelson98 Jun 14, 2024
0ea91c2
Merge pull request #129 from Code-Hammers/CHE-126/subtask/Add-Remaini…
brok3turtl3 Jun 14, 2024
f495d07
updated classNames to alphebetical order
Mnelson98 Jun 17, 2024
75422f7
Added company and title to profile cards and ensuring bio doesnt spil…
Mnelson98 Jun 17, 2024
7f98b21
updated styling
Mnelson98 Jun 17, 2024
3e36a8a
added company and title info
Mnelson98 Jun 17, 2024
ab16a47
Merge branch 'dev' into CHE-113/story/Profiles-Improvements
brok3turtl3 Jun 18, 2024
5b188eb
Merge branch 'CHE-113/story/Profiles-Improvements' into CHE-127/Add-R…
Mnelson98 Jun 20, 2024
1a64fe0
removed career info from profiles card for another ticket
Mnelson98 Jun 20, 2024
389344e
destructured user profile and added networking status
Mnelson98 Jun 20, 2024
872ea97
formatting the page
Mnelson98 Jun 20, 2024
8d3b891
added skills and specializations
Mnelson98 Jun 20, 2024
3accd91
reformatting page
Mnelson98 Jun 21, 2024
1ab7fd2
styling
Mnelson98 Jun 21, 2024
6baa76f
restructured page and added media links
Mnelson98 Jul 8, 2024
876c452
updating tests
Mnelson98 Jul 8, 2024
191a1ce
linting and test updates
Mnelson98 Jul 15, 2024
9f2a883
Merge branch 'dev' into CHE-113/story/Profiles-Improvements
brok3turtl3 Jul 27, 2024
49845b3
CHE-127 Updated ts-jest version
brok3turtl3 Aug 8, 2024
c4f0d21
CHE-127 Updated actions workflow file
brok3turtl3 Aug 8, 2024
a17bb0d
Merge branch 'CHE-113/story/Profiles-Improvements' into CHE-127/Add-R…
brok3turtl3 Aug 8, 2024
0d4343e
Merge pull request #159 from Code-Hammers/CHE-127/Add-Remaining-Profi…
brok3turtl3 Aug 8, 2024
13a88e1
Merge branch 'dev' into CHE-113/story/Profiles-Improvements
brok3turtl3 Aug 9, 2024
f19b3f7
CHE-113 Fixes from merging dev
brok3turtl3 Aug 9, 2024
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
Binary file added .DS_Store
Binary file not shown.
50 changes: 46 additions & 4 deletions __tests__/profileController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,30 @@ xdescribe('Profile Controller Tests', () => {
mockRequest = {
params: { userID: '65117c94f000c9930ef5c0ee' },
body: {
firstName: 'Bobby',
lastName: 'Orr',
availabilityForNetworking: true,
careerInformation: {
currentPosition: {
company: 'CodeHammers',
title: 'Developer',
},
pastPositions: [
{
company: 'CodeHammers',
title: 'Junior Developer',
startDate: '2020-01-01',
endDate: '2021-01-01',
},
],
},
cohort: 'ECRI-TEST',
email: '[email protected]',
gitHubProfile: 'Ghub',
linkedInProfile: 'Lin',
nickName: 'Johnny',
personalBio: 'I love dogs!',
skills: ['Javascript', 'Typescript', 'React', 'Nodejs'],
socialMediaLinks: 'SMlinks',
specializations: ['Javascript', 'React'],
},
};
mockResponse = {
Expand All @@ -114,9 +135,30 @@ xdescribe('Profile Controller Tests', () => {
it('should handle profile update', async () => {
(Profile.findOneAndUpdate as jest.Mock).mockResolvedValue({
_id: '65117c94f000c9930ef5c0ee',
firstName: 'Bobby',
lastName: 'Orr',
availabilityForNetworking: true,
careerInformation: {
currentPosition: {
company: 'CodeHammers',
title: 'Developer',
},
pastPositions: [
{
company: 'CodeHammers',
title: 'Junior Developer',
startDate: '2020-01-01',
endDate: '2021-01-01',
},
],
},
cohort: 'ECRI-TEST',
email: '[email protected]',
gitHubProfile: 'Ghub',
linkedInProfile: 'Lin',
nickName: 'Johnny',
personalBio: 'I love dogs!',
skills: ['Javascript', 'Typescript', 'React', 'Nodejs'],
socialMediaLinks: 'SMlinks',
specializations: ['Javascript', 'React'],
});

await updateProfile(mockRequest as Request, mockResponse as Response, mockNext);
Expand Down
Binary file added client/src/assets/blogLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/assets/github_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/assets/linkedInLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/assets/twitterLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions client/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ const Header = () => {

return (
<div
className="fixed top-0 left-0 right-0 bg-gray-600 text-white p-4 md:p-6 flex items-center justify-between"
className="bg-gray-600 fixed flex items-center justify-between left-0 md:p-6 p-4 right-0 text-white top-0"
style={{ margin: '10px 20px 0 20px', zIndex: 1000 }}
>
<Link to="/app/main" className="flex items-center">
<img src={logo} alt="Code Hammers Logo" className="h-12 md:h-16" />
<h1 className="ml-3 text-xl md:text-2xl font-bold">Code Hammers</h1>
<h1 className="font-bold md:text-2xl ml-3 text-xl">Code Hammers</h1>
</Link>

<div className="flex-grow mx-10">
<div className="flex justify-evenly space-x-4 md:space-x-6 lg:space-x-10">
<div className="flex justify-evenly lg:space-x-10 md:space-x-6 space-x-4">
<Link
to="/app/directory"
className={`text-lg md:text-xl ${
Expand All @@ -60,15 +60,15 @@ const Header = () => {
</Link>
<Link
to="/app/profiles"
className={`text-lg md:text-xl ${
className={`md:text-xl text-lg ${
currentPath === 'profiles' ? 'text-gray-300' : 'hover:text-gray-300'
} transition transform hover:scale-105`}
>
Profiles
</Link>
<Link
to="/app/forums"
className={`text-lg md:text-xl ${
className={`md:text-xl text-lg ${
currentPath === 'forums' ? 'text-gray-300' : 'hover:text-gray-300'
} transition transform hover:scale-105`}
>
Expand All @@ -79,18 +79,18 @@ const Header = () => {
<div className="relative">
<button
onClick={() => setShowDropdown(!showDropdown)}
className="bg-gray-700 hover:bg-gray-800 font-bold py-2 px-4 rounded"
className="bg-blue-500 font-bold hover:bg-blue-700 px-4 py-2 rounded text-white"
>
Account
</button>
{showDropdown && (
<div
ref={dropdownRef}
className="absolute right-0 mt-2 py-2 w-48 bg-gray-700 rounded-md shadow-xl z-20"
className="absolute bg-gray-700 mt-2 py-2 right-0 rounded-md shadow-xl w-48 z-20"
>
<a
href="#!"
className="block px-4 py-2 text-sm text-white hover:bg-gray-800"
className="block hover:bg-gray-800 px-4 py-2 text-sm text-white"
onClick={() => {
navigate('/app/editProfile');
setShowDropdown(false);
Expand All @@ -100,7 +100,7 @@ const Header = () => {
</a>
<a
href="#!"
className="block px-4 py-2 text-sm text-white hover:bg-gray-800"
className="block hover:bg-gray-800 px-4 py-2 text-sm text-white"
onClick={handleLogout}
>
Logout
Expand Down
53 changes: 53 additions & 0 deletions client/src/components/ProfileInput/ProfileInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from 'react';

interface EditProfileInputProps {
label: string;
type: string;
value: string;
name: string;
onChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void; // Add onKeyDown as optional
placeholder?: string;
}

const EditProfileInput = ({
label,
type,
value,
name,
onChange,
onKeyDown,
placeholder,
}: EditProfileInputProps) => {
return (
<div className="mb-4">
<label className="block font-bold mb-2 text-sm" htmlFor={name}>
{label}
</label>
{type === 'textarea' ? (
<textarea
className="bg-gray-800 p-2 rounded text-white w-full"
id={name}
name={name}
value={value}
onChange={onChange}
style={{ maxHeight: '200px' }}
maxLength={1000}
/>
) : (
<input
className="bg-gray-800 p-2 rounded text-white w-full"
id={name}
name={name}
type={type}
value={value}
onChange={onChange}
onKeyDown={onKeyDown}
placeholder={placeholder}
/>
)}
</div>
);
};

export default EditProfileInput;
17 changes: 13 additions & 4 deletions client/src/components/ProfileThumb/ProfileThumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,27 @@ interface ProfileThumbProps {
const ProfileThumb = ({ profile }: ProfileThumbProps) => {
const defaultImage = 'https://picsum.photos/200';

const shortenBio = (bio: string | undefined, wordLimit: number) => {
if (!bio) return;
const words: string[] = bio.split(' ');
if (words.length > wordLimit) {
return words.slice(0, wordLimit).join(' ') + '...';
}
return bio;
};

return (
<div className="bg-gradient-to-r from-gray-700 via-gray-800 to-gray-900 text-white p-4 rounded-lg flex flex-col items-center justify-center h-64 w-64">
<div className="bg-gradient-to-r flex flex-col from-gray-700 h-64 items-center justify-center p-4 rounded-lg text-white to-gray-900 via-gray-800 w-64">
<img
src={profile.profilePhoto || defaultImage}
alt={profile.firstName || 'Default Profile'}
className="rounded-full h-24 w-24 object-cover mb-4"
className="h-24 mb-4 object-cover rounded-full w-24"
/>

<h1 className="text-xl font-bold mb-2">
<h1 className="font-bold mb-2 text-xl">
{profile.firstName} {profile.lastName}
</h1>
<h2 className="text-md mb-2">{profile.personalBio}</h2>
<h2 className="max-h-10 mb-2 text-xs">{shortenBio(profile.personalBio, 8)}</h2>
</div>
);
};
Expand Down
10 changes: 9 additions & 1 deletion client/src/features/userProfile/userProfileSlice.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
import axios from 'axios';
import { IProfile } from '../../../types/profile';
import { NavigateFunction } from 'react-router-dom';

export interface ProfileState {
profile: IProfile | null;
Expand Down Expand Up @@ -31,11 +32,18 @@ export const fetchUserProfile = createAsyncThunk(
},
);

interface UpdateUserProfileArgs extends Partial<IProfile> {
userID: string;
navigate: NavigateFunction;
}

export const updateUserProfile = createAsyncThunk(
'profile/updateUserProfile',
async ({ userID, ...updateData }: Partial<IProfile> & { userID: string }, thunkAPI) => {
async ({ userID, navigate, ...updateData }: UpdateUserProfileArgs, thunkAPI) => {
try {
console.log('userId before axios call: ', userID);
const response = await axios.put(`/api/profiles/${userID}`, updateData);
navigate(`/app/profile/${userID}`);
return response.data;
} catch (error) {
let errorMessage = 'An error occurred during profile update';
Expand Down
Loading
Loading