From f21d03ab2e9db6754363a05f732c2a503d83643b Mon Sep 17 00:00:00 2001 From: mayabaxx Date: Wed, 18 Oct 2023 14:40:20 +1000 Subject: [PATCH] center the mf divs !!!!!!!!!! grrrrr --- build/ui-display/frontend-app/src/App.css | 57 +++++++++++++++---- build/ui-display/frontend-app/src/App.js | 47 ++++++++++++--- .../src/components/widgets/BusiestWidget.js | 6 +- .../src/components/widgets/DateWidget.js | 10 ---- .../widgets/SuggestedActivityWidget.js | 52 +++++++++++++++++ .../src/components/widgets/WeatherWidget.js | 7 ++- .../src/components/widgets/Widgets.css | 20 ++++++- 7 files changed, 162 insertions(+), 37 deletions(-) create mode 100644 build/ui-display/frontend-app/src/components/widgets/SuggestedActivityWidget.js diff --git a/build/ui-display/frontend-app/src/App.css b/build/ui-display/frontend-app/src/App.css index ed4b801..49b53cf 100644 --- a/build/ui-display/frontend-app/src/App.css +++ b/build/ui-display/frontend-app/src/App.css @@ -12,11 +12,12 @@ .App-header { background-color: #edf6f9; display: flex; + height: 20%; flex-direction: column; align-items: center; justify-content: center; font-size: calc(10px + 2vmin); - color: white; + color: --darkgrey; border-radius: 20px; } @@ -24,22 +25,58 @@ border-radius: 20px; border: 1px solid #454545; background: var(--blue); - width: 962px; - height: 1100px; - margin: auto; - position: relative; - + width: 95%; + height: 95%; + margin: 2.5%; } .Grass-box { border-radius: 20px; border: 1px solid #454545; background: var(--lightgreen); - width: 962px; - height: 279px; + width: 1080px; + height: 20%; + margin: auto; + position: absolute; bottom: 0px; - position: absolute - ; +} + +.shared-div { + position: relative; + width: 100%; + height: 20%; + display: flex; + justify-content: space-between; + /* border: 1px solid #454545; */ +} + +.left-widget { + border-radius: 20px; + width: 47.5%; + height: 100%; + display: flex; /* Use flexbox to center content vertically and horizontally */ + justify-content: center; + align-items: center; + /* border: 1px solid #454545; */ +} + +.right-widget { + border-radius: 20px; + width: 47.5%; + height: 100%; + display: flex; /* Use flexbox to center content vertically and horizontally */ + justify-content: center; + align-items: center; + /* border: 1px solid #454545; */ +} + +.SuggestedTime-box { + display: flex; + background-color: var(--cream); + border-radius: 20px; + border: 1px solid #454545; + width: 100%; + height: 20%; } :root { diff --git a/build/ui-display/frontend-app/src/App.js b/build/ui-display/frontend-app/src/App.js index 18e5792..dede642 100644 --- a/build/ui-display/frontend-app/src/App.js +++ b/build/ui-display/frontend-app/src/App.js @@ -2,23 +2,52 @@ import './App.css'; import DateWidget from './components/widgets/DateWidget'; import ClockWidget from './components/widgets/ClockWidget'; import WeatherWidget from './components/widgets/WeatherWidget'; +import SuggestedActivityWidget from './components/widgets/SuggestedActivityWidget'; import BusiestWidget from './components/widgets/BusiestWidget'; import SuggestedTimeWidget from './components/widgets/SuggestedTimeWidget'; function App() { return ( + //
+ //
+ //
+ // + //
+ // + //
+ //
+ // + // + // here's the sky + //
+ //
+ // here's the grass :D + //
+ //
-
- - -
- - - here's the sky -
- here's the grass :D +
+
+ +
+ +
+
+
+
+ +
+
+ +
+
+
+ {/* */} +
+
+
+ {/* grass here */}
); diff --git a/build/ui-display/frontend-app/src/components/widgets/BusiestWidget.js b/build/ui-display/frontend-app/src/components/widgets/BusiestWidget.js index a9d6f29..8774901 100644 --- a/build/ui-display/frontend-app/src/components/widgets/BusiestWidget.js +++ b/build/ui-display/frontend-app/src/components/widgets/BusiestWidget.js @@ -5,15 +5,15 @@ export default function BusiestWidget() { const [busiest, setBusiest] = useState(""); const [loading, setLoading] = useState(true); - const baseURL = 'https://localhost:8000/display/'; + const baseURL = 'https://localhost:3000/display/'; useEffect(() => { const fetchData = async () => { - const response = await fetch("http://localhost:8000/display/user-totals"); + const response = await fetch("http://localhost:3000/display/user-totals"); const data = await response.json(); if (data) { const times = Object.values(data); - setBusiest(Object.entries(data).filter(([key, value]) => value == Math.max(...times)).map(([key, value]) => key)); + setBusiest(Object.entries(data).filter(([key, value]) => value === Math.max(...times)).map(([key, value]) => key)); setLoading(false); } diff --git a/build/ui-display/frontend-app/src/components/widgets/DateWidget.js b/build/ui-display/frontend-app/src/components/widgets/DateWidget.js index 1249f16..861a9ff 100644 --- a/build/ui-display/frontend-app/src/components/widgets/DateWidget.js +++ b/build/ui-display/frontend-app/src/components/widgets/DateWidget.js @@ -2,12 +2,6 @@ import React from "react"; export default function DateWidget() { const prettyDate = (date) => { - /* - const timeOptions = { - hour: "2-digit", - minute: "2-digit", - hour12: true - };*/ const dateOptions = { day: "numeric", @@ -16,10 +10,6 @@ export default function DateWidget() { }; return new Date(date).toLocaleString('en-AU', dateOptions); - - /* - return [new Date(date).toLocaleTimeString('en-AU', timeOptions), "on", - new Date(date).toLocaleString('en-AU', dateOptions)].join(" "); */ } return ( diff --git a/build/ui-display/frontend-app/src/components/widgets/SuggestedActivityWidget.js b/build/ui-display/frontend-app/src/components/widgets/SuggestedActivityWidget.js new file mode 100644 index 0000000..f8f8dc4 --- /dev/null +++ b/build/ui-display/frontend-app/src/components/widgets/SuggestedActivityWidget.js @@ -0,0 +1,52 @@ +// import React from "react"; + +// export default function ClockWidget() { +// const Activities = ({ weatherCondition }) => { + +// const weatherActivities = { +// 'Thunderstorm': 'movie marathon', +// 'Drizzle': 'bake off', +// 'Rain': 'trip to the library', +// 'Clear': 'picnic', +// 'Clouds': 'game of Catan' +// }; + +// const weather = 'Clear'; +// const activity = weatherActivities[weather] || 'movie'; +// } + + + +// return ( +//
+//

It's looking {weatherCondition} today, how about a {activity}?

+//
+// ); +// } + +import React from 'react'; + +const weatherActivities = { + 'Thunderstorm': 'movie marathon', + 'Drizzle': 'bake off', + 'Rain': 'trip to the library', + 'Clear': 'picnic', + 'Clouds': 'game of Catan' +}; + +const Activities = ({ weatherCondition }) => { + // hard code this value for now + if (!weatherCondition) { + weatherCondition = 'Clear'; + } +// Get the corresponding activity based on the weatherCondition + const activity = weatherActivities[weatherCondition] || 'movie'; + + return ( +
+

It's looking {weatherCondition} today, how about a {activity}?

+
+ ); +} + +export default Activities; \ No newline at end of file diff --git a/build/ui-display/frontend-app/src/components/widgets/WeatherWidget.js b/build/ui-display/frontend-app/src/components/widgets/WeatherWidget.js index 3abee6e..b9d8846 100644 --- a/build/ui-display/frontend-app/src/components/widgets/WeatherWidget.js +++ b/build/ui-display/frontend-app/src/components/widgets/WeatherWidget.js @@ -35,19 +35,22 @@ class WeatherWidget extends Component { }; render() { - const { temperature, icon } = this.state; + const { temperature, icon, condition } = this.state; return (
{temperature !== null && (
-

{temperature}°C

{icon && ( Weather Icon )} +

{temperature}°C

+

+ {condition} +

)}
diff --git a/build/ui-display/frontend-app/src/components/widgets/Widgets.css b/build/ui-display/frontend-app/src/components/widgets/Widgets.css index 00ae87a..7c8dcd7 100644 --- a/build/ui-display/frontend-app/src/components/widgets/Widgets.css +++ b/build/ui-display/frontend-app/src/components/widgets/Widgets.css @@ -1,14 +1,28 @@ @import "../../App.css"; .Clock-box { - background-color: var(--purple); + background-color: var(--cream); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(10px + 2vmin); - color: white; + height: 20%; + color: var(--darkgrey); border-radius: 20px; - margin-top: 200px; + margin-top: 0%; + text-shadow: 0 2px 2px var(--darkgrey); } +.Date-box { + border-radius: 20px; + margin-bottom: 0%; + height: 5%; + display: flex; + width: 100%; + align-items: center; + justify-content: center; + font-size: calc(5px + 2vmin); + background-color: var(--cream); + +} \ No newline at end of file