Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
e540488
Created the Cohort page and added a design with mockup data of 'My Co…
Valen98 Oct 28, 2024
7dfd8c7
Added a 3 dot button on each student
Valen98 Oct 29, 2024
1a05f0f
Check if post request return resonse error when email already exists,…
shyye Oct 29, 2024
d470ad3
Refactor header component to close menu when navigating to a new page
SimpFred Oct 29, 2024
5f5cf25
Add user profile page route
SimpFred Oct 29, 2024
b47dcfe
Reverted auth.js file and added 'replace state' for pathname
Valen98 Oct 29, 2024
46ff866
Add ErrorMessage component
shyye Oct 29, 2024
1003a6d
Get and add response error message to the UI
shyye Oct 29, 2024
82e2ebc
Updated TextInput to display error messages when the props want certa…
Yumikitsu Oct 29, 2024
8803ae5
Add additional user details to mockData.js
SimpFred Oct 29, 2024
9323d8a
Add ProfileHeader component to display user profile information
SimpFred Oct 29, 2024
2259e7b
Add BasicInfoForm component to display basic user information
SimpFred Oct 29, 2024
8a5de92
Add TrainingInfoForm component to display training information in the…
SimpFred Oct 29, 2024
d5d1ece
Refactor profile page CSS styles
SimpFred Oct 29, 2024
6174f86
Add UserProfile component with Profile context to display user profil…
SimpFred Oct 29, 2024
e240ddc
Solved the navigation issue by removing data in useEffect, setToken t…
Valen98 Oct 29, 2024
69ef923
Merge pull request #34 from boolean-uk/30-my-cohort-component
sebgro98 Oct 29, 2024
ff5824e
Merge pull request #37 from boolean-uk/36-bug-fix-the-navigation-fron…
sebgro98 Oct 29, 2024
903466f
CHange name to avoid name conflicts
shyye Oct 29, 2024
695a190
Add validation on Register Page for email and password
shyye Oct 29, 2024
5b9842f
Add email validation in TextInput component (UI/format feedback to user)
shyye Oct 29, 2024
a2cc12e
Finished with the teacher view
Valen98 Oct 29, 2024
65035bc
Refactor BasicInfoForm component to remove section divider at the bottom
SimpFred Oct 29, 2024
27e315a
Refactor TrainingInfoForm component to remove section divider at the …
SimpFred Oct 29, 2024
1d8b621
Created ContactInfoForm component to add contact information fields i…
SimpFred Oct 29, 2024
f705350
Add BioForm component to display user's bio in the profile page
SimpFred Oct 29, 2024
40a58b3
Refactor profile page CSS to improve layout and styling
SimpFred Oct 29, 2024
c1c0d0c
Add mobile and password fields to user object in mockData.js
SimpFred Oct 29, 2024
9dde0fa
Refactor profile page to add BioForm and ContactInfoForm components
SimpFred Oct 29, 2024
f8cfd2d
Refactor profile page to dynamically generate profile link based on u…
SimpFred Oct 29, 2024
9bff10e
Refactor profile link in navigation to dynamically generate based on …
SimpFred Oct 29, 2024
f14c44e
Refactor profile page to remove commented out code and unused variables
SimpFred Oct 29, 2024
5b2b815
Refactor auth.js to remove unnecessary dependencies in useEffect
SimpFred Oct 29, 2024
f744e85
Updated the TextInput component to be able to display locked text inp…
Yumikitsu Oct 29, 2024
b1c80b5
Merge pull request #40 from boolean-uk/39-teachers-component-in-my-co…
sebgro98 Oct 29, 2024
ebedbde
Merge branch 'main' of github.com:boolean-uk/team-dev-client-ex-2410-…
shyye Oct 29, 2024
10f55d5
Merge branch 'main' into team3-ticket21-implement-user-profile-view-page
SimpFred Oct 29, 2024
c57b179
Added a popup window that displays when a user attempts to upload a p…
Yumikitsu Oct 29, 2024
230e677
Merge branch 'main' of https://github.com/boolean-uk/team-dev-client-…
Yumikitsu Oct 29, 2024
52584ba
Merge branch 'main' into team3-ticket21-implement-user-profile-view-page
FredrikEH Oct 29, 2024
b9dc0ea
Refactor profilePage.css to update color variables and remove unused …
SimpFred Oct 29, 2024
89d9909
Updated CSS so that the changes made by others didn't break the websi…
Yumikitsu Oct 29, 2024
8036fa7
Refactor profilePage to add an edit button in the user profile sectio…
SimpFred Oct 29, 2024
5605735
Merge branch 'team3-ticket21-implement-user-profile-view-page' of git…
SimpFred Oct 29, 2024
6ec1eb8
Refactor AuthContext to store user data
SimpFred Oct 30, 2024
7b95409
Refactor AuthContext to store user role instead of user
SimpFred Oct 30, 2024
cac4c0a
Refactor AuthContext to remove unnecessary user data check
SimpFred Oct 30, 2024
99cded2
Merge pull request #43 from boolean-uk/27-user-registration-needs-to-…
sebgro98 Oct 30, 2024
c9af19b
Merge branch 'main' into ticket-46-store-user-role-along-with-token
SimpFred Oct 30, 2024
e39bdae
Merged main into my branch again and fixed merge conflicts
Yumikitsu Oct 30, 2024
140da6f
Merge branch 'main' into team3-ticket21-implement-user-profile-view-page
SimpFred Oct 30, 2024
57f5c19
Changed back .prettierrc but now it uses deprecated code so npx prett…
Yumikitsu Oct 30, 2024
0e0c67b
Merge pull request #45 from boolean-uk/26-welcome-page-frontend
sebgro98 Oct 30, 2024
54ee08c
Merge pull request #42 from boolean-uk/team3-ticket21-implement-user-…
sebgro98 Oct 30, 2024
97d0f12
Merge branch 'main' into ticket-46-store-user-role-along-with-token
SimpFred Oct 30, 2024
881667e
Add validChars to the email component that includes '.'
shyye Oct 30, 2024
0fe3a1c
Display posts looks pretty alright
MalteStengard Oct 29, 2024
2d2527c
Updated my branch with new main, looks to be working
MalteStengard Oct 30, 2024
91b28fd
Merge pull request #48 from boolean-uk/ticket-46-store-user-role-alon…
sebgro98 Oct 30, 2024
b89dc23
Refactor user profile routes to use profileId instead of userId and a…
SimpFred Oct 30, 2024
648a1f5
Refactor profile page CSS
SimpFred Oct 30, 2024
a6c60ac
Add isEditMode to enable profile editing functionality
SimpFred Oct 30, 2024
3152c62
Merge branch 'main' into ticket-44-implement-user-profile-edit-page-f…
SimpFred Oct 30, 2024
5102ca3
Merge pull request #54 from boolean-uk/MalteStengard-#24-display_post…
sebgro98 Oct 30, 2024
7141e9f
revert eslint.json file
sebgro98 Oct 30, 2024
cbc53a9
Refactor profile page useEffect to set isCurrentUserTeacher correct r…
SimpFred Oct 30, 2024
f076b7b
Merge pull request #55 from boolean-uk/revert-eslint
sebgro98 Oct 30, 2024
f5e7574
Merge branch 'main' of github.com:boolean-uk/team-dev-client-ex-2410-…
sebgro98 Oct 30, 2024
3a00c4a
Merge pull request #53 from boolean-uk/52-user-registration---fix-ema…
sebgro98 Oct 30, 2024
002f269
Refactor profile page to use useNavigate instead of NavLink for routing
SimpFred Oct 30, 2024
798bdcc
Refactor ContactInfoForm to only allow specific characters in the mob…
SimpFred Oct 30, 2024
f51249f
Added so you can see all the students and teacher of current cohort
Valen98 Oct 30, 2024
0a3ace1
Refactor formatRole function to handle role capitalization
SimpFred Oct 30, 2024
0d85659
Refactor TrainingInfoForm to validate input fields with specific char…
SimpFred Oct 30, 2024
05fb028
Merge pull request #57 from boolean-uk/41-fetch-teachers-for-list-of-…
sebgro98 Oct 30, 2024
1e7d9e6
Add minLength to textInput component
shyye Oct 30, 2024
3286d10
Refactor ContactInfoForm to validate input fields with specific chara…
SimpFred Oct 30, 2024
74e4351
Refactor ContactInfoForm to remove validChars prop from email input
SimpFred Oct 30, 2024
da40f00
merge with main
SimpFred Oct 30, 2024
817888d
Add optional choice for pattern on textInput
shyye Oct 30, 2024
e0f4a16
Change font size for error messages
shyye Oct 30, 2024
f6aef71
Add pattern to password input
shyye Oct 30, 2024
cc99d0e
Change _form.css to fix position for the password eye symbol and the …
shyye Oct 30, 2024
46938c4
Merge branch 'main' into 28-user-registration-needs-to-validate-passw…
shyye Oct 31, 2024
03d1679
Add '*Required' text
shyye Oct 31, 2024
01560a6
Added a dropdown button for 'My Cohort' so the user can now change cu…
Valen98 Oct 31, 2024
232e246
Search results are previewed under search box
agrmet Oct 31, 2024
ae83ae1
Merge branch 'main' of github.com:boolean-uk/team-dev-client-ex-2410-…
sebgro98 Oct 31, 2024
07cf599
Merge branch 'ticket-44-implement-user-profile-edit-page-frontend' of…
sebgro98 Oct 31, 2024
075a698
Merge pull request #58 from boolean-uk/ticket-44-implement-user-profi…
sebgro98 Oct 31, 2024
c935988
Added and removed documentation
Valen98 Oct 31, 2024
1f3bfeb
Merge branch 'main' into 23-search_user
agrmet Oct 31, 2024
78b3118
Merge branch 'main' of https://github.com/boolean-uk/team-dev-client-…
Oct 31, 2024
c19589b
Fix missing CSS class
shyye Oct 31, 2024
06cb15b
Merge pull request #62 from boolean-uk/60-make-a-drop-down-menu-for-m…
FredrikEH Oct 31, 2024
b015fab
Merge branch 'main' of github.com:boolean-uk/team-dev-client-ex-2410-…
sebgro98 Oct 31, 2024
438b2d5
Moved logic to search component, made sure nothing is displayed when …
agrmet Oct 31, 2024
4057fb7
Merge pull request #63 from boolean-uk/28-user-registration-needs-to-…
sebgro98 Oct 31, 2024
7a6af87
Search results are now in same card as search box
agrmet Oct 31, 2024
d42d447
Merge branch 'main' into 23-search_user
agrmet Oct 31, 2024
6ec013b
Merge branch 'main' into 64-fix-user-registration-email-validation-no…
shyye Oct 31, 2024
20a918e
Remove hardcoded email pattern and replace with props attribute
shyye Oct 31, 2024
0322ba5
Create regex and pattern variables for email validation, update TextI…
shyye Oct 31, 2024
a84f47b
Created a GET request for User and updated the PATCH request for user…
Yumikitsu Oct 31, 2024
a27b978
Finished with the cohort list on the dashboard and so when the user c…
Valen98 Oct 31, 2024
f941bde
Added arrowleftIcon
agrmet Oct 31, 2024
d66d0c1
Merge branch 'main' of https://github.com/boolean-uk/team-dev-client-…
Oct 31, 2024
34cfd7d
Merge for testing
Oct 31, 2024
f6eb59a
Simple search page working
agrmet Oct 31, 2024
da0778f
Welcome page now fully works and updates the user's profile data as d…
Yumikitsu Oct 31, 2024
0e587c4
Merge branch 'main' of https://github.com/boolean-uk/team-dev-client-…
Yumikitsu Oct 31, 2024
a8e8060
Merge branch 'main' of github.com:boolean-uk/team-dev-client-ex-2410-…
sebgro98 Oct 31, 2024
7f00e4b
Merge branch '47-updating-user-profile-data-frontend' of github.com:b…
sebgro98 Oct 31, 2024
2ae6eae
Merge pull request #66 from boolean-uk/64-fix-user-registration-email…
sebgro98 Oct 31, 2024
cd8b31d
Merge branch 'main' of github.com:boolean-uk/team-dev-client-ex-2410-…
sebgro98 Oct 31, 2024
63166fe
Merge pull request #67 from boolean-uk/65-fill-up-my-cohort-list-on-t…
sebgro98 Oct 31, 2024
c62b255
Added route for if there is no search parameter
agrmet Oct 31, 2024
ad4b2fb
Simplified search navigation by removing unnecessary condition check
agrmet Oct 31, 2024
38fb1ee
Merge branch 'main' of https://github.com/boolean-uk/team-dev-client-…
Yumikitsu Oct 31, 2024
78630cd
Merge branch '47-updating-user-profile-data-frontend' of https://gith…
Yumikitsu Oct 31, 2024
46b269e
Merge pull request #68 from boolean-uk/47-updating-user-profile-data-…
sebgro98 Oct 31, 2024
4bd8126
Added a student view and teachers view
Valen98 Oct 31, 2024
5bd9df2
Added better titles for modal
Valen98 Oct 31, 2024
6e07287
Replaced dummy data with getUsers from apiclient
agrmet Oct 31, 2024
a339448
Merge branch 'main' of https://github.com/boolean-uk/team-dev-client-…
Oct 31, 2024
bfada61
Merge branch '69-add-a-student-view-of-cohort-and-a-teachers-view-of-…
Oct 31, 2024
5f9bcd3
I made a naming mistake of my style.cs which is suppose to be style.css
Valen98 Oct 31, 2024
6a2fd89
Merge branch '69-add-a-student-view-of-cohort-and-a-teachers-view-of-…
Valen98 Oct 31, 2024
f65cc3a
Added better debugging if teacher does not have any cohorts
Valen98 Oct 31, 2024
dfb720e
Removed a useless return :)
Valen98 Oct 31, 2024
2a38b00
Merge pull request #70 from boolean-uk/69-add-a-student-view-of-cohor…
sebgro98 Oct 31, 2024
447aebf
Merge branch 'main' of https://github.com/boolean-uk/team-dev-client-…
Oct 31, 2024
8d6d7bb
Merge for testing
Oct 31, 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
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
"version": "detect"
}
}
}
}
47 changes: 47 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import Verification from './pages/verification';
import { AuthProvider, ProtectedRoute } from './context/auth';
import { ModalProvider } from './context/modal';
import Welcome from './pages/welcome';
import UserProfile from './pages/profilePage';
import Cohort from './pages/cohort';
import Search from './pages/search';

const App = () => {
return (
Expand All @@ -20,6 +23,24 @@ const App = () => {
<Route path="loading" element={<Loading />} />
<Route path="verification" element={<Verification />} />

<Route
path="dashboard/search/:searchQuery"
element={
<ProtectedRoute>
<Search />
</ProtectedRoute>
}
/>

<Route
path="dashboard/search/"
element={
<ProtectedRoute>
<Search />
</ProtectedRoute>
}
/>

<Route
index
element={
Expand All @@ -28,6 +49,16 @@ const App = () => {
</ProtectedRoute>
}
/>

<Route
path="/cohort"
element={
<ProtectedRoute>
<Cohort />
</ProtectedRoute>
}
/>

<Route
path="welcome"
element={
Expand All @@ -36,6 +67,22 @@ const App = () => {
</ProtectedRoute>
}
/>
<Route
path="/profile/:profileId"
element={
<ProtectedRoute>
<UserProfile isEditMode={false} />
</ProtectedRoute>
}
/>
<Route
path="/profile/:profileId/edit"
element={
<ProtectedRoute>
<UserProfile isEditMode={true} />
</ProtectedRoute>
}
/>
</Routes>
</ModalProvider>
</AuthProvider>
Expand Down
11 changes: 11 additions & 0 deletions src/assets/icons/arrowLeftIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const arrowLeftIcon = () => (
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="24" cy="24" r="20" fill="#F0F5FA" />
<path
d="M24 36L12 24L24 12L25.575 13.575L16.275 22.875H36V25.125H16.275L25.575 34.425L24 36Z"
fill="#64648C"
/>
</svg>
);

export default arrowLeftIcon;
74 changes: 74 additions & 0 deletions src/components/createCohortModal/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import useModal from '../../hooks/useModal';
import { useState } from 'react';
import Button from '../button';

const CreateCohortModal = () => {
const { closeModal } = useModal();
const [title, setTitle] = useState('');
const [startDate, setStartDate] = useState('');
const [endDate, setEndDate] = useState('');

const onChange = (e) => {
const { name, value } = e.target;
if (name === 'title') setTitle(value);
if (name === 'startDate') setStartDate(value);
if (name === 'endDate') setEndDate(value);
};

const onSubmit = () => {
console.log('Submit button was clicked! Closing modal in 2 seconds...');
console.log(title);
console.log(startDate);
console.log(endDate);
setTimeout(() => {
closeModal();
}, 2000);
};

const today = new Date().toISOString().split('T')[0];

return (
<div>
<section>
<input
type="text"
name="title"
value={title}
onChange={onChange}
placeholder="Cohort Title"
/>
</section>
<section>
<input
type="date"
name="startDate"
value={startDate}
onChange={onChange}
placeholder="Start Date"
min={today}
/>
</section>
<section>
<input
type="date"
name="endDate"
value={endDate}
onChange={onChange}
placeholder="End Date"
min={today}
/>
</section>

<section className="create-port-actions">
<Button
onClick={onSubmit}
text="Create Cohort"
classes={`${title.length ? 'blue' : 'offwhite'} width-full`}
disabled={!title.length}
/>
</section>
</div>
);
};

export default CreateCohortModal;
Empty file.
12 changes: 12 additions & 0 deletions src/components/errorMessage/_errorMessage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.simple-error-message {
background: var(--color-offwhite);
padding: 24px;
border-radius: 8px;
width: 100%;
margin-bottom: 25px;
/*
The value for red color below is taken from the style guide in the Figma Design Document.
It could be implemented as a global CSS variable in the _globals.css file instead.
*/
border: 1px #f00000 solid;
}
7 changes: 7 additions & 0 deletions src/components/errorMessage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import './_errorMessage.css';

const ErrorMessage = ({ message }) => {
return <div className={`simple-error-message`}>{message}</div>;
};

export default ErrorMessage;
146 changes: 137 additions & 9 deletions src/components/form/textInput/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,119 @@
import { useState } from 'react';
import './textInput.css';
import { useEffect, useState } from 'react';

const TextInput = ({ value, onChange, name, label, icon, type = 'text' }) => {
/**
* validChars: Characters that are allowed in the input, the user can't type characters that are not included in validChars
* -
* pattern: Required pattern/format for email or password.
* patternDescription: Requirements can be passed in via patternDescription, it will be displayed as help messages to the user if the input doesn't match the pattern
*/
const TextInput = ({
value,
onChange,
name,
label,
icon,
type = 'text',
isRequired = false,
validChars = 'A-Za-z0-9@_-',
pattern = null,
patternDescription = null,
minLength = 0,
maxLength = 50,
isLocked = false
}) => {
const [input, setInput] = useState('');
const [error, setError] = useState('');
const [showpassword, setShowpassword] = useState(false);
if (type === 'password') {

useEffect(() => {
if (isRequired) {
if (value != null) {
if (value.length === 0) {
setError(`${label.slice(0, -1)} is required`);
} else {
setError('');
}
}
}
}, [isRequired, value]);

const validateInput = (value, event) => {
const regex = new RegExp(`^[${validChars}]+$`);
const isValid = regex.test(value) && value.length <= maxLength;
if (!isRequired) {
onChange(event);
} else if (value.length === 0 && isRequired) {
setError(`${label.slice(0, -1)} is required`);
onChange(event);
} else if (!isValid) {
setError(
`Input must be up to ${maxLength} characters long and contain only: ${validChars.split('').join(', ')}`
);
} else if (pattern && !pattern.test(value)) {
if (patternDescription) {
setError(`${patternDescription}`);
} else {
setError(`Input must match the pattern: ${pattern}`);
}
onChange(event);
} else if (value.length < minLength) {
setError(`Input must be at least ${minLength} characters long`);
onChange(event);
} else {
setError('');
}
return isValid;
};

const handleChange = (event) => {
const { value } = event.target;
if (validateInput(value, event)) {
onChange(event);
}
setInput(value);
};

if (isLocked && type === 'password') {
return (
<div className="inputwrapper">
<label htmlFor={name}>{label}</label>
<input type={type} name={name} value={value} readOnly={true} />
{showpassword && <input type="text" name={name} value={value} className="passwordreveal" />}
<button
className={`showpasswordbutton-duo formbutton ${showpassword === true && '__faded'}`}
onClick={(e) => {
e.preventDefault();
setShowpassword(!showpassword);
}}
>
<EyeLogo />
</button>
<button className={`lockbutton formbutton`}>
<LockLogo />
</button>
</div>
);
} else if (isLocked) {
return (
<div className="inputwrapper">
<label htmlFor={name}>{label}</label>
<input type={type} name={name} value={value} readOnly={true} />
<button className={`lockbutton formbutton`}>
<LockLogo />
</button>
</div>
);
} else if (type === 'password') {
return (
<div className="inputwrapper">
<label htmlFor={name}>{label}</label>
<input
type={type}
name={name}
value={value}
onChange={(e) => {
onChange(e);
setInput(e.target.value);
}}
onChange={handleChange}
className={error && 'input-error'}
/>
{showpassword && <input type="text" name={name} value={input} className="passwordreveal" />}
<button
Expand All @@ -26,6 +125,23 @@ const TextInput = ({ value, onChange, name, label, icon, type = 'text' }) => {
>
<EyeLogo />
</button>
{error && <span className="error-message">{error}</span>}
</div>
);
} else if (type === 'email') {
return (
<div className="inputwrapper">
{label && <label htmlFor={name}>{label}</label>}
<input
type={type}
name={name}
value={value}
onChange={handleChange}
pattern={pattern}
className={(error && 'input-error') || (icon && 'input-has-icon')}
/>
{icon && <span className="input-icon">{icon}</span>}
{error && <span className="error-message">{error}</span>}
</div>
);
} else {
Expand All @@ -36,10 +152,11 @@ const TextInput = ({ value, onChange, name, label, icon, type = 'text' }) => {
type={type}
name={name}
value={value}
onChange={onChange}
className={icon && 'input-has-icon'}
onChange={handleChange}
className={(error && 'input-error') || (icon && 'input-has-icon')}
/>
{icon && <span className="input-icon">{icon}</span>}
{error && <span className="error-message">{error}</span>}
</div>
);
}
Expand All @@ -56,4 +173,15 @@ const EyeLogo = () => {
);
};

const LockLogo = () => {
return (
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 32 32" width="32" height="32">
<path
fill="#64648C"
d="M16 2C12.686 2 10 4.686 10 8v6H8c-1.104 0-2 .896-2 2v12c0 1.104.896 2 2 2h16c1.104 0 2-.896 2-2V16c0-1.104-.896-2-2-2h-2V8c0-3.314-2.686-6-6-6zm0 2c2.206 0 4 1.794 4 4v6h-8V8c0-2.206 1.794-4 4-4zm-6 12h12v12H10V16zm6 2c-1.104 0-2 .896-2 2s.896 2 2 2 2-.896 2-2-.896-2-2-2z"
/>
</svg>
);
};

export default TextInput;
3 changes: 3 additions & 0 deletions src/components/form/textInput/textInput.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.error-message {
font-size: 0.8rem;
}
Loading