switching between sprints
This commit is contained in:
@@ -13,7 +13,7 @@ const config = {
|
|||||||
};
|
};
|
||||||
const uiConfig = {
|
const uiConfig = {
|
||||||
signInFlow: 'popup',
|
signInFlow: 'popup',
|
||||||
signInSuccessUrl: '/signedIn',
|
signInSuccessUrl: '/',
|
||||||
signInOptions: [
|
signInOptions: [
|
||||||
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
|
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ button{
|
|||||||
}
|
}
|
||||||
.checkmark{
|
.checkmark{
|
||||||
color: green;
|
color: green;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.redx{
|
.redx{
|
||||||
color: red;
|
color: red;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import uuid from "uuid";
|
|||||||
|
|
||||||
export default function NewItem({ addItem, boxId, sprint }) {
|
export default function NewItem({ addItem, boxId, sprint }) {
|
||||||
const [value, setValue ] = useState("");
|
const [value, setValue ] = useState("");
|
||||||
console.log(sprint);
|
|
||||||
const handleSubmit = e => {
|
const handleSubmit = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let retroRef;
|
let retroRef;
|
||||||
@@ -28,7 +27,6 @@ console.log(sprint);
|
|||||||
title: value,
|
title: value,
|
||||||
}
|
}
|
||||||
let objectId = retroRef.push(item);
|
let objectId = retroRef.push(item);
|
||||||
console.log(objectId.key);
|
|
||||||
databaseRef.ref(url + `/` + objectId.key + `/id`).set(objectId.key)
|
databaseRef.ref(url + `/` + objectId.key + `/id`).set(objectId.key)
|
||||||
setValue("")
|
setValue("")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import React, { useState } from "react";
|
import React from "react";
|
||||||
import firebase from'firebase'
|
import firebase from'firebase';
|
||||||
import { Link } from "@reach/router";
|
import SprintSelect from "../sprintSelect/SprintSelect"
|
||||||
import Boxes from "../boxes/Boxes";
|
|
||||||
import styles from "./signedIn.module.css";
|
import styles from "./signedIn.module.css";
|
||||||
|
|
||||||
export default function SignedIn() {
|
export default function SignedIn() {
|
||||||
const [sprint, setSprint] = useState(1);
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className={styles.alignRight}>
|
<div className={styles.alignRight}>
|
||||||
@@ -17,16 +15,7 @@ export default function SignedIn() {
|
|||||||
<button className={styles.signOutButton} onClick={() => firebase.auth().signOut()}>Sign Out</button>
|
<button className={styles.signOutButton} onClick={() => firebase.auth().signOut()}>Sign Out</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<nav>
|
<SprintSelect />
|
||||||
<Link onClick={() => setSprint(sprint + 1)} to={`/` + sprint}>Sprint (+))</Link>
|
|
||||||
{console.log(sprint)}
|
|
||||||
</nav>
|
|
||||||
<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>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
body{
|
body{
|
||||||
background: lightseagreen;
|
background: lightseagreen;
|
||||||
}
|
}
|
||||||
.grid{
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: auto auto auto;
|
|
||||||
grid-column-gap: 1em;
|
|
||||||
margin: 1rem;
|
|
||||||
}
|
|
||||||
.alignRight{
|
.alignRight{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export default function Boxes({ sectionName, boxId, sprint }) {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className={styles.box}>
|
<div className={styles.box}>
|
||||||
<Cards sectionName={sectionName} boxId={boxId} sprint={sprint}/>
|
<Cards sectionName={sectionName} boxId={boxId} sprint={sprint} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import NewItem from '../NewItem/NewItem.js'
|
|||||||
import DeleteItem from '../deleteItem/DeleteItem.js'
|
import DeleteItem from '../deleteItem/DeleteItem.js'
|
||||||
import styles from "./cards.module.css";
|
import styles from "./cards.module.css";
|
||||||
|
|
||||||
export function Cards({item, setItem, boxId, sprint, sectionName}) {
|
export function Cards({item, setItem, boxId, sprint, sectionName, sprint_id}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h3>{sectionName}</h3>
|
<h3>{sectionName}</h3>
|
||||||
{item.map((i, index) => (
|
{item.map((i, index) => (
|
||||||
<div className={styles.cardBackground} key={i.id}>
|
<div className={i.sprint_id === sprint ? styles.cardBackground : styles.hide} key={i.id}>
|
||||||
<Item
|
<Item
|
||||||
item={i}
|
item={i}
|
||||||
index={index}
|
index={index}
|
||||||
|
|||||||
@@ -3,3 +3,6 @@
|
|||||||
margin: .5em;
|
margin: .5em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
|
.hide{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,4 +6,5 @@
|
|||||||
font-size: .5em;
|
font-size: .5em;
|
||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
letter-spacing: 1px;
|
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={()=> {}}/>
|
||||||
|
}
|
||||||
6
src/sprintSelect/sprintSelect.module.css
Normal file
6
src/sprintSelect/sprintSelect.module.css
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.grid{
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto auto auto;
|
||||||
|
grid-column-gap: 1em;
|
||||||
|
margin: 1rem;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user