Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform track changes #54

Open
wants to merge 74 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
03c798e
Prettier file formatting
Oct 25, 2017
1cdb921
Updated Communication examples
Oct 25, 2017
3732cc9
Updated Craft examples
Oct 25, 2017
bfba173
Updated initiative examples
Oct 25, 2017
57ce22c
Updated all Supporting area examples
Oct 25, 2017
e3869b0
Change logo and add Heroku scripts
Oct 25, 2017
4549bdf
Try to fix heroku deploy
Oct 25, 2017
3673bf7
Adds reset button
Oct 25, 2017
e4e2467
Hide title selector until we've baselined everyone
Oct 30, 2017
de39c4a
New examples for Building category
Nov 1, 2017
094ad5b
Add the title selector back in
Feb 8, 2018
f01d055
Change some track names
Feb 8, 2018
adb11ae
Modifications to Career track
Feb 8, 2018
d158537
Modifications to Recruitment track
Feb 8, 2018
b24a76f
Modified communication example
Feb 8, 2018
617cd87
Modifications to Platform track
Feb 8, 2018
4214af3
Modifications to Plaform track
Feb 8, 2018
6a1bcf6
Modify Career level 3
Apr 29, 2018
c544226
Remove remaining references to Medium
Oct 16, 2018
90b1f2e
Update titles to match wiki
Oct 16, 2018
c42e66c
Merge pull request #2 from vend/minor-amendments
Oct 16, 2018
fbe894a
Fix flow typing errors
edsrzf Oct 17, 2018
9b0e16c
Reduce flow type repetition
edsrzf Oct 17, 2018
e7acfe6
Merge pull request #3 from edsrzf/flow
edsrzf Oct 24, 2018
ca25ccd
Add option to import from/save to Google Sheets
edsrzf Oct 22, 2018
1e8d17c
Notes!
edsrzf Oct 24, 2018
212eb7b
Hax to make appropriate cells bold
edsrzf Oct 24, 2018
5a98f73
Merge pull request #4 from vend/sheets
edsrzf Oct 31, 2018
ee6eaf9
Latest Next JS (#5)
rlopes Oct 31, 2018
89784fd
Merge pull request #6 from vend/notes
edsrzf Oct 31, 2018
2b75441
Add a longer description for each track
celine-may Nov 14, 2018
2daa0ce
Removed temp copy
celine-may Nov 15, 2018
ef5193d
Merge pull request #7 from vend/add-long-description
celine-may Nov 15, 2018
b1cd62f
Update web client example tasks
celine-may Nov 15, 2018
9b24b0f
Add description to web client track
celine-may Nov 15, 2018
2859975
Add description
celine-may Nov 15, 2018
56e504f
Update example tasks
celine-may Nov 15, 2018
9d87a37
New example task
celine-may Nov 15, 2018
c9824d4
Remove mentions of Android on mobile track
edsrzf Nov 22, 2018
7a671fe
Add mobile examples
edsrzf Nov 22, 2018
1461d35
Mobile description
edsrzf Nov 22, 2018
235205e
Mentorship description
edsrzf Nov 22, 2018
123c37a
Mentorship example tweaks
edsrzf Nov 22, 2018
239e831
Merge pull request #12 from vend/mobile
edsrzf Dec 6, 2018
05f2220
added descriptions (from medium) to comms and pm
bandyson Dec 6, 2018
1266203
switch Medium to Vend.
bandyson Dec 6, 2018
059135b
Merge branch 'master' of github.com:vend/snowflake into org-design-track
celine-may Dec 6, 2018
1d897f4
Update org design with Richard’s suggestions
celine-may Dec 6, 2018
6031d76
Update web client with suggestions
celine-may Dec 6, 2018
42d56be
Merge branch 'master' of github.com:vend/snowflake into web-client-track
celine-may Dec 6, 2018
44dcd53
Reword mentorship example
edsrzf Dec 6, 2018
8afaf0f
Merge pull request #13 from vend/mentorship
edsrzf Dec 7, 2018
e6bb9c1
Merge pull request #8 from vend/web-client-track
celine-may Dec 7, 2018
3eb23d9
Merge branch 'master' of github.com:vend/snowflake into org-design-track
celine-may Dec 9, 2018
0b79d07
Update examples to include Evan’s suggestions
celine-may Dec 9, 2018
e2af88d
Evangelism track update
tenitski Dec 9, 2018
b8ab630
Services & APIs track update
tenitski Dec 10, 2018
39a26ae
Comma added
tenitski Dec 10, 2018
29b29ed
Merge pull request #9 from vend/org-design-track
celine-may Dec 10, 2018
80e519f
change platform displayName
gustavosoares Dec 19, 2018
b0f6935
Merge branch 'master' of github.com:vend/snowflake into platform-track
gustavosoares Dec 19, 2018
2baabfb
add description
gustavosoares Dec 19, 2018
5952c2d
platform changes
gustavosoares Dec 20, 2018
64a434a
Added "promoting Vend at meetup"
tenitski Jan 3, 2019
e5d1db0
Added "promoting Vend at meetup"
tenitski Jan 3, 2019
f00fe34
Added "promoting Vend at meetup"
tenitski Jan 3, 2019
01b7f90
Merge pull request #16 from vend/evangelism-review
tenitski Jan 3, 2019
145b58a
Merge pull request #15 from vend/services-api-review
tenitski Jan 3, 2019
2c9f13d
Merge branch 'master' of github.com:vend/snowflake into platform-track
gustavosoares Jan 3, 2019
d67211e
platform track changes
gustavosoares Jan 3, 2019
d72fcfc
platform track changes
gustavosoares Jan 3, 2019
001de5b
platform track changes
gustavosoares Jan 4, 2019
1eb4941
CR
gustavosoares Jan 10, 2019
1b2a729
CR
gustavosoares Jan 10, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .babelrc
@@ -0,0 +1,4 @@
{
"presets": ["next/babel"],
"plugins": ["transform-flow-strip-types"]
}
4 changes: 4 additions & 0 deletions components/KeyboardListener.js
Expand Up @@ -15,6 +15,10 @@ class KeyboardListener extends React.Component<Props> {
}

handleKeyDown(e: KeyboardEvent) {
if (document.activeElement && document.activeElement.tagName === 'INPUT') {
// Don't do shortcuts while input has focus.
return
}
switch(e.code) {
case 'ArrowUp':
this.props.increaseFocusedMilestoneFn()
Expand Down
2 changes: 1 addition & 1 deletion components/LevelThermometer.js
Expand Up @@ -61,7 +61,7 @@ class LevelThermometer extends React.Component<Props> {
.style('text-anchor', 'start')
}

rightRoundedRect(x, y, width, height, radius) {
rightRoundedRect(x: number, y: number, width: number, height: number, radius: number): string {
return "M" + x + "," + y
+ "h" + (width - radius)
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius
Expand Down
245 changes: 245 additions & 0 deletions components/SheetsControl.js
@@ -0,0 +1,245 @@
// @flow

import type { Milestone, MilestoneMap, NoteMap } from '../constants'
import { trackIds, tracks } from '../constants'

import React from 'react'

declare var gapi: any

const API_KEY = 'AIzaSyCPZccI1B543VHblD__af_JvV2b8Z5-Lis'
const CLIENT_ID = '124466069863-0uic3ahingc9bst2oc95h29nvu30lrnu.apps.googleusercontent.com'

const DISCOVERY_DOCS = ["https://sheets.googleapis.com/$discovery/rest?version=v4"]
const SCOPES = "https://www.googleapis.com/auth/spreadsheets"

const RANGE = `B1:C${trackIds.length+3}`

const DOCS_URL_REGEX = /^https:\/\/docs.google.com\/spreadsheets\/d\/([0-9a-zA-Z_\-]+)/

type Props = {
name: string,
title: string,
onImport: (name: string, title: string, milestones: Milestone[], notes: string[]) => void,
milestoneByTrack: MilestoneMap,
notesByTrack: NoteMap
}

type State = {
isSignedIn: boolean,
sheetId: string
}

export default class SheetsControl extends React.Component<Props, State> {
constructor(props: Props) {
super(props)
this.state = {
isSignedIn: false,
sheetId: '',
}
}

componentDidMount() {
window.sheetsControl = this
}

componentDidUpdate(prevProps: Props, prevState: State) {
if (this.state.isSignedIn && !prevState.isSignedIn) {
this.importSheet()
}
}

componentWillUnmount() {
delete window.sheetsControl
}

initClient() {
console.log('initing')
gapi.client.init({
apiKey: API_KEY,
clientId: CLIENT_ID,
discoveryDocs: DISCOVERY_DOCS,
scope: SCOPES
}).then(() => {
console.log('promise resolved')
// Listen for sign-in state changes.
gapi.auth2.getAuthInstance().isSignedIn.listen(this.updateSigninStatus.bind(this))

// Handle the initial sign-in state.
this.updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get())
}).catch(error => {
console.log('init failed', error)
})
}

updateSigninStatus(isSignedIn: boolean) {
console.log('signed in', isSignedIn)
this.setState({ isSignedIn })
}

render() {
const style = <style jsx>{`
button,input {
font-size: 20px;
line-height: 20px;
margin-bottom: 20px;
margin-left: 3px;
min-width: 100px;
}
button {
border: 1;
background: #eee;
border-radius: 0px;
}
`}</style>

if (!this.state.isSignedIn) {
return (
<div>
{style}
<button onClick={this.handleAuthClick.bind(this)}>Authorize</button>
</div>
)
} else {
return (
<div>
{style}
<div>
<input
type="text"
value={this.state.sheetId}
onChange={this.handleSheetChange.bind(this)}
placeholder="Sheet ID"
/>
</div>
{this.state.sheetId &&
<div>
<a href={`https://docs.google.com/spreadsheets/d/${this.state.sheetId}/edit`} target="_blank">View Sheet</a>
</div>}
<button onClick={this.importSheet.bind(this)} disabled={!this.state.sheetId}>Import</button>
{this.state.sheetId
? <button onClick={this.handleSaveClick.bind(this)}>Save</button>
: <button onClick={this.handleCreateClick.bind(this)}>Create</button>}
<button onClick={this.handleSignOutClick.bind(this)}>Sign Out</button>
</div>
)
}
}

handleSheetChange(e: SyntheticEvent<HTMLButtonElement>) {
const val = e.currentTarget.value
const match = val.match(DOCS_URL_REGEX)
if (match) {
// URL pasted in
this.setState({ sheetId: match[1] })
} else {
this.setState({ sheetId: val })
}
}

handleAuthClick() {
gapi.auth2.getAuthInstance().signIn()
}

importSheet() {
if (!this.state.sheetId) {
return
}
console.log('importing sheet', this.state.sheetId)
// Get stuff from sheet
gapi.client.sheets.spreadsheets.values.get({
spreadsheetId: this.state.sheetId,
range: RANGE,
majorDimension: 'COLUMNS'
}).then(response => {
console.log('imported sheet')
const range = response.result
if (range.values.length > 0) {
// Special-case the first two rows
const name = range.values[0][0]
const title = range.values[1][0]
// Skip the third as they're just constant headers
const milestones = range.values[0].slice(3).map(val => parseInt(val[0]))
const notes = range.values[1].slice(3)
this.props.onImport(name, title, milestones, notes)
} else {
console.log('no values found')
}
})
}

handleSignOutClick() {
gapi.auth2.getAuthInstance().signOut()
}

handleCreateClick() {
const rowValue = (val, bold) => ({
userEnteredValue: {
[typeof val === 'number' ? 'numberValue' : 'stringValue']: val
},
textFormatRuns: bold ? [
{
startIndex: 0,
format: { bold: true }
}
] : undefined
})
const rows = trackIds.map(trackId => [
tracks[trackId].displayName,
this.props.milestoneByTrack[trackId],
this.props.notesByTrack[trackId]
])
rows.unshift([
'Track',
'Milestone',
'Notes'
])
rows.unshift([
'Title',
this.props.title
])
rows.unshift([
'Name',
this.props.name
])
const data = rows.map((row, i) => ({
startRow: i,
rowData: {
values: row.map((val, j) => rowValue(val, i === 2 || j === 0))
}
}))
gapi.client.sheets.spreadsheets.create({
properties: {
title: `${this.props.name}'s Snowflake`
},
sheets: [ { data } ]
}).then(response => {
this.setState({ sheetId: response.result.spreadsheetId })
})
}

handleSaveClick() {
const headers = [
[this.props.name],
[this.props.title],
['Milestone', 'Notes']
]
const values = trackIds.map(trackId => [
this.props.milestoneByTrack[trackId],
this.props.notesByTrack[trackId]
])
gapi.client.sheets.spreadsheets.values.update({
spreadsheetId: this.state.sheetId,
range: RANGE,
valueInputOption: 'USER_ENTERED',
resource: {
majorDimension: 'ROWS',
values: headers.concat(values)
}
}).then(() => {
console.log('saved')
}).catch(() => {
console.log('error saving')
})
}
}