diff --git a/asset-manifest.json b/asset-manifest.json index f952c91..6892375 100644 --- a/asset-manifest.json +++ b/asset-manifest.json @@ -1,15 +1,15 @@ { "files": { "main.css": "/static/css/main.073c9b0a.css", - "main.js": "/static/js/main.bf458550.js", + "main.js": "/static/js/main.a353131e.js", "static/js/787.e3145bef.chunk.js": "/static/js/787.e3145bef.chunk.js", "index.html": "/index.html", "main.073c9b0a.css.map": "/static/css/main.073c9b0a.css.map", - "main.bf458550.js.map": "/static/js/main.bf458550.js.map", + "main.a353131e.js.map": "/static/js/main.a353131e.js.map", "787.e3145bef.chunk.js.map": "/static/js/787.e3145bef.chunk.js.map" }, "entrypoints": [ "static/css/main.073c9b0a.css", - "static/js/main.bf458550.js" + "static/js/main.a353131e.js" ] } \ No newline at end of file diff --git a/index.html b/index.html index 8be2be1..5e8c0aa 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -How Old Are My Cats
\ No newline at end of file +How Old Are My Cats
\ No newline at end of file diff --git a/new-cat-site/cat-site/src/App.tsx b/new-cat-site/cat-site/src/App.tsx index 90beeb1..3d92ea8 100644 --- a/new-cat-site/cat-site/src/App.tsx +++ b/new-cat-site/cat-site/src/App.tsx @@ -14,7 +14,6 @@ function App() { * @param isoBirthdate incoming iso Birthdate */ function time_since(isoBirthdate: string): string { - console.log("Incoming " + isoBirthdate); let currDate = new Date(); let birthDate = new Date(isoBirthdate); let differenceInTimeMillis = currDate.getTime() - birthDate.getTime(); @@ -25,8 +24,6 @@ function App() { let yearQuotient = Math.floor(differenceInTimeDays / 365); let yearRemainder = differenceInTimeDays % 365; let monthQuotient = Math.floor(yearRemainder / 30); - console.log("Years: " + yearQuotient); - console.log("Days: " + yearRemainder); return yearQuotient + " Years " + monthQuotient + " Months old"; } @@ -35,7 +32,9 @@ function App() {
{/*// TODO - add a filter that will hide cards when you type in the filter*/}
- +
{ diff --git a/new-cat-site/cat-site/src/app/TopBar.tsx b/new-cat-site/cat-site/src/app/TopBar.tsx index 4b4eb22..0e0679d 100644 --- a/new-cat-site/cat-site/src/app/TopBar.tsx +++ b/new-cat-site/cat-site/src/app/TopBar.tsx @@ -5,28 +5,41 @@ import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import textContent from "./contents.json"; +import { nextBirthdayAsStr } from './birthday-calc'; -export default function TopBar() { +export default function TopBar(props: any) { const initialText = textContent["topBar"]["textBeginning"]; + const styles = { + maxWidth: { + width: "100%" + }, + strikethru: { + textDecoration: "line-through" + } + }; + return ( - + {/* Align text with center of screen */} { initialText }   - + { textContent["topBar"]["textStruckThrough"] }   { textContent["topBar"]["textEnd"]} - {/* // TODO put strike-thrus */} +   + + - Next Birthday Is {nextBirthdayAsStr()} + diff --git a/new-cat-site/cat-site/src/app/birthday-calc.ts b/new-cat-site/cat-site/src/app/birthday-calc.ts new file mode 100644 index 0000000..826b891 --- /dev/null +++ b/new-cat-site/cat-site/src/app/birthday-calc.ts @@ -0,0 +1,31 @@ +import textContent from "./contents.json"; + +/** + * This takes in the entire props structure and manipulates incoming string data to generate + * a formatted output to be directly displayed. + * @returns the next birthday details as a string used for the banner of the page + */ +export function nextBirthdayAsStr(): string { + let soonestName: string = "" + let soonestDate: Date = new Date() + let soonestDays: number = 99999 + textContent.cards.forEach(details => { + const date = new Date(details.birthdate); + const todaysDate = new Date(); + + date.setFullYear(2000); + todaysDate.setFullYear(2000); + + let diff = date.getTime() - todaysDate.getTime() + var diffDays = Math.ceil(diff / (1000 * 3600 * 24)); + + // Number of diff days is in the future, and is less than current soonest days + if (diffDays > 0 && diffDays < soonestDays) { + soonestName = details.name + soonestDate = new Date(details.birthdate) + soonestDays = diffDays + } + }) + + return `${soonestName}`; +} \ No newline at end of file diff --git a/new-cat-site/cat-site/src/app/catcard/Card.tsx b/new-cat-site/cat-site/src/app/catcard/Card.tsx index cee4e9f..707dc6d 100644 --- a/new-cat-site/cat-site/src/app/catcard/Card.tsx +++ b/new-cat-site/cat-site/src/app/catcard/Card.tsx @@ -1,8 +1,6 @@ -import * as React from 'react'; import Card from '@mui/joy/Card'; import CardContent from '@mui/joy/CardContent'; import Typography from '@mui/joy/Typography'; -import Carousel from "react-material-ui-carousel"; export default function BasicCard(props: any) { diff --git a/static/js/main.bf458550.js b/static/js/main.a353131e.js similarity index 73% rename from static/js/main.bf458550.js rename to static/js/main.a353131e.js index 1c2e146..32c3c11 100644 --- a/static/js/main.bf458550.js +++ b/static/js/main.a353131e.js @@ -1,3 +1,3 @@ -/*! For license information please see main.bf458550.js.LICENSE.txt */ -!function(){"use strict";var e={463:function(e,t,n){var r=n(791),a=n(296);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n