Skip to content

Commit

Permalink
Begun changing the layout of the board
Browse files Browse the repository at this point in the history
- moved all clocks to top left
- Moved weather to top right with a "feels like" section as well
- Moved the voice assistant controls and the motivational phrase to the bottom right

Issue: #2
  • Loading branch information
Femi236 committed Feb 12, 2021
1 parent f62fdf1 commit 47a27c0
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 40 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added planning/board-design-version-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/no-voice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/voice.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 21 additions & 14 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class App extends Component {
constructor() {
super();
this.state = {
render: false, //Set render state to false
render: true, //Set render state to false
};

// Create references to different components that we need to access their methods
Expand Down Expand Up @@ -59,34 +59,41 @@ class App extends Component {
return (
<React.Fragment>
<div className="row container-fluid pt-3">
<div className="col-3 h1 align-left">
<Clock type={1} />
<div className="col-4 h2 align-left text-left pl-5">
<Clock type={2} />
<div className="largerh1">
<Clock type={1} />
</div>

<ImageSlideshow />
</div>

<div className="col-6"></div>
<div className="col-3 h1 text-left">
<Clock type={2} />
<Clock type={3} />
<div className="col-5"></div>
<div className="col-3 h2 text-right pr-5">
<div className="largerh1">
<Weather type={1} ref={this.weatherRef} />
</div>
<Weather type={2} />
</div>

<div className="w-100 d-none d-md-block">
<Spotify />
<div className="uplift">
<Spotify />
</div>
</div>
<div className="w-100 d-none d-md-block"></div>
<div className="w-100 d-none d-md-block"></div>
<div className="w-100 d-none d-md-block"></div>
<div className="col-3 align-left">
<Weather ref={this.weatherRef} />
</div>
<div className="col-3 align-left"></div>
<div className="col-3">
<Todo ref={this.todoRef} />
</div>
<div className="col-2"></div>
<div className="col-4">
<VoiceAssistant
sayWeather={this.sayWeather}
sayTasks={this.sayTasks}
/>
<Todo ref={this.todoRef} />
</div>
<div className="col-6">
<Quote />
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions src/components/VoiceAssistant.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ const VoiceAssistant = (props) => {
onClick={() => (listening ? stopListening() : startListening())}
src={process.env.PUBLIC_URL + img}
alt=""
style={{ height: 80 }}
style={{ height: 40 }}
></img>
<button onClick={() => wikiSearch("michael jordan")}>search</button>
<button onClick={() => thisWikiSearch("Michael Jordan")}>speak</button>
<button onClick={() => thisTellJoke()}>Joke</button>
<p>{transcript}</p>
<img src={getSpeakImage()} alt=""></img>
{/* <button onClick={() => wikiSearch("michael jordan")}>search</button>
<button onClick={() => thisWikiSearch("Michael Jordan")}>speak</button> */}
{/* <button onClick={() => thisTellJoke()}>Joke</button> */}
{/* <p>{transcript}</p> */}
<img src={getSpeakImage()} alt="" style={{ height: 140 }}></img>
</div>
);
};
Expand Down
22 changes: 16 additions & 6 deletions src/components/clock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,24 @@ class Clock extends Component {
returnedTime = (props) => {
// Return different parts of the time depending on the type of component called
if (this.props.type === 1) {
return this.state.date.toLocaleTimeString();
return (
<React.Fragment>
{this.state.date.getHours().toLocaleString() +
":" +
(this.state.date.getMinutes() < 10
? "0" + this.state.date.getMinutes().toLocaleString()
: this.state.date.getMinutes().toLocaleString())}{" "}
<sup>{this.state.date.getSeconds()}</sup>
</React.Fragment>
);
} else if (this.props.type === 2) {
return this.state.weekday[this.state.date.getDay()];
} else if (this.props.type === 3) {
return (
this.state.month[this.state.date.getMonth()] +
" " +
this.state.date.getDate()
<React.Fragment>
{this.state.weekday[this.state.date.getDay()] + " "}
{this.state.month[this.state.date.getMonth()] +
" " +
this.state.date.getDate()}
</React.Fragment>
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/spotify.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Spotify extends Component {

componentDidMount() {
// Call from the API every half second
this.spotifyID = setInterval(() => this.getNowPlaying(), 500);
this.spotifyID = setInterval(() => this.getNowPlaying(), 2000);
}

/**
Expand Down
15 changes: 10 additions & 5 deletions src/components/todo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { authProvider } from "../authProvider";

// The ID of my pi-app list in todo
const taskListID =
"AQMkADAwATMwMAItMjIAM2ItOGJkYi0wMAItMDAKAC4AAAPsE0bgVciJS53tz5qGuCfJAQD4bxjVsPprRZ7XeMcIESaWAAFORSDGAAAA/";
"AQMkADAwATMwMAItMjIAM2ItOGJkYi0wMAItMDAKAC4AAAPsE0bgVciJS53tz5qGuCfJAQD4bxjVsPprRZ7XeMcIESaWAAFORSDGAAAA";
const baseURL = "https://graph.microsoft.com/v1.0/me/todo/lists/";

class App extends Component {
Expand All @@ -20,16 +20,21 @@ class App extends Component {
getAllTasks = async () => {
const token = await authProvider.getAccessToken();
axios
.get(baseURL + taskListID + "tasks/", {
.get(baseURL + taskListID + "/tasks", {
headers: {
Authorization: "Bearer " + token.accessToken,
},
})
.then((res) => {
console.log(res);
let tasks = res.data.value;
this.setState({ tasks });
console.log(tasks);
this.sayTasks();
// let filteredTasks = tasks.filter((x) => x.status !== "completed");
this.setState({ tasks: tasks });

// this.sayTasks();
for (let i = 0; i < this.state.tasks.length; i++) {
console.log(this.state.tasks[i].title);
}
});
};

Expand Down
22 changes: 14 additions & 8 deletions src/components/weather.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const apiKey = process.env.REACT_APP_WEATHER_API_KEY;
class Weather extends Component {
constructor() {
super();
this.state = { temp: 0.0, icon: "04d" };
this.state = { temp: 0.0, icon: "04d", feels_like: 0.0 };
}

componentDidMount() {
Expand All @@ -28,6 +28,7 @@ class Weather extends Component {
this.setState({
temp: Math.round((response.main.temp - 273.15) * 10) / 10,
icon: response.weather[0].icon,
feels_like: Math.round((response.main.feels_like - 273.15) * 10) / 10,
});
};

Expand All @@ -44,17 +45,22 @@ class Weather extends Component {
};

render() {
return (
<React.Fragment>
<div className="h1">
{this.state.temp}°C
if (this.props.type == 1) {
return (
<React.Fragment>
<img
src={`http://openweathermap.org/img/wn/${this.state.icon}@2x.png`}
alt=""
></img>
</div>
</React.Fragment>
);
{this.state.temp}°C
</React.Fragment>
);
}
if (this.props.type == 2) {
return (
<React.Fragment>Feels Like {this.state.feels_like}°C</React.Fragment>
);
}
}
}

Expand Down
11 changes: 11 additions & 0 deletions src/cover.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,14 @@ body {
position: absolute;
z-index: -1;
}

.largerh1 {
font-size: 60px;
}

.uplift {
position: absolute;
left: 40%;
top: 15%;
z-index: 1;
}

0 comments on commit 47a27c0

Please sign in to comment.