From 319c8eae9407f54a94d71fd0709eafe98beb2cda Mon Sep 17 00:00:00 2001 From: Aneet Singh Sahota Date: Thu, 7 Mar 2024 13:41:38 -0800 Subject: [PATCH 1/6] final --- app/favicon.ico | Bin 25931 -> 0 bytes app/layout.js | 28 ++--- app/page.js | 178 ++++++++++++++++---------------- components/Contact.js | 26 +++++ components/ContactForm.js | 85 +++++++++++++++ components/ContactInfoView.js | 30 ++++++ components/ContactsList.js | 18 ++++ data/contactsAPI.js | 0 pages/InfoViewPage/page.js | 21 ++++ pages/api/contactsAPI.js | 39 +++++++ pages/contactForm/page.js | 13 +++ {app => styles}/globals.css | 4 +- {app => styles}/page.module.css | 0 13 files changed, 337 insertions(+), 105 deletions(-) delete mode 100644 app/favicon.ico create mode 100644 components/Contact.js create mode 100644 components/ContactForm.js create mode 100644 components/ContactInfoView.js create mode 100644 components/ContactsList.js create mode 100644 data/contactsAPI.js create mode 100644 pages/InfoViewPage/page.js create mode 100644 pages/api/contactsAPI.js create mode 100644 pages/contactForm/page.js rename {app => styles}/globals.css (99%) rename {app => styles}/page.module.css (100%) diff --git a/app/favicon.ico b/app/favicon.ico deleted file mode 100644 index 718d6fea4835ec2d246af9800eddb7ffb276240c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25931 zcmeHv30#a{`}aL_*G&7qml|y<+KVaDM2m#dVr!KsA!#An?kSQM(q<_dDNCpjEux83 zLb9Z^XxbDl(w>%i@8hT6>)&Gu{h#Oeyszu?xtw#Zb1mO{pgX9699l+Qppw7jXaYf~-84xW z)w4x8?=youko|}Vr~(D$UXIbiXABHh`p1?nn8Po~fxRJv}|0e(BPs|G`(TT%kKVJAdg5*Z|x0leQq0 zkdUBvb#>9F()jo|T~kx@OM8$9wzs~t2l;K=woNssA3l6|sx2r3+kdfVW@e^8e*E}v zA1y5{bRi+3Z`uD3{F7LgFJDdvm;nJilkzDku>BwXH(8ItVCXk*-lSJnR?-2UN%hJ){&rlvg`CDTj z)Bzo!3v7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/layout.js index 821f712..691f14b 100644 --- a/app/layout.js +++ b/app/layout.js @@ -1,17 +1,17 @@ -import { Inter } from 'next/font/google' -import './globals.css' +// import { Inter } from 'next/font/google' +// import './globals.css' -const inter = Inter({ subsets: ['latin'] }) +// const inter = Inter({ subsets: ['latin'] }) -export const metadata = { - title: 'Create Next App', - description: 'Generated by create next app', -} +// export const metadata = { +// title: 'Create Next App', +// description: 'Generated by create next app', +// } -export default function RootLayout({ children }) { - return ( - - {children} - - ) -} +// export default function RootLayout({ children }) { +// return ( +// +// {children} +// +// ) +// } diff --git a/app/page.js b/app/page.js index 5f905a8..16becaa 100644 --- a/app/page.js +++ b/app/page.js @@ -1,95 +1,95 @@ -import Image from 'next/image' -import styles from './page.module.css' +// import Image from 'next/image' +// import styles from './page.module.css' -export default function Home() { - return ( -
-
-

- Get started by editing  - app/page.js -

- -
+// export default function Home() { +// return ( +//
+//
+//

+// Get started by editing  +// app/page.js +//

+// +//
-
- Next.js Logo -
+//
+// Next.js Logo +//
-
- ) -} +// +//

+// Deploy -> +//

+//

+// Instantly deploy your Next.js site to a shareable URL with Vercel. +//

+//
+// +//
+// ) +// } diff --git a/components/Contact.js b/components/Contact.js new file mode 100644 index 0000000..c38cdb2 --- /dev/null +++ b/components/Contact.js @@ -0,0 +1,26 @@ +import React from 'react'; + + +const Contact = ({ contact }) => { + const {id, name, email, image_url, phone_number } = contact; + const hiddenIdStyle = { + display: 'none', + }; + + + +return ( +
  • + ID: {id} + Name:{name} | Image {image_url} | Email {email} | Number:{phone_number} + +
    + {name}/ +
  • + ); +}; + +export default Contact; + + + diff --git a/components/ContactForm.js b/components/ContactForm.js new file mode 100644 index 0000000..0d7cf94 --- /dev/null +++ b/components/ContactForm.js @@ -0,0 +1,85 @@ + +import React, { useState } from 'react'; +import { v4 as uuidv4 } from 'uuid'; + +const ContactForm = (props) => { + const [name, setName] = useState(''); + const [email, setEmail] = useState(''); + const [image, setImage] = useState(''); + const [number, setNumber] = useState(''); + + const handleClick = () => { + const contact = { + id: uuidv4(), + name, + email, + image_url: image, + phone_number: number, + }; + props.addContact(contact); + + // Clear the form after adding a contact + setName(''); + setEmail(''); + setImage(''); + setNumber(''); + }; + + return ( +
    + +

    Add a New Contact

    + +
    + setName(event.target.value)} + placeholder='Enter Name' + /> + +
    + +
    + + setEmail(event.target.value)} + placeholder='Enter Email' + /> +
    + +
    + + setImage(event.target.value)} + placeholder='Enter Image URL' + /> +
    + + +
    + + setNumber(event.target.value)} + placeholder='Enter Phone Number' + /> +
    +
    + + + +
    + ); +}; + +export default ContactForm; diff --git a/components/ContactInfoView.js b/components/ContactInfoView.js new file mode 100644 index 0000000..41296c2 --- /dev/null +++ b/components/ContactInfoView.js @@ -0,0 +1,30 @@ + +import React from 'react'; +import Link from 'next/link'; +import { useRouter } from 'next/router'; + +const ContactInfoView = ({ contact }) => { + const router = useRouter(); + + if (!contact) { + return ( +

    Loading...

    + ); + } + + return ( +
    +

    Contact Info View

    + Back + +
    +

    Name

    {contact.name}
    +

    Profile Pic

    {contact.image}
    +

    Email

    {contact.email}
    +

    Phone

    {contact.phone_number}
    +
    +
    + ); +}; + +export default ContactInfoView; diff --git a/components/ContactsList.js b/components/ContactsList.js new file mode 100644 index 0000000..f131fd5 --- /dev/null +++ b/components/ContactsList.js @@ -0,0 +1,18 @@ +import React from 'react'; +import Link from 'next/link'; + +const ContactsList = ({ contacts, onContactClick }) => { + return( + + ); +}; + +export default ContactsList; \ No newline at end of file diff --git a/data/contactsAPI.js b/data/contactsAPI.js new file mode 100644 index 0000000..e69de29 diff --git a/pages/InfoViewPage/page.js b/pages/InfoViewPage/page.js new file mode 100644 index 0000000..74d3741 --- /dev/null +++ b/pages/InfoViewPage/page.js @@ -0,0 +1,21 @@ +import React from 'react'; +import { useRouter } from 'next/router'; +import ContactInfoView from '@/components/ContactInfoView'; + +const ContactInfoPage = () => { + const router = useRouter(); + const { id } = router.query; + + // Mock function to simulate fetching contact details + const fetchContactDetails = async () => { + // Replace this with your actual data fetching logic or use local data + return { + }; + }; + + const contactDetails = fetchContactDetails(); // Fetch contact details based on the ID + + return ; +}; + +export default ContactInfoPage; \ No newline at end of file diff --git a/pages/api/contactsAPI.js b/pages/api/contactsAPI.js new file mode 100644 index 0000000..bebc449 --- /dev/null +++ b/pages/api/contactsAPI.js @@ -0,0 +1,39 @@ +import contactsData from '../../data/contactsAPI'; + +export default async function handler(req, res) { + if (req.method === 'GET') { + try { + const { search } = req.query; + + // Filter contacts based on the search term + const filteredContacts = contactsData.filter((contact) => + Object.values(contact).some((value) => + String(value).toLowerCase().includes(search.toLowerCase()) + ) + ); + + return res.status(200).json(filteredContacts); + } catch (error) { + console.error('Error fetching contacts:', error); + return res.status(500).json({ message: 'Internal server error' }); + } + } else if (req.method === 'POST') { + try { + // Extract the contact data from the request body + const contactData = JSON.parse(req.body); + + // Perform the logic to save the contact data to the data/contactsAPI folder or your database + // For simplicity, let's assume you have a function to save the data + // SaveContactToDatabase(contactData); + + // Respond with a success message or the saved contact data + return res.status(200).json({ message: 'Contact added successfully', contact: contactData }); + } catch (error) { + console.error('Error adding contact:', error); + return res.status(500).json({ message: 'Internal server error' }); + } + } else { + // Handle other HTTP methods if needed + return res.status(405).json({ message: 'Method Not Allowed' }); + } +} diff --git a/pages/contactForm/page.js b/pages/contactForm/page.js new file mode 100644 index 0000000..235ada7 --- /dev/null +++ b/pages/contactForm/page.js @@ -0,0 +1,13 @@ +import React from 'react'; +import ContactForm from './ContactForm'; + +const ContactFormPage = ({ addContact }) => { + return ( +
    +

    Contact Form Page

    + +
    + ); +}; + +export default ContactFormPage; \ No newline at end of file diff --git a/app/globals.css b/styles/globals.css similarity index 99% rename from app/globals.css rename to styles/globals.css index d4f491e..515036b 100644 --- a/app/globals.css +++ b/styles/globals.css @@ -1,4 +1,4 @@ -:root { +/* :root { --max-width: 1100px; --border-radius: 12px; --font-mono: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono', @@ -104,4 +104,4 @@ a { html { color-scheme: dark; } -} +} */ diff --git a/app/page.module.css b/styles/page.module.css similarity index 100% rename from app/page.module.css rename to styles/page.module.css From bb2303491e3ce4b0bf652f134012ee8154ad1ae0 Mon Sep 17 00:00:00 2001 From: Aneet Singh Sahota Date: Tue, 19 Mar 2024 14:14:18 -0700 Subject: [PATCH 2/6] resubmit --- app/layout.js | 17 --------- app/page.js | 95 -------------------------------------------------- pages/_app.js | 36 +++++++++++++++++++ pages/index.js | 63 +++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 112 deletions(-) delete mode 100644 app/layout.js delete mode 100644 app/page.js create mode 100644 pages/_app.js create mode 100644 pages/index.js diff --git a/app/layout.js b/app/layout.js deleted file mode 100644 index 691f14b..0000000 --- a/app/layout.js +++ /dev/null @@ -1,17 +0,0 @@ -// import { Inter } from 'next/font/google' -// import './globals.css' - -// const inter = Inter({ subsets: ['latin'] }) - -// export const metadata = { -// title: 'Create Next App', -// description: 'Generated by create next app', -// } - -// export default function RootLayout({ children }) { -// return ( -// -// {children} -// -// ) -// } diff --git a/app/page.js b/app/page.js deleted file mode 100644 index 16becaa..0000000 --- a/app/page.js +++ /dev/null @@ -1,95 +0,0 @@ -// import Image from 'next/image' -// import styles from './page.module.css' - -// export default function Home() { -// return ( -//
    -//
    -//

    -// Get started by editing  -// app/page.js -//

    -// -//
    - -//
    -// Next.js Logo -//
    - -// -//
    -// ) -// } diff --git a/pages/_app.js b/pages/_app.js new file mode 100644 index 0000000..958442e --- /dev/null +++ b/pages/_app.js @@ -0,0 +1,36 @@ + +import '../styles/globals.css'; // Import global styles +import 'bootstrap/dist/css/bootstrap.min.css'; // Import Bootstrap styles +import React from 'react'; +import { useRouter } from 'next/router'; +import NProgress from 'nprogress'; // Import NProgress library for page loading indicator +import 'nprogress/nprogress.css'; // Import NProgress styles +import Layout from '@/components/Layout'; // Import your layout component + +// Event listener to start NProgress when a route changes +Router.events.on('routeChangeStart', () => { + NProgress.start(); +}); + +// Event listener to end NProgress when a route changes +Router.events.on('routeChangeComplete', () => { + NProgress.done(); +}); + +// Event listener to handle errors during route changes +Router.events.on('routeChangeError', () => { + NProgress.done(); +}); + +function MyApp({ Component, pageProps }) { + const router = useRouter(); + + return ( + + {/* Render the component for each page */} + + + ); +} + +export default MyApp; \ No newline at end of file diff --git a/pages/index.js b/pages/index.js new file mode 100644 index 0000000..a1f6458 --- /dev/null +++ b/pages/index.js @@ -0,0 +1,63 @@ +// pages/index.js (or Home.js) +import React, { useState, useEffect } from 'react'; +import Head from 'next/head'; +import ContactForm from '@/components/ContactForm'; +import ContactsList from '@/components/ContactsList'; +import styles from '@/styles/page.module.css'; + +const Home = () => { + const [contacts, setContacts] = useState([]); + const [showContactForm, setShowContactForm] = useState(false); + + useEffect(() => { + // Fetch initial contacts when the component mounts + const fetchContacts = async () => { + try { + const response = await fetch('/api/contactsAPI'); + const data = await response.json(); + setContacts(data); + } catch (error) { + console.error('Error fetching contacts:', error); + } + }; + + fetchContacts(); + }, []); // Run once when the component mounts to fetch initial data + + const addContact = async (contact) => { + try { + const response = await fetch('/api/contactsAPI', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(contact), + }); + + if (response.ok) { + const addedContactData = await response.json(); + setContacts((prevContacts) => [...prevContacts, addedContactData.contact]); + setShowContactForm(false); + } else { + console.error('Failed to add contact:', response.statusText); + } + } catch (error) { + console.error('Error adding contact:', error); + } + }; + + const handleAddContact = () => { + setShowContactForm(true); + }; + + return ( + <> + + {/* Additional head content if needed */} + + {/* ... rest of the component */} + + ); +}; + +export default Home; From 8b198e0a6e930b10460244a6b1a68e0bc8c9c846 Mon Sep 17 00:00:00 2001 From: Aneet Singh Sahota Date: Tue, 19 Mar 2024 14:25:58 -0700 Subject: [PATCH 3/6] final edit --- pages/index.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/pages/index.js b/pages/index.js index a1f6458..a46c7f3 100644 --- a/pages/index.js +++ b/pages/index.js @@ -52,12 +52,29 @@ const Home = () => { return ( <> - - {/* Additional head content if needed */} - - {/* ... rest of the component */} + {/* Additional head content if needed */} +
    +
    +
    +
    +

    All Contacts

    + + {showContactForm && } +
    + +
    +
    +
    +
    Profile Pic Name Email Phone
    +
    +
    + +
    +
    +
    +
    ); }; -export default Home; +export default Home; \ No newline at end of file From 940bf335c4dee3f01d55939f7484767d9a1f032a Mon Sep 17 00:00:00 2001 From: lesavantdon <144865003+lesavantdon@users.noreply.github.com> Date: Fri, 7 Jun 2024 11:41:55 -0700 Subject: [PATCH 4/6] pc draft --- Layout.js | 13 ++ app.js | 37 ++++++ components/Contact.js | 26 ---- components/ContactForm.js | 107 +++++++-------- components/ContactInfoView.js | 48 ++++--- components/ContactsList.js | 37 ++++-- data/contactsAPI.js | 0 package-lock.json | 187 ++++++++++++++++---------- package.json | 6 +- pages/InfoViewPage/page.js | 21 --- pages/_app.js | 36 ----- pages/addContact.js | 94 +++++++++++++ pages/api/contactsAPI.js | 48 +++---- pages/contactForm/page.js | 13 -- pages/index.js | 96 ++++++-------- styles/globals.css | 107 --------------- styles/page.module.css | 242 ++++------------------------------ 17 files changed, 451 insertions(+), 667 deletions(-) create mode 100644 Layout.js create mode 100644 app.js delete mode 100644 components/Contact.js delete mode 100644 data/contactsAPI.js delete mode 100644 pages/InfoViewPage/page.js delete mode 100644 pages/_app.js create mode 100644 pages/addContact.js delete mode 100644 pages/contactForm/page.js delete mode 100644 styles/globals.css diff --git a/Layout.js b/Layout.js new file mode 100644 index 0000000..3712ae6 --- /dev/null +++ b/Layout.js @@ -0,0 +1,13 @@ +// components/Layout.jsx +const Layout = ({ children }) => { + return ( +
    +
    Header
    +
    {children}
    +
    Footer
    +
    + ); + }; + + export default Layout; + \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 0000000..244ff81 --- /dev/null +++ b/app.js @@ -0,0 +1,37 @@ +// pages/_app.js +import React from 'react'; +import App from 'next/app'; +import Router from 'next/router'; +import NProgress from 'nprogress'; // Import NProgress library for page loading indicator +import 'nprogress/nprogress.css'; // Import NProgress styles + +import Layout from './Layout'; // Import your layout component + +// Event listener to start NProgress when a route changes +Router.events.on('routeChangeStart', () => { + NProgress.start(); +}); + +// Event listener to stop NProgress when a route change is complete +Router.events.on('routeChangeComplete', () => { + NProgress.done(); +}); + +// Event listener to stop NProgress when a route change error occurs +Router.events.on('routeChangeError', () => { + NProgress.done(); +}); + +class MyApp extends App { + render() { + const { Component, pageProps } = this.props; + + return ( + + + + ); + } +} + +export default MyApp; diff --git a/components/Contact.js b/components/Contact.js deleted file mode 100644 index c38cdb2..0000000 --- a/components/Contact.js +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; - - -const Contact = ({ contact }) => { - const {id, name, email, image_url, phone_number } = contact; - const hiddenIdStyle = { - display: 'none', - }; - - - -return ( -
  • - ID: {id} - Name:{name} | Image {image_url} | Email {email} | Number:{phone_number} - -
    - {name}/ -
  • - ); -}; - -export default Contact; - - - diff --git a/components/ContactForm.js b/components/ContactForm.js index 0d7cf94..ffa1b5a 100644 --- a/components/ContactForm.js +++ b/components/ContactForm.js @@ -1,83 +1,68 @@ - +// components/ContactForm.js import React, { useState } from 'react'; import { v4 as uuidv4 } from 'uuid'; +import { useRouter } from 'next/router'; -const ContactForm = (props) => { +const ContactForm = ({ addContact }) => { const [name, setName] = useState(''); const [email, setEmail] = useState(''); - const [image, setImage] = useState(''); - const [number, setNumber] = useState(''); + const [image_url, setImageUrl] = useState(''); + const [phone_number, setPhoneNumber] = useState(''); + const router = useRouter(); - const handleClick = () => { + const handleSubmit = async (e) => { + e.preventDefault(); const contact = { id: uuidv4(), name, email, - image_url: image, - phone_number: number, + image_url, + phone_number, }; - props.addContact(contact); - - // Clear the form after adding a contact - setName(''); - setEmail(''); - setImage(''); - setNumber(''); + await addContact(contact); + router.push('/'); }; return ( -
    - -

    Add a New Contact

    - -
    + +
    + setName(event.target.value)} - placeholder='Enter Name' + onChange={(e) => setName(e.target.value)} + placeholder="Enter Name" /> - -
    - -
    - - setEmail(event.target.value)} - placeholder='Enter Email' - /> -
    - -
    - - setImage(event.target.value)} - placeholder='Enter Image URL' - /> -
    - - -
    - - setNumber(event.target.value)} - placeholder='Enter Phone Number' - /> -
    - +
    + + setEmail(e.target.value)} + placeholder="Enter Email" + /> +
    +
    + + setImageUrl(e.target.value)} + placeholder="Enter Image URL" + /> +
    +
    + + setPhoneNumber(e.target.value)} + placeholder="Enter Phone Number" + /> +
    + - ); }; diff --git a/components/ContactInfoView.js b/components/ContactInfoView.js index 41296c2..24dad88 100644 --- a/components/ContactInfoView.js +++ b/components/ContactInfoView.js @@ -1,28 +1,42 @@ - -import React from 'react'; -import Link from 'next/link'; +import React, { useEffect, useState } from 'react'; import { useRouter } from 'next/router'; +import styles from '@/styles/page.module.css'; -const ContactInfoView = ({ contact }) => { +const ContactInfoView = () => { const router = useRouter(); + const { id } = router.query; + const [contact, setContact] = useState(null); + + useEffect(() => { + const fetchContact = async () => { + try { + if (id) { + const response = await fetch(`/api/contactsAPI/${id}`); + if (response.ok) { + const data = await response.json(); + setContact(data); + } else { + console.error(`Failed to fetch contact, status: ${response.status}`); + } + } + } catch (error) { + console.error('Error fetching contact:', error); + } + }; + + fetchContact(); + }, [id]); if (!contact) { - return ( -

    Loading...

    - ); + return
    Loading...
    ; } return ( -
    -

    Contact Info View

    - Back - -
    -

    Name

    {contact.name}
    -

    Profile Pic

    {contact.image}
    -

    Email

    {contact.email}
    -

    Phone

    {contact.phone_number}
    -
    +
    +

    {contact.name}

    +

    Email: {contact.email}

    +

    Phone: {contact.phone_number}

    + {contact.name}
    ); }; diff --git a/components/ContactsList.js b/components/ContactsList.js index f131fd5..d1118b5 100644 --- a/components/ContactsList.js +++ b/components/ContactsList.js @@ -1,18 +1,31 @@ import React from 'react'; -import Link from 'next/link'; +import { useRouter } from 'next/router'; +import styles from '@/styles/page.module.css'; -const ContactsList = ({ contacts, onContactClick }) => { - return( -
      - {contacts.map(contact => ( -
    • - - onContactClick(contact)}>{contact.name} - +const ContactsList = ({ contacts }) => { + const router = useRouter(); + + const handleContactClick = (contactId) => { + router.push(`/contactInfoPage/${contactId}`); + }; + + return ( + +
        + {contacts.map(contact => ( +
      • handleContactClick(contact.id)}> + + {contact.name} + {contact.email} + {contact.phone_number}
      • + ))} -
      - ); +
    + ); }; -export default ContactsList; \ No newline at end of file +export default ContactsList; diff --git a/data/contactsAPI.js b/data/contactsAPI.js deleted file mode 100644 index e69de29..0000000 diff --git a/package-lock.json b/package-lock.json index f3ada0d..6dd692e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,9 +8,13 @@ "name": "parsity_contact_list_eval", "version": "0.1.0", "dependencies": { - "next": "14.0.2", + "bootstrap": "^5.3.3", + "next": "^14.2.3", + "next.js": "^1.0.3", + "nprogress": "^0.2.0", "react": "^18", - "react-dom": "^18" + "react-dom": "^18", + "uuid": "^9.0.1" }, "devDependencies": { "eslint": "^8", @@ -128,9 +132,9 @@ "dev": true }, "node_modules/@next/env": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.0.2.tgz", - "integrity": "sha512-HAW1sljizEaduEOes/m84oUqeIDAUYBR1CDwu2tobNlNDFP3cSm9d6QsOsGeNlIppU1p/p1+bWbYCbvwjFiceA==" + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.3.tgz", + "integrity": "sha512-W7fd7IbkfmeeY2gXrzJYDx8D2lWKbVoTIj1o1ScPHNzvp30s1AuoEFSdr39bC5sjxJaxTtq3OTCZboNp0lNWHA==" }, "node_modules/@next/eslint-plugin-next": { "version": "14.0.2", @@ -142,9 +146,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.0.2.tgz", - "integrity": "sha512-i+jQY0fOb8L5gvGvojWyZMfQoQtDVB2kYe7fufOEiST6sicvzI2W5/EXo4lX5bLUjapHKe+nFxuVv7BA+Pd7LQ==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.3.tgz", + "integrity": "sha512-3pEYo/RaGqPP0YzwnlmPN2puaF2WMLM3apt5jLW2fFdXD9+pqcoTzRk+iZsf8ta7+quAe4Q6Ms0nR0SFGFdS1A==", "cpu": [ "arm64" ], @@ -157,9 +161,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.0.2.tgz", - "integrity": "sha512-zRCAO0d2hW6gBEa4wJaLn+gY8qtIqD3gYd9NjruuN98OCI6YyelmhWVVLlREjS7RYrm9OUQIp/iVJFeB6kP1hg==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.3.tgz", + "integrity": "sha512-6adp7waE6P1TYFSXpY366xwsOnEXM+y1kgRpjSRVI2CBDOcbRjsJ67Z6EgKIqWIue52d2q/Mx8g9MszARj8IEA==", "cpu": [ "x64" ], @@ -172,9 +176,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.0.2.tgz", - "integrity": "sha512-tSJmiaon8YaKsVhi7GgRizZoV0N1Sx5+i+hFTrCKKQN7s3tuqW0Rov+RYdPhAv/pJl4qiG+XfSX4eJXqpNg3dA==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.3.tgz", + "integrity": "sha512-cuzCE/1G0ZSnTAHJPUT1rPgQx1w5tzSX7POXSLaS7w2nIUJUD+e25QoXD/hMfxbsT9rslEXugWypJMILBj/QsA==", "cpu": [ "arm64" ], @@ -187,9 +191,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.0.2.tgz", - "integrity": "sha512-dXJLMSEOwqJKcag1BeX1C+ekdPPJ9yXbWIt3nAadhbLx5CjACoB2NQj9Xcqu2tmdr5L6m34fR+fjGPs+ZVPLzA==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.3.tgz", + "integrity": "sha512-0D4/oMM2Y9Ta3nGuCcQN8jjJjmDPYpHX9OJzqk42NZGJocU2MqhBq5tWkJrUQOQY9N+In9xOdymzapM09GeiZw==", "cpu": [ "arm64" ], @@ -202,9 +206,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.0.2.tgz", - "integrity": "sha512-WC9KAPSowj6as76P3vf1J3mf2QTm3Wv3FBzQi7UJ+dxWjK3MhHVWsWUo24AnmHx9qDcEtHM58okgZkXVqeLB+Q==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.3.tgz", + "integrity": "sha512-ENPiNnBNDInBLyUU5ii8PMQh+4XLr4pG51tOp6aJ9xqFQ2iRI6IH0Ds2yJkAzNV1CfyagcyzPfROMViS2wOZ9w==", "cpu": [ "x64" ], @@ -217,9 +221,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.0.2.tgz", - "integrity": "sha512-KSSAwvUcjtdZY4zJFa2f5VNJIwuEVnOSlqYqbQIawREJA+gUI6egeiRu290pXioQXnQHYYdXmnVNZ4M+VMB7KQ==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.3.tgz", + "integrity": "sha512-BTAbq0LnCbF5MtoM7I/9UeUu/8ZBY0i8SFjUMCbPDOLv+un67e2JgyN4pmgfXBwy/I+RHu8q+k+MCkDN6P9ViQ==", "cpu": [ "x64" ], @@ -232,9 +236,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.0.2.tgz", - "integrity": "sha512-2/O0F1SqJ0bD3zqNuYge0ok7OEWCQwk55RPheDYD0va5ij7kYwrFkq5ycCRN0TLjLfxSF6xI5NM6nC5ux7svEQ==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.3.tgz", + "integrity": "sha512-AEHIw/dhAMLNFJFJIJIyOFDzrzI5bAjI9J26gbO5xhAKHYTZ9Or04BesFPXiAYXDNdrwTP2dQceYA4dL1geu8A==", "cpu": [ "arm64" ], @@ -247,9 +251,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.0.2.tgz", - "integrity": "sha512-vJI/x70Id0oN4Bq/R6byBqV1/NS5Dl31zC+lowO8SDu1fHmUxoAdILZR5X/sKbiJpuvKcCrwbYgJU8FF/Gh50Q==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.3.tgz", + "integrity": "sha512-vga40n1q6aYb0CLrM+eEmisfKCR45ixQYXuBXxOOmmoV8sYST9k7E3US32FsY+CkkF7NtzdcebiFT4CHuMSyZw==", "cpu": [ "ia32" ], @@ -262,9 +266,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.0.2.tgz", - "integrity": "sha512-Ut4LXIUvC5m8pHTe2j0vq/YDnTEyq6RSR9vHYPqnELrDapPhLNz9Od/L5Ow3J8RNDWpEnfCiQXuVdfjlNEJ7ug==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.3.tgz", + "integrity": "sha512-Q1/zm43RWynxrO7lW4ehciQVj+5ePBhOK+/K2P7pLFX3JaJ/IZVC69SHidrmZSOkqz7ECIOhhy7XhAFG4JYyHA==", "cpu": [ "x64" ], @@ -311,17 +315,33 @@ "node": ">= 8" } }, + "node_modules/@popperjs/core": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", + "peer": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/popperjs" + } + }, "node_modules/@rushstack/eslint-patch": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.5.1.tgz", "integrity": "sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==", "dev": true }, + "node_modules/@swc/counter": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==" + }, "node_modules/@swc/helpers": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.2.tgz", - "integrity": "sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.5.tgz", + "integrity": "sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==", "dependencies": { + "@swc/counter": "^0.1.3", "tslib": "^2.4.0" } }, @@ -696,6 +716,24 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/bootstrap": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.3.tgz", + "integrity": "sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/twbs" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/bootstrap" + } + ], + "peerDependencies": { + "@popperjs/core": "^2.11.8" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -753,9 +791,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001561", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001561.tgz", - "integrity": "sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw==", + "version": "1.0.30001625", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001625.tgz", + "integrity": "sha512-4KE9N2gcRH+HQhpeiRZXd+1niLB/XNLAhSy4z7fI8EzcbcPoAqjNInxVHTiTwWfTIV4w096XG8OtCOCQQKPv3w==", "funding": [ { "type": "opencollective", @@ -1720,11 +1758,6 @@ "node": ">=10.13.0" } }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" - }, "node_modules/globals": { "version": "13.23.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", @@ -2501,17 +2534,17 @@ "dev": true }, "node_modules/next": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/next/-/next-14.0.2.tgz", - "integrity": "sha512-jsAU2CkYS40GaQYOiLl9m93RTv2DA/tTJ0NRlmZIBIL87YwQ/xR8k796z7IqgM3jydI8G25dXvyYMC9VDIevIg==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/next/-/next-14.2.3.tgz", + "integrity": "sha512-dowFkFTR8v79NPJO4QsBUtxv0g9BrS/phluVpMAt2ku7H+cbcBJlopXjkWlwxrk/xGqMemr7JkGPGemPrLLX7A==", "dependencies": { - "@next/env": "14.0.2", - "@swc/helpers": "0.5.2", + "@next/env": "14.2.3", + "@swc/helpers": "0.5.5", "busboy": "1.6.0", - "caniuse-lite": "^1.0.30001406", + "caniuse-lite": "^1.0.30001579", + "graceful-fs": "^4.2.11", "postcss": "8.4.31", - "styled-jsx": "5.1.1", - "watchpack": "2.4.0" + "styled-jsx": "5.1.1" }, "bin": { "next": "dist/bin/next" @@ -2520,18 +2553,19 @@ "node": ">=18.17.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "14.0.2", - "@next/swc-darwin-x64": "14.0.2", - "@next/swc-linux-arm64-gnu": "14.0.2", - "@next/swc-linux-arm64-musl": "14.0.2", - "@next/swc-linux-x64-gnu": "14.0.2", - "@next/swc-linux-x64-musl": "14.0.2", - "@next/swc-win32-arm64-msvc": "14.0.2", - "@next/swc-win32-ia32-msvc": "14.0.2", - "@next/swc-win32-x64-msvc": "14.0.2" + "@next/swc-darwin-arm64": "14.2.3", + "@next/swc-darwin-x64": "14.2.3", + "@next/swc-linux-arm64-gnu": "14.2.3", + "@next/swc-linux-arm64-musl": "14.2.3", + "@next/swc-linux-x64-gnu": "14.2.3", + "@next/swc-linux-x64-musl": "14.2.3", + "@next/swc-win32-arm64-msvc": "14.2.3", + "@next/swc-win32-ia32-msvc": "14.2.3", + "@next/swc-win32-x64-msvc": "14.2.3" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", + "@playwright/test": "^1.41.2", "react": "^18.2.0", "react-dom": "^18.2.0", "sass": "^1.3.0" @@ -2540,11 +2574,24 @@ "@opentelemetry/api": { "optional": true }, + "@playwright/test": { + "optional": true + }, "sass": { "optional": true } } }, + "node_modules/next.js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/next.js/-/next.js-1.0.3.tgz", + "integrity": "sha512-nosnT7Jh4ML3kzwG9MPW+SfBKuHoZEMcCWw5kxwMYXoxnADGzIxWl+TdDMcEZP6Xl/t8m/5uyVlA9SBkH2oh/w==" + }, + "node_modules/nprogress": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz", + "integrity": "sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==" + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -3492,16 +3539,16 @@ "punycode": "^2.1.0" } }, - "node_modules/watchpack": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", - "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", - "dependencies": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - }, - "engines": { - "node": ">=10.13.0" + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" } }, "node_modules/which": { diff --git a/package.json b/package.json index 5f7406f..5f8dba5 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,13 @@ "lint": "next lint" }, "dependencies": { + "bootstrap": "^5.3.3", + "next": "^14.2.3", + "next.js": "^1.0.3", + "nprogress": "^0.2.0", "react": "^18", "react-dom": "^18", - "next": "14.0.2" + "uuid": "^9.0.1" }, "devDependencies": { "eslint": "^8", diff --git a/pages/InfoViewPage/page.js b/pages/InfoViewPage/page.js deleted file mode 100644 index 74d3741..0000000 --- a/pages/InfoViewPage/page.js +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import { useRouter } from 'next/router'; -import ContactInfoView from '@/components/ContactInfoView'; - -const ContactInfoPage = () => { - const router = useRouter(); - const { id } = router.query; - - // Mock function to simulate fetching contact details - const fetchContactDetails = async () => { - // Replace this with your actual data fetching logic or use local data - return { - }; - }; - - const contactDetails = fetchContactDetails(); // Fetch contact details based on the ID - - return ; -}; - -export default ContactInfoPage; \ No newline at end of file diff --git a/pages/_app.js b/pages/_app.js deleted file mode 100644 index 958442e..0000000 --- a/pages/_app.js +++ /dev/null @@ -1,36 +0,0 @@ - -import '../styles/globals.css'; // Import global styles -import 'bootstrap/dist/css/bootstrap.min.css'; // Import Bootstrap styles -import React from 'react'; -import { useRouter } from 'next/router'; -import NProgress from 'nprogress'; // Import NProgress library for page loading indicator -import 'nprogress/nprogress.css'; // Import NProgress styles -import Layout from '@/components/Layout'; // Import your layout component - -// Event listener to start NProgress when a route changes -Router.events.on('routeChangeStart', () => { - NProgress.start(); -}); - -// Event listener to end NProgress when a route changes -Router.events.on('routeChangeComplete', () => { - NProgress.done(); -}); - -// Event listener to handle errors during route changes -Router.events.on('routeChangeError', () => { - NProgress.done(); -}); - -function MyApp({ Component, pageProps }) { - const router = useRouter(); - - return ( - - {/* Render the component for each page */} - - - ); -} - -export default MyApp; \ No newline at end of file diff --git a/pages/addContact.js b/pages/addContact.js new file mode 100644 index 0000000..76f7688 --- /dev/null +++ b/pages/addContact.js @@ -0,0 +1,94 @@ +// pages/add-contact.js + +import React, { useState } from 'react'; +import { v4 as uuidv4 } from 'uuid'; +import { useRouter } from 'next/router'; +import styles from '@/styles/page.module.css'; + + +const AddContactPage = () => { + + const [name, setName] = useState(''); + const [email, setEmail] = useState(''); + const [image, setImage] = useState(''); + const [number, setNumber] = useState(''); + const router = useRouter(); + + const handleSubmit = async (e) => { + e.preventDefault(); + const contact = { + id: uuidv4(), + name, + email, + image_url: image, + phone_number: number, + }; + + const response = await fetch('/api/contactsAPI', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(contact), + }); + + if (response.ok) { + setName(''); + setEmail(''); + setImage(''); + setNumber(''); + + router.push('/'); + } else { + console.error('Failed to add contact'); + } + }; + + return ( +
    +

    Add a New Contact

    +
    + + setName(e.target.value)} + placeholder="Enter Name" + /> +
    +
    + + setEmail(e.target.value)} + placeholder="Enter Email" + /> +
    +
    + + setImage(e.target.value)} + placeholder="Enter Image URL" + /> +
    +
    + + setNumber(e.target.value)} + placeholder="Enter Phone Number" + /> +
    + + +
    + ); +}; + +export default AddContactPage; diff --git a/pages/api/contactsAPI.js b/pages/api/contactsAPI.js index bebc449..35aae62 100644 --- a/pages/api/contactsAPI.js +++ b/pages/api/contactsAPI.js @@ -1,39 +1,23 @@ -import contactsData from '../../data/contactsAPI'; +let contacts = []; -export default async function handler(req, res) { +export default function handler(req, res) { if (req.method === 'GET') { - try { - const { search } = req.query; - - // Filter contacts based on the search term - const filteredContacts = contactsData.filter((contact) => - Object.values(contact).some((value) => - String(value).toLowerCase().includes(search.toLowerCase()) - ) - ); - - return res.status(200).json(filteredContacts); - } catch (error) { - console.error('Error fetching contacts:', error); - return res.status(500).json({ message: 'Internal server error' }); + const { id } = req.query; + if (id) { + const contact = contacts.find(contact => contact.id === id); + if (contact) { + res.status(200).json(contact); + } else { + res.status(404).json({ message: 'Contact not found' }); + } + } else { + res.status(200).json(contacts); } } else if (req.method === 'POST') { - try { - // Extract the contact data from the request body - const contactData = JSON.parse(req.body); - - // Perform the logic to save the contact data to the data/contactsAPI folder or your database - // For simplicity, let's assume you have a function to save the data - // SaveContactToDatabase(contactData); - - // Respond with a success message or the saved contact data - return res.status(200).json({ message: 'Contact added successfully', contact: contactData }); - } catch (error) { - console.error('Error adding contact:', error); - return res.status(500).json({ message: 'Internal server error' }); - } + const newContact = req.body; + contacts.push(newContact); + res.status(201).json({ contact: newContact }); } else { - // Handle other HTTP methods if needed - return res.status(405).json({ message: 'Method Not Allowed' }); + res.status(405).end(); // Method Not Allowed } } diff --git a/pages/contactForm/page.js b/pages/contactForm/page.js deleted file mode 100644 index 235ada7..0000000 --- a/pages/contactForm/page.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; -import ContactForm from './ContactForm'; - -const ContactFormPage = ({ addContact }) => { - return ( -
    -

    Contact Form Page

    - -
    - ); -}; - -export default ContactFormPage; \ No newline at end of file diff --git a/pages/index.js b/pages/index.js index a46c7f3..5474b7c 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,80 +1,66 @@ -// pages/index.js (or Home.js) +// pages/index.js + import React, { useState, useEffect } from 'react'; -import Head from 'next/head'; -import ContactForm from '@/components/ContactForm'; -import ContactsList from '@/components/ContactsList'; +import { useRouter} from 'next/router'; import styles from '@/styles/page.module.css'; +import ContactsList from '@/components/ContactsList'; + + const Home = () => { const [contacts, setContacts] = useState([]); - const [showContactForm, setShowContactForm] = useState(false); - + const [searchTerm, setSearchTerm] = useState(''); + const router = useRouter(); + + const handleAddContact = () => { + router.push('/addContact'); + }; + useEffect(() => { - // Fetch initial contacts when the component mounts const fetchContacts = async () => { try { const response = await fetch('/api/contactsAPI'); const data = await response.json(); + console.log('Fetched Contacts:', data); // Log fetched contacts setContacts(data); + } catch (error) { console.error('Error fetching contacts:', error); } }; - fetchContacts(); - }, []); // Run once when the component mounts to fetch initial data + fetchContacts(); + }, []); - const addContact = async (contact) => { - try { - const response = await fetch('/api/contactsAPI', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(contact), - }); + const filteredContacts = contacts.filter(contact => + contact.name.toLowerCase().includes(searchTerm.toLowerCase()) + ); - if (response.ok) { - const addedContactData = await response.json(); - setContacts((prevContacts) => [...prevContacts, addedContactData.contact]); - setShowContactForm(false); - } else { - console.error('Failed to add contact:', response.statusText); - } - } catch (error) { - console.error('Error adding contact:', error); - } - }; - const handleAddContact = () => { - setShowContactForm(true); - }; return ( - <> - {/* Additional head content if needed */} -
    -
    -
    -
    -

    All Contacts

    - - {showContactForm && } -
    - -
    -
    -
    -
    Profile Pic Name Email Phone
    -
    -
    - -
    +
    +

    All Contacts

    + +
    + setSearchTerm(e.target.value)} + /> +
    +

    Profile Pic

    +

    Name

    +

    Email

    +

    Phone

    -
    -
    - + + +
    +
    ); }; -export default Home; \ No newline at end of file +export default Home; diff --git a/styles/globals.css b/styles/globals.css deleted file mode 100644 index 515036b..0000000 --- a/styles/globals.css +++ /dev/null @@ -1,107 +0,0 @@ -/* :root { - --max-width: 1100px; - --border-radius: 12px; - --font-mono: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono', - 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro', - 'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace; - - --foreground-rgb: 0, 0, 0; - --background-start-rgb: 214, 219, 220; - --background-end-rgb: 255, 255, 255; - - --primary-glow: conic-gradient( - from 180deg at 50% 50%, - #16abff33 0deg, - #0885ff33 55deg, - #54d6ff33 120deg, - #0071ff33 160deg, - transparent 360deg - ); - --secondary-glow: radial-gradient( - rgba(255, 255, 255, 1), - rgba(255, 255, 255, 0) - ); - - --tile-start-rgb: 239, 245, 249; - --tile-end-rgb: 228, 232, 233; - --tile-border: conic-gradient( - #00000080, - #00000040, - #00000030, - #00000020, - #00000010, - #00000010, - #00000080 - ); - - --callout-rgb: 238, 240, 241; - --callout-border-rgb: 172, 175, 176; - --card-rgb: 180, 185, 188; - --card-border-rgb: 131, 134, 135; -} - -@media (prefers-color-scheme: dark) { - :root { - --foreground-rgb: 255, 255, 255; - --background-start-rgb: 0, 0, 0; - --background-end-rgb: 0, 0, 0; - - --primary-glow: radial-gradient(rgba(1, 65, 255, 0.4), rgba(1, 65, 255, 0)); - --secondary-glow: linear-gradient( - to bottom right, - rgba(1, 65, 255, 0), - rgba(1, 65, 255, 0), - rgba(1, 65, 255, 0.3) - ); - - --tile-start-rgb: 2, 13, 46; - --tile-end-rgb: 2, 5, 19; - --tile-border: conic-gradient( - #ffffff80, - #ffffff40, - #ffffff30, - #ffffff20, - #ffffff10, - #ffffff10, - #ffffff80 - ); - - --callout-rgb: 20, 20, 20; - --callout-border-rgb: 108, 108, 108; - --card-rgb: 100, 100, 100; - --card-border-rgb: 200, 200, 200; - } -} - -* { - box-sizing: border-box; - padding: 0; - margin: 0; -} - -html, -body { - max-width: 100vw; - overflow-x: hidden; -} - -body { - color: rgb(var(--foreground-rgb)); - background: linear-gradient( - to bottom, - transparent, - rgb(var(--background-end-rgb)) - ) - rgb(var(--background-start-rgb)); -} - -a { - color: inherit; - text-decoration: none; -} - -@media (prefers-color-scheme: dark) { - html { - color-scheme: dark; - } -} */ diff --git a/styles/page.module.css b/styles/page.module.css index 6676d2c..a89ffd0 100644 --- a/styles/page.module.css +++ b/styles/page.module.css @@ -1,229 +1,39 @@ -.main { - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: center; - padding: 6rem; - min-height: 100vh; -} - -.description { - display: inherit; - justify-content: inherit; - align-items: inherit; - font-size: 0.85rem; - max-width: var(--max-width); - width: 100%; - z-index: 2; - font-family: var(--font-mono); -} - -.description a { - display: flex; - justify-content: center; - align-items: center; - gap: 0.5rem; -} - -.description p { - position: relative; - margin: 0; - padding: 1rem; - background-color: rgba(var(--callout-rgb), 0.5); - border: 1px solid rgba(var(--callout-border-rgb), 0.3); - border-radius: var(--border-radius); -} - -.code { - font-weight: 700; - font-family: var(--font-mono); -} +/* styles/page.module.css */ -.grid { - display: grid; - grid-template-columns: repeat(4, minmax(25%, auto)); - max-width: 100%; - width: var(--max-width); +.formGroup { + margin-bottom: 1rem; } -.card { - padding: 1rem 1.2rem; - border-radius: var(--border-radius); - background: rgba(var(--card-rgb), 0); - border: 1px solid rgba(var(--card-border-rgb), 0); - transition: background 200ms, border 200ms; +.btn { + background-color: blue; + color: white; + padding: 0.5rem 1rem; + border: none; + cursor: pointer; } -.card span { - display: inline-block; - transition: transform 200ms; +.btn:hover { + background-color: darkblue; } -.card h2 { - font-weight: 600; - margin-bottom: 0.7rem; +.contactsList { + list-style-type: none; + padding: 0; } -.card p { - margin: 0; - opacity: 0.6; - font-size: 0.9rem; - line-height: 1.5; - max-width: 30ch; +.contactsListItem { + padding: 0.5rem 0; } -.center { - display: flex; - justify-content: center; - align-items: center; - position: relative; - padding: 4rem 0; -} - -.center::before { - background: var(--secondary-glow); - border-radius: 50%; - width: 480px; - height: 360px; - margin-left: -400px; -} - -.center::after { - background: var(--primary-glow); - width: 240px; - height: 180px; - z-index: -1; -} - -.center::before, -.center::after { - content: ''; - left: 50%; - position: absolute; - filter: blur(45px); - transform: translateZ(0); -} - -.logo { - position: relative; -} -/* Enable hover only on non-touch devices */ -@media (hover: hover) and (pointer: fine) { - .card:hover { - background: rgba(var(--card-rgb), 0.1); - border: 1px solid rgba(var(--card-border-rgb), 0.15); - } - - .card:hover span { - transform: translateX(4px); - } -} - -@media (prefers-reduced-motion) { - .card:hover span { - transform: none; - } -} - -/* Mobile */ -@media (max-width: 700px) { - .content { - padding: 4rem; - } - - .grid { - grid-template-columns: 1fr; - margin-bottom: 120px; - max-width: 320px; - text-align: center; - } - - .card { - padding: 1rem 2.5rem; - } - - .card h2 { - margin-bottom: 0.5rem; - } - - .center { - padding: 8rem 0 6rem; - } - - .center::before { - transform: none; - height: 300px; - } - - .description { - font-size: 0.8rem; - } - - .description a { - padding: 1rem; - } - - .description p, - .description div { - display: flex; - justify-content: center; - position: fixed; - width: 100%; - } - - .description p { - align-items: center; - inset: 0 0 auto; - padding: 2rem 1rem 1.4rem; - border-radius: 0; - border: none; - border-bottom: 1px solid rgba(var(--callout-border-rgb), 0.25); - background: linear-gradient( - to bottom, - rgba(var(--background-start-rgb), 1), - rgba(var(--callout-rgb), 0.5) - ); - background-clip: padding-box; - backdrop-filter: blur(24px); - } - - .description div { - align-items: flex-end; - pointer-events: none; - inset: auto 0 0; - padding: 2rem; - height: 200px; - background: linear-gradient( - to bottom, - transparent 0%, - rgb(var(--background-end-rgb)) 40% - ); - z-index: 1; - } -} - -/* Tablet and Smaller Desktop */ -@media (min-width: 701px) and (max-width: 1120px) { - .grid { - grid-template-columns: repeat(2, 50%); - } -} - -@media (prefers-color-scheme: dark) { - .vercelLogo { - filter: invert(1); - } - - .logo { - filter: invert(1) drop-shadow(0 0 0.3rem #ffffff70); - } +.inputText { + width: 100%; + padding: 0.5rem; + margin: 0.5rem 0; + border: 1px solid #ccc; + border-radius: 4px; } -@keyframes rotate { - from { - transform: rotate(360deg); - } - to { - transform: rotate(0deg); - } -} +.header { + display: in-line; + justify-content: space-between; +} \ No newline at end of file From 2446b0cd77c1fbf9695739d9fa18ae61a5802543 Mon Sep 17 00:00:00 2001 From: lesavantdon <144865003+lesavantdon@users.noreply.github.com> Date: Fri, 7 Jun 2024 23:37:23 -0700 Subject: [PATCH 5/6] 2nd pc draft --- components/ContactForm.js | 46 +++++++--- components/ContactInfoView.js | 2 + components/ContactsList.js | 7 +- pages/addContact.js | 91 ++----------------- .../{contactsAPI.js => contactsAPI/[id].js} | 11 +-- pages/api/contactsAPI/index.js | 13 +++ pages/contactInfo/[id].js | 25 +++++ pages/index.js | 4 +- 8 files changed, 92 insertions(+), 107 deletions(-) rename pages/api/{contactsAPI.js => contactsAPI/[id].js} (53%) create mode 100644 pages/api/contactsAPI/index.js create mode 100644 pages/contactInfo/[id].js diff --git a/components/ContactForm.js b/components/ContactForm.js index ffa1b5a..6bbd286 100644 --- a/components/ContactForm.js +++ b/components/ContactForm.js @@ -1,9 +1,11 @@ -// components/ContactForm.js import React, { useState } from 'react'; import { v4 as uuidv4 } from 'uuid'; import { useRouter } from 'next/router'; +import styles from '@/styles/page.module.css'; -const ContactForm = ({ addContact }) => { + +const AddContactPage = () => { + const [name, setName] = useState(''); const [email, setEmail] = useState(''); const [image_url, setImageUrl] = useState(''); @@ -19,52 +21,72 @@ const ContactForm = ({ addContact }) => { image_url, phone_number, }; - await addContact(contact); - router.push('/'); + + const response = await fetch('/api/contactsAPI', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(contact), + }); + + if (response.ok) { + setName(''); + setEmail(''); + setImageUrl(''); + setPhoneNumber(''); + + router.push('/'); + } else { + console.error('Failed to add contact'); + } }; return (
    -
    +

    Add a New Contact

    +
    setName(e.target.value)} placeholder="Enter Name" />
    -
    +
    setEmail(e.target.value)} placeholder="Enter Email" />
    -
    +
    setImageUrl(e.target.value)} placeholder="Enter Image URL" />
    -
    +
    setPhoneNumber(e.target.value)} placeholder="Enter Phone Number" />
    - + ); }; -export default ContactForm; +export default AddContactPage; \ No newline at end of file diff --git a/components/ContactInfoView.js b/components/ContactInfoView.js index 24dad88..e51d2fb 100644 --- a/components/ContactInfoView.js +++ b/components/ContactInfoView.js @@ -7,11 +7,13 @@ const ContactInfoView = () => { const { id } = router.query; const [contact, setContact] = useState(null); + useEffect(() => { const fetchContact = async () => { try { if (id) { const response = await fetch(`/api/contactsAPI/${id}`); + console.log(`/api/contactsAPI/${id}`); if (response.ok) { const data = await response.json(); setContact(data); diff --git a/components/ContactsList.js b/components/ContactsList.js index d1118b5..e1de8cd 100644 --- a/components/ContactsList.js +++ b/components/ContactsList.js @@ -5,8 +5,9 @@ import styles from '@/styles/page.module.css'; const ContactsList = ({ contacts }) => { const router = useRouter(); - const handleContactClick = (contactId) => { - router.push(`/contactInfoPage/${contactId}`); + const handleContactClick = (id) => { + router.push(`/contactInfo/${id}`); + console.log (`/contactInfo/${id}`); }; return ( @@ -28,4 +29,4 @@ const ContactsList = ({ contacts }) => { ); }; -export default ContactsList; +export default ContactsList; \ No newline at end of file diff --git a/pages/addContact.js b/pages/addContact.js index 76f7688..60b8436 100644 --- a/pages/addContact.js +++ b/pages/addContact.js @@ -1,93 +1,20 @@ -// pages/add-contact.js - -import React, { useState } from 'react'; -import { v4 as uuidv4 } from 'uuid'; +import React from 'react'; +import ContactForm from '@/components/ContactForm'; import { useRouter } from 'next/router'; -import styles from '@/styles/page.module.css'; - const AddContactPage = () => { - - const [name, setName] = useState(''); - const [email, setEmail] = useState(''); - const [image, setImage] = useState(''); - const [number, setNumber] = useState(''); const router = useRouter(); - const handleSubmit = async (e) => { - e.preventDefault(); - const contact = { - id: uuidv4(), - name, - email, - image_url: image, - phone_number: number, - }; - - const response = await fetch('/api/contactsAPI', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(contact), - }); - - if (response.ok) { - setName(''); - setEmail(''); - setImage(''); - setNumber(''); - - router.push('/'); - } else { - console.error('Failed to add contact'); - } + const handleAddContact = () => { + // Navigate back to the home page after adding a contact + router.push('/'); }; return ( -
    -

    Add a New Contact

    -
    - - setName(e.target.value)} - placeholder="Enter Name" - /> -
    -
    - - setEmail(e.target.value)} - placeholder="Enter Email" - /> -
    -
    - - setImage(e.target.value)} - placeholder="Enter Image URL" - /> -
    -
    - - setNumber(e.target.value)} - placeholder="Enter Phone Number" - /> -
    - - -
    +
    + + +
    ); }; diff --git a/pages/api/contactsAPI.js b/pages/api/contactsAPI/[id].js similarity index 53% rename from pages/api/contactsAPI.js rename to pages/api/contactsAPI/[id].js index 35aae62..b830281 100644 --- a/pages/api/contactsAPI.js +++ b/pages/api/contactsAPI/[id].js @@ -1,22 +1,19 @@ let contacts = []; export default function handler(req, res) { + const { id } = req.query; // Extract the ID from the URL parameter if (req.method === 'GET') { - const { id } = req.query; if (id) { - const contact = contacts.find(contact => contact.id === id); + // Find the contact with the matching ID + const contact = contacts.find((contact) => contact.id === id); if (contact) { res.status(200).json(contact); } else { res.status(404).json({ message: 'Contact not found' }); } } else { - res.status(200).json(contacts); + res.status(400).json({ message: 'ID parameter missing' }); // Handle case where ID is missing in the request } - } else if (req.method === 'POST') { - const newContact = req.body; - contacts.push(newContact); - res.status(201).json({ contact: newContact }); } else { res.status(405).end(); // Method Not Allowed } diff --git a/pages/api/contactsAPI/index.js b/pages/api/contactsAPI/index.js new file mode 100644 index 0000000..9a875d5 --- /dev/null +++ b/pages/api/contactsAPI/index.js @@ -0,0 +1,13 @@ +let contacts = []; + +export default function handler(req, res) { + if (req.method === 'GET') { + res.status(200).json(contacts); + } else if (req.method === 'POST') { + const newContact = req.body; + contacts.push(newContact); + res.status(201).json({ contact: newContact }); + } else { + res.status(405).end(); // Method Not Allowed + } +} diff --git a/pages/contactInfo/[id].js b/pages/contactInfo/[id].js new file mode 100644 index 0000000..b5e50b4 --- /dev/null +++ b/pages/contactInfo/[id].js @@ -0,0 +1,25 @@ +// pages/contactinfo/[id].js + +import React from 'react'; +import { useRouter } from 'next/router'; +import ContactInfoView from '@/components/ContactInfoView'; + +const ContactIdPage = () => { + const router = useRouter(); + const {id} = router.query; + + + const handleHomeClick = () => { + router.push('/'); + }; + + return ( +
    +

    Contact Info Page

    + + +
    + ); +}; + +export default ContactIdPage; diff --git a/pages/index.js b/pages/index.js index 5474b7c..7a10eea 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,5 +1,3 @@ -// pages/index.js - import React, { useState, useEffect } from 'react'; import { useRouter} from 'next/router'; import styles from '@/styles/page.module.css'; @@ -63,4 +61,4 @@ const Home = () => { ); }; -export default Home; +export default Home; \ No newline at end of file From 8f5fe39dcb1e339533f7fe3ec57e2cdd29cad5bf Mon Sep 17 00:00:00 2001 From: lesavantdon Date: Thu, 4 Jul 2024 00:58:38 -0700 Subject: [PATCH 6/6] final draft --- README.md | 6 - components/ContactForm.js | 26 ++- components/ContactInfoView.js | 30 ++- components/ContactsList.js | 40 +++- package-lock.json | 399 ++++++++++++++++++++++++++------- package.json | 14 +- pages/api/contactsAPI/[id].js | 2 +- pages/api/contactsAPI/index.js | 2 +- pages/contactInfo/[id].js | 13 +- pages/data/contacts.js | 2 + pages/index.js | 15 +- readme | 0 styles/page.module.css | 112 ++++++++- 13 files changed, 536 insertions(+), 125 deletions(-) delete mode 100644 README.md create mode 100644 pages/data/contacts.js create mode 100644 readme diff --git a/README.md b/README.md deleted file mode 100644 index 989e4cc..0000000 --- a/README.md +++ /dev/null @@ -1,6 +0,0 @@ -## Contact List - -This project has been created by a student at Parsity, an online software engineering course. The work in this repository is wholly of the student based on a sample starter project that can be accessed by looking at the repository that this project forks. - -If you have any questions about this project or the program in general, visit [parsity.io](https://parsity.io/) or email hello@parsity.io. - diff --git a/components/ContactForm.js b/components/ContactForm.js index 6bbd286..fb9a984 100644 --- a/components/ContactForm.js +++ b/components/ContactForm.js @@ -3,17 +3,34 @@ import { v4 as uuidv4 } from 'uuid'; import { useRouter } from 'next/router'; import styles from '@/styles/page.module.css'; - const AddContactPage = () => { - const [name, setName] = useState(''); const [email, setEmail] = useState(''); const [image_url, setImageUrl] = useState(''); const [phone_number, setPhoneNumber] = useState(''); + const [error, setError] = useState(''); const router = useRouter(); + const validateEmail = (email) => { + const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + return regex.test(email); + }; + const handleSubmit = async (e) => { e.preventDefault(); + setError(''); + + // Validate inputs + if (!name || !email || !image_url || !phone_number) { + setError('All fields are required.'); + return; + } + + if (!validateEmail(email)) { + setError('Please enter a valid email address.'); + return; + } + const contact = { id: uuidv4(), name, @@ -35,7 +52,6 @@ const AddContactPage = () => { setEmail(''); setImageUrl(''); setPhoneNumber(''); - router.push('/'); } else { console.error('Failed to add contact'); @@ -45,6 +61,7 @@ const AddContactPage = () => { return (

    Add a New Contact

    + {error &&

    {error}

    }
    { />
    -
    ); }; -export default AddContactPage; \ No newline at end of file +export default AddContactPage; diff --git a/components/ContactInfoView.js b/components/ContactInfoView.js index e51d2fb..25109ce 100644 --- a/components/ContactInfoView.js +++ b/components/ContactInfoView.js @@ -1,5 +1,6 @@ import React, { useEffect, useState } from 'react'; import { useRouter } from 'next/router'; +import PropTypes from 'prop-types'; import styles from '@/styles/page.module.css'; const ContactInfoView = () => { @@ -7,13 +8,15 @@ const ContactInfoView = () => { const { id } = router.query; const [contact, setContact] = useState(null); + const handleHomeClick = () => { + router.push('/'); + }; useEffect(() => { const fetchContact = async () => { try { if (id) { const response = await fetch(`/api/contactsAPI/${id}`); - console.log(`/api/contactsAPI/${id}`); if (response.ok) { const data = await response.json(); setContact(data); @@ -34,13 +37,28 @@ const ContactInfoView = () => { } return ( -
    -

    {contact.name}

    -

    Email: {contact.email}

    -

    Phone: {contact.phone_number}

    - {contact.name} +
    +
    +

    {contact.name}

    + +

    {contact.email}

    +

    {contact.phone_number}

    + +
    ); }; +ContactInfoView.propTypes = { + id: PropTypes.string, + contact: PropTypes.shape({ + name: PropTypes.string, + email: PropTypes.string, + image_url: PropTypes.string, + phone_number: PropTypes.string, + }), +}; + export default ContactInfoView; diff --git a/components/ContactsList.js b/components/ContactsList.js index e1de8cd..d50d8d8 100644 --- a/components/ContactsList.js +++ b/components/ContactsList.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { useRouter } from 'next/router'; import styles from '@/styles/page.module.css'; @@ -7,26 +8,49 @@ const ContactsList = ({ contacts }) => { const handleContactClick = (id) => { router.push(`/contactInfo/${id}`); - console.log (`/contactInfo/${id}`); + }; + const handleEditClick = (id) => { + router.push(`/editContact/${id}`); }; return ( -
      - {contacts.map(contact => ( + {contacts.map((contact) => (
    • handleContactClick(contact.id)}> - + onClick={() => handleContactClick(contact.id)} + > +
      + +
      {contact.name} - {contact.email} + {contact.email} {contact.phone_number} -
    • + + ))}
    ); }; -export default ContactsList; \ No newline at end of file +ContactsList.propTypes = { + contacts: PropTypes.arrayOf( + PropTypes.shape({ + id: PropTypes.string.isRequired, + name: PropTypes.string.isRequired, + email: PropTypes.string.isRequired, + image_url: PropTypes.string.isRequired, + phone_number: PropTypes.string.isRequired, + }) + ).isRequired, +}; + +export default ContactsList; diff --git a/package-lock.json b/package-lock.json index 6dd692e..5921631 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,17 +8,23 @@ "name": "parsity_contact_list_eval", "version": "0.1.0", "dependencies": { + "axios": "^1.7.2", "bootstrap": "^5.3.3", - "next": "^14.2.3", + "next": "^14.2.4", "next.js": "^1.0.3", "nprogress": "^0.2.0", - "react": "^18", - "react-dom": "^18", + "prop-types": "^15.8.1", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "styled-components": "^6.1.11", "uuid": "^9.0.1" }, "devDependencies": { + "@types/node": "^20.14.9", + "@types/react": "^18.3.3", "eslint": "^8", - "eslint-config-next": "14.0.2" + "eslint-config-next": "14.0.2", + "typescript": "^5.5.3" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -42,6 +48,24 @@ "node": ">=6.9.0" } }, + "node_modules/@emotion/is-prop-valid": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.2.tgz", + "integrity": "sha512-uNsoYd37AFmaCdXlg6EYD1KaPOaRWRByMCYzbKUX4+hhMfrxdVSelShywL4JVaAeM/eHUOSprYBQls+/neX3pw==", + "dependencies": { + "@emotion/memoize": "^0.8.1" + } + }, + "node_modules/@emotion/memoize": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.1.tgz", + "integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA==" + }, + "node_modules/@emotion/unitless": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.1.tgz", + "integrity": "sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==" + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -132,9 +156,9 @@ "dev": true }, "node_modules/@next/env": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.3.tgz", - "integrity": "sha512-W7fd7IbkfmeeY2gXrzJYDx8D2lWKbVoTIj1o1ScPHNzvp30s1AuoEFSdr39bC5sjxJaxTtq3OTCZboNp0lNWHA==" + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.4.tgz", + "integrity": "sha512-3EtkY5VDkuV2+lNmKlbkibIJxcO4oIHEhBWne6PaAp+76J9KoSsGvNikp6ivzAT8dhhBMYrm6op2pS1ApG0Hzg==" }, "node_modules/@next/eslint-plugin-next": { "version": "14.0.2", @@ -146,9 +170,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.3.tgz", - "integrity": "sha512-3pEYo/RaGqPP0YzwnlmPN2puaF2WMLM3apt5jLW2fFdXD9+pqcoTzRk+iZsf8ta7+quAe4Q6Ms0nR0SFGFdS1A==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.4.tgz", + "integrity": "sha512-AH3mO4JlFUqsYcwFUHb1wAKlebHU/Hv2u2kb1pAuRanDZ7pD/A/KPD98RHZmwsJpdHQwfEc/06mgpSzwrJYnNg==", "cpu": [ "arm64" ], @@ -161,9 +185,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.3.tgz", - "integrity": "sha512-6adp7waE6P1TYFSXpY366xwsOnEXM+y1kgRpjSRVI2CBDOcbRjsJ67Z6EgKIqWIue52d2q/Mx8g9MszARj8IEA==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.4.tgz", + "integrity": "sha512-QVadW73sWIO6E2VroyUjuAxhWLZWEpiFqHdZdoQ/AMpN9YWGuHV8t2rChr0ahy+irKX5mlDU7OY68k3n4tAZTg==", "cpu": [ "x64" ], @@ -176,9 +200,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.3.tgz", - "integrity": "sha512-cuzCE/1G0ZSnTAHJPUT1rPgQx1w5tzSX7POXSLaS7w2nIUJUD+e25QoXD/hMfxbsT9rslEXugWypJMILBj/QsA==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.4.tgz", + "integrity": "sha512-KT6GUrb3oyCfcfJ+WliXuJnD6pCpZiosx2X3k66HLR+DMoilRb76LpWPGb4tZprawTtcnyrv75ElD6VncVamUQ==", "cpu": [ "arm64" ], @@ -191,9 +215,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.3.tgz", - "integrity": "sha512-0D4/oMM2Y9Ta3nGuCcQN8jjJjmDPYpHX9OJzqk42NZGJocU2MqhBq5tWkJrUQOQY9N+In9xOdymzapM09GeiZw==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.4.tgz", + "integrity": "sha512-Alv8/XGSs/ytwQcbCHwze1HmiIkIVhDHYLjczSVrf0Wi2MvKn/blt7+S6FJitj3yTlMwMxII1gIJ9WepI4aZ/A==", "cpu": [ "arm64" ], @@ -206,9 +230,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.3.tgz", - "integrity": "sha512-ENPiNnBNDInBLyUU5ii8PMQh+4XLr4pG51tOp6aJ9xqFQ2iRI6IH0Ds2yJkAzNV1CfyagcyzPfROMViS2wOZ9w==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.4.tgz", + "integrity": "sha512-ze0ShQDBPCqxLImzw4sCdfnB3lRmN3qGMB2GWDRlq5Wqy4G36pxtNOo2usu/Nm9+V2Rh/QQnrRc2l94kYFXO6Q==", "cpu": [ "x64" ], @@ -221,9 +245,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.3.tgz", - "integrity": "sha512-BTAbq0LnCbF5MtoM7I/9UeUu/8ZBY0i8SFjUMCbPDOLv+un67e2JgyN4pmgfXBwy/I+RHu8q+k+MCkDN6P9ViQ==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.4.tgz", + "integrity": "sha512-8dwC0UJoc6fC7PX70csdaznVMNr16hQrTDAMPvLPloazlcaWfdPogq+UpZX6Drqb1OBlwowz8iG7WR0Tzk/diQ==", "cpu": [ "x64" ], @@ -236,9 +260,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.3.tgz", - "integrity": "sha512-AEHIw/dhAMLNFJFJIJIyOFDzrzI5bAjI9J26gbO5xhAKHYTZ9Or04BesFPXiAYXDNdrwTP2dQceYA4dL1geu8A==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.4.tgz", + "integrity": "sha512-jxyg67NbEWkDyvM+O8UDbPAyYRZqGLQDTPwvrBBeOSyVWW/jFQkQKQ70JDqDSYg1ZDdl+E3nkbFbq8xM8E9x8A==", "cpu": [ "arm64" ], @@ -251,9 +275,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.3.tgz", - "integrity": "sha512-vga40n1q6aYb0CLrM+eEmisfKCR45ixQYXuBXxOOmmoV8sYST9k7E3US32FsY+CkkF7NtzdcebiFT4CHuMSyZw==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.4.tgz", + "integrity": "sha512-twrmN753hjXRdcrZmZttb/m5xaCBFa48Dt3FbeEItpJArxriYDunWxJn+QFXdJ3hPkm4u7CKxncVvnmgQMY1ag==", "cpu": [ "ia32" ], @@ -266,9 +290,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.3.tgz", - "integrity": "sha512-Q1/zm43RWynxrO7lW4ehciQVj+5ePBhOK+/K2P7pLFX3JaJ/IZVC69SHidrmZSOkqz7ECIOhhy7XhAFG4JYyHA==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.4.tgz", + "integrity": "sha512-tkLrjBzqFTP8DVrAAQmZelEahfR9OxWpFR++vAI9FBhCiIxtwHwBHC23SBHCTURBtwB4kc/x44imVOnkKGNVGg==", "cpu": [ "x64" ], @@ -351,6 +375,36 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/node": { + "version": "20.14.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", + "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/prop-types": { + "version": "15.7.12", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", + "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==", + "dev": true + }, + "node_modules/@types/react": { + "version": "18.3.3", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", + "integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", + "dev": true, + "dependencies": { + "@types/prop-types": "*", + "csstype": "^3.0.2" + } + }, + "node_modules/@types/stylis": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/@types/stylis/-/stylis-4.2.5.tgz", + "integrity": "sha512-1Xve+NMN7FWjY14vLoY5tL3BVEQ/n42YLwaqJIPYhotZ9uBHt87VceMwWQpzmdEt2TNXIorIFG+YeCUUW7RInw==" + }, "node_modules/@typescript-eslint/parser": { "version": "6.10.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.10.0.tgz", @@ -680,6 +734,11 @@ "has-symbols": "^1.0.3" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "node_modules/available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", @@ -701,6 +760,16 @@ "node": ">=4" } }, + "node_modules/axios": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/axobject-query": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz", @@ -745,12 +814,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -790,6 +859,14 @@ "node": ">=6" } }, + "node_modules/camelize": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.1.tgz", + "integrity": "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001625", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001625.tgz", @@ -848,6 +925,17 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -868,6 +956,29 @@ "node": ">= 8" } }, + "node_modules/css-color-keywords": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz", + "integrity": "sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg==", + "engines": { + "node": ">=4" + } + }, + "node_modules/css-to-react-native": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-3.2.0.tgz", + "integrity": "sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ==", + "dependencies": { + "camelize": "^1.0.0", + "css-color-keywords": "^1.0.0", + "postcss-value-parser": "^4.0.2" + } + }, + "node_modules/csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" + }, "node_modules/damerau-levenshtein": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", @@ -928,6 +1039,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -1585,9 +1704,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -1632,6 +1751,25 @@ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, + "node_modules/follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -1641,6 +1779,19 @@ "is-callable": "^1.1.3" } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2483,6 +2634,25 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -2534,11 +2704,11 @@ "dev": true }, "node_modules/next": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/next/-/next-14.2.3.tgz", - "integrity": "sha512-dowFkFTR8v79NPJO4QsBUtxv0g9BrS/phluVpMAt2ku7H+cbcBJlopXjkWlwxrk/xGqMemr7JkGPGemPrLLX7A==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/next/-/next-14.2.4.tgz", + "integrity": "sha512-R8/V7vugY+822rsQGQCjoLhMuC9oFj9SOi4Cl4b2wjDrseD0LRZ10W7R6Czo4w9ZznVSshKjuIomsRjvm9EKJQ==", "dependencies": { - "@next/env": "14.2.3", + "@next/env": "14.2.4", "@swc/helpers": "0.5.5", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", @@ -2553,15 +2723,15 @@ "node": ">=18.17.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "14.2.3", - "@next/swc-darwin-x64": "14.2.3", - "@next/swc-linux-arm64-gnu": "14.2.3", - "@next/swc-linux-arm64-musl": "14.2.3", - "@next/swc-linux-x64-gnu": "14.2.3", - "@next/swc-linux-x64-musl": "14.2.3", - "@next/swc-win32-arm64-msvc": "14.2.3", - "@next/swc-win32-ia32-msvc": "14.2.3", - "@next/swc-win32-x64-msvc": "14.2.3" + "@next/swc-darwin-arm64": "14.2.4", + "@next/swc-darwin-x64": "14.2.4", + "@next/swc-linux-arm64-gnu": "14.2.4", + "@next/swc-linux-arm64-musl": "14.2.4", + "@next/swc-linux-x64-gnu": "14.2.4", + "@next/swc-linux-x64-musl": "14.2.4", + "@next/swc-win32-arm64-msvc": "14.2.4", + "@next/swc-win32-ia32-msvc": "14.2.4", + "@next/swc-win32-x64-msvc": "14.2.4" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", @@ -2596,7 +2766,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -2864,6 +3033,11 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -2877,13 +3051,18 @@ "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "dev": true, + "license": "MIT", "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", "react-is": "^16.13.1" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -2914,9 +3093,9 @@ ] }, "node_modules/react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "dependencies": { "loose-envify": "^1.1.0" }, @@ -2925,22 +3104,21 @@ } }, "node_modules/react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "dependencies": { "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" + "scheduler": "^0.23.2" }, "peerDependencies": { - "react": "^18.2.0" + "react": "^18.3.1" } }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "dev": true + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "node_modules/reflect.getprototypeof": { "version": "1.0.4", @@ -3101,9 +3279,9 @@ } }, "node_modules/scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", "dependencies": { "loose-envify": "^1.1.0" } @@ -3152,6 +3330,11 @@ "node": ">= 0.4" } }, + "node_modules/shallowequal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", + "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==" + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -3197,9 +3380,9 @@ } }, "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", "engines": { "node": ">=0.10.0" } @@ -3310,6 +3493,60 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/styled-components": { + "version": "6.1.11", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.11.tgz", + "integrity": "sha512-Ui0jXPzbp1phYij90h12ksljKGqF8ncGx+pjrNPsSPhbUUjWT2tD1FwGo2LF6USCnbrsIhNngDfodhxbegfEOA==", + "dependencies": { + "@emotion/is-prop-valid": "1.2.2", + "@emotion/unitless": "0.8.1", + "@types/stylis": "4.2.5", + "css-to-react-native": "3.2.0", + "csstype": "3.1.3", + "postcss": "8.4.38", + "shallowequal": "1.1.0", + "stylis": "4.3.2", + "tslib": "2.6.2" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/styled-components" + }, + "peerDependencies": { + "react": ">= 16.8.0", + "react-dom": ">= 16.8.0" + } + }, + "node_modules/styled-components/node_modules/postcss": { + "version": "8.4.38", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", + "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.0", + "source-map-js": "^1.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/styled-jsx": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", @@ -3332,6 +3569,11 @@ } } }, + "node_modules/stylis": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.2.tgz", + "integrity": "sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg==" + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -3502,11 +3744,10 @@ } }, "node_modules/typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", + "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", "dev": true, - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -3530,6 +3771,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 5f8dba5..bbb25fc 100644 --- a/package.json +++ b/package.json @@ -9,16 +9,22 @@ "lint": "next lint" }, "dependencies": { + "axios": "^1.7.2", "bootstrap": "^5.3.3", - "next": "^14.2.3", + "next": "^14.2.4", "next.js": "^1.0.3", "nprogress": "^0.2.0", - "react": "^18", - "react-dom": "^18", + "prop-types": "^15.8.1", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "styled-components": "^6.1.11", "uuid": "^9.0.1" }, "devDependencies": { + "@types/node": "^20.14.9", + "@types/react": "^18.3.3", "eslint": "^8", - "eslint-config-next": "14.0.2" + "eslint-config-next": "14.0.2", + "typescript": "^5.5.3" } } diff --git a/pages/api/contactsAPI/[id].js b/pages/api/contactsAPI/[id].js index b830281..6d922d5 100644 --- a/pages/api/contactsAPI/[id].js +++ b/pages/api/contactsAPI/[id].js @@ -1,4 +1,4 @@ -let contacts = []; +import contacts from '../../data/contacts'; export default function handler(req, res) { const { id } = req.query; // Extract the ID from the URL parameter diff --git a/pages/api/contactsAPI/index.js b/pages/api/contactsAPI/index.js index 9a875d5..20a03ce 100644 --- a/pages/api/contactsAPI/index.js +++ b/pages/api/contactsAPI/index.js @@ -1,4 +1,4 @@ -let contacts = []; +import contacts from '../../data/contacts'; export default function handler(req, res) { if (req.method === 'GET') { diff --git a/pages/contactInfo/[id].js b/pages/contactInfo/[id].js index b5e50b4..bacf566 100644 --- a/pages/contactInfo/[id].js +++ b/pages/contactInfo/[id].js @@ -3,21 +3,20 @@ import React from 'react'; import { useRouter } from 'next/router'; import ContactInfoView from '@/components/ContactInfoView'; +import styles from '@/styles/page.module.css'; const ContactIdPage = () => { const router = useRouter(); const {id} = router.query; - - const handleHomeClick = () => { - router.push('/'); - }; - return (
    -

    Contact Info Page

    + + +

    Contact Info Page

    + - +
    ); }; diff --git a/pages/data/contacts.js b/pages/data/contacts.js new file mode 100644 index 0000000..86f0754 --- /dev/null +++ b/pages/data/contacts.js @@ -0,0 +1,2 @@ +const contacts = []; +export default contacts; diff --git a/pages/index.js b/pages/index.js index 7a10eea..4428b5a 100644 --- a/pages/index.js +++ b/pages/index.js @@ -38,8 +38,10 @@ const Home = () => { return (
    -

    All Contacts

    +

    All Contacts

    +
    +
    { value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} /> -
    -

    Profile Pic

    -

    Name

    -

    Email

    -

    Phone

    +
    +

    Profile Pic

    +

    Name

    +

    Email

    +

    Phone

    +
    diff --git a/readme b/readme new file mode 100644 index 0000000..e69de29 diff --git a/styles/page.module.css b/styles/page.module.css index a89ffd0..506030a 100644 --- a/styles/page.module.css +++ b/styles/page.module.css @@ -1,10 +1,50 @@ /* styles/page.module.css */ +/* ContactInfo.module.css */ +.h2 { + /* Your CSS styles here */ + text-align: center; + margin-top: 20px; +} + +.buttonContainer { + display: flex; + justify-content: center; /* Center horizontally */ + margin-bottom: 20px; /* Adjust as needed */ +} + +.circularImage { + + width: 100px; /* Adjust the size as needed */ + height: 100px; /* Ensure the height is equal to the width */ + border-radius: 50%; + object-fit: cover; /* Ensures the image covers the element, maintaining its aspect ratio */ +} + +.centeredContainer + +{ + display: flex; + justify-content: center; /* Center horizontally */ + align-items: center; /* Center vertically */ + height: 75vh; /* Full viewport height to center vertically */ +} .formGroup { margin-bottom: 1rem; } -.btn { +.h1 { + display: flex; + justify-content: center; /* Center horizontally */ + align-items: center; /* Center vertically */ +} + + +.btn + { + display: flex; + justify-content: center; /* Center horizontally */ + align-items: center; /* Center vertically */ background-color: blue; color: white; padding: 0.5rem 1rem; @@ -18,11 +58,47 @@ .contactsList { list-style-type: none; - padding: 0; + padding: 10; } .contactsListItem { - padding: 0.5rem 0; + display: flex; + align-items: center; + justify-content: space-between; + padding: 10px; + background-color: #f0f0f0; + margin-bottom: 10px; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); +} + +.contactsListItem img { + + width: 50px; + height: 50px; + margin-right: 45px; /* Add margin between image and text */ +} + +.contactsListItem span { + display: flex; +} +.contactDetails { + display: flex; + align-items: center; +} + + + +.editButton { + padding: 5px 10px; + background-color: #007bff; + color: white; + border: none; + border-radius: 5px; + cursor: pointer; +} + +.editButton:hover { + background-color: #0056b3; } .inputText { @@ -34,6 +110,32 @@ } .header { - display: in-line; + display: flex; + align-items: center; justify-content: space-between; -} \ No newline at end of file + +} + +.header h2 { + display: grid; + grid-template-columns: auto 1fr auto auto auto; + gap: 45px; + flex: 1; /* Adjust to match the span in .contactsListItem */ + text-align: center; +} + + +.contactInfo { + text-align: center; + padding: 2rem; + border: 1px solid #ccc; + border-radius: px; + background-color: #fff; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); +} +/* page.module.css */ +.error { + color: red; + margin-bottom: 10px; +} +