Rename to story, add webpack 5 to next, modify rsvp for test site.

This commit is contained in:
Bradley Shellnut 2021-06-04 13:43:37 -07:00
parent 80f287a24c
commit 4def277228
9 changed files with 1799 additions and 2574 deletions

6
.env
View file

@ -1,6 +0,0 @@
MONGO_URL=
SECRET_COOKIE_PASSWORD=fjdk47fh48djsk3jdh8f9hdjshaj3eu4
ROOT_DOMAIN=localhost:3000
NEXT_PUBLIC_CLOUD_NAME=
NEXT_PUBLIC_FOLDER_NAME=
SITE_ENV=TEST_SITE

View file

@ -7,8 +7,8 @@ export default function Nav() {
<NavLink href="/">
<a>Home</a>
</NavLink>
<NavLink href="/cats">
<a>Our Cats</a>
<NavLink href="/story">
<a>Our Story</a>
</NavLink>
<NavLink href="/party">
<a>Wedding Party</a>

View file

@ -2,4 +2,7 @@ module.exports = {
images: {
domains: ['res.cloudinary.com', 'via.placeholder.com'],
},
future: {
webpack5: true,
},
};

4198
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,8 +15,8 @@
"cloudinary-build-url": "^0.2.1",
"dotenv": "^10.0.0",
"jsonwebtoken": "^8.5.1",
"mongodb": "^3.6.8",
"mongoose": "^5.12.11",
"mongodb": "^3.6.9",
"mongoose": "^5.12.13",
"next": "^10.2.3",
"next-iron-session": "^4.1.13",
"next-with-apollo": "^5.1.1",
@ -31,23 +31,23 @@
"waait": "^1.0.5"
},
"devDependencies": {
"@babel/core": "^7.13.13",
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.2",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.27.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^7.1.0",
"eslint-config-wesbos": "^2.0.0-beta.5",
"eslint-config-prettier": "^8.3.0",
"eslint-config-wesbos": "^2.0.0-beta.7",
"eslint-plugin-html": "^6.1.2",
"eslint-plugin-import": "^2.23.3",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"prettier": "^2.3.0",
"typescript": "^4.2.4"
"typescript": "^4.3.2"
},
"eslintConfig": {
"extends": [

View file

@ -19,20 +19,20 @@ 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' });
}
} else {
await connectDb();
const { firstName, lastName } = await req.body;
await connectDb();
const { firstName, lastName } = await req.body;
try {
const result = await Guest.findOne({
firstName: { $regex: new RegExp(firstName.trim(), 'i') },
lastName: { $regex: new RegExp(lastName.trim(), 'i') },
});
// console.log(JSON.stringify(result));
res.status(200).json({ status: 'SUCCESS', groupId: result.group });
} catch (error) {
const { response: fetchResponse } = error;
res.status(fetchResponse?.status || 500).json({ status: 'FAILURE' });
try {
const result = await Guest.findOne({
firstName: { $regex: new RegExp(firstName.trim(), 'i') },
lastName: { $regex: new RegExp(lastName.trim(), 'i') },
});
// console.log(JSON.stringify(result));
res.status(200).json({ status: 'SUCCESS', groupId: result.group });
} catch (error) {
const { response: fetchResponse } = error;
res.status(fetchResponse?.status || 500).json({ status: 'FAILURE' });
}
}
});

View file

@ -1,80 +0,0 @@
import Head from 'next/head';
import { RiExternalLinkLine } from 'react-icons/ri';
import CustomNextImage from '../components/CustomNextImage';
import Layout from '../components/Layout';
import useUser from '../lib/useUser';
import { PhotoPageStyles, PhotosStyles } from './photos';
export default function CatsPage() {
const { user } = useUser({ redirectTo: '/login' });
if (!user || user.isLoggedIn === false) {
return <Layout>Loading...</Layout>;
}
const cats = [
{
url: 'https://via.placeholder.com/500x500.png',
alt: 'Cat 1',
},
{
url: 'https://via.placeholder.com/500x500.png',
alt: 'Cat 2',
},
{
url: 'https://via.placeholder.com/500x500.png',
alt: 'Cat 3',
},
{
url: 'https://via.placeholder.com/500x500.png',
alt: 'Cat 4',
},
{
url: 'https://via.placeholder.com/500x500.png',
alt: 'Cat 5',
},
{
url: 'https://via.placeholder.com/500x500.png',
alt: 'Cat 6',
},
];
return (
<div>
<Head>
<title key="title">N & N | Our Cats</title>
</Head>
<PhotoPageStyles className="center">
<h1>Photos</h1>
<a
target="_blank"
rel="noopener noreferrer nofollow"
aria-label="Link to Photo Gallery"
href="https://example.com"
>
Link to full photo gallery <RiExternalLinkLine />
</a>
<PhotosStyles>
{cats.map((cat) => (
<CustomNextImage
key={cat.url}
src={cat.url}
alt={cat.alt}
height={500}
width={500}
blur
/>
))}
</PhotosStyles>
<a
target="_blank"
rel="noopener noreferrer nofollow"
aria-label="Link to Photo Gallery"
href="https://example.com"
>
Link to full photo gallery <RiExternalLinkLine />
</a>
</PhotoPageStyles>
</div>
);
}

View file

@ -99,7 +99,7 @@ export default function PartyPage() {
<h1 className="center">Meet our Wedding Party</h1>
<CustomNextImage
src="https://via.placeholder.com/450X800.png"
alt="Wedding Part"
alt="Wedding Party"
height={450}
width={800}
/>

36
pages/story.js Normal file
View file

@ -0,0 +1,36 @@
import Head from 'next/head';
import CustomNextImage from '../components/CustomNextImage';
import Layout from '../components/Layout';
import useUser from '../lib/useUser';
import { PhotoPageStyles } from './photos';
export default function StoryPage() {
const { user } = useUser({ redirectTo: '/login' });
if (!user || user.isLoggedIn === false) {
return <Layout>Loading...</Layout>;
}
return (
<div>
<Head>
<title key="title">N & N | Our Story</title>
</Head>
<PhotoPageStyles className="center">
<h1>Our Story</h1>
<CustomNextImage
src="https://via.placeholder.com/450X800.png"
alt="Placeholder Our Story Image"
height={450}
width={800}
/>
<p>
Our story Lorem ipsum dolor sit amet consectetur adipisicing elit.
Natus, illo. Vitae rerum officia, commodi atque reprehenderit tempore
amet accusantium dicta corrupti sint vero laboriosam quae explicabo,
repellat quisquam. Vitae, cumque.
</p>
</PhotoPageStyles>
</div>
);
}