Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
373 commits
Select commit Hold shift + click to select a range
8a9e055
feat: my order card
boompikachu Jan 28, 2020
e8667d2
Merge remote-tracking branch 'origin/feat/order-food-modal' into chos…
boompikachu Jan 28, 2020
e170bdb
refactor: change component name
boompikachu Jan 28, 2020
b2e4c01
Merge remote-tracking branch 'origin/feat/order-food-modal' into chos…
boompikachu Jan 28, 2020
2c1bb5b
feat: no fadding effect when leave login modal page
new5558 Jan 28, 2020
8a08fa6
feat: mock api for ordered food
boompikachu Jan 28, 2020
51439d2
add: gray colour
boompikachu Jan 28, 2020
dc942e5
feat: add mock food api data
new5558 Jan 28, 2020
4d5b08e
fix: now cannot resolve Countdown
new5558 Jan 28, 2020
fa30fe5
fix: background now shown on staging now.sh
new5558 Jan 28, 2020
6a4f1ea
feat: use production data as mock order api
new5558 Jan 28, 2020
236b700
Migrate Cypress to main monorepo
dtinth Jan 28, 2020
a3ef5de
Some skeleton for the announcement page
dtinth Jan 28, 2020
2d4f768
Add Firebase integration
dtinth Jan 28, 2020
6015c42
Merge pull request #33 from dtinth/migrate-cypress
fivechjr Jan 28, 2020
409f6a2
Enable frontend to connect to separate backend environments
dtinth Jan 28, 2020
d41d470
Add loading state for announcement
dtinth Jan 28, 2020
e703a00
Add Tweet button
dtinth Jan 28, 2020
a9810ba
Add "tweet-button" testid to the Tweet button
dtinth Jan 28, 2020
7fd441f
feat: order modal
new5558 Jan 28, 2020
56db124
fix: ordeef food modal's state persist
new5558 Jan 28, 2020
ce5d830
feat(order-modal): add all details
new5558 Jan 28, 2020
8a19bc0
fix: modal incorrect position
new5558 Jan 28, 2020
678561c
fix: oveflow y layout
new5558 Jan 28, 2020
c0734cf
feat: add zero availability case
new5558 Jan 28, 2020
b7b0843
Merge branch 'dev' into feat/order-food-modal
new5558 Jan 28, 2020
20447e5
Merge pull request #35 from thinc-org/feat/order-food-modal
fivechjr Jan 29, 2020
5e08830
fix: merge conflict
new5558 Jan 29, 2020
78b79c0
refactor: integrated feat/order-food-modal to feat/order-food
new5558 Jan 29, 2020
028f223
Merge branch 'dev' of github.com:thinc-org/JS-BKK-Front into announce…
dtinth Jan 29, 2020
eb0e2af
Merge pull request #34 from dtinth/announcement
dtinth Jan 29, 2020
e43ee55
feat: styling page
new5558 Jan 29, 2020
e3c3d61
fix: multiple select not working
new5558 Jan 29, 2020
32e7761
fix: remove console.log
new5558 Jan 29, 2020
563732a
Merge pull request #32 from thinc-org/feat/order-food
new5558 Jan 29, 2020
a8c98a7
Use Firebase auth
dtinth Jan 29, 2020
c219969
Implement login logic for test environment
dtinth Jan 29, 2020
a1f73a8
Persist env in sessionStorage
dtinth Jan 29, 2020
66c7998
Fix problem where auth modal flashes
dtinth Jan 29, 2020
9ecb0b5
Fix typechecking errors
dtinth Jan 30, 2020
d14418e
Fix problem where auth state is stuck at "checking"
dtinth Jan 30, 2020
d1cd1d6
Merge pull request #36 from dtinth/auth
new5558 Jan 30, 2020
b7bf0bb
fix(modal): remove width 100%
new5558 Jan 30, 2020
3d63dee
feat(modal): better scrolling way
new5558 Jan 30, 2020
c69c15f
fix: change box-sizing: content-block -> border-block
new5558 Jan 30, 2020
61e6fd4
Merge pull request #37 from thinc-org/fix/modal-layout
fivechjr Jan 30, 2020
fc04c09
fix: navigation not working when login modal opened up
new5558 Jan 30, 2020
4c8920d
Merge pull request #38 from thinc-org/fix/modal-layout
new5558 Jan 30, 2020
73eab6d
add: support for 2 foods and side dish
boompikachu Jan 30, 2020
78285b7
Merge branch 'dev' into chosen-food-order
boompikachu Jan 30, 2020
41f0365
fix: make food choice dynamic
boompikachu Jan 30, 2020
e261d73
refactor: mock api names
boompikachu Jan 30, 2020
e21c4ab
Revert "refactor: mock api names"
boompikachu Jan 30, 2020
d6e28df
refactor: <div> to <>
boompikachu Jan 30, 2020
90cf9c6
Merge pull request #39 from thinc-org/chosen-food-order
boompikachu Jan 30, 2020
7e0e3fc
Display loading state for authentication
dtinth Jan 30, 2020
7e75f5a
Add "status" flag to FetchResult (to differentiate between no data vs…
dtinth Jan 30, 2020
9e5785b
Refactor most stuff to use FetchStatus
dtinth Jan 30, 2020
4b3cef6
Add JSDoc for FetchResult
dtinth Jan 30, 2020
991f265
FetchedResult<T> extends FetchResult<T>
dtinth Jan 30, 2020
75cb691
Make useFetcher usable without observer
dtinth Jan 30, 2020
4078ad9
Fix interface names
dtinth Jan 30, 2020
ca0a22f
Add ErrorMessage component
dtinth Jan 30, 2020
f8e9d24
Organize imports
dtinth Jan 30, 2020
def0541
Organize imports
dtinth Jan 30, 2020
bc2a0b3
Integrate useMyOrder with backend
dtinth Jan 30, 2020
f6407c9
Sign in with Eventpop is working now!!!!!!!!!
dtinth Jan 30, 2020
b52f56f
Uncomment the auto-select logic
dtinth Jan 30, 2020
9a56aae
Display feedback while loading
dtinth Jan 30, 2020
3a1f609
Cancel sign in if pop-up closed
dtinth Jan 30, 2020
3ed569e
Add buttons to sign in as test users
dtinth Jan 30, 2020
391cfa4
Y U NO SUPPORT flatMap, now?
dtinth Jan 30, 2020
4f6bef2
I’m confused
dtinth Jan 30, 2020
76c4398
OHHHHHHH THAT’S WHY!!! NOTHING TO DO WITH flatMap, BUT EACH COMPONEN…
dtinth Jan 30, 2020
b749282
Merge pull request #40 from dtinth/food-flow
fivechjr Jan 31, 2020
2b5c375
:sparkles: Implement API for networking event [WIP]
fivechjr Jan 31, 2020
dd856ff
Add `useFirestoreSnapshot` hook
dtinth Jan 31, 2020
3a7ae30
Refactor useMyOrder use `useFirestoreSnapshot`
dtinth Jan 31, 2020
58d6ac5
Integrate Countdown and add real-time updates
dtinth Jan 31, 2020
e982b25
Improve accessibility for food ordering item list
dtinth Jan 31, 2020
db45598
Add more attributes for automated test
dtinth Jan 31, 2020
944480c
Merge pull request #42 from thinc-org/dtinth/more-food-integrations
fivechjr Feb 1, 2020
63b0802
Add react-focus-lock
dtinth Jan 31, 2020
955e851
focus:outline-none is bad for accessibility
dtinth Jan 31, 2020
8c624aa
Add FocusLock to modal and make it accessible
dtinth Jan 31, 2020
7027b8d
Fix wrong label for restaurant group
dtinth Feb 1, 2020
bbde312
Add data-authentication-state to nav (for automated tests)
dtinth Feb 1, 2020
32a2e71
Allow programmatic logout (for automated test)
dtinth Feb 1, 2020
5ccb1ee
Better make this page English
dtinth Feb 1, 2020
09318bd
This is supposed to be a page header
dtinth Feb 1, 2020
25692e0
Improve semantic HTML
dtinth Feb 1, 2020
fd2c725
Merge pull request #43 from thinc-org/dtinth/more-food-integrations
fivechjr Feb 2, 2020
7a9cfbd
Add some error boundary
dtinth Feb 2, 2020
6404012
Fallback didn’t work on route level, unfortunately, had to fall back …
dtinth Feb 2, 2020
2d4d42b
Add margin-left to availability number
dtinth Feb 2, 2020
57fc82e
Make the menu list fill the screen
dtinth Feb 2, 2020
cf87017
Update restaurant availability in real time
dtinth Feb 2, 2020
d4d9ba9
Improve styling on number of menu left
dtinth Feb 2, 2020
32f2457
fix : conflict
wasinphand Feb 3, 2020
04a5936
Merge pull request #44 from dtinth/food-stocking
fivechjr Feb 3, 2020
9f9edda
Merge pull request #31 from thinc-org/schedule
new5558 Feb 3, 2020
ea25b03
fix: eslint/typescript errors/warning
new5558 Feb 3, 2020
3b07d45
feat: disable restaurant selection when availibility is 0
new5558 Feb 3, 2020
4945b4e
feat(order-food-modal): prevent selection of food when availibility i…
new5558 Feb 3, 2020
7989757
fix: remove disable input in restaurant's food selection
new5558 Feb 3, 2020
221ced2
feat: add food out of stock modal
new5558 Feb 3, 2020
ee5142b
Merge pull request #45 from thinc-org/order-food/disable-selection
fivechjr Feb 3, 2020
c84c19e
feat: link schedules with conference
new5558 Feb 3, 2020
fd20c6e
fix: build error
new5558 Feb 3, 2020
9aa9f2c
feat: style schedule components
new5558 Feb 4, 2020
18dd975
feat: add speakers detail
new5558 Feb 4, 2020
430ef06
feat: staff info
boompikachu Feb 4, 2020
1edb127
Merge branch 'feat/integrate-schedule' into feat/staff-information
boompikachu Feb 4, 2020
1eebaa3
fix: make staff list dynamic
boompikachu Feb 4, 2020
cf99620
fix: image dynamic
boompikachu Feb 4, 2020
488f58f
feat: add speaker modal
new5558 Feb 4, 2020
1ddfa3e
fix: some images not rendering
new5558 Feb 4, 2020
dfb79b0
fix: now build error
new5558 Feb 4, 2020
ad07650
fix(speaker-modal): font size
new5558 Feb 4, 2020
bddd482
Link schedules with conference (#46)
dtinth Feb 4, 2020
fac008f
Implement availability check for menu
dtinth Feb 4, 2020
ebd3697
Handle one little edge case when menu is sold out
dtinth Feb 4, 2020
1f9eb2f
Implement change your mind button
dtinth Feb 4, 2020
bdb5c5e
Refactor parts of Countdown
dtinth Feb 4, 2020
4ebd07b
Hide list when time is up
dtinth Feb 4, 2020
c5b4637
Merge pull request #47 from dtinth/food-stocking
new5558 Feb 5, 2020
3139bba
fix: schedule font color
new5558 Feb 5, 2020
d374f30
fix: eslint errors
new5558 Feb 5, 2020
4f08c85
fix: some modal is clipped out by the screen
new5558 Feb 5, 2020
d01bffd
Merge pull request #48 from thinc-org/fix/misc
fivechjr Feb 5, 2020
f51b989
fix: email not dynamic
boompikachu Feb 5, 2020
7ec0809
Merge branch 'dev' into feat/staff-information
boompikachu Feb 5, 2020
031b35c
Merge pull request #49 from thinc-org/feat/staff-information
new5558 Feb 5, 2020
8032876
Make larger Thai text
dtinth Feb 6, 2020
7443a4f
Move intro to change mind section
dtinth Feb 6, 2020
fac6562
Display Your Food Selection after selecting a meal
dtinth Feb 6, 2020
855abc1
Fix title
dtinth Feb 6, 2020
bf26309
Add GA
dtinth Feb 6, 2020
4971278
Update logout button style
dtinth Feb 6, 2020
76b058a
Add container
dtinth Feb 6, 2020
a6694a3
Add container, add curtain on Networking
dtinth Feb 6, 2020
28dd45c
Add Sentry
dtinth Feb 6, 2020
a50bc07
Don’t sanitize HTML
dtinth Feb 6, 2020
af9e552
Remove unused import
dtinth Feb 6, 2020
ed55325
UI adjustments
dtinth Feb 6, 2020
d3d7b10
Use pre-wrap for info
dtinth Feb 6, 2020
0973ac9
Well, add some text-based spinner
dtinth Feb 6, 2020
b7ed127
Add vertical margins to modals
dtinth Feb 6, 2020
c71bf08
Fix useLayoutEffect warning
dtinth Feb 6, 2020
4672a78
Remove unused import
dtinth Feb 6, 2020
0f6abec
Add floor map
dtinth Feb 6, 2020
c6b9977
Fix bg size
dtinth Feb 7, 2020
d02ef5c
Wha- make it top left background
dtinth Feb 7, 2020
4419012
Make announcement fill area
dtinth Feb 7, 2020
f1f376f
Implement dietary restrictions notice
dtinth Feb 7, 2020
fe83dce
Add clause for event staff
dtinth Feb 7, 2020
f53a481
Organize import
dtinth Feb 7, 2020
be19db3
Only allow food stalls for Booth Staff
dtinth Feb 7, 2020
d6fd17e
Merge branch 'dev' into networking
new5558 Feb 7, 2020
6ef6632
Add viewpoint and restaurant exterior
dtinth Feb 7, 2020
d9ba587
feat/welcome to network
boompikachu Feb 7, 2020
5dfcdee
feat: networking hooks
new5558 Feb 7, 2020
b630ef3
Merge branch 'feat/new-network' into networking
new5558 Feb 7, 2020
2963b9b
feat: submit button
boompikachu Feb 7, 2020
8d77c5f
Merge remote-tracking branch 'origin/networking' into feat/new-network
boompikachu Feb 7, 2020
ebd72ee
Merge remote-tracking branch 'origin/feat/new-network' into networking
new5558 Feb 7, 2020
e2ad8db
THIS. THIS CAUSED A RESUBSCRIPTION LOOP THAT COSTED US $6 IN FIREBASE…
dtinth Feb 7, 2020
a10fa5c
feat(networking): add firebase to create networking profile page (wel…
new5558 Feb 7, 2020
4a2ce96
feat: my-badge
boompikachu Feb 7, 2020
2692b1f
add padding
boompikachu Feb 7, 2020
0e5797a
fix: welcome to networking layout
new5558 Feb 7, 2020
a63aa31
Merge remote-tracking branch 'origin/feat/new-network' into networking
new5558 Feb 7, 2020
723a298
fix: remove unused comment
new5558 Feb 7, 2020
89d9bf9
feat: add link from my-badge to dashboard
new5558 Feb 7, 2020
67a34e6
fix: remove unnecessary observer
new5558 Feb 7, 2020
ef0d43c
add desgin
wasinphand Feb 7, 2020
77165be
feat: BadgeList
boompikachu Feb 7, 2020
f43b006
fix duplicate
boompikachu Feb 7, 2020
4507c9c
feat: auto redirect to welcome page
new5558 Feb 7, 2020
2a19192
enhance
boompikachu Feb 7, 2020
696a40f
fix: change default case
boompikachu Feb 7, 2020
d8fd30a
feat: add dynamic badge
new5558 Feb 7, 2020
2e90887
fix: merge conflict
new5558 Feb 7, 2020
59b30c9
add loser
wasinphand Feb 7, 2020
4d38b2c
add loser
wasinphand Feb 7, 2020
b9472bd
nav bar logo
boompikachu Feb 7, 2020
c1fabaa
feat: dashboard
new5558 Feb 7, 2020
63ff439
feat: dynamic badge
new5558 Feb 7, 2020
36680b8
fix: merge conflict
new5558 Feb 7, 2020
ee4beab
fix: bring back updateBio function
new5558 Feb 7, 2020
044a4d0
Merge branch 'networking' into feat/new-network
boompikachu Feb 7, 2020
df21a97
Merge pull request #51 from thinc-org/feat/new-network
boompikachu Feb 7, 2020
62f8f7e
Merge branch 'networking' of https://github.com/thinc-org/JS-BKK-Fron…
new5558 Feb 7, 2020
25fa0d6
fix: trigger firebase function
new5558 Feb 7, 2020
f6b3179
fix: redirect to winner page
new5558 Feb 7, 2020
f2acc15
fix: redirect when winners appears
new5558 Feb 7, 2020
5a6aacf
feat: timeout
new5558 Feb 7, 2020
6d1655a
Implement sign in with ticket code and phone
dtinth Feb 7, 2020
f1b2c01
fix: sort array of winner before announce
new5558 Feb 7, 2020
cabc4fb
Make it clear that it is a 6 digit code
dtinth Feb 7, 2020
af9f226
skeleton friendlist
boompikachu Feb 7, 2020
182773a
Merge branch 'networking' into feat/friend-list
boompikachu Feb 7, 2020
27c52d2
fix: merge conflict
new5558 Feb 7, 2020
98212b7
fix: nav bar blocking (after merge)
boompikachu Feb 7, 2020
859ac09
Merge branch 'networking' into feat/friend-list
boompikachu Feb 7, 2020
03b8ec5
add edit
wasinphand Feb 7, 2020
4c5ea21
Merge branch 'networking' of https://github.com/thinc-org/JS-BKK-Fron…
wasinphand Feb 7, 2020
45f8abc
change from result page to popup
new5558 Feb 7, 2020
aef1c04
Merge branch 'networking' of https://github.com/thinc-org/JS-BKK-Fron…
new5558 Feb 7, 2020
b5936ca
dynamic friendlist
boompikachu Feb 7, 2020
cff9085
fix: merge branch
new5558 Feb 7, 2020
fb680e7
fix: cannot render undefined error
new5558 Feb 7, 2020
5f0f707
feat: add previous bio before set new one
new5558 Feb 7, 2020
f3be0ab
friend list new design
boompikachu Feb 7, 2020
b28e518
feat: add blur to badge
new5558 Feb 7, 2020
4f4c976
fix: merge conflict
new5558 Feb 7, 2020
66610eb
feat: style friendlist component
new5558 Feb 7, 2020
3c1d4b6
fix: remove console.log
new5558 Feb 7, 2020
ad160c7
fix: schedule overlay by time not working due to next.js prerendering
new5558 Feb 7, 2020
969a00a
Link to Schedule
dtinth Feb 8, 2020
ea0b483
Swap sign in button
dtinth Feb 8, 2020
537dff6
Merge pull request #1 from thinc-org/fix/schedule-overlay
fivechjr Feb 8, 2020
1beebdb
Fix schedule
fivechjr Feb 8, 2020
ab2bcfe
Go
fivechjr Feb 8, 2020
6df9380
Merge pull request #2 from JavaScriptBangkok/schedule
fivechjr Feb 8, 2020
b982432
hide login with event button
buffaly Feb 8, 2020
d42a70d
Merge pull request #3 from JavaScriptBangkok/hide-button-login-eventpop
fivechjr Feb 8, 2020
e07cb20
Fix background
fivechjr Feb 8, 2020
fb6950f
Merge pull request #4 from JavaScriptBangkok/bg-overlap
fivechjr Feb 8, 2020
ba84e94
+10 minutes on schedule
fivechjr Feb 8, 2020
f4734ac
Merge pull request #5 from JavaScriptBangkok/schedule-shift
fivechjr Feb 8, 2020
3db7c5b
Swap agenda
fivechjr Feb 8, 2020
13fb55f
Merge pull request #6 from JavaScriptBangkok/schedule-shift
fivechjr Feb 8, 2020
9c8ca9a
feat: add clickable networking profile
new5558 Feb 8, 2020
1660521
feat: edit bio link
new5558 Feb 8, 2020
f8d8547
style: emoji nav
rayriffy Feb 8, 2020
921ff33
Merge pull request #7 from rayriffy/master
dtinth Feb 8, 2020
24cd35d
disable networking until event starts
new5558 Feb 8, 2020
998f692
Merge pull request #41 from thinc-org/networking
fivechjr Feb 8, 2020
126d4b5
resolve conflict
new5558 Feb 8, 2020
0ac4b56
Merge pull request #8 from thinc-org/dev
fivechjr Feb 8, 2020
1c6191f
Fix background on Android devices
fivechjr Feb 8, 2020
84de415
Merge pull request #9 from JavaScriptBangkok/bg-overlap-android
fivechjr Feb 8, 2020
c371699
Bring back "Sign in with Eventpop"
fivechjr Feb 8, 2020
e8a7c80
Loading text to "Networking"
fivechjr Feb 8, 2020
fda2aa7
Add bottom spacing
fivechjr Feb 8, 2020
706f63d
Merge pull request #10 from JavaScriptBangkok/loading-text
fivechjr Feb 8, 2020
b3e6037
Shift afternoon schedule
fivechjr Feb 8, 2020
100ca82
Merge pull request #11 from JavaScriptBangkok/shift-schedule
fivechjr Feb 8, 2020
1c789d8
fix: auth loading behavior
new5558 Feb 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"presets": ["next/babel", "@emotion/babel-preset-css-prop"],
"plugins": [
["emotion"],
["@babel/plugin-proposal-decorators", { "legacy": true }]
]
"presets": ["next/babel"],
"plugins": [["@babel/plugin-proposal-decorators", { "legacy": true }]]
}
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = {
2,
{ extensions: ['.js', '.jsx', '.ts', '.tsx'] }
],
'react/button-has-type': 'off',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 0,
'import/no-extraneous-dependencies': [
Expand All @@ -44,7 +45,8 @@ module.exports = {
'always',
{ exceptAfterSingleLine: true }
],
'no-underscore-dangle': 'off'
'no-underscore-dangle': 'off',
'import/no-cycle': 'off'
},
globals: {
React: 'writable'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

#tailwind
/styles/index.css
26 changes: 26 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
.env*
yarn.lock

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"muhajirframe.vscode-react-emotion",
"dbaeumer.vscode-eslint",
"bradlc.vscode-tailwindcss",
"msjsdiag.debugger-for-chrome"
]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": true
// "editor.formatOnSave": true,
"editor.tabSize": 2
}
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Start the project

Make user you have [VS Code](https://code.visualstudio.com/), [Node.js](https://nodejs.org/en/), [Yarn](https://yarnpkg.com/lang/en/), [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint), [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode), and [VScode React Emotion Snippets](https://marketplace.visualstudio.com/items?itemName=muhajirframe.vscode-react-emotion) installed before starting the project.
Make sure you have [VS Code](https://code.visualstudio.com/), [Node.js](https://nodejs.org/en/), [Yarn](https://yarnpkg.com/lang/en/), [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint), [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode), and [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss) installed before starting the project.

## Instruction

Expand All @@ -27,3 +27,11 @@ Install [Debugger for Microsoft Edge](https://marketplace.visualstudio.com/items
> Edge: full

on VS Code debug panel

# Running Cypress tests

Make sure your dev server is open.

```
yarn cypress open
```
131 changes: 131 additions & 0 deletions commons/components/AuthModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/* eslint-disable jsx-a11y/label-has-associated-control */
import { observer } from 'mobx-react-lite';
import React, { useCallback, useContext, useEffect, useState } from 'react';
import { useAuthenticationController } from '../../components/authentication';
import { RootStore } from '../../interfaces/Commons';
import rootContext from '../context.root';
import { getEnvName } from '../firebase';
import Button from './Button';
import Card from './Card';
import Modal from './Modal';
import TextSpinner from './TextSpinner';

const AuthModal: React.FC = observer(() => {
const [loginError, setLoginError] = useState<string | null>(null);
const [activeSignInProcesses, setActiveSignInProcesses] = useState<number>(0);
const { authModalStore } = useContext<RootStore>(rootContext);
const authenticationController = useAuthenticationController();

const login = useCallback(async e => {
e.preventDefault();
setActiveSignInProcesses(x => x + 1);
try {
await authenticationController.loginWithEventpop();
} catch (error) {
setLoginError(`Failed! ${error}`);
} finally {
setActiveSignInProcesses(x => x - 1);
}
}, []);

const login2 = useCallback(async e => {
e.preventDefault();
setActiveSignInProcesses(x => x + 1);
try {
// eslint-disable-next-line no-alert
const referenceCode = prompt('Ticket reference code (6 digits code)');
if (!referenceCode) {
throw new Error('No reference code provided');
}
// eslint-disable-next-line no-alert
const phoneNumber = prompt('Your phone number registered with Eventpop');
if (!phoneNumber) {
throw new Error('No phone number provided');
}
await authenticationController.loginWithEventpopInfo(
referenceCode,
phoneNumber
);
} catch (error) {
setLoginError(`Failed! ${error}`);
} finally {
setActiveSignInProcesses(x => x - 1);
}
}, []);

const loginTest = useCallback(async (e, uid: string) => {
e.preventDefault();
setActiveSignInProcesses(x => x + 1);
try {
await authenticationController.loginAsTestUser(uid);
} catch (error) {
setLoginError(`Failed! ${error}`);
} finally {
setActiveSignInProcesses(x => x - 1);
}
}, []);

const [isTestEnvironment, setIsTestEnvironment] = useState(false);

useEffect(() => {
setIsTestEnvironment(getEnvName() === 'test');
}, []);

const testUsers = isTestEnvironment
? ['test01', 'test02', 'test03', 'test04', 'test05']
: [];

return (
<Modal noCloseButton modalStore={authModalStore} className='px-4 my-4'>
<section aria-label='Authentication modal'>
<Card className='flex flex-col items-center'>
<p className='font-extrabold text-bg mb-4'>
To continue, Please log in
</p>
<p className='text-base leading-tight'>
Make your meal selection and meet other people through our
networking activity to win special prizes.
</p>
<Button
onClick={e => login2(e)}
type='button'
className='mt-12 mb-2 py-3 px-10 font-bg bg-yellow-dark text-black rounded'
>
Sign in with your ticket code and phone number
</Button>
- or -
<Button
onClick={login}
type='button'
className={`py-2 my-2 px-10 font-bg border bg-white border-yellow-dark text-black rounded ${
activeSignInProcesses > 0 ? 'opacity-50' : ''
}`}
>
{activeSignInProcesses > 0 ? (
<>
Please wait… <TextSpinner />
</>
) : (
'Sign in with Eventpop (Chrome/Safari)'
)}
</Button>
{testUsers.map(uid => {
return (
<Button
key={uid}
onClick={e => loginTest(e, uid)}
type='button'
className='mt-2 py-2 px-8 font-bg border bg-white border-yellow-dark text-black rounded'
>
Sign in as test user {uid}
</Button>
);
})}
{loginError}
</Card>
</section>
</Modal>
);
});

export default AuthModal;
34 changes: 34 additions & 0 deletions commons/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import { Onclick } from '../../interfaces/Commons';

interface Props {
className?: string;
children?: React.ReactNode;
type: 'submit' | 'button' | 'reset';
onClick?: Onclick;
disabled?: boolean;
'aria-label'?: string;
}

const Button: React.FC<Props> = ({
children,
className,
type,
onClick,
disabled,
'aria-label': ariaLabel
}) => {
return (
<button
disabled={disabled}
className={className}
type={type}
onClick={onClick}
aria-label={ariaLabel}
>
{children}
</button>
);
};

export default Button;
36 changes: 36 additions & 0 deletions commons/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';

interface PropTypes {
className?: string;
noPadding?: boolean;
'aria-labelledby'?: string;
'aria-label'?: string;
'data-testid'?: string;
tabIndex?: number;
}

const Card: React.FC<PropTypes> = ({
children,
className,
noPadding,
tabIndex,
'aria-labelledby': ariaLabelledby,
'aria-label': ariaLabel,
'data-testid': dataTestid
}) => {
return (
<div
aria-label={ariaLabel}
aria-labelledby={ariaLabelledby}
data-testid={dataTestid}
tabIndex={tabIndex}
className={`bg-white rounded-lg ${
noPadding ? 'p-0' : 'p-4'
} ${className}`}
>
{children}
</div>
);
};

export default Card;
11 changes: 11 additions & 0 deletions commons/components/CloseButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React, { MouseEvent } from 'react';

interface PropTypes {
onClick: (e: MouseEvent) => void;
}

const CloseButton: React.FC<PropTypes> = ({ onClick }) => {
return <button onClick={onClick}>df</button>;
};

export default CloseButton;
13 changes: 13 additions & 0 deletions commons/components/ErrorMessage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default function ErrorMessage(props: { error?: any }) {
const { error } = props;
return (
<div
className='rounded p-4'
style={{ background: 'white', color: 'red', border: '4px solid red' }}
>
<strong>Something went wrong!</strong>
<br />
{String(error)}
</div>
);
}
16 changes: 16 additions & 0 deletions commons/components/Loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const Loading: React.FC<{ message: string; color?: 'dark' | 'light' }> = ({
message,
color = 'dark'
}) => {
return (
<div
className={`text-xl text-center p-4 ${
color === 'dark' ? 'text-gray-700' : 'text-white'
}`}
>
{message}…
</div>
);
};

export default Loading;
Loading