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

Vite #1536

Closed
wants to merge 31 commits into from
Closed

Vite #1536

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
42af763
feat: Add press edit agian to revert data
trillium Aug 24, 2023
cc15deb
update styling + add trilliums pr
plang-psm Aug 25, 2023
c9e4773
add length validation to description field
Aug 14, 2023
4241d9e
update description validation
Aug 28, 2023
74ddbec
feat: Refactor ProjectForm to use TitledBox
trillium Sep 10, 2023
6c887a2
asset: Delete yarn.lock for later refresh
trillium Sep 26, 2023
b55547b
asset: Add dependencies for vite and svg
trillium Sep 26, 2023
65c0ab8
feat: Create vite.config.js and mimic create-react-app
trillium Jul 16, 2023
41bdc92
chore: Add vite to scripts
trillium Jul 16, 2023
0129890
chore: Move index.html to root for vite
trillium Jul 16, 2023
8332312
chore: Remove %PUBLIC_URL% from index.html
trillium Jul 16, 2023
2538b4e
chore: Add link to vite in index.html
trillium Jul 16, 2023
bf7d80c
chore: Rename all components to .jsx for vite
trillium Jul 16, 2023
caf21dc
chore: Add "engines" and specifcy node 18+
trillium Jul 16, 2023
52ef907
chore: Move Vite out of dev dependencies
trillium Jul 16, 2023
a72ef22
asset: Update Dockerfiles in client
trillium Jul 16, 2023
adfcebf
asset: Update node in backend as well
trillium Jul 16, 2023
0a18da6
fix: Add step to specify more current node
trillium Jul 16, 2023
70c2558
fix: Direct call to upgrade node in action
trillium Jul 16, 2023
deea3ec
fix: Add rest of Dockerfiles, missed two
trillium Jul 16, 2023
18d150e
fix: Swap to node:18.alpine, remove 'npm i- g npm'
trillium Jul 16, 2023
5148273
fix: Change to alpine:3.14 in Dockerfile.prod
trillium Jul 16, 2023
2bb93eb
wip: Update containers for testing
trillium Jul 16, 2023
dbe6039
wip: Update to node:20-alpine in Dockerfile.prod
trillium Jul 16, 2023
6aab651
wip: Add --no-update-notifier to yarn install
trillium Jul 16, 2023
0bf1731
wip: Remove --silent, get all the infos
trillium Jul 16, 2023
4b9712d
feat: Upgrade react to 18 in project root
trillium Sep 26, 2023
fa946df
wip: Upgrade react-datepicker, add engines
trillium Sep 26, 2023
b3a7c34
wip: Upgrade react-test-renderer
trillium Sep 26, 2023
d271d31
asset: Regenerate yarn.lock
trillium Sep 26, 2023
72634ac
chore: Rename components to .jsx for vite
trillium Sep 26, 2023
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
5 changes: 5 additions & 0 deletions .github/workflows/aws-frontend-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ jobs:
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref }}
- name: Checkout
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions backend/Dockerfile.api
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
FROM node:14.11.0 AS api-development
FROM node:18.12.0 AS api-development
RUN mkdir /srv/backend
WORKDIR /srv/backend
RUN mkdir -p node_modules
COPY package.json yarn.lock ./
RUN yarn install --pure-lockfile
COPY . .

FROM node:14.11.0 AS api-test
FROM node:18.12.0 AS api-test
RUN mkdir /srv/backend
WORKDIR /srv/backend
COPY package.json yarn.lock ./
RUN yarn install --silent
RUN mkdir -p node_modules

FROM node:14.11.0-slim AS api-production
FROM node:18.12.0-slim AS api-production
EXPOSE 4000
USER node
WORKDIR /srv/backend
Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.11.0 AS api-development
FROM node:18.12.0 AS api-development
RUN mkdir /srv/backend
WORKDIR /srv/backend
RUN mkdir -p node_modules
Expand Down
4 changes: 2 additions & 2 deletions backend/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:14.11.0 AS api-builder
FROM node:18.12.0 AS api-builder
RUN mkdir /srv/backend
WORKDIR /srv/backend
RUN mkdir -p node_modules
COPY package.json yarn.lock ./
RUN yarn install --pure-lockfile
COPY . .

FROM node:14.11.0-slim AS api-production
FROM node:18.12.0-slim AS api-production
EXPOSE 4000
USER node
WORKDIR /srv/backend
Expand Down
4 changes: 2 additions & 2 deletions client/Dockerfile.client
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:14.11.0 AS client-development
FROM node:18-alpine AS client-development
RUN mkdir /srv/client && chown node:node /srv/client
WORKDIR /srv/client
USER node
RUN mkdir -p node_modules
COPY --chown=node:node package.json package.json ./
RUN npm install --silent

FROM node:14.11.0-slim AS client-builder
FROM node:18.12.0-slim AS client-builder
USER node
WORKDIR /srv/client
COPY --from=client-development /srv/client/node_modules node_modules
Expand Down
2 changes: 1 addition & 1 deletion client/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.11.0 AS client-development
FROM node:18-alpine AS client-development
RUN mkdir /srv/client && chown node:node /srv/client
WORKDIR /srv/client
USER node
Expand Down
6 changes: 3 additions & 3 deletions client/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:14.11.0 AS node-modules-install
FROM node:20-alpine AS node-modules-install
RUN mkdir /srv/client && chown node:node /srv/client
WORKDIR /srv/client
USER node
RUN mkdir -p node_modules
COPY --chown=node:node package.json package.json ./
RUN npm install --silent
RUN npm install --no-update-notifier

FROM node:14.11.0-slim AS client-builder
FROM node:18-slim AS client-builder
USER node
WORKDIR /srv/client
COPY --from=node-modules-install /srv/client/node_modules node_modules
Expand Down
9 changes: 5 additions & 4 deletions client/public/index.html → client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand All @@ -18,13 +18,13 @@
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="manifest" href="/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
Notice the use of in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
Unlike "/favicon.ico" or "favicon.ico", "/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
Expand All @@ -33,6 +33,7 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
31 changes: 19 additions & 12 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@mui/material": "^5.11.12",
"@vitejs/plugin-react": "^4.0.3",
"@vitejs/plugin-react-swc": "^3.3.2",
"classnames": "^2.2.6",
"cross-env": "^7.0.2",
"cross-var": "^1.1.0",
Expand All @@ -20,20 +22,21 @@
"minimist": "^1.2.6",
"moment": "^2.29.2",
"moment-recur": "^1.0.7",
"react": "^16.13.1",
"react-datepicker": "^3.1.3",
"react-dom": "^16.13.1",
"react": "^18.2.0",
"react-datepicker": "^4.16.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.44.3",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.4.1",
"validator": "^13.7.0"
"validator": "^13.7.0",
"vite": "^4.4.4",
"vite-plugin-svgr": "^3.2.0"
},
"scripts": {
"start": "dotenv -e .env -e ../backend/.env -- cross-var cross-env PORT=%CLIENT_PORT% react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --watchAll=false",
"test:watch": "react-scripts test",
"eject": "react-scripts eject",
"vite": "vite",
"start": "dotenv -e .env -e ../backend/.env -- cross-var cross-env PORT=%CLIENT_PORT% vite",
"build": "vite build",
"test": "vitest",
"preview": "vite preview",
"heroku-postbuild": "npm run build"
},
"eslintConfig": {
Expand Down Expand Up @@ -63,7 +66,11 @@
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"prettier": "^2.1.1",
"react-test-renderer": "^16.13.1",
"sass": "^1.49.7"
"react-test-renderer": "^18.2.0",
"sass": "^1.49.7",
"vitest": "^0.33.0"
},
"engines": {
"node": "<=18.0.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export default function ProjectForm({
formData,
projectToEdit,
isEdit,
setFormData
revertToOriginal,
setOriginalProjectData,
}) {
const history = useHistory();

Expand Down Expand Up @@ -119,9 +120,8 @@ export default function ProjectForm({
console.error(errors);
return;
}
// setOriginalProjectData(data);
setFormData(data);
setEditMode(false);
setOriginalProjectData(data);
setEditMode(true);
};

// ----------------- Handles and Toggles -----------------
Expand All @@ -130,14 +130,10 @@ export default function ProjectForm({
const handleRadioChange = (event) => {
setLocationType(event.target.value);
};

// Toggles the project view to edit mode change.
const handleEditMode = (event) => {
setEditMode(!editMode);
// React hook form method to reset data back to original values. Triggered when Edit Mode is cancelled.
reset({
...formData,
});
revertToOriginal();
};

// ----------------- Icons -----------------
Expand Down
File renamed without changes.
18 changes: 0 additions & 18 deletions client/src/components/manageProjects/addProject.js

This file was deleted.

78 changes: 78 additions & 0 deletions client/src/components/manageProjects/addProject.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import React from 'react';
import ProjectForm from '../ProjectForm';
import { simpleInputs } from '../data';

function addProject() {
// Array filled with default inputs.
const simpleInputs = [
{
label: 'Project Name',
name: 'name',
type: 'text',
placeholder: 'Enter project name',
},
{
label: 'Project Description',
name: 'description',
type: 'textarea',
placeholder: 'Enter project description',
value: /^[a-zA-Z0-9].{0,250}$/,
errorMessage: 'Description must start with alphanumeric characters, 250 char limit'
},
{
label: 'Location',
name: 'location',
type: 'text',
placeholder: 'Enter location for meeting',
value: /https:\/\/[\w-]*\.?zoom.us\/(j|my)\/[\d\w?=-]+/,
errorMessage: 'Please enter a valid Zoom URL',
addressValue: '',
addressError: 'Invalid address',
},
// Leaving incase we want to add this back in for updating projects
// {
// label: 'GitHub Identifier',
// name: 'githubIdentifier',
// type: 'text',
// placeholder: 'Enter GitHub identifier',
// },
{
label: 'GitHub URL',
name: 'githubUrl',
type: 'text',
placeholder: 'htttps://github.com/',
},
{
label: 'Slack Channel Link',
name: 'slackUrl',
type: 'text',
placeholder: 'htttps://slack.com/',
},
{
label: 'Google Drive URL',
name: 'googleDriveUrl',
type: 'text',
placeholder: 'htttps://drive.google.com/',
},
// Leaving incase we want to add this back in for updating projects
// {
// label: 'HFLA Website URL',
// name: 'hflaWebsiteUrl',
// type: 'text',
// placeholder: 'htttps://hackforla.org/projects/',
// },
];

return (
<div>
<ProjectForm
arr={simpleInputs}
formData={null}
handleChange={null}
isEdit={false}
/>
</div>
);
}

export default addProject;
Loading
Loading