Skip to content

Project 1 - PTBC9#42

Open
ianthehamster wants to merge 18 commits intorocketacademy:mainfrom
ianthehamster:main
Open

Project 1 - PTBC9#42
ianthehamster wants to merge 18 commits intorocketacademy:mainfrom
ianthehamster:main

Conversation

@ianthehamster
Copy link

No description provided.

@@ -0,0 +1,74 @@
// Updating the first task in the this.state.tasks array

Choose a reason for hiding this comment

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

Can explain the purpose of this document?

Copy link
Author

Choose a reason for hiding this comment

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

No purpose

<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
<div class="background-container">

Choose a reason for hiding this comment

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

is this a bootstrap class? If not, what purpose does it serve? I don't see any styling anywhere for it.

Copy link
Author

Choose a reason for hiding this comment

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

Used it but deleted the css

.app-container {
display: flex;
flex-direction: column;
height: 100vh; /* height of 100vh ensures that the layout spans the full height */

Choose a reason for hiding this comment

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

redundant comment

Copy link
Author

Choose a reason for hiding this comment

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

Noted

@@ -1,19 +1,105 @@
.App {
text-align: center;
/* App.css */

Choose a reason for hiding this comment

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

redundant comment

Copy link
Author

Choose a reason for hiding this comment

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

Noted

.task-completed {
flex: 1; /* Equal distribution of space */
box-sizing: border-box; /* Include padding and border in the width calculation */
width: calc(33.33% - 40px); /* 33.33% width with 20px margin on each side */

Choose a reason for hiding this comment

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

this seems responsive but might not actually be. 40px on a mobile screen might be a lot.

Copy link
Author

Choose a reason for hiding this comment

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

Will test it out

cols="20"
value={this.state.task}
onChange={this.handleChange}
style={{ height: "400px" }}

Choose a reason for hiding this comment

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

Fixed height might be tricky. What if the user input is more than that? Unless every row has a max of 100px? Overall, is this necessary? Maybe minHeight would be a bit better here. Also, why use inline-styling instead of the css file?

<button onClick={resetLocalStorage}>Reset to Default</button>
</div>
<TaskComposer addTask={addTaskToDo} taskLength={tasks.length} />
{tasks && tasks.length > 0 ? (

Choose a reason for hiding this comment

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

Since tasks is an array, the first condition is always true. [] is a truthy value in JavaScript

Choose a reason for hiding this comment

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

Suggested change
{tasks && tasks.length > 0 ? (
{tasks.length ? (

this would be sufficient here

{tasks.map((task) => (
<Task
key={task.id}
{...task}

Choose a reason for hiding this comment

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

Why add all task properties here as props? I would rather pass the whole task as prop, and then use it in the Task component instead of accessing all properties via component props individually.

Comment on lines +35 to +36
showButton={false}
showButtonInProgress={true}

Choose a reason for hiding this comment

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

If you would include these booleans in a task's data structure as properties, you wouldn't need 4 different tasks list components, but would be able to run this map here completely dynamically and only use a single prop for displaying a certain button or not. Hardcoding like so will lead to problems with extending upon your software in the future.

Comment on lines +21 to +24
this.props.updateTask(this.props.id, updatedTask);

// Close the update form by calling the callback function by setting isEditing in Task.js to false
this.props.onUpdateComplete();

Choose a reason for hiding this comment

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

is onUpdateComplete a callback for updateTask here? I do not think so. The both functions could potentially execute simultaneously, depending on what the functions do. It is not guaranteed that a task is updated before the complete function runs.

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.

2 participants