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

Create team page #3

Closed
wants to merge 11 commits into from
Closed

Create team page #3

wants to merge 11 commits into from

Conversation

nishadipri
Copy link
Collaborator

Description

This pull request introduces the CreateTeamPage component, allowing users to create new teams. Key features include:

Form Input:
Users can input a team name and add team members by providing their details or selecting existing employees.
Validation and Alerts:
The form includes validation checks and alerts for missing information or duplicate team members.
Dynamic Member List:
Added team members dynamically appear below the form for easy management.
Screenshot 2024-03-28 at 05 12 22

How to test?

use the command "npm start"

@nishadipri nishadipri requested a review from a team as a code owner March 28, 2024 04:13
if (!exists) {
return knex.schema.createTable('TeamMembers', (table) => {
table.increments('id').unsigned().primary();
table.integer('team_id').unsigned().notNullable();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are missing something on this line.

return knex.schema.createTable('TeamMembers', (table) => {
table.increments('id').unsigned().primary();
table.integer('team_id').unsigned().notNullable();
table.integer('employee_id').unsigned().notNullable();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think you are missing something here.

// });
// }

// connectToDatabase();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this file commented out?

@@ -16,6 +16,8 @@ module.exports = {
directory: path.join(__dirname, '/seeds/development'),
},
},
// Existing code...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

function CreateTeam() {
const [teamName, setTeamName] = useState('');
const [firstName, setFirstName] = useState('');
const [lastName, setLasttName] = useState('');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have a typo in the setter

const [lastName, setLasttName] = useState('');
const [email, setEmail] = useState('');
const [teamMembers, setTeamMembers] = useState([]);
const [employees] = useState([
Copy link
Member

@DanJecu DanJecu Mar 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just do it like this:

Suggested change
const [employees] = useState([
const employees = [<!-- data -->]

email,
};

teamMembers.push(newMember);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When adding new members to the team, you directly manipulate the DOM with teamMembers.push(). React prefers immutability, so it's better to create a new array and then update the state.

}
};

const addExcistingMember = (e) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for typo

Copy link
Member

@DanJecu DanJecu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left a few comments for you.

As I recommended earlier, it would be beneficial to break PRs into smaller ones. For instance, having a separate PR for adding the migrations and another for CreateTeamPage. Additionally, consider breaking down the component into smaller components to better separate concerns.

@nishadipri nishadipri closed this Apr 2, 2024
@nishadipri nishadipri deleted the createTeamPage branch April 2, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants