Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
teknikattan-scoring-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tddd96-grupp1
teknikattan-scoring-system
Commits
32ad618a
Commit
32ad618a
authored
3 years ago
by
Björn Modée
Browse files
Options
Downloads
Patches
Plain Diff
Add timer and slide counter
parent
37008f69
No related branches found
Branches containing commit
No related tags found
1 merge request
!141
Add timer and slide counter
Pipeline
#45146
passed with warnings
3 years ago
Stage: setup
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/src/pages/presentationEditor/components/slideSettingsComponents/Timer.tsx
+2
-1
2 additions, 1 deletion
...tationEditor/components/slideSettingsComponents/Timer.tsx
client/src/pages/views/TeamViewPage.tsx
+34
-10
34 additions, 10 deletions
client/src/pages/views/TeamViewPage.tsx
with
36 additions
and
11 deletions
client/src/pages/presentationEditor/components/slideSettingsComponents/Timer.tsx
+
2
−
1
View file @
32ad618a
...
...
@@ -12,9 +12,10 @@ type TimerProps = {
}
const
Timer
=
({
activeSlide
,
competitionId
}:
TimerProps
)
=>
{
const
maxTime
=
1000
const
maxTime
=
1000
// ms
const
dispatch
=
useAppDispatch
()
const
updateTimer
=
async
(
event
:
React
.
ChangeEvent
<
HTMLTextAreaElement
|
HTMLInputElement
>
)
=>
{
/** If timer value is above the max value, set the timer value to max value to not overflow the server */
if
(
+
event
.
target
.
value
>
maxTime
)
{
setTimer
(
maxTime
)
await
axios
...
...
This diff is collapsed.
Click to expand it.
client/src/pages/views/TeamViewPage.tsx
+
34
−
10
View file @
32ad618a
import
{
Snackbar
}
from
'
@material-ui/core
'
import
{
Snackbar
,
Typography
}
from
'
@material-ui/core
'
import
{
Alert
}
from
'
@material-ui/lab
'
import
React
,
{
useEffect
,
useState
}
from
'
react
'
import
{
useAppSelector
}
from
'
../../hooks
'
import
{
socketConnect
,
socketJoinPresentation
}
from
'
../../sockets
'
import
SlideDisplay
from
'
../presentationEditor/components/SlideDisplay
'
import
{
PresentationBackground
,
PresentationContainer
}
from
'
./styled
'
import
Timer
from
'
../views/components/Timer
'
import
{
OperatorContainer
,
OperatorHeader
,
PresentationBackground
,
PresentationContainer
,
SlideCounter
,
}
from
'
./styled
'
const
TeamViewPage
:
React
.
FC
=
()
=>
{
const
code
=
useAppSelector
((
state
)
=>
state
.
presentation
.
code
)
...
...
@@ -12,6 +19,11 @@ const TeamViewPage: React.FC = () => {
const
activeViewTypeId
=
viewTypes
.
find
((
viewType
)
=>
viewType
.
name
===
'
Team
'
)?.
id
const
[
successMessageOpen
,
setSuccessMessageOpen
]
=
useState
(
true
)
const
competitionName
=
useAppSelector
((
state
)
=>
state
.
presentation
.
competition
.
name
)
const
presentation
=
useAppSelector
((
state
)
=>
state
.
presentation
)
const
activeSlideOrder
=
useAppSelector
(
(
state
)
=>
state
.
presentation
.
competition
.
slides
.
find
((
slide
)
=>
slide
.
id
===
state
.
presentation
.
activeSlideId
)?.
order
)
const
teamName
=
useAppSelector
(
(
state
)
=>
state
.
presentation
.
competition
.
teams
.
find
((
team
)
=>
team
.
id
===
state
.
competitionLogin
.
data
?.
team_id
)?.
name
...
...
@@ -23,14 +35,26 @@ const TeamViewPage: React.FC = () => {
}
},
[])
return
(
<
PresentationBackground
>
<
PresentationContainer
>
{
activeViewTypeId
&&
<
SlideDisplay
variant
=
"presentation"
activeViewTypeId
=
{
activeViewTypeId
}
/>
}
</
PresentationContainer
>
<
Snackbar
open
=
{
successMessageOpen
}
autoHideDuration
=
{
4000
}
onClose
=
{
()
=>
setSuccessMessageOpen
(
false
)
}
>
<
Alert
severity
=
"success"
>
{
`Du har gått med i tävlingen "
${
competitionName
}
" som lag
${
teamName
}
`
}
</
Alert
>
</
Snackbar
>
</
PresentationBackground
>
<
OperatorContainer
>
<
OperatorHeader
>
<
Typography
variant
=
"h1"
>
<
Timer
></
Timer
>
</
Typography
>
<
SlideCounter
>
<
Typography
variant
=
"h3"
>
{
activeSlideOrder
!==
undefined
&&
activeSlideOrder
+
1
}
/
{
presentation
.
competition
.
slides
.
length
}
</
Typography
>
</
SlideCounter
>
</
OperatorHeader
>
<
PresentationBackground
>
<
PresentationContainer
>
{
activeViewTypeId
&&
<
SlideDisplay
variant
=
"presentation"
activeViewTypeId
=
{
activeViewTypeId
}
/>
}
</
PresentationContainer
>
<
Snackbar
open
=
{
successMessageOpen
}
autoHideDuration
=
{
4000
}
onClose
=
{
()
=>
setSuccessMessageOpen
(
false
)
}
>
<
Alert
severity
=
"success"
>
{
`Du har gått med i tävlingen "
${
competitionName
}
" som lag
${
teamName
}
`
}
</
Alert
>
</
Snackbar
>
</
PresentationBackground
>
</
OperatorContainer
>
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment