From be2649cd9c2125a96e060312dbc23415059ab8d4 Mon Sep 17 00:00:00 2001 From: reiyua Date: Thu, 4 Jan 2024 17:29:04 +1100 Subject: [PATCH] Various optimizations, mainly removing unused code and adding comments. --- README.md | 71 ++----------------------------------------- src/App.test.js | 8 ----- src/CountdownTimer.js | 7 +++-- src/ExpiredNotice.js | 2 +- src/ShowCounter.js | 2 +- 5 files changed, 8 insertions(+), 82 deletions(-) delete mode 100644 src/App.test.js diff --git a/README.md b/README.md index 58beeac..ec2068a 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,3 @@ -# Getting Started with Create React App +# TomHodges.github.io -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). - -## Available Scripts - -In the project directory, you can run: - -### `npm start` - -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in your browser. - -The page will reload when you make changes.\ -You may also see any lint errors in the console. - -### `npm test` - -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. - -### `npm run build` - -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `npm run eject` - -**Note: this is a one-way operation. Once you `eject`, you can't go back!** - -If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. - -You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). - -### Code Splitting - -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) - -### Analyzing the Bundle Size - -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) - -### Making a Progressive Web App - -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) - -### Advanced Configuration - -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) - -### Deployment - -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) - -### `npm run build` fails to minify - -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) +This is a webstie which simply displays a countdown timer to my retirement. \ No newline at end of file diff --git a/src/App.test.js b/src/App.test.js deleted file mode 100644 index 1f03afe..0000000 --- a/src/App.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import App from './App'; - -test('renders learn react link', () => { - render(); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); -}); diff --git a/src/CountdownTimer.js b/src/CountdownTimer.js index 9139e14..fd48ec2 100644 --- a/src/CountdownTimer.js +++ b/src/CountdownTimer.js @@ -13,18 +13,19 @@ import Button from 'react-bootstrap/Button'; const CountdownTimer = ({ targetDate }) => { const [days, hours, minutes, seconds] = useCountdown(targetDate); -// Return the JSX to display the countdown timer +// Return the JSX to display the countdown timer, this function will return the ExpiredNotice component if the countdown has finished, +// otherwise it will return the ShowCounter component +// The component below display's the simple text stating the purpose of the timer, and the countdown box itself. return ( -

Countdown to Retirement

+

Countdown to Tom's Retirement

{days + hours + minutes + seconds <= 0 ? ( - ) : ( diff --git a/src/ExpiredNotice.js b/src/ExpiredNotice.js index 9c156f1..60873da 100644 --- a/src/ExpiredNotice.js +++ b/src/ExpiredNotice.js @@ -1,6 +1,6 @@ import React from 'react'; -// ExpiredNotice component +// ExpiredNotice component - simply displays a message that the countdown has finished const ExpiredNotice = () =>
Time's up!
; export default ExpiredNotice; \ No newline at end of file diff --git a/src/ShowCounter.js b/src/ShowCounter.js index d7c3c38..2c17d38 100644 --- a/src/ShowCounter.js +++ b/src/ShowCounter.js @@ -1,4 +1,4 @@ -// This file contains the ShowCounter component which is used to display the countdown timer. +// This file contains the ShowCounter component which is used to display the countdown timer on the website import React from 'react';