Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
INJECT
frontend
Commits
d65730c8
There was an error fetching the commit references. Please try again later.
Commit
d65730c8
authored
10 months ago
by
Marek Veselý
Browse files
Options
Downloads
Patches
Plain Diff
fix: teamaddress loading
parent
0f760cb3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/email/EmailFormOverlay/TraineeEmailFormOverlay.tsx
+41
-7
41 additions, 7 deletions
...nd/src/email/EmailFormOverlay/TraineeEmailFormOverlay.tsx
frontend/src/email/EmailFormOverlay/index.tsx
+6
-18
6 additions, 18 deletions
frontend/src/email/EmailFormOverlay/index.tsx
with
47 additions
and
25 deletions
frontend/src/email/EmailFormOverlay/TraineeEmailFormOverlay.tsx
+
41
−
7
View file @
d65730c8
import
ErrorMessage
from
'
@/components/ErrorMessage
'
import
{
NonIdealState
,
Spinner
}
from
'
@blueprintjs/core
'
import
{
useGetTeamEmailParticipant
}
from
'
@inject/graphql/queries/GetTeamEmailParticipant.generated
'
import
type
{
FC
}
from
'
react
'
import
EmailFormOverlay
from
'
.
'
...
...
@@ -9,12 +12,43 @@ interface TraineeEmailFormOverlayProps {
const
TraineeEmailFormOverlay
:
FC
<
TraineeEmailFormOverlayProps
>
=
({
teamId
,
exerciseId
,
})
=>
(
<
EmailFormOverlay
teamId
=
{
teamId
}
emailForm
=
'trainee'
exerciseId
=
{
exerciseId
}
/>
)
})
=>
{
const
{
data
,
loading
,
error
}
=
useGetTeamEmailParticipant
({
variables
:
{
teamId
,
},
skip
:
!
teamId
,
})
if
(
loading
)
{
return
<
Spinner
/>
}
if
(
error
)
{
return
(
<
ErrorMessage
>
<
h1
>
Error occurred!
</
h1
>
<
p
>
{
error
.
message
}
</
p
>
</
ErrorMessage
>
)
}
if
(
!
data
||
!
data
.
teamEmailParticipant
)
{
return
(
<
NonIdealState
icon
=
'low-voltage-pole'
title
=
'No data'
description
=
'Please wait for the data to come in'
/>
)
}
return
(
<
EmailFormOverlay
teamId
=
{
teamId
}
emailForm
=
'trainee'
exerciseId
=
{
exerciseId
}
teamAddress
=
{
data
.
teamEmailParticipant
.
address
}
/>
)
}
export
default
TraineeEmailFormOverlay
This diff is collapsed.
Click to expand it.
frontend/src/email/EmailFormOverlay/index.tsx
+
6
−
18
View file @
d65730c8
...
...
@@ -2,7 +2,6 @@ import { Button, Card, Overlay2 } from '@blueprintjs/core'
import
{
css
}
from
'
@emotion/css
'
import
type
{
EmailThread
}
from
'
@inject/graphql/fragments/EmailThread.generated
'
import
type
{
FileInfo
}
from
'
@inject/graphql/fragments/FileInfo.generated
'
import
{
useGetTeamEmailParticipant
}
from
'
@inject/graphql/queries/GetTeamEmailParticipant.generated
'
import
type
{
FC
}
from
'
react
'
import
{
useCallback
,
useEffect
,
useState
}
from
'
react
'
import
InstructorEmailForm
from
'
../EmailForm/InstructorEmailForm
'
...
...
@@ -22,11 +21,13 @@ const card = css`
export
const
OPEN_COMPOSE_EVENT_TYPE
=
'
openCompose
'
export
const
OPEN_REPLY_EVENT_TYPE
=
'
openReply
'
interfac
e
EmailFormOverlayProps
{
typ
e
EmailFormOverlayProps
=
{
teamId
:
string
emailForm
:
'
trainee
'
|
'
instructor
'
exerciseId
:
string
}
}
&
(
|
{
emailForm
:
'
trainee
'
;
teamAddress
:
string
}
|
{
emailForm
:
'
instructor
'
;
teamAddress
?:
undefined
}
)
interface
ComposeInitialValues
{
content
?:
string
...
...
@@ -43,25 +44,12 @@ interface OpenReplyEventPayload {
const
EmailFormOverlay
:
FC
<
EmailFormOverlayProps
>
=
({
teamId
,
emailForm
,
teamAddress
,
exerciseId
,
})
=>
{
const
[
open
,
setOpen
]
=
useState
(
false
)
const
[
emailThread
,
setEmailThread
]
=
useState
<
EmailThread
|
undefined
>
()
const
{
data
:
teamParticipantData
}
=
useGetTeamEmailParticipant
({
variables
:
{
teamId
,
},
skip
:
!
teamId
,
})
const
[
teamAddress
,
setTeamAddress
]
=
useState
<
string
>
(
teamParticipantData
?.
teamEmailParticipant
?.
address
||
''
)
useEffect
(
()
=>
setTeamAddress
(
teamParticipantData
?.
teamEmailParticipant
?.
address
||
''
),
[
teamParticipantData
?.
teamEmailParticipant
?.
address
]
)
const
formState
=
useFormState
({
teamAddress
:
emailForm
===
'
trainee
'
?
teamAddress
:
undefined
,
inInstructor
:
emailForm
===
'
instructor
'
,
...
...
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