Skip to content

Commit a05701e

Browse files
committed
Implement ActivatedAppsList
1 parent 119fd94 commit a05701e

13 files changed

Lines changed: 19866 additions & 35 deletions

package-lock.json

Lines changed: 19720 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "borum-sphere",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "The web app for Borum users to read, update, delete, and create their account and the Borum products that they're using",
55
"private": true,
66
"dependencies": {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { useEffect } from "react";
2+
import ChangePassword from "../ChangePassword/changePassword";
3+
import Email from "../InlineFormElements/Email/email";
4+
import FullName from "../InlineFormElements/FullName/fullName";
5+
import Layout from "../Layout/layout";
6+
import Sidebar from "../Sidebar/sidebar";
7+
import accountSettings from "./accountSettings.module.css";
8+
9+
export default function AccountSettings() {
10+
useEffect(() => {
11+
document.title = "Account Settings - Borum Sphere";
12+
}, []);
13+
14+
return (
15+
<Layout sidebar={<Sidebar />}>
16+
<main className={accountSettings.container}>
17+
<h2>Account Settings</h2>
18+
<FullName />
19+
<Email />
20+
<ChangePassword />
21+
</main>
22+
</Layout>
23+
);
24+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@media only screen and (min-width: 600px) {
2+
.container {
3+
width: 500px;
4+
}
5+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { useEffect, useState } from "react";
2+
import Layout from "../Layout/layout";
3+
import Sidebar from "../Sidebar/sidebar";
4+
import activatedAppsList from "./activatedAppsList.module.css";
5+
6+
export default function ActivatedAppsList() {
7+
const [activatedApps, setActivatedApps] = useState([]);
8+
9+
useEffect(() => {
10+
fetch(`http://localhost:8400/login`, {
11+
headers: {
12+
authorization: `Basic ${localStorage.getItem('apiKey')}`
13+
}
14+
}).then(response => {
15+
if (response.ok && response.status !== 204) {
16+
return response.json();
17+
}
18+
}).then(response => {
19+
setActivatedApps(response.data.filter(item => item.activated));
20+
});
21+
22+
document.title = "Activated Apps - Borum Sphere";
23+
}, []);
24+
25+
return (
26+
<Layout sidebar={<Sidebar />}>
27+
<main className={activatedAppsList.container}>
28+
<h2>Activated Borum Apps</h2>
29+
<p>{activatedApps.length} Activated Borum Apps</p>
30+
<ul>
31+
{activatedApps.map(item => <li key={item.name.replace(/\s/g, "")}><img width={50} src={item.logoSrc} alt={`${item.name} Logo`} />{item.name}</li>)}
32+
</ul>
33+
</main>
34+
</Layout>
35+
36+
);
37+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.container ul {
2+
padding-inline-start: 0;
3+
}
4+
5+
.container li {
6+
list-style: none;
7+
text-align: left;
8+
display: flex;
9+
align-items: center;
10+
}
11+
12+
.container li img {
13+
margin-right: 1em;
14+
}

src/App.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { Route, BrowserRouter, Switch } from "react-router-dom";
66
import Dashboard from "./Dashboard/dashboard";
77
import ForgotPassword from "./ForgotPassword/forgotPassword";
88
import ResetPassword from "./ResetPassword/resetPassword";
9+
import AccountSettings from "./AccountSettings/accountSettings";
10+
import ActivatedAppsList from "./ActivatedAppsList/activatedAppsList";
911

1012
function App() {
1113
return (
@@ -14,6 +16,12 @@ function App() {
1416
<Route exact path="/">
1517
<Dashboard />
1618
</Route>
19+
<Route path="/account">
20+
<AccountSettings />
21+
</Route>
22+
<Route path="/apps">
23+
<ActivatedAppsList />
24+
</Route>
1725
<Route path="/signup">
1826
<Register />
1927
</Route>

src/Dashboard/dashboard.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Link, useHistory } from "react-router-dom";
2-
import ChangePassword from "../ChangePassword/changePassword";
3-
import Email from "../InlineFormElements/Email/email";
4-
import FullName from "../InlineFormElements/FullName/fullName";
2+
import AccountSettings from "../AccountSettings/accountSettings";
3+
import ActivatedApps from "../ActivatedAppsList/activatedAppsList";
54
import Layout from "../Layout/layout";
65
import dashboard from "./dashboard.module.css";
76

@@ -14,20 +13,16 @@ export default function Dashboard() {
1413

1514
return (
1615
<Layout>
17-
<article>
18-
<h1>Borum Sphere Dashboard</h1>
19-
<FullName />
20-
<Email />
21-
<ChangePassword />
22-
<div className={dashboard.linkButtons}>
16+
<AccountSettings />
17+
<ActivatedApps />
18+
<div className={dashboard.linkButtons}>
2319
<button>
2420
<Link to="/signup">Create new Borum Account</Link>
2521
</button>
2622
<button className={dashboard.signOut}>
2723
<Link to="/logout">Log Out</Link>
2824
</button>
2925
</div>
30-
</article>
3126
</Layout>
3227
);
3328
}

src/Dashboard/dashboard.module.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
.linkButtons {
22
display: flex;
3-
flex-direction: column;
3+
align-items: center;
44
}
55

66
.linkButtons button {
77
background: white;
8-
font-size: 2em;
8+
font-size: 1em;
99
border: 1px solid blue;
10-
margin-bottom: 1em;
10+
margin-right: 1em;
1111
padding: 1em;
12-
border-radius: 25px;
12+
border-radius: 10px;
1313
}
1414

1515
.linkButtons button:hover {

src/Layout/layout.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import layout from "./layout.module.css";
33
export default function Layout(props) {
44
return (
55
<div className={layout.container}>
6-
<section className="App">
6+
<nav className={layout.sidebar}>{props.sidebar}</nav>
7+
<section className={layout.app}>
78
{props.children}
89
</section>
910

0 commit comments

Comments
 (0)