rough outline for components

This commit is contained in:
Dylan K 2021-11-05 15:50:45 -05:00
parent 3ab14c4a29
commit 30fca60e96
6 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,11 @@
import React from 'react';
const Footer = () => {
return (
<footer>
<div>&copy; 2021 Dylan Kunkel</div> {/* Maybe actually make this official? */}
</footer>
)
};
export default Footer;

View File

@ -0,0 +1,18 @@
import React from 'react';
import { Link } from 'react-router-dom'; // probably will need this
import Auth from '../../utils/auth';
const Header = () => {
const logout = event => {
event.preventDefault();
Auth.logout();
}
return (
<header>
</header>
)
};
export default Header;

View File

@ -0,0 +1,42 @@
import { useMutation } from "@apollo/client";
import React, { useState } from 'react';
import { ADD_NOTE } from "../../utils/mutations";
import { QUERY_NOTES } from "../../utils/queries";
function NewNote() {
const [formData, setFormData] = useState({
title: "",
noteContent: "",
// do I include isCoordinate?
});
const [addNote, { error }] = useMutation(ADD_NOTE, { // Loosely referenced from regular-warehouse
update(cache, { data: { addNote } }) { // Note sure if/how this will work
try {
const { notes } = cache.readQuery({ query: QUERY_NOTES });
cache.writeQuery({
query: QUERY_NOTES,
data: { notes: [addNote, ...notes] }
});
} catch (e) {
console.error(e);
}
}
});
const handleChange = (event) => {
};
const handleFormSubmit = async (event) => {
};
return (
<div>
</div>
);
}
export default NewNote;

View File

@ -0,0 +1,18 @@
import React from 'react';
import { Link } from 'react-router-dom'; // Don't know if I'll need this
// import { DELETE_NOTE } when it's made (i think)
import { useMutation } from '@apollo/client';
const NoteList = ({ notes }) => {
// const [deleteNote] = useMutation(DELETE_NOTE)
return (
<div>
</div>
);
};
export default NoteList;

View File

@ -89,6 +89,10 @@ const resolvers = {
throw new AuthenticationError('You need to be logged in to post a comment!');
},
// update note
// update comment?
// delete note
// delete comment
}
};

View File

@ -40,6 +40,10 @@ const typeDefs = gql`
addUser(username: String!, email: String!, password: String!): Auth
addNote(title: String!, noteContent: String!, isCoordinate: Boolean): Note # isCoordinate is not required; false by default
addComment(noteId: ID!, commentContent: String!): Note # This is performed on note? Also noteId doesn't exist anywhere AS noteId. How does this work? *Referenced deep-thoughts
# update note
# update comment?
# delete note
# delete comment
}
type Auth {