diff --git a/ui/src/app/page.js b/ui/src/app/page.js index 124afff..51af997 100644 --- a/ui/src/app/page.js +++ b/ui/src/app/page.js @@ -36,12 +36,14 @@ const fetchCounter = async () => { throw new Error("Failed to fetch data"); } + /** @type {CounterApiResponse} */ const data = await response.json(); if (!data) { throw new Error("Invalid response data"); } + /** @type {Counter} */ const result = { currentValue: data.CurrentValue, updatedAt: data.UpdatedAt, @@ -52,7 +54,7 @@ const fetchCounter = async () => { }; return result; } catch (error) { - console.error("Error fetching the current value:", error.message); + /** @type {Counter} */ return { currentValue: null, updatedAt: null, @@ -69,6 +71,7 @@ const fetchCounter = async () => { * @returns {JSX.Element} The Home component. */ const Home = async () => { + /** @type {Counter} */ const data = await fetchCounter(); return ( @@ -78,7 +81,11 @@ const Home = async () => {
- +
); diff --git a/ui/src/components/Callendar/index.jsx b/ui/src/components/Callendar/index.jsx index a4e84ad..4fa9b80 100644 --- a/ui/src/components/Callendar/index.jsx +++ b/ui/src/components/Callendar/index.jsx @@ -13,12 +13,11 @@ import { PopoverTrigger, } from "@/components/ui/popover"; -const Callendar = ({ className }) => { +const Callendar = ({ className, lastTimeReseted, currentCouterValue }) => { const [date, setDate] = React.useState({ - from: new Date(2022, 0, 20), - to: addDays(new Date(2022, 0, 20), 20), + from: lastTimeReseted || new Date(2024, 4, 13), + to: addDays(new Date(2024, 4, 13), currentCouterValue), }); - return (
@@ -53,7 +52,7 @@ const Callendar = ({ className }) => { defaultMonth={date?.from} selected={date} onSelect={() => {}} - numberOfMonths={2} + numberOfMonths={1} disabled={() => true} />