Compare commits
9 Commits
ui
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71ee823940 | ||
|
|
e158b5ccd6 | ||
|
|
aafba656c8 | ||
|
|
17de3426e2 | ||
|
|
f58d607c5d | ||
|
|
ddaf3df1a3 | ||
|
|
4398ee2d45 | ||
|
|
3b9ee304db | ||
|
|
f5c8edd74c |
14647
package-lock.json
generated
Normal file
14647
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,12 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@reach/router": "^1.2.1",
|
||||||
"firebase": "^7.2.2",
|
"firebase": "^7.2.2",
|
||||||
"node-sass": "^4.13.0",
|
"node-sass": "^4.13.0",
|
||||||
"react": "^16.11.0",
|
"react": "^16.11.0",
|
||||||
"react-dom": "^16.11.0",
|
"react-dom": "^16.11.0",
|
||||||
|
"react-firebaseui": "^4.1.0",
|
||||||
"react-redux": "^7.1.1",
|
"react-redux": "^7.1.1",
|
||||||
"react-scripts": "3.2.0",
|
"react-scripts": "3.2.0",
|
||||||
"redux": "^4.0.4",
|
"redux": "^4.0.4",
|
||||||
|
|||||||
46
src/App.js
46
src/App.js
@@ -1,17 +1,49 @@
|
|||||||
import React from "react";
|
import React, {useState, useEffect} from "react";
|
||||||
|
import StyledFirebaseAuth from 'react-firebaseui/StyledFirebaseAuth';
|
||||||
|
import firebase from'firebase'
|
||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
|
import { Router } from "@reach/router";
|
||||||
import Boxes from "./boxes/Boxes";
|
import Boxes from "./boxes/Boxes";
|
||||||
import styles from "./App.module.css";
|
import SignedIn from "./SignedIn/SignedIn.js";
|
||||||
import setupStore from "./store/setupStore.js";
|
import setupStore from "./store/setupStore.js";
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
apiKey: "AIzaSyC5krz4RBiT87RK7cEidh3n-A4H63uGcyM",
|
||||||
|
authDomain: "retrod-7e2cd.firebaseapp.com",
|
||||||
|
};
|
||||||
|
const uiConfig = {
|
||||||
|
signInFlow: 'popup',
|
||||||
|
signInSuccessUrl: '/',
|
||||||
|
signInOptions: [
|
||||||
|
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
|
||||||
|
]
|
||||||
|
};
|
||||||
function App() {
|
function App() {
|
||||||
|
const [sprint, setSprint] = useState(1);
|
||||||
|
const [isSignedIn, setSignIn] = useState(false)
|
||||||
|
useEffect(() => {
|
||||||
|
firebase.auth().onAuthStateChanged(user => {
|
||||||
|
setSignIn(!!user)
|
||||||
|
})
|
||||||
|
})
|
||||||
return (
|
return (
|
||||||
<Provider store={setupStore()}>
|
<Provider store={setupStore()}>
|
||||||
<div className={styles.grid}>
|
<Router>
|
||||||
<Boxes sectionName={"What Went Well"} />
|
<Boxes exact path={`/` + sprint} />
|
||||||
<Boxes sectionName={"What Could Be Better"} />
|
</Router>
|
||||||
<Boxes sectionName={"Questions"} />
|
<div>
|
||||||
</div>
|
{isSignedIn ? (
|
||||||
|
<>
|
||||||
|
<SignedIn/>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<h1>You're Not Signed In</h1>
|
||||||
|
<StyledFirebaseAuth uiConfig={uiConfig} firebaseAuth={firebase.auth()}/>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</Provider>
|
</Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,25 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { databaseRef } from '../store/firebase.js'
|
||||||
|
import styles from "./items.module.css";
|
||||||
|
|
||||||
export default function Item({ item }) {
|
export default function Item({ item, boxId, sprint }) {
|
||||||
|
const handleClick = e => {
|
||||||
|
let url;
|
||||||
|
if(boxId === "1"){
|
||||||
|
url = `retros/` + sprint + `/www/`
|
||||||
|
} else if(boxId === "2"){
|
||||||
|
url = `retros/` + sprint + `/!www/`
|
||||||
|
} else if(boxId === "3"){
|
||||||
|
url = `retros/` + sprint + `/questions/`
|
||||||
|
} else {
|
||||||
|
url = 'retros/1/a/'
|
||||||
|
}
|
||||||
|
databaseRef.ref(url + item.id + `/completed`).set(item.completed === false ? true : false)
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div style={{ textDecoration: item.completed ? "line-through" : "" }}>
|
<div className={styles.flexItem}>
|
||||||
{item.title}
|
<p style={{ textDecoration: item.completed ? "line-through" : "" }}>{item.title}</p>
|
||||||
|
<button onClick={handleClick}>{item.completed === false ? <p className={styles.checkmark}>✓</p> : <p className={styles.redx}>x</p>}</button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
15
src/Items/items.module.css
Normal file
15
src/Items/items.module.css
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
.flexItem{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
button{
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.checkmark{
|
||||||
|
color: green;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.redx{
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
@@ -1,23 +1,45 @@
|
|||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
|
import { databaseRef } from '../store/firebase.js'
|
||||||
|
import uuid from "uuid";
|
||||||
|
|
||||||
export default function NewItem({ addItem }) {
|
export default function NewItem({ addItem, boxId, sprint }) {
|
||||||
const [value, setValue ] = useState("");
|
const [value, setValue ] = useState("");
|
||||||
|
|
||||||
const handleSubmit = e => {
|
const handleSubmit = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if(!value) return;
|
let retroRef;
|
||||||
|
let url;
|
||||||
addItem(value);
|
if(boxId === "1"){
|
||||||
setValue("");
|
url = `retros/` + sprint + `/www`;
|
||||||
|
retroRef = databaseRef.ref(url);
|
||||||
|
} else if(boxId === "2"){
|
||||||
|
url = `retros/` + sprint + `/!www`;
|
||||||
|
retroRef = databaseRef.ref(url);
|
||||||
|
} else if(boxId === "3"){
|
||||||
|
url = `retros/` + sprint + `/questions`;
|
||||||
|
retroRef = databaseRef.ref(url);
|
||||||
|
} else {
|
||||||
|
url = 'retros/1/a';
|
||||||
|
retroRef = databaseRef.ref(url);
|
||||||
|
}
|
||||||
|
const item = {
|
||||||
|
completed: false,
|
||||||
|
id: uuid.v4(),
|
||||||
|
title: value,
|
||||||
|
}
|
||||||
|
let objectId = retroRef.push(item);
|
||||||
|
databaseRef.ref(url + `/` + objectId.key + `/id`).set(objectId.key)
|
||||||
|
setValue("")
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit}>
|
<div>
|
||||||
<input
|
<form onSubmit={handleSubmit}>
|
||||||
type="text"
|
<input
|
||||||
value={value}
|
type="text"
|
||||||
placeholder="stuff"
|
value={value}
|
||||||
onChange={e => setValue(e.target.value)}
|
placeholder="stuff"
|
||||||
/>
|
onChange={e => setValue(e.target.value)}
|
||||||
</form>
|
/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
21
src/SignedIn/SignedIn.js
Normal file
21
src/SignedIn/SignedIn.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import React from "react";
|
||||||
|
import firebase from'firebase';
|
||||||
|
import SprintSelect from "../sprintSelect/SprintSelect"
|
||||||
|
import styles from "./signedIn.module.css";
|
||||||
|
|
||||||
|
export default function SignedIn() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className={styles.alignRight}>
|
||||||
|
<div className={styles.marginRight}>
|
||||||
|
<p>{firebase.auth().currentUser.displayName}</p>
|
||||||
|
<div>
|
||||||
|
<img align="right" className={styles.profilePicture} alt='user profile' src={firebase.auth().currentUser.photoURL} />
|
||||||
|
</div>
|
||||||
|
<button className={styles.signOutButton} onClick={() => firebase.auth().signOut()}>Sign Out</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<SprintSelect />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
25
src/SignedIn/signedIn.module.css
Normal file
25
src/SignedIn/signedIn.module.css
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
body{
|
||||||
|
background: lightseagreen;
|
||||||
|
}
|
||||||
|
.alignRight{
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
.marginRight{
|
||||||
|
margin-right: 1rem;
|
||||||
|
}
|
||||||
|
.signOutButton{
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
text-decoration: underline;
|
||||||
|
cursor: pointer;
|
||||||
|
width: 100%;
|
||||||
|
text-align: right;
|
||||||
|
padding: 0;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.alignRight .profilePicture{
|
||||||
|
max-width: 50px;
|
||||||
|
}
|
||||||
@@ -2,12 +2,11 @@ import React from 'react';
|
|||||||
import styles from './Boxes.module.css'
|
import styles from './Boxes.module.css'
|
||||||
import Cards from '../cards/Cards.js'
|
import Cards from '../cards/Cards.js'
|
||||||
|
|
||||||
export default function Boxes({ sectionName }) {
|
export default function Boxes({ sectionName, boxId, sprint }) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h3>{sectionName}</h3>
|
|
||||||
<div className={styles.box}>
|
<div className={styles.box}>
|
||||||
<Cards />
|
<Cards sectionName={sectionName} boxId={boxId} sprint={sprint} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
.box{
|
.box{
|
||||||
border: .15rem solid black;
|
border: .15rem solid black;
|
||||||
|
background: lightgrey;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,43 +2,42 @@ import React, { useState, useEffect, useMemo } from 'react';
|
|||||||
import { databaseRef } from '../store/firebase.js'
|
import { databaseRef } from '../store/firebase.js'
|
||||||
import Item from '../Items/Items.js';
|
import Item from '../Items/Items.js';
|
||||||
import NewItem from '../NewItem/NewItem.js'
|
import NewItem from '../NewItem/NewItem.js'
|
||||||
import uuid from "uuid";
|
import DeleteItem from '../deleteItem/DeleteItem.js'
|
||||||
|
import styles from "./cards.module.css";
|
||||||
|
|
||||||
export function Cards({item, setItem}) {
|
export function Cards({item, setItem, boxId, sprint, sectionName, sprint_id}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h3>{sectionName}</h3>
|
||||||
|
{item.map((i, index) => (
|
||||||
|
<div className={i.sprint_id === sprint ? styles.cardBackground : styles.hide} key={i.id}>
|
||||||
|
<Item
|
||||||
|
item={i}
|
||||||
|
index={index}
|
||||||
|
boxId={boxId}
|
||||||
|
sprint={sprint}
|
||||||
|
/>
|
||||||
|
<DeleteItem item={i} boxId={boxId} sprint={sprint}/>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
<NewItem sprint={sprint} boxId={boxId}/>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const addItem = title => {
|
export default function FirebaseWrapper({sectionName, boxId, sprint}) {
|
||||||
const newItem = [...item, {title, completed: false, id: uuid.v4()}];
|
|
||||||
setItem(newItem)
|
|
||||||
}
|
|
||||||
const deleteItem = id => {
|
|
||||||
const deleted = item.reduce((acc, current) => {
|
|
||||||
if(current.id !== id){
|
|
||||||
return [...acc, current];
|
|
||||||
}
|
|
||||||
return [...acc, {...current, completed: true}]
|
|
||||||
}, [])
|
|
||||||
setItem(deleted)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{item.map((i, index) => (
|
|
||||||
<div key={i.id}>
|
|
||||||
<Item
|
|
||||||
item={i}
|
|
||||||
index={index}
|
|
||||||
/>
|
|
||||||
<button onClick={() => deleteItem(i.id) }>x</button>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
<NewItem addItem={addItem} />
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function FirebaseWrapper() {
|
|
||||||
const [cards, setCards] = useState(null)
|
const [cards, setCards] = useState(null)
|
||||||
const retroRef = useMemo(() => databaseRef.ref('retros/1'), []);
|
let retro;
|
||||||
|
if(boxId === "1"){
|
||||||
|
retro = databaseRef.ref(`retros/` + sprint + `/www`);
|
||||||
|
} else if(boxId === "2"){
|
||||||
|
retro = databaseRef.ref(`retros/` + sprint + `/!www`);
|
||||||
|
} else if(boxId === "3"){
|
||||||
|
retro = databaseRef.ref(`retros/` + sprint + `/questions`);
|
||||||
|
} else {
|
||||||
|
retro = databaseRef.ref('retros/1/a');
|
||||||
|
}
|
||||||
|
const retroRef = useMemo(() => databaseRef.ref(retro), []);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
retroRef.on('value', function(snapshot) {
|
retroRef.on('value', function(snapshot) {
|
||||||
const values = Object.values(snapshot.val())
|
const values = Object.values(snapshot.val())
|
||||||
@@ -52,5 +51,5 @@ export default function FirebaseWrapper() {
|
|||||||
if(!cards) {
|
if(!cards) {
|
||||||
return <div>loading...</div>;
|
return <div>loading...</div>;
|
||||||
};
|
};
|
||||||
return <Cards item={cards} setItem={()=> {}}/>
|
return <Cards sectionName={sectionName} item={cards} boxId={boxId} sprint={sprint} setItem={()=> {}}/>
|
||||||
}
|
}
|
||||||
|
|||||||
8
src/cards/cards.module.css
Normal file
8
src/cards/cards.module.css
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
.cardBackground{
|
||||||
|
background: white;
|
||||||
|
margin: .5em;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
.hide{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
@@ -1,12 +1,31 @@
|
|||||||
import React, {useState} from 'react';
|
import React from 'react';
|
||||||
|
import { databaseRef } from '../store/firebase.js'
|
||||||
|
import styles from "./deleteItem.module.css";
|
||||||
|
|
||||||
export default function DeleteItem({ deleteItem }) {
|
export default function DeleteItem({ item, boxId, objectId, sprint }) {
|
||||||
|
// const [value, setValue ] = useState("");
|
||||||
|
|
||||||
const handleClick = e => {
|
const handleClick = e => {
|
||||||
deleteItem(value);
|
let retroRef;
|
||||||
setValue("");
|
if(boxId === "1"){
|
||||||
|
retroRef = databaseRef.ref(`retros/` + sprint + `/www/` + item.id);
|
||||||
|
} else if(boxId === "2"){
|
||||||
|
retroRef = databaseRef.ref(`retros/` + sprint + `/!www/` + item.id);
|
||||||
|
} else if(boxId === "3"){
|
||||||
|
retroRef = databaseRef.ref(`retros/` + sprint + `/questions/` + item.id);
|
||||||
|
} else {
|
||||||
|
retroRef = databaseRef.ref(`retros/1/a/` + item.id);
|
||||||
|
}
|
||||||
|
// const item = {
|
||||||
|
// completed: false,
|
||||||
|
// id: uuid.v4(),
|
||||||
|
// title: value,
|
||||||
|
// }
|
||||||
|
// databaseRef.ref.remove(retroRef);
|
||||||
|
// setValue("")
|
||||||
|
retroRef.remove()
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<button onClick={handleClick}>x</button>
|
<button className={styles.deleteButton} onClick={handleClick}>DELETE</button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/deleteItem/deleteItem.module.css
Normal file
10
src/deleteItem/deleteItem.module.css
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.deleteButton{
|
||||||
|
color: darkred;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
font-size: .5em;
|
||||||
|
font-weight: bolder;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
54
src/sprintSelect/SprintSelect.js
Normal file
54
src/sprintSelect/SprintSelect.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import React, { useState, useEffect, useMemo } from 'react';
|
||||||
|
import Boxes from "../boxes/Boxes";
|
||||||
|
import { databaseRef } from '../store/firebase.js'
|
||||||
|
import styles from "../sprintSelect/sprintSelect.module.css";
|
||||||
|
|
||||||
|
export function SprintSelect({item}) {
|
||||||
|
const [sprint, setSprint] = useState(1);
|
||||||
|
let sprintArray = [];
|
||||||
|
let sortedSprint;
|
||||||
|
sortedSprint = item.map((i, index) => (
|
||||||
|
sprintArray.push(i.sprint_id)
|
||||||
|
))
|
||||||
|
.reduce((unique, item) => {
|
||||||
|
return unique.includes(item) ? unique : [...unique, item]
|
||||||
|
}, [])
|
||||||
|
.sort();
|
||||||
|
let dropdownSprint;
|
||||||
|
dropdownSprint = sortedSprint.map((i, index) => (
|
||||||
|
<option onClick={() => setSprint(i)}>{i}</option>
|
||||||
|
));
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<label>Choose Sprint:</label>
|
||||||
|
<select>
|
||||||
|
{dropdownSprint}
|
||||||
|
</select>
|
||||||
|
<h3>Sprint {sprint}</h3>
|
||||||
|
<div className={styles.grid}>
|
||||||
|
<Boxes sectionName={"What Went Well"} sprint={sprint} boxId={'1'} />
|
||||||
|
<Boxes sectionName={"What Could Be Better"} sprint={sprint} boxId={'2'}/>
|
||||||
|
<Boxes sectionName={"Questions"} sprint={sprint} boxId={'3'}/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function FirebaseWrapper() {
|
||||||
|
const [cards, setCards] = useState(null)
|
||||||
|
let retro = databaseRef.ref(`retros/1/www`);
|
||||||
|
const retroRef = useMemo(() => databaseRef.ref(retro), []);
|
||||||
|
useEffect(() => {
|
||||||
|
retroRef.on('value', function(snapshot) {
|
||||||
|
const values = Object.values(snapshot.val())
|
||||||
|
setCards(values)
|
||||||
|
});
|
||||||
|
return () => {
|
||||||
|
retroRef.off();
|
||||||
|
}
|
||||||
|
}, [retroRef]);
|
||||||
|
if(!cards) {
|
||||||
|
return <div>loading...</div>;
|
||||||
|
};
|
||||||
|
return <SprintSelect item={cards} setItem={()=> {}}/>
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user