Skip to content

Commit

Permalink
🍍 Sprint Hala (#46)
Browse files Browse the repository at this point in the history
* πŸ”– 1.7.0: 🍍 Begin `sprint-hala` (Thu - 6/10/21)

* πŸ”– 1.7.1: ✨ Add `start dates` to member profiles in GUI

* πŸ”– 1.7.2: πŸ”§ Modify `dashboard` to return 200 cards per each study member

* πŸ”– 1.7.3: πŸ¦Έβ€β™€οΈ Add Shaza as newest StudyDash `Member #3`!

* πŸ”– 1.7.4: πŸ“¦ Release `sprint-hala` 🍍 ➑ PROD: `v1.7.4-hala` (Sun - 6/20/21)
  • Loading branch information
r002 authored Jun 20, 2021
1 parent 4cbc5e2 commit 496b3ed
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 29 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>Sprint Grape πŸ‡ (Sun 4/25/21)</title>
<title>Sprint Hala 🍍 (Thu - 6/10/21)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body style="visibility: hidden;">
Expand Down
90 changes: 62 additions & 28 deletions src/StudyGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,52 @@ import changelogUri from './data/changelog.json'
import './providers/AuthContext'
import firebase from 'firebase/app'

const uriAllCards = 'https://api.github.com/repos/r002/codenewbie/issues?since=2021-05-03&milestone=1&sort=created&direction=desc&per_page=100'
// const uriVersion = 'https://api.github.com/repos/r002/captains-log/commits?sha=sprint-grape'
const uriAllCards = 'https://api.github.com/repos/studydash/cards/issues?milestone=1&sort=created&direction=desc&per_page=100'
const uriAllCards0 = 'https://api.github.com/repos/studydash/cards/issues?milestone=1&sort=created&direction=desc&per_page=100&creator=r002'
const uriAllCards1 = 'https://api.github.com/repos/studydash/cards/issues?milestone=1&sort=created&direction=desc&per_page=100&creator=anitabe404'
const uriAllCards2 = 'https://api.github.com/repos/studydash/cards/issues?milestone=1&sort=created&direction=desc&per_page=100&creator=shazahuang'

type StudyMember = {
userFullname: string
userHandle: string
startDateStr: string
uid: string
repo: string
active: boolean
}

const studyMembers: StudyMember[] = [
{
userFullname: 'Robert Lin',
userHandle: 'r002',
startDateStr: '2021-05-03T04:00:00Z',
uid: '45280066'
uid: '45280066',
repo: 'https://github.com/studydash/cards',
active: true
},
{
userFullname: 'Anita Beauchamp',
userHandle: 'anitabe404',
startDateStr: '2021-05-04T04:00:00Z',
uid: '9167395'
uid: '9167395',
repo: 'https://github.com/studydash/cards',
active: true
},
{
userFullname: 'Matthew Curcio',
userHandle: 'mccurcio',
startDateStr: '2021-05-10T04:00:00Z',
uid: '1915749'
uid: '1915749',
repo: 'https://github.com/studydash/cards',
active: false
},
{
userFullname: 'Shaza Huang',
userHandle: 'shazahuang',
startDateStr: '2021-06-18T04:00:00Z',
uid: '85973779',
repo: 'https://github.com/studydash/cards',
active: true
}
]
const upDb = new UserProgressDb()
Expand Down Expand Up @@ -79,21 +97,27 @@ tagMap.set('podcast notes', {
icon: 'πŸŽ™'
})

const fetchAllCards = fetch(uriAllCards)
const fetchVersion = fetch(changelogUri)
Promise.all([fetchAllCards, fetchVersion]).then(responses => {
const jsonAllCards = responses[0].json()
const jsonVersion = responses[1].json()
Promise.all([jsonAllCards, jsonVersion]).then(jsonPayloads => {
const allCards = jsonPayloads[0]
const allCommits = jsonPayloads[1]
const fetchAllCards0 = fetch(uriAllCards0)
const fetchAllCards1 = fetch(uriAllCards1)
const fetchAllCards2 = fetch(uriAllCards2)
Promise.all([fetchVersion, fetchAllCards0, fetchAllCards1, fetchAllCards2]).then(responses => {
const jsonVersion = responses[0].json()
const jsonAllCards0 = responses[1].json()
const jsonAllCards1 = responses[2].json()
const jsonAllCards2 = responses[3].json()
Promise.all([jsonVersion, jsonAllCards0, jsonAllCards1, jsonAllCards2]).then(jsonPayloads => {
const allCommits = jsonPayloads[0]
const allCards0 = jsonPayloads[1]
const allCards1 = jsonPayloads[2]
const allCards2 = jsonPayloads[3]
const latestCommit = {
version: allCommits[0].version,
message: allCommits[0].message,
built: new Date(allCommits[0].built)
}

for (const item of allCards) {
for (const item of allCards0.concat(allCards1).concat(allCards2)) {
// Ad-hoc code to adjust dates of Anita's cards - 5/11/21
// This is a total hack. Write a proper `updateCard(...)` method later
if (item.number === 16) {
Expand Down Expand Up @@ -180,12 +204,13 @@ type TCard = {
updated: Date
tags: Tag[]
comments: number
repo: string
}
const CardComp: React.FC<TCard> = (props) => {
const title = props.title.length > 51 ? props.title.substr(0, 48) + '...' : props.title
return (
<FCard>
<a href={'https://github.com/r002/codenewbie/issues/' + props.number}>{title}</a>
<a href={props.repo + '/issues/' + props.number}>{title}</a>
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%' }}>
<div>
<PtrSpan title={'Created: ' + props.created.toString()}>{formatTime(props.created)}</PtrSpan>&nbsp;
Expand Down Expand Up @@ -422,11 +447,11 @@ const StudyGroup: React.FC<TStudyGroup> = (props) => {
return (
<FStudyGroup>
<FTopbarLinks>
<a href='https://github.com/r002/codenewbie/issues/75'>Roadmap/Specs</a>&nbsp;&nbsp;&nbsp;
<a href='https://github.com/studydash/cards/issues/75'>Roadmap/Specs</a>&nbsp;&nbsp;&nbsp;
<a href={uriAllCards}>Raw Data</a>&nbsp;&nbsp;&nbsp;
<a href='https://github.com/r002/codenewbie/issues'>Repo</a>&nbsp;&nbsp;&nbsp;
<a href='https://github.com/r002/codenewbie/issues/4'>Members</a>&nbsp;&nbsp;&nbsp;
<a href='https://github.com/r002/codenewbie/discussions/30?sort=new'>History</a>&nbsp;&nbsp;&nbsp;
<a href='https://github.com/studydash/cards/issues'>Repo</a>&nbsp;&nbsp;&nbsp;
<a href='https://github.com/studydash/cards/issues/4'>Members</a>&nbsp;&nbsp;&nbsp;
<a href='https://github.com/studydash/cards/discussions/30?sort=new'>History</a>&nbsp;&nbsp;&nbsp;
<a href='https://github.com/r002/captains-log/blob/main/src/data/changelog.json'>Changelog</a>&nbsp;&nbsp;&nbsp;
<a href='https://community.codenewbie.org/r002/5-codenewbie-study-group-cohort-looking-for-study-mates-4lpj'>CodeNewbie</a>
</FTopbarLinks>
Expand All @@ -439,13 +464,20 @@ const StudyGroup: React.FC<TStudyGroup> = (props) => {
const handle = member.userHandle
const streak = upDb.getUser(handle)?.CurrentStreak
const missedDays = upDb.getUser(handle)?.MissedDays
return (
const rs = []
const content =
<div key={'member' + i}>
Member #{i}: <a href={'https://github.com/' + handle}>{handle}</a> |
Streak: {streak} consecutive days |
Start: {(new Date(member.startDateStr)).toDateString()} |
Missed Days: {missedDays}<br />
</div>
)
if (member.active) {
rs.push(content)
} else {
rs.push(<s key={'member' + i}>{content}</s>)
}
return (rs)
})
}
<br />
Expand Down Expand Up @@ -475,12 +507,14 @@ const StudyGroup: React.FC<TStudyGroup> = (props) => {
</FVertical>
{
studyMembers.map((m: StudyMember, i: number) =>
<FVertical key={'vertical' + i}>
<MemberCard key={m.uid} name={m.userFullname} userHandle={m.userHandle} uid={m.uid} />
{
dateRange.map((day: TDay, i: number) => renderCard(upDb, m, day, i))
}
</FVertical>
m.active
? <FVertical key={'vertical' + i}>
<MemberCard key={m.uid} name={m.userFullname} userHandle={m.userHandle} uid={m.uid} />
{
dateRange.map((day: TDay, i: number) => renderCard(upDb, m, day, i))
}
</FVertical>
: <span key={'vertical' + i}></span>
)
}
</FHorizontal>
Expand All @@ -496,9 +530,9 @@ function renderCard (upDb:UserProgressDb, m:StudyMember, day: TDay, i: number) {
const rs = []
const card = upDb.getUser(m.userHandle)!.getCard(day.dateStr)
if (card) {
rs.push(<CardComp key={m.userHandle + i} title={card.title} userHandle={card.userHandle}
rs.push(<CardComp key={m.userHandle + i} title={card.title} userHandle={card.userHandle} repo={m.repo}
number={card.number} created={card.created} updated={card.updated} tags={card.tags} comments={card.comments} />)
} else if (Date.parse(day.dateStr) > Date.parse(m.startDateStr)) {
} else if (Date.parse(day.dateStr) >= Date.parse(m.startDateStr)) {
rs.push(<MissedDayCard key={m.userHandle + i} dateStr={day.dateStr} />)
} else {
rs.push(<EmptyCard key={m.userHandle + i} />)
Expand Down
25 changes: 25 additions & 0 deletions src/data/changelog.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
[
{
"version": "1.7.4",
"message": "πŸ“¦ Release `sprint-hala` 🍍 ➑ PROD: `v1.7.4-hala`",
"built": "Sun, 20 Jun 2021 15:56:01 EDT"
},
{
"version": "1.7.3",
"message": "πŸ¦Έβ€β™€οΈ Add Shaza as newest StudyDash `Member #3`!",
"built": "Sat, 19 Jun 2021 18:06:41 EDT"
},
{
"version": "1.7.2",
"message": "πŸ”§ Modify `dashboard` to return 200 cards per each study member",
"built": "Fri, 18 Jun 2021 01:13:49 EDT"
},
{
"version": "1.7.1",
"message": "✨ Add `start dates` to member profiles in GUI",
"built": "Thu, 10 Jun 2021 16:47:54 EDT"
},
{
"version": "1.7.0",
"message": "🍍 Begin `sprint-hala` (Thu - 6/10/21)",
"built": "Thu, 10 Jun 2021 14:52:50 EDT"
},
{
"version": "1.6.28",
"message": "πŸ“¦ Release `sprint-grape` ➑ PROD: `v1.6.28-grape`",
Expand Down

0 comments on commit 496b3ed

Please sign in to comment.