Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
paul committed Jul 16, 2024
1 parent 59fa65c commit 993d560
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 54 deletions.
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
114 changes: 60 additions & 54 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,67 +13,73 @@ function App() {
// seconds: "00",
// });

const [countdown2, setCountdown2] = useState({
days: "00",
hours: "00",
minutes: "00",
seconds: "00",
});
// const [countdown2, setCountdown2] = useState({
// days: "00",
// hours: "00",
// minutes: "00",
// seconds: "00",
// });

useEffect(() => {
// const newYearTime1 = new Date(
// `June 25 ${new Date().getFullYear()} 00:00:00`
// );
const newYearTime2 = new Date(
`July 1 ${new Date().getFullYear()} 00:00:00`
);
// useEffect(() => {
// // const newYearTime1 = new Date(
// // `June 25 ${new Date().getFullYear()} 00:00:00`
// // );
// const newYearTime2 = new Date(
// `July 1 ${new Date().getFullYear()} 00:00:00`
// );

const updateCountDown = (setCountdown, newYearTime) => {
const interval = setInterval(() => {
const currentTime = new Date();
const diff = newYearTime - currentTime;
const d = Math.floor(diff / (1000 * 60 * 60 * 24));
const h = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const m = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
const s = Math.floor((diff % (1000 * 60)) / 1000);
setCountdown({
days: d < 10 ? `0${d}` : d,
hours: h < 10 ? `0${h}` : h,
minutes: m < 10 ? `0${m}` : m,
seconds: s < 10 ? `0${s}` : s,
});
}, 1000);
// const updateCountDown = (setCountdown, newYearTime) => {
// const interval = setInterval(() => {
// const currentTime = new Date();
// const diff = newYearTime - currentTime;
// const d = Math.floor(diff / (1000 * 60 * 60 * 24));
// const h = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
// const m = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
// const s = Math.floor((diff % (1000 * 60)) / 1000);
// setCountdown({
// days: d < 10 ? `0${d}` : d,
// hours: h < 10 ? `0${h}` : h,
// minutes: m < 10 ? `0${m}` : m,
// seconds: s < 10 ? `0${s}` : s,
// });
// }, 1000);

return () => clearInterval(interval);
};
// return () => clearInterval(interval);
// };

// updateCountDown(setCountdown1, newYearTime1);
updateCountDown(setCountdown2, newYearTime2);
}, []);
// // updateCountDown(setCountdown1, newYearTime1);
// updateCountDown(setCountdown2, newYearTime2);
// }, []);

return (
<div className="App">
<div className="container-fluid">
<div className="col-12 text-center mx-auto">
<h0 className="mt-5">
<b>{new Date().getFullYear()}</b>
</h0>
<h1 className="mt-5">SGC Countdown</h1>
</div>
</div>
{/* {counterBox("25 Jun CDC Launch Day", countdown1)} */}
{counterBox("1 Jul WOG onboarded", countdown2)}

<div className="qr-code-container">
<QRCode
value="https://github.com/opengovsg/sgc-countdown-timer"
size={100}
/>
<p className="text-right">
Anybody from SGC or Redeem welcome to contribute!
</p>
</div>
<div>
<iframe
width="100%"
height="500%"
src="https://p.datadoghq.com/sb/ed664b02-f65c-11eb-b9fa-da7ad0900002-f37bb4ab32c815cb17b7fcfca68fede7?refresh_mode=sliding&from_ts=1719810752213&to_ts=1719814352213&live=true"
></iframe>
</div>
// <div className="App">
// {/* <div className="container-fluid">
// <div className="col-12 text-center mx-auto">
// <h0 className="mt-5">
// <b>{new Date().getFullYear()}</b>
// </h0>
// <h1 className="mt-5">SGC Countdown</h1>
// </div>
// </div>
// {/* {counterBox("25 Jun CDC Launch Day", countdown1)} */}

// <div className="qr-code-container">
// <QRCode
// value="https://github.com/opengovsg/sgc-countdown-timer"
// size={100}
// />
// <p className="text-right">
// Anybody from SGC or Redeem welcome to contribute!
// </p>
// </div>
// </div>
);
}

Expand Down

0 comments on commit 993d560

Please sign in to comment.