Skip to content

Pomo 647 add our code to fire base#33

Open
motaz99 wants to merge 12 commits into
mainfrom
pomo-647-add-our-code-to-fire-base
Open

Pomo 647 add our code to fire base#33
motaz99 wants to merge 12 commits into
mainfrom
pomo-647-add-our-code-to-fire-base

Conversation

@motaz99

@motaz99 motaz99 commented Jul 6, 2021

Copy link
Copy Markdown
Contributor

No description provided.

@motaz99 motaz99 requested review from mujz and raghadhav July 6, 2021 09:34
@github-actions

github-actions Bot commented Jul 8, 2021

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 3c77b0c):

https://the-sol-pomodoro--pr33-pomo-647-add-our-cod-csiyyvr0.web.app

(expires Tue, 27 Jul 2021 10:27:47 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@mujz mujz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work man! I left you some comments, most of them are very small and will take you no time to address. Let me know when this is ready for review again by re-requesting review.

Comment thread package.json
"react": "^17.0.2",
"react-bootstrap": "^1.6.0",
"react-dom": "^17.0.2",
"react-firebase-hooks": "^3.0.4",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It doesn't look like you're using this. You should remove it using the command

npm remove react-firebase-hooks

Comment thread public/index.html
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://www.gstatic.com/firebasejs/8.6.5/firebase-app.js"></script>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this necessary? You should not need this since you're adding the npm package for firebase, right?

Comment thread src/component/TimerArea/index.jsx Outdated
@@ -1,15 +1,151 @@
import React from 'react';
/* eslint-disable */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oops, I committed this by mistake. Can you remove this? Sorry 😬

});

useEffect(() => {
const subFunc = (doc) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Give this a better name

Suggested change
const subFunc = (doc) => {
const handleSnapshotChange = (doc) => {

Comment thread src/component/TimerArea/index.jsx Outdated
Comment on lines +45 to +54
setState({
...state,
periodCounter,
currentPeriod: periodTime,
startTime,
stopTime,
isRunning,
isLoading: false,
timeToShow,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is a warning in the browser console saying that you should change this code to

Suggested change
setState({
...state,
periodCounter,
currentPeriod: periodTime,
startTime,
stopTime,
isRunning,
isLoading: false,
timeToShow,
});
setState((prevState) => ({
...prevState,
periodCounter,
currentPeriod: periodTime,
startTime,
stopTime,
isRunning,
isLoading: false,
timeToShow,
}));

Comment thread src/services/timer.js
Comment on lines +69 to +72
* A function that take time as two parameters
* @param {number} startTime time in millisecond
* @param {number} stopTime time in millisecond
* @returns {array} return two time in millisecond as an array

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Improve the documentation by making it say something like this

Suggested change
* A function that take time as two parameters
* @param {number} startTime time in millisecond
* @param {number} stopTime time in millisecond
* @returns {array} return two time in millisecond as an array
* A function that determines the value of startTime at the moment the Pomodoro clock starts, and always returns null for the new stopTime because when a Pomodoro clock starts, the stopTime must be reset to empty.
* @param {number} startTime previous start time in milliseconds
* @param {number} stopTime previous stop time in milliseconds
* @returns {array} the [newStartTime, newStopTime] in milliseconds

Comment thread src/services/timer.js
* @returns {array} return two time in millisecond as an array
*/
export const calcNewStartStopTimes = (startTime, stopTime) => {
const clockTime = new Date().getTime();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's rename clockTime to currentTime to be more precise and clear.

Suggested change
const clockTime = new Date().getTime();
const currentTime = new Date().getTime();

Comment thread src/services/timer.js
*/
export const calcNewStartStopTimes = (startTime, stopTime) => {
const clockTime = new Date().getTime();
const deferenceStartAndStopTime = stopTime ? stopTime - startTime : 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you spot the typo?

Comment thread src/services/timer.js
};

/**
* A function that take three parameters to clculate the time that appear on the UI

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Better grammar

Suggested change
* A function that take three parameters to clculate the time that appear on the UI
* A function that takes three parameters to clculate the time that should appear on the UI

Also, can you spot the typo? (I didn't fix it, I want you to spot it and fix it).

Comment thread src/services/timer.js
Comment on lines +54 to +59
* A function that take two parameter {time2} is object have time as minute and seconds
the second parameter {time1} is the time that subtracts, this function convert the
the object to millisecond and calculate the deference between the two times return new
time as minutes and seconds in an array
* @param {number} time1 the time that subtracts
* @param {object} time2 the time to subtract from

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Improve the documentation

Suggested change
* A function that take two parameter {time2} is object have time as minute and seconds
the second parameter {time1} is the time that subtracts, this function convert the
the object to millisecond and calculate the deference between the two times return new
time as minutes and seconds in an array
* @param {number} time1 the time that subtracts
* @param {object} time2 the time to subtract from
* A function that calculates the deference between the two periods
* @param {number} time1 the subtrahend period in milliseconds
* @param {object} time2 the minuend period as an object that has "mins" and "secs" props
* @returns {number} the duration in milliseconds between the two periods

Also, can you spot the typos?

@motaz99 motaz99 requested a review from mujz July 9, 2021 16:49
@mujz mujz removed their request for review July 13, 2021 10:40
@motaz99 motaz99 requested a review from mujz July 25, 2021 07:04
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