@@ -1,5 +1,5 @@
|
||||
import React, { createContext, useState, ReactNode, useEffect } from "react";
|
||||
import { endOfMonth, getDate, sub, add, compareAsc } from "date-fns";
|
||||
import { endOfMonth, getDate, sub, compareAsc } from "date-fns";
|
||||
// TODO: import types
|
||||
|
||||
type days =
|
||||
@@ -10,7 +10,6 @@ type days =
|
||||
| "Thursday"
|
||||
| "Friday"
|
||||
| "Saturday";
|
||||
|
||||
interface DaysOfWeek {
|
||||
startOfWeek: {
|
||||
Sunday: days[];
|
||||
@@ -23,6 +22,42 @@ interface UpdateCalendarProps {
|
||||
month: number;
|
||||
day: number;
|
||||
}
|
||||
|
||||
interface Month {
|
||||
week1: Date[];
|
||||
week2: Date[];
|
||||
week3: Date[];
|
||||
week4: Date[];
|
||||
week5: Date[];
|
||||
week6: Date[];
|
||||
}
|
||||
|
||||
interface Calendar {
|
||||
startOfWeek: {
|
||||
Sunday: Month;
|
||||
Monday: Month;
|
||||
};
|
||||
}
|
||||
|
||||
// Will replace all states and be used in redis as a form of memoization.
|
||||
interface MonthInfo {
|
||||
date: Date;
|
||||
layout: Calendar;
|
||||
startWeekday: string;
|
||||
endWeekday: string;
|
||||
days: number;
|
||||
}
|
||||
|
||||
interface CurrentMonth {
|
||||
prev: MonthInfo;
|
||||
curr: MonthInfo;
|
||||
next: MonthInfo;
|
||||
}
|
||||
|
||||
interface CalenderMemoize {
|
||||
String: CurrentMonth;
|
||||
}
|
||||
|
||||
interface CalenderContextState {
|
||||
selectedDate: Date;
|
||||
daysOfMonth: [number];
|
||||
@@ -37,14 +72,45 @@ const CalenderContextProvider = ({
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}): JSX.Element => {
|
||||
const indexToDay = {
|
||||
startOfWeek: {
|
||||
Sunday: {
|
||||
0: "Sunday",
|
||||
1: "Monday",
|
||||
2: "Tuesday",
|
||||
3: "Wednesday",
|
||||
4: "Thursday",
|
||||
5: "Friday",
|
||||
6: "Saturday",
|
||||
},
|
||||
Monday: {
|
||||
0: "Monday",
|
||||
1: "Tuesday",
|
||||
2: "Wednesday",
|
||||
3: "Thursday",
|
||||
4: "Friday",
|
||||
5: "Saturday",
|
||||
6: "Sunday",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Selected month & year
|
||||
const [selectedDate, setSelectedDate] = useState<Date>(new Date());
|
||||
// Update this to have the day of week and the last numerical day.
|
||||
const [endOfSelectedMonth, SetEndOfSelectedDMonth] = useState<number>(
|
||||
getDate(endOfMonth(selectedDate))
|
||||
);
|
||||
// Update this to have the day of week and the last numerical day.
|
||||
const [endOfPrevMonth, setEndOfPrevMonth] = useState<number>(
|
||||
getDate(endOfMonth(sub(selectedDate, { months: 1 })))
|
||||
);
|
||||
// Add start of selected month and start of next month, including day of week and numerical day.
|
||||
|
||||
// TODO: Remove this state and all referenced to it once the date alignment algorithm is complete.
|
||||
const [daysOfMonth, setDaysOfMonth] = useState<[number]>([1]);
|
||||
|
||||
// TODO: Repalce this with the new date alignment algorithm.
|
||||
// Update or populate the days of the month.
|
||||
const populateDays = (): void => {
|
||||
let newDaysOfMonth: [number] = [...daysOfMonth];
|
||||
@@ -60,6 +126,7 @@ const CalenderContextProvider = ({
|
||||
setDaysOfMonth(newDaysOfMonth);
|
||||
};
|
||||
|
||||
// TODO: Update new referenced once they are added.
|
||||
// Update selected month sates when the selected month is updated.
|
||||
|
||||
// Update days of month.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"private": true,
|
||||
"name": "lucid-creations-media-potty-chart",
|
||||
"homepage": "https://lucidcreations.media/introducing-code-name-potty-chart/",
|
||||
"version": "v0.0.4.1-pre-alpha",
|
||||
"version": "v0.0.5.1-pre-alpha",
|
||||
"author": {
|
||||
"name": "Lucid Creations Media",
|
||||
"url": "https://lucidcreations.media",
|
||||
@@ -17,7 +17,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@chakra-ui/react": "^1.7.3",
|
||||
"@emotion/react": "^11.7.0",
|
||||
"@emotion/react": "^11.7.1",
|
||||
"@emotion/styled": "^11.6.0",
|
||||
"@types/react": "^17.0.37",
|
||||
"date-fns": "^2.27.0",
|
||||
@@ -30,7 +30,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify/react": "^3.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
||||
"eslint": "^8.4.1",
|
||||
"eslint-config-next": "12.0.7",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
@@ -38,7 +38,7 @@
|
||||
"eslint-plugin-react": "^7.27.1",
|
||||
"eslint-plugin-react-hooks": "^4.3.0",
|
||||
"prettier": "^2.5.1",
|
||||
"typescript": "4.5.2"
|
||||
"typescript": "4.5.4"
|
||||
},
|
||||
"packageManager": "yarn@3.1.0"
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import MobileNav from "./MobileNav";
|
||||
|
||||
const Header = (): JSX.Element => {
|
||||
const appName = "LCM Potty Chart";
|
||||
const appVersion = "v0.0.4.1-pre-alpha";
|
||||
const appVersion = "v0.0.5.1-pre-alpha";
|
||||
|
||||
// Add transparency while not at the top of the page.
|
||||
const [transparentNavbar, setTransparentNavbar] = useState<boolean>(false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export type NavItem = [string, string];
|
||||
export type NavItems = NavItem[];
|
||||
|
||||
const navItems: NavItems = [["Home", "#top"]];
|
||||
const navItems: NavItems = [["Home", "/"]];
|
||||
|
||||
export default navItems;
|
||||
|
||||
122
yarn.lock
122
yarn.lock
@@ -979,16 +979,16 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@emotion/cache@npm:^11.6.0":
|
||||
version: 11.6.0
|
||||
resolution: "@emotion/cache@npm:11.6.0"
|
||||
"@emotion/cache@npm:^11.7.1":
|
||||
version: 11.7.1
|
||||
resolution: "@emotion/cache@npm:11.7.1"
|
||||
dependencies:
|
||||
"@emotion/memoize": ^0.7.4
|
||||
"@emotion/sheet": ^1.1.0
|
||||
"@emotion/utils": ^1.0.0
|
||||
"@emotion/weak-memoize": ^0.2.5
|
||||
stylis: ^4.0.10
|
||||
checksum: 3c72c50bfe06fd7ec2728988181173664183d2320305a01bb757caa6a9d485de25fccde1b173d810423d2ff88a178d5a72cc21db76b9e458311a8ce3044dd2a1
|
||||
stylis: 4.0.13
|
||||
checksum: cf7aa8fe3bacfdedcda94b53e76a7635e122043439715fcfbf7f1a81340cfe6099a59134481a03ec3e0437466566d18528577d1e6ea92f5b98c372b8b38a8f35
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1031,12 +1031,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@emotion/react@npm:^11.7.0":
|
||||
version: 11.7.0
|
||||
resolution: "@emotion/react@npm:11.7.0"
|
||||
"@emotion/react@npm:^11.7.1":
|
||||
version: 11.7.1
|
||||
resolution: "@emotion/react@npm:11.7.1"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.13.10
|
||||
"@emotion/cache": ^11.6.0
|
||||
"@emotion/cache": ^11.7.1
|
||||
"@emotion/serialize": ^1.0.2
|
||||
"@emotion/sheet": ^1.1.0
|
||||
"@emotion/utils": ^1.0.0
|
||||
@@ -1050,7 +1050,7 @@ __metadata:
|
||||
optional: true
|
||||
"@types/react":
|
||||
optional: true
|
||||
checksum: 8b50d61caabe04ae413ae23b98c170da643754ec89f25eb001464095685686585d0f88988bc36432f231e6de6abdbee73308c42ba427de9eaaf5a54d7f2f6ae5
|
||||
checksum: 3392aa71f9c68c16022947959f7f842174e6b075b3baf58e185462411cd9b5a87557109a9225b1abaa2d7200a08b7cb9d7f21aa035f0d36b2c89e19b2a124e02
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1526,12 +1526,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/eslint-plugin@npm:^5.6.0":
|
||||
version: 5.6.0
|
||||
resolution: "@typescript-eslint/eslint-plugin@npm:5.6.0"
|
||||
"@typescript-eslint/eslint-plugin@npm:^5.7.0":
|
||||
version: 5.7.0
|
||||
resolution: "@typescript-eslint/eslint-plugin@npm:5.7.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/experimental-utils": 5.6.0
|
||||
"@typescript-eslint/scope-manager": 5.6.0
|
||||
"@typescript-eslint/experimental-utils": 5.7.0
|
||||
"@typescript-eslint/scope-manager": 5.7.0
|
||||
debug: ^4.3.2
|
||||
functional-red-black-tree: ^1.0.1
|
||||
ignore: ^5.1.8
|
||||
@@ -1544,23 +1544,23 @@ __metadata:
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
checksum: aeae8c2de535cad6032c0b27fbb86baccd07788319efd5a97d828bc03a85eae5e635aff794a1d7a2b3ee2a84d6d6d7e68c42438fee62af42fead89f381df7bca
|
||||
checksum: e3674ee680e5dffecdb5d243d6c958ea8003021919d1b2068a3bebfde8e5303b3cecbc28cd144e1bacececb638b3d90fd3e16cd9e1f2e397c0eac8f148b9d3ac
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/experimental-utils@npm:5.6.0":
|
||||
version: 5.6.0
|
||||
resolution: "@typescript-eslint/experimental-utils@npm:5.6.0"
|
||||
"@typescript-eslint/experimental-utils@npm:5.7.0":
|
||||
version: 5.7.0
|
||||
resolution: "@typescript-eslint/experimental-utils@npm:5.7.0"
|
||||
dependencies:
|
||||
"@types/json-schema": ^7.0.9
|
||||
"@typescript-eslint/scope-manager": 5.6.0
|
||||
"@typescript-eslint/types": 5.6.0
|
||||
"@typescript-eslint/typescript-estree": 5.6.0
|
||||
"@typescript-eslint/scope-manager": 5.7.0
|
||||
"@typescript-eslint/types": 5.7.0
|
||||
"@typescript-eslint/typescript-estree": 5.7.0
|
||||
eslint-scope: ^5.1.1
|
||||
eslint-utils: ^3.0.0
|
||||
peerDependencies:
|
||||
eslint: "*"
|
||||
checksum: f708f38be41a3cb4c8c2c8573a660ce7de88f50becf53bea6679fcc8a56ba73c59f2e1a94f5a7773c8cccaf0c2e4dda679564c67764c989f8137594d6589aa4c
|
||||
checksum: 5e9ca434d834059632bf6f227c9d7f13f143f5a42d8518df6e54db242e971bae09038d9abcc5ff3debab8ecf17c742544ff66778f6bcbc90e94d92ee358d8315
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1591,6 +1591,16 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/scope-manager@npm:5.7.0":
|
||||
version: 5.7.0
|
||||
resolution: "@typescript-eslint/scope-manager@npm:5.7.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 5.7.0
|
||||
"@typescript-eslint/visitor-keys": 5.7.0
|
||||
checksum: 8323e9787cb21c2e6c3de6bef2eb56e7e37c04f9c19413ad54964545dacc27a59ce6c19d660f4a20c0c6a368eee264d231436e9e8f221ed551abdcaf78596e12
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/types@npm:5.6.0":
|
||||
version: 5.6.0
|
||||
resolution: "@typescript-eslint/types@npm:5.6.0"
|
||||
@@ -1598,6 +1608,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/types@npm:5.7.0":
|
||||
version: 5.7.0
|
||||
resolution: "@typescript-eslint/types@npm:5.7.0"
|
||||
checksum: 4573250e59ea9e0b163c3e05e44ffb4b1ba4cdcfd6081c1f0b532e4c4bbbc5eb34ff4286c81c815115a1a1690cc8b1ad7b3ed79f3798773bf494b6ed82d0396b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/typescript-estree@npm:5.6.0":
|
||||
version: 5.6.0
|
||||
resolution: "@typescript-eslint/typescript-estree@npm:5.6.0"
|
||||
@@ -1616,6 +1633,24 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/typescript-estree@npm:5.7.0":
|
||||
version: 5.7.0
|
||||
resolution: "@typescript-eslint/typescript-estree@npm:5.7.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 5.7.0
|
||||
"@typescript-eslint/visitor-keys": 5.7.0
|
||||
debug: ^4.3.2
|
||||
globby: ^11.0.4
|
||||
is-glob: ^4.0.3
|
||||
semver: ^7.3.5
|
||||
tsutils: ^3.21.0
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
checksum: 0a63186e7b89dc3a1607d2b838ee7b44b4471654f3e77d62687242e5cb9d2a2385312f438dcfdcb70dadcb3638a141e1660483f7bb5d2cf3563cc9a43b0b2d94
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/visitor-keys@npm:5.6.0":
|
||||
version: 5.6.0
|
||||
resolution: "@typescript-eslint/visitor-keys@npm:5.6.0"
|
||||
@@ -1626,6 +1661,16 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/visitor-keys@npm:5.7.0":
|
||||
version: 5.7.0
|
||||
resolution: "@typescript-eslint/visitor-keys@npm:5.7.0"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": 5.7.0
|
||||
eslint-visitor-keys: ^3.0.0
|
||||
checksum: 59f7468c37cfcb92eb0de15b7ece47dd64a56c4d03d13167140c980399a4f12f20c1df52534f486cefc46bab65e717689b81decb327d2677063c47c0a26ae875
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"abbrev@npm:1":
|
||||
version: 1.1.1
|
||||
resolution: "abbrev@npm:1.1.1"
|
||||
@@ -4357,11 +4402,11 @@ __metadata:
|
||||
resolution: "lucid-creations-media-potty-chart@workspace:."
|
||||
dependencies:
|
||||
"@chakra-ui/react": ^1.7.3
|
||||
"@emotion/react": ^11.7.0
|
||||
"@emotion/react": ^11.7.1
|
||||
"@emotion/styled": ^11.6.0
|
||||
"@iconify/react": ^3.1.0
|
||||
"@types/react": ^17.0.37
|
||||
"@typescript-eslint/eslint-plugin": ^5.6.0
|
||||
"@typescript-eslint/eslint-plugin": ^5.7.0
|
||||
date-fns: ^2.27.0
|
||||
eslint: ^8.4.1
|
||||
eslint-config-next: 12.0.7
|
||||
@@ -4376,7 +4421,7 @@ __metadata:
|
||||
react: 17.0.2
|
||||
react-dom: 17.0.2
|
||||
sharp: ^0.29.3
|
||||
typescript: 4.5.2
|
||||
typescript: 4.5.4
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@@ -6151,7 +6196,14 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"stylis@npm:^4.0.10, stylis@npm:^4.0.3":
|
||||
"stylis@npm:4.0.13":
|
||||
version: 4.0.13
|
||||
resolution: "stylis@npm:4.0.13"
|
||||
checksum: 8ea7a87028b6383c6a982231c4b5b6150031ce028e0fdaf7b2ace82253d28a8af50cc5a9da8a421d3c7c4441592f393086e332795add672aa4a825f0fe3713a3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"stylis@npm:^4.0.3":
|
||||
version: 4.0.10
|
||||
resolution: "stylis@npm:4.0.10"
|
||||
checksum: 0fecaf5c234ec3ffcb0afc21478742a815a21cb964365259789be9c1692e72e13d8c081c1150fd76ed2146633a3251cdecd6e0c120b158f44bd74c38f81cafb3
|
||||
@@ -6369,23 +6421,23 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@npm:4.5.2":
|
||||
version: 4.5.2
|
||||
resolution: "typescript@npm:4.5.2"
|
||||
"typescript@npm:4.5.4":
|
||||
version: 4.5.4
|
||||
resolution: "typescript@npm:4.5.4"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 74f9ce65d532bdf5d0214b3f60cf37992180023388c87a11ee6f838a803067ef0b63c600fa501b0deb07f989257dce1e244c9635ed79feca40bbccf6e0aa1ebc
|
||||
checksum: 59f3243f9cd6fe3161e6150ff6bf795fc843b4234a655dbd938a310515e0d61afd1ac942799e7415e4334255e41c2c49b7dd5d9fd38a17acd25a6779ca7e0961
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@patch:typescript@4.5.2#~builtin<compat/typescript>":
|
||||
version: 4.5.2
|
||||
resolution: "typescript@patch:typescript@npm%3A4.5.2#~builtin<compat/typescript>::version=4.5.2&hash=ddd1e8"
|
||||
"typescript@patch:typescript@4.5.4#~builtin<compat/typescript>":
|
||||
version: 4.5.4
|
||||
resolution: "typescript@patch:typescript@npm%3A4.5.4#~builtin<compat/typescript>::version=4.5.4&hash=ddd1e8"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 24a439e062a05e3285a4f0e8a40644116ecdca89f3e908bed01e5a01b9aee747e3bcf0e85fe9e017e5ebf0c0863437c39479f2616f55a244c2d82d37022cdc4f
|
||||
checksum: 270255355c3236076dbbd0900ff0b7b159fac7e6a95f9ed8c59f57361c7dace9f1fbffd3b5eb21377c7f636027382ad89eb64b2acfbcd9e08574f04cfc75ca3d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user