mirror of
https://github.com/BradNut/weddingsite
synced 2025-09-08 17:40:36 +00:00
Updating dependencies and changing to use '_' in case we use UUID as the backend ID.
This commit is contained in:
parent
57092ea420
commit
e0b46ec0ac
7 changed files with 414 additions and 370 deletions
|
|
@ -82,24 +82,24 @@ export default function GuestRSVP({ guest, inputs, handleChange }) {
|
|||
</h3>
|
||||
<input
|
||||
type="radio"
|
||||
id={`${guest.id}-accepted`}
|
||||
name={`${guest.id}-rsvpStatus`}
|
||||
id={`${guest.id}_accepted`}
|
||||
name={`${guest.id}_rsvpStatus`}
|
||||
value="accepted"
|
||||
checked={inputs[guest.id]?.rsvpStatus === 'accepted'}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
<label htmlFor={`${guest.id}-accepted`}>
|
||||
<label htmlFor={`${guest.id}_accepted`}>
|
||||
{inputs[guest.id]?.rsvpStatus === 'accepted' ? 'Accepted' : 'Accept'}
|
||||
</label>
|
||||
<input
|
||||
type="radio"
|
||||
id={`${guest.id}-declined`}
|
||||
name={`${guest.id}-rsvpStatus`}
|
||||
id={`${guest.id}_declined`}
|
||||
name={`${guest.id}_rsvpStatus`}
|
||||
value="declined"
|
||||
checked={inputs[guest.id]?.rsvpStatus === 'declined'}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
<label htmlFor={`${guest.id}-declined`}>
|
||||
<label htmlFor={`${guest.id}_declined`}>
|
||||
{inputs[guest.id]?.rsvpStatus === 'declined' ? 'Declined' : 'Decline'}
|
||||
</label>
|
||||
</GuestStyles>
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export default function PlusOneRSVP({ guest, inputs, handleChange }) {
|
|||
handleChange({
|
||||
target: {
|
||||
value: !inputs[`${guest.id}`].plusOne,
|
||||
name: `${guest.id}-plusOne`,
|
||||
name: `${guest.id}_plusOne`,
|
||||
type: 'text',
|
||||
},
|
||||
});
|
||||
|
|
@ -100,16 +100,16 @@ export default function PlusOneRSVP({ guest, inputs, handleChange }) {
|
|||
<div className="plusone__names">
|
||||
<input
|
||||
type="text"
|
||||
id={`${guest.id}-plusOneFirstName`}
|
||||
name={`${guest.id}-plusOneFirstName`}
|
||||
id={`${guest.id}_plusOneFirstName`}
|
||||
name={`${guest.id}_plusOneFirstName`}
|
||||
placeholder="First Name"
|
||||
value={inputs[`${guest.id}`]?.plusOneFirstName}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
id={`${guest.id}-plusOneLastName`}
|
||||
name={`${guest.id}-plusOneLastName`}
|
||||
id={`${guest.id}_plusOneLastName`}
|
||||
name={`${guest.id}_plusOneLastName`}
|
||||
placeholder="Last Name"
|
||||
value={inputs[`${guest.id}`]?.plusOneLastName}
|
||||
onChange={handleChange}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ export default function useForm(initial = {}) {
|
|||
|
||||
function handleChange(e) {
|
||||
let { value, name, type } = e.target;
|
||||
// console.log(value, name, type);
|
||||
if (name.includes('-')) {
|
||||
const values = name.split('-');
|
||||
console.log(value, name, type);
|
||||
if (name.includes('_')) {
|
||||
const values = name.split('_');
|
||||
// console.log(`Values: ${JSON.stringify(values)}`);
|
||||
const [id, property] = values;
|
||||
const data = inputs[id];
|
||||
|
|
|
|||
708
package-lock.json
generated
708
package-lock.json
generated
File diff suppressed because it is too large
Load diff
26
package.json
26
package.json
|
|
@ -15,17 +15,17 @@
|
|||
"@reach/portal": "^0.16.2",
|
||||
"@reach/visually-hidden": "^0.16.0",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-plugin-styled-components": "^2.0.2",
|
||||
"babel-plugin-styled-components": "^2.0.6",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"cloudinary-build-url": "^0.2.4",
|
||||
"dotenv": "^16.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"iron-session": "^6.0.5",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"mongodb": "^4.3.1",
|
||||
"mongoose": "^6.2.2",
|
||||
"next": "^12.0.10",
|
||||
"next-with-apollo": "^5.2.1",
|
||||
"mongodb": "^4.4.1",
|
||||
"mongoose": "^6.2.4",
|
||||
"next": "^12.1.0",
|
||||
"next-with-apollo": "^5.3.0",
|
||||
"normalize.css": "^8.0.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"plaiceholder": "^2.3.0",
|
||||
|
|
@ -33,32 +33,32 @@
|
|||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-icons": "^4.3.1",
|
||||
"sharp": "^0.30.1",
|
||||
"sharp": "^0.30.2",
|
||||
"styled-components": "^5.3.3",
|
||||
"swr": "^0.5.6",
|
||||
"waait": "^1.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.17.4",
|
||||
"@babel/core": "^7.17.5",
|
||||
"@babel/preset-env": "^7.16.11",
|
||||
"@testing-library/jest-dom": "^5.16.2",
|
||||
"@testing-library/react": "^12.1.3",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.12.0",
|
||||
"@typescript-eslint/parser": "^5.12.0",
|
||||
"eslint": "^8.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
||||
"@typescript-eslint/parser": "^5.14.0",
|
||||
"eslint": "^8.10.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-config-wesbos": "^3.0.2",
|
||||
"eslint-plugin-html": "^6.2.0",
|
||||
"eslint-plugin-import": "^2.25.4",
|
||||
"eslint-plugin-jsx-a11y": "^6.5.1",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"eslint-plugin-react": "^7.28.0",
|
||||
"eslint-plugin-react": "^7.29.3",
|
||||
"eslint-plugin-react-hooks": "^4.3.0",
|
||||
"jest": "^27.5.1",
|
||||
"prettier": "^2.5.1",
|
||||
"typescript": "^4.5.5"
|
||||
"typescript": "^4.6.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export default withSession(async (req, res) => {
|
|||
|
||||
// TODO: REMOVE THIS WHEN TAKING YOUR SITE TO PRODUCTION
|
||||
if (process.env.SITE_ENV === 'TEST_SITE') {
|
||||
res.status(200).json({ status: 'SUCCESS', groupId: 'TESTID_12345' });
|
||||
res.status(200).json({ status: 'SUCCESS', groupId: 'TESTID-12345' });
|
||||
} else {
|
||||
await connectDb();
|
||||
const { firstName, lastName } = await req.body;
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ export default function SingleGroupPage({ group }) {
|
|||
|
||||
if (res.message === 'SUCCESS') {
|
||||
setMessage(
|
||||
`Successfully submited your RSVP${
|
||||
`Successfully submitted your RSVP${
|
||||
body.guests.length > 1 ? 's' : ''
|
||||
}. Don't forget to save the date!!`
|
||||
);
|
||||
|
|
@ -300,15 +300,15 @@ export default function SingleGroupPage({ group }) {
|
|||
// eslint-disable-next-line react/prop-types
|
||||
group?.guests?.map((guest) =>
|
||||
!guest.isPlusOne ? (
|
||||
<QuestionStyles key={`${guest?.id}-dietaryNotes`}>
|
||||
<QuestionStyles key={`${guest?.id}_dietaryNotes`}>
|
||||
<p>
|
||||
{guest.firstName} {guest.lastName} :
|
||||
</p>
|
||||
<label htmlFor={`${guest.id}-dietaryNotes`}>
|
||||
<label htmlFor={`${guest.id}_dietaryNotes`}>
|
||||
<p className="sr-only">{`Enter dietery restrictions for ${guest.firstName} ${guest.lastName}`}</p>
|
||||
<textarea
|
||||
name={`${guest.id}-dietaryNotes`}
|
||||
id={`${guest.id}-dietaryNotes`}
|
||||
name={`${guest.id}_dietaryNotes`}
|
||||
id={`${guest.id}_dietaryNotes`}
|
||||
cols="30"
|
||||
rows="2"
|
||||
placeholder="Example: Nut allergy, Fish, etc."
|
||||
|
|
@ -336,15 +336,15 @@ export default function SingleGroupPage({ group }) {
|
|||
// eslint-disable-next-line react/prop-types
|
||||
group?.guests?.map((guest) =>
|
||||
!guest?.isPlusOne ? (
|
||||
<QuestionStyles key={`${guest?.id}-songRequests`}>
|
||||
<QuestionStyles key={`${guest?.id}_songRequests`}>
|
||||
<p>
|
||||
{guest.firstName} {guest.lastName}:
|
||||
</p>
|
||||
<label htmlFor={`${guest.id}-songRequests`}>
|
||||
<label htmlFor={`${guest.id}_songRequests`}>
|
||||
<p className="sr-only">{`Enter song requests for ${guest.firstName} ${guest.lastName}`}</p>
|
||||
<textarea
|
||||
name={`${guest.id}-songRequests`}
|
||||
id={`${guest.id}-songRequests`}
|
||||
name={`${guest.id}_songRequests`}
|
||||
id={`${guest.id}_songRequests`}
|
||||
cols="30"
|
||||
rows="2"
|
||||
placeholder="Example: Paint It Black - Rolling Stones"
|
||||
|
|
@ -420,7 +420,7 @@ export async function getServerSideProps({ params }) {
|
|||
group.id = params.id;
|
||||
group.guests = [
|
||||
{
|
||||
id: 'TEST_GUEST_ID_12345',
|
||||
id: 'TEST-GUEST-ID-12345',
|
||||
firstName: 'Test',
|
||||
lastName: 'Lastname',
|
||||
rsvpStatus: false,
|
||||
|
|
|
|||
Loading…
Reference in a new issue