Skip to content

Initial Submit#8

Open
nsLittle wants to merge 28 commits into
projectshft:mainfrom
nsLittle:main
Open

Initial Submit#8
nsLittle wants to merge 28 commits into
projectshft:mainfrom
nsLittle:main

Conversation

@nsLittle
Copy link
Copy Markdown

Initial submission. Can't for the life of me figure out how to pass props to sibling component. Need to step away from this for a bit.

@nsLittle
Copy link
Copy Markdown
Author

Second submission of Rolodex eval

Comment thread components/AllContactsList.js Outdated
{contacts.map((contact, index) => (
<div className='contact-data' key={index}>
<img className='contact-data-url' src={contact.url} alt={contact.name} />
<p className='contact-data-info'><Link href={`/contacts/:${contact.name}`}>{contact.name}</Link></p>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need the : in here {/contacts/:${contact.name}}

Comment thread app/contacts/[name]/page.js Outdated
export default function Individual() {
const rawName = useParams();

console.log(contacts);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chore: clean up console.logs when you are finished with them

Comment thread app/contacts/[name]/page.js Outdated
'use client';
import React from "react";
import { useParams } from "next/navigation";
// import { useRouter } from 'next/router';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chore: remove commented out code

import { useParams } from "next/navigation";
import { Contacts, contacts } from "../../Data/page";

export default function Individual() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

every function at minimum should be commented with what it does, parameters, and return type

Comment thread components/AddContactsBar.tsx Outdated

const handleInputName = (e) => {
setInputName(e.target.value);
console.log(e.target.value);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would recommend removing console logs - this is just a tool to test your code - shouldn't be pushed with finished work

Comment thread components/AddContactsBar.tsx Outdated
} else {
contacts.push(newContact);
// contacts.push(newContact) works, but it doesn't render on home page
// contacts.push(newContact) pushes newContact to Data/page.js, but does not trigger resorting
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed unused code

@nsLittle
Copy link
Copy Markdown
Author

Submitting as Typscript evaluation

Comment thread tsconfig.json
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to enforce Typescript, do true in this one for the next time :)

Comment thread app/Data/page.ts Outdated
@@ -0,0 +1,46 @@
"use client";

export interface Contacts {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface should be singular, if you want multiple of a single contact, then you do:
const contacts: Contact[] = []....

Comment thread app/Data/page.ts Outdated
phone: string;
}

export const contacts = [
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing interface

Comment thread app/Data/page.ts
phone: string;
}

export const sortedContacts = contacts
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's the type?

Suggested change
export const sortedContacts = contacts
export const sortedContacts: SortedContacts[] = contacts

Comment thread app/Data/page.ts Outdated
},
];

export interface SortedContacts {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its the same as Contact interface, you can use that one, no need to repeat it

Comment thread app/layout.tsx Outdated
Comment on lines +6 to +14
// interface Metadata {
// title: string;
// description: string;
// }

// export const metadata: Metadata = {
// title: "TypeX",
// description: "Generated by create next app",
// };
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove please

Comment thread components/AddContactsBar.tsx Outdated
import { useRouter } from "next/navigation";

export default function AddContactsBar({ contacts = [] }) {
interface Contacts {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated

Comment thread components/AddContactsBar.tsx Outdated
Comment on lines +12 to +16
const [inputName, setInputName] = useState("");
const [inputUrl, setInputUrl] = useState("");
const [inputEmail, setInputEmail] = useState("");
const [inputPhone, setInputPhone] = useState("");
const router = useRouter();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing types

Comment thread components/AddContactsBar.tsx Outdated

const handleInputName = (e) => {
setInputName(e.target.value);
console.log(e.target.value);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove console logs please

Comment thread components/AllContactsList.tsx Outdated

export default function AllContactsList({
contacts = [],
// sortedContacts = [],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code should be removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants