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

Set up routing for judging #78

Merged
merged 4 commits into from
Nov 6, 2020
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Restrict View page
  • Loading branch information
ianmah committed Nov 6, 2020
commit d02df9d1464556b7e31b3f0cbee0a26118da2411
20 changes: 14 additions & 6 deletions src/pages/Judging/View.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import React from 'react'
import React, { useEffect, useState } from 'react'
import { isJudgingOpen } from '../../utility/firebase'

export default ({ id }) => (
<h1>
Viewing project {id}
</h1>
)
export default ({ id }) => {
const [isJudgingEnabled, setIsJudgingEnabled] = useState(false)

useEffect(() => {
const unsubscribe = isJudgingOpen(setIsJudgingEnabled)
return unsubscribe
}, [setIsJudgingEnabled])

return (
isJudgingEnabled ? <h1>Viewing project {id}</h1> : <h1>Judging is not open</h1>
)
}