Skip to content

Commit

Permalink
Merge branch 'development' into new-fetch-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bkmorgan3 committed May 22, 2024
2 parents 95f8e92 + 617e52d commit 326b257
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 122 deletions.
108 changes: 56 additions & 52 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,50 +50,53 @@ These steps are manditory in order to contribute to all HackforLA projects.
## **Part 2: How to set up the development environment**

### **2.1 Fork the repository**
*A fork is a copy of the repository that will be placed on your GitHub account url.*

In https://github.com/hackforla/VRMS, look for the fork icon in the top right. Click it and create a fork of the repository.
* In https://github.com/hackforla/VRMS, look for the fork icon in the top right. Click it and create a fork of the repository.

For git beginners, a fork is a copy of the repository that will be placed on your GitHub account url.
* It should create a copy here: https://github.com/YOUR_GITHUB_USERNAME/vrms, where `YOUR_GITHUB_USERNAME` is replaced with your github username.

It should create a copy here: https://github.com/your_GitHub_user_name/vrms, where `your_GitHub_user_name` is replaced with exactly that.
> NOTE: This copy is on a remote server on the GitHub website and not on your computer yet.
Note that this copy is on a remote server on the GitHub website and not on your computer yet.

If you click the icon again, it will not create a new fork but instead give you the URL associated with your fork.
* Click the icon again, it will give you the URL associated with your forked repository and not create a new fork.

### **2.2 Clone the remote repository to your local computer**

The following process will make a copy of the fork that you just created on your local computer.

First create a new folder on your local computer that will contain `hackforla` projects.

In your shell, navigate there then run the following commands:
1. Create a new folder on your local computer that will contain `hackforla` projects.

```bash
git clone https://github.com/your_GitHub_user_name/vrms.git
```
2. In your shell (terminal), navigate to this folder then run the following commands:
```bash
git clone https://github.com/YOUR_GITHUB_USERNAME/vrms.git
```

You should now have a new folder in your `hackforla` folder called `vrms`.
You should now have a new folder in your `hackforla` folder called `vrms`.

Verify which URL your `origin` remote is pointing to:
3. Verify which URL your `origin` remote is pointing to:
```bash
git remote show origin
```
Your terminal should return:
```bash
remote origin
Fetch URL: https://github.com/YOUR_GITHUB_USERNAME/vrms.git
Push URL: https://github.com/YOUR_GITHUB_USERNAME/vrms.git
...
```

```bash
git remote show origin
```
If you accidentally cloned the `hackforla/vrms.git` then you can change your local copy to upload to your fork with the following:

If you accidentally cloned the `hackforla/vrms.git` then you can change your local copy to upload to your fork with the following:
```bash
git remote set-url origin https://github.com/YOUR_GITHUB_USERNAME/vrms.git
```

```bash
git remote set-url origin https://github.com/your_user_name/vrms.git
```
4. Add another remote called `vrms` that points to the `hackforla` version of the repository. This will allow you to incorporate changes later:
```bash
git remote add vrms https://github.com/hackforla/vrms.git
```

Add another remote called `vrms` that points to the `hackforla` version of the repository. This will allow you to incorporate changes later:

```bash
git remote add vrms https://github.com/hackforla/vrms.git
```

Note: Understanding how git remotes work will make collaborating much easier. You can learn more about remotes [here](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/configuring-a-remote-for-a-fork) and [here](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes)
Note: Understanding how git remotes work will make collaborating much easier. You can learn more about remotes [here](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/configuring-a-remote-for-a-fork) and [here](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes).


### **2.3 Get up and running**
Expand Down Expand Up @@ -125,7 +128,8 @@ Note: Understanding how git remotes work will make collaborating much easier. Yo

Note 2: `touch` is a Unix/Linux or Mac command; It is not available in Windows. In Windows, use a text editor (e.g. Notepad) to create an empty file and save it in each of the locations as `.env` . (If you use Windows Explorer to create the file it will create a file called `.env.txt`, which will not work.)

- Then paste the content from the [document](https://docs.google.com/document/d/1yDF6UmyO-MPNrl3y_Mw0mkm_WaixlSkXzWbudCzHXDY/edit?usp=sharing). It is accessible for the project team members only.
- Then paste the content from the [document](https://docs.google.com/document/d/1yDF6UmyO-MPNrl3y_Mw0mkm_WaixlSkXzWbudCzHXDY/edit?usp=sharing). It is accessible for the project team members only.

- _Please note that the `ports` for the frontend and backend are set in this location_

1. Take a second to review the `app.js` and `server.js` files in the `vrms/backend` folder. These two files are a blueprint for the back end, so please familiarize yourself with it. You'll see folders for the database collection models, routes for the API, and a config file which loads the necessary environment variables.
Expand Down Expand Up @@ -184,21 +188,21 @@ Claiming an issue is a two step process:


### **3.2 Create a new branch for each issue you work on**
Create a new branch for each issue you work on. Doing all your work on feature branches leaves your repository's main branch unmodified and greatly simplifies keeping your fork in sync with the main project.


Before creating a new branch, always make sure you are currently on the `development` branch by using the command
```
git branch
```
Before creating a new branch, always pull down the latest changes from the `development` branch by using the command
```
git pull vrms development
```
Finally, create a new branch where you will work on your issue by using the command
```
git checkout -b your-branch-name
```
You will create a new branch for each issue you work on. Doing all your work on feature branches leaves your repository's main branch unmodified and greatly simplifies keeping your fork in sync with the main project.


1. Before creating a new branch, always make sure you are currently on the `development` branch by using the command
```bash
git branch
```
2. Before creating a new branch, always pull down the latest changes from the `development` branch by using the command
```bash
git pull vrms development
```
3. Finally, create a new branch where you will work on your issue by using the command:
```bash
git checkout -b your-branch-name
```

### **3.3 Work on the Issue**
Every issue will contain action items you must complete before you are ready to submit a pull request. Be sure to use the checkboxes as you complete each action item so we can track your progress!
Expand All @@ -213,14 +217,14 @@ git commit -m "your commit message"

## **Part 4: How to create pull requests**
### **4.1 Push changes to your forked repository**
Before pushing code, always pull down the latest changes from the `development` branch by using the command
```
git pull vrms development
```
Once you are satisfied with your changes, push them to the feature branch you made within your remote repository.
```
git push --set-upstream origin your-branch-name
```
1. Before pushing code, always pull down the latest changes from the `development` branch by using the command
```
git pull vrms development
```
2. Once you are satisfied with your changes, push them to the feature branch you made within your remote repository.
```
git push --set-upstream origin your-branch-name
```
### **4.2 Create a pull request on the VRMS repository**
1. Go to your fork of the VRMS repository on GitHub and click on the `Compare & pull request` button. <details><summary>See screenshot</summary> <img src="https://user-images.githubusercontent.com/73561520/220488394-09bc759e-98d9-4a09-86c6-66378cf50923.png"/></details>
2. Be sure to title your pull request by summarizing the changes you made
Expand Down
95 changes: 52 additions & 43 deletions client/src/components/ProjectForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function ProjectForm({
formData,
projectToEdit,
isEdit,
setFormData
setFormData,
}) {
const history = useHistory();

Expand All @@ -74,11 +74,11 @@ export default function ProjectForm({
const [editMode, setEditMode] = useState(false);
const { auth } = useAuth();
const [isModalOpen, setIsModalOpen] = useState(false);
const handleOpen = () => setIsModalOpen(true)
const handleClose = () => setIsModalOpen(false)
const handleOpen = () => setIsModalOpen(true);
const handleClose = () => setIsModalOpen(false);
const checkFields = () => {
history.push("/projects")
}
history.push('/projects');
};

/**
* React Hook Forms
Expand All @@ -95,7 +95,7 @@ export default function ProjectForm({
handleSubmit,
reset,
formState: { errors },
control
control,
} = useForm({
mode: 'all',
// Holds the current project data in state.
Expand All @@ -104,7 +104,7 @@ export default function ProjectForm({
},
});

const { dirtyFields } = useFormState({control})
const { dirtyFields } = useFormState({ control });

// ----------------- Submit requests -----------------

Expand Down Expand Up @@ -134,8 +134,6 @@ export default function ProjectForm({
setEditMode(false);
};



// ----------------- Handles and Toggles -----------------

// Handles the location radio button change.
Expand Down Expand Up @@ -229,46 +227,51 @@ export default function ProjectForm({
<Box sx={{ textAlign: 'center' }}>
<Typography variant="h1">Project Management</Typography>
</Box>
<TitledBox
title={editMode ? 'Editing Project' : 'Project Information'}
badge={isEdit ? editIcon() : addIcon()}
{auth.user.accessLevel === 'admin' ? (
<TitledBox
title={editMode ? 'Editing Project' : 'Project Information'}
badge={isEdit ? editIcon() : addIcon()}
/>
) : (
<TitledBox title={'Project Information'} />
)}
<form
id="project-form"
onSubmit={handleSubmit((data) => {
isEdit ? submitEditProject(data) : submitNewProject(data);
})}
>

<form
id="project-form"
onSubmit={handleSubmit((data) => {
isEdit ? submitEditProject(data) : submitNewProject(data);
})}
>

{arr.map((input) => (
<ValidatedTextField
key={input.name}
register={register}
isEdit={isEdit}
editMode={editMode}
locationType={locationType}
locationRadios={locationRadios}
errors={errors}
input={input}
/>
))}
<ChangesModal
open={isModalOpen}
onClose={handleClose}
destination={'/projects'}
aria-labelledby="modal-modal-title"
aria-describedby="modal-modal-description"
handleClose={handleClose}
{arr.map((input) => (
<ValidatedTextField
key={input.name}
register={register}
isEdit={isEdit}
editMode={editMode}
locationType={locationType}
locationRadios={locationRadios}
errors={errors}
input={input}
/>
))}
<ChangesModal
open={isModalOpen}
onClose={handleClose}
destination={'/projects'}
aria-labelledby="modal-modal-title"
aria-describedby="modal-modal-description"
handleClose={handleClose}
/>
</form>
</form>
{auth.user.accessLevel === 'admin' ? (
<Box>
<Grid container justifyContent="space-evenly" sx={{ my: 3 }}>
<Grid item xs="auto">
<StyledButton
type="submit"
form="project-form"
variant={!isEdit ? 'secondary' : !editMode ? 'contained' : 'secondary'}
variant={
!isEdit ? 'secondary' : !editMode ? 'contained' : 'secondary'
}
cursor="pointer"
disabled={isEdit ? !editMode : false}
>
Expand All @@ -279,14 +282,20 @@ export default function ProjectForm({
<StyledButton
variant="contained"
cursor="pointer"
onClick={!editMode || Object.keys(dirtyFields).length === 0 ? checkFields: handleOpen}
onClick={
!editMode || Object.keys(dirtyFields).length === 0
? checkFields
: handleOpen
}
>
Close
</StyledButton>
</Grid>
</Grid>
</Box>
</TitledBox>
) : (
''
)}
</Box>
) : (
<Redirect to="/login" />
Expand Down
44 changes: 21 additions & 23 deletions client/src/components/parts/boxes/TitledBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@ import React from 'react';
import { Box, Typography, Divider } from '@mui/material';

export default function TitledBox({ title, children, badge, childrenBoxSx }) {
return (
<Box sx={{ bgcolor: '#F5F5F5', my: 3 }}>
<Box
sx={{
p: 2,
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}
>
<Box>
<Typography sx={{ fontSize: '18px', fontWeight: '600' }}>
{title}
</Typography>
</Box>
{badge}
</Box>
<Divider sx={{ borderColor: 'rgba(0,0,0,1)' }} />
<Box sx={{ py: 2, px: 4, ...childrenBoxSx }}>{children}</Box>
return (
<Box sx={{ bgcolor: '#F5F5F5', my: 3 }}>
<Box
sx={{
p: 2,
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}
>
<Box>
<Typography sx={{ fontSize: '18px', fontWeight: '600' }}>
{title}
</Typography>
</Box>
);


}
{badge ? badge : ' '}
</Box>
<Divider sx={{ borderColor: 'rgba(0,0,0,1)' }} />
<Box sx={{ py: 2, px: 4, ...childrenBoxSx }}>{children}</Box>
</Box>
);
}
6 changes: 3 additions & 3 deletions client/src/components/presentational/CheckInButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ const CheckInButtons = (props) => {
</Link>
<Link
to={`/checkIn/newUser?eventId=${props.event}`}
className={`home-button`}
className={`home-button ${props.disabled && "disabled"}`}
>
CHECK IN AS NEW USER
</Link>

{props.events.length > 1 && (
<Link to={`/newProfile`} className={`home-button-light`}>
...OR CREATE A NEW PROFILE
<Link to={`/newProfile`} className={`home-button`}>
CREATE A NEW PROFILE
</Link>
)}
</>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/presentational/newUserForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const NewUserForm = (props) => {
className="form-check-in-submit"
onClick={(e) => props.checkInNewUser(e)}
>
CHECK IN
{props.newMember ? 'CREATE PROFILE' : 'CHECK IN'}
</button>
</div>
</div>
Expand Down

0 comments on commit 326b257

Please sign in to comment.