mirror of
https://github.com/Dkunk7/crafters-coven.git
synced 2025-12-10 11:05:53 -06:00
rough outline for components
This commit is contained in:
parent
3ab14c4a29
commit
30fca60e96
@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
|
||||
const Footer = () => {
|
||||
return (
|
||||
<footer>
|
||||
<div>© 2021 Dylan Kunkel</div> {/* Maybe actually make this official? */}
|
||||
</footer>
|
||||
)
|
||||
};
|
||||
|
||||
export default Footer;
|
||||
@ -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;
|
||||
@ -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;
|
||||
@ -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;
|
||||
@ -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
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user