diff --git a/README.md b/README.md index d35121b7..964a0938 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ /--------------------------------- THE TREE -----------------------------------/ - + + +```bash THE TREE... (structure of the html elements) (Electron Window) @@ -16,17 +18,20 @@ THE TREE... (structure of the html elements) --> TabDisplay (this is the display for whichever tab has been clicked) - -> (whatever tab gets clicked. Ex. , , etc.) +``` RENDERING FOR DEBUGGING: - To render your component for debuggging/testing (see ExTab for an example component) you can go into TabDisplay (the component - and replace with your component (and pass it any dummy data you will need). + To render your component for debuggging/testing (see ExTab for an example component) you can go into TabDisplay (the + componend and replace with your component (and pass it any dummy data you will need). /---------------------------------- MODEL ------------------------------------/ Model: - The Model manages the interactions between components (mostly tabs) and all the data for the app (list of all tasks ('taskList' - list of all task titles, paired with their 'key' ('titlesKeyPairs')), and the most recently clicked task ('currentTask')). It handles updates to the data (add, edit, remove) in response to actions (clicks, form entries, etc.) that occur from anywhere in the app. + The Model manages the interactions between components (mostly tabs) and all the data for the app (list of all + tasks ('taskList' list of all task titles, paired with their 'key' ('titlesKeyPairs')), and the most recently clicked + task ('currentTask')). It handles updates to the data (add, edit, remove) in response to actions (clicks, form + entries, etc.) that occur from anywhere in the app. What I think 'tasks' are: task = { @@ -37,22 +42,30 @@ THE TREE... (structure of the html elements) } Components and the model: - Basically, I don't think they should interact directly with the model, I think it is easier to test and manage if - the components (tabs) get passed the single function that they need from the Model ('recordFinalState()'), rather than a reference to the entire thing. + Basically, I don't think they should interact directly with the model, I think it is easier to test and manage + if the components (tabs) get passed the single function that they need from the Model ('registerFinalState()'), + rather than a reference to the entire thing. - -> The TabDisplay component (who's role is rendering tabs based on tab clicks) that renders your component will pass - in all the data from the currently selected task that has to do with your component, along with that task's 'key' property (a unique numeric identifier). + -> The TabDisplay component (who's role is rendering tabs based on tab clicks) that renders your component + will pass in all the data from the currently selected task that has to do with your component, along with that + task's 'key' property (a unique numeric identifier), and a reference to the Model's 'registerFinalState()' + function. - -> I think you should handle actions locally, meaning if a user wants to edit a journal entry, then record those changes in - your local copy of the Journal info for the currently selected task in your component's 'state'. Then in your component's 'componentWillUnmount()' method, pass the final version of that state, with all of its accumulated changes (or no changes if nothing changed) back to the Model, and it will update the appropriate task (via the Model's recordFinalState("", this.state, key), which will be passed as a function into your component (again, through the 'props' argument in the - constructor)). (the functional version of the this.setState() method will come in handy, as if you use it, React will automatically re-render your component with the appropriately updated state). + -> I think you should handle actions locally, meaning if a user wants to edit a journal entry, then record + those changes in your local copy of the Journal info for the currently selected task in your component's 'state'. + Then in your component's 'componentWillUnmount()' method, pass the final version of that state, with all of its + accumulated changes (or no changes if nothing changed) back to the Model, and it will update the appropriate task + (via the Model's recordFinalState("", this.state, key), which will be passed as a function into + your component (again, through the 'props' argument in the constructor)). (the functional version of the + this.setState() method will come in handy, as if you use it, React will automatically re-render your component + with the appropriately updated state). *** I'll update ExTab to try and illustrate what I mean *** *** if you think this is bonkers, slack me, I am happy to make changes to try and make it easier :) *** - *** For now, just pretend that you have access to all of the data from the currentTask that has to do with your individual - component, passed in through the 'props' argument in the constructor. *** + *** For now, just pretend that you have access to all of the data from the currentTask that has to do with + your individual component, passed in through the 'props' argument in the constructor. *** /------------------------------- OTHER STUFF? -------------------------------/ diff --git a/src/components/Journal/Journal.css b/src/components/Journal/Journal.css new file mode 100644 index 00000000..1fef6cca --- /dev/null +++ b/src/components/Journal/Journal.css @@ -0,0 +1,3 @@ +#displayContainer { + +} \ No newline at end of file diff --git a/src/components/Journal/View.js b/src/components/Journal/View.js new file mode 100644 index 00000000..9a1abd69 --- /dev/null +++ b/src/components/Journal/View.js @@ -0,0 +1,20 @@ +import React from 'react'; + + + +const View = ({value, entries, handleSubmit, handleChange}) => ( +
+
+