Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Commits
5e7f84b0
Verified
Commit
5e7f84b0
authored
3 years ago
by
Andreas Ellewsen
Browse files
Options
Downloads
Patches
Plain Diff
Move RoleLine to its own component
parent
c990338e
No related branches found
Branches containing commit
No related tags found
1 merge request
!146
Greg 98 landing page
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/components/roleLine/index.tsx
+61
-0
61 additions, 0 deletions
frontend/src/components/roleLine/index.tsx
frontend/src/routes/sponsor/guest/guestInfo/index.tsx
+2
-34
2 additions, 34 deletions
frontend/src/routes/sponsor/guest/guestInfo/index.tsx
with
63 additions
and
34 deletions
frontend/src/components/roleLine/index.tsx
0 → 100644
+
61
−
0
View file @
5e7f84b0
import
{
Button
,
TableCell
,
TableRow
}
from
'
@mui/material
'
import
{
Role
}
from
'
interfaces
'
import
{
useTranslation
}
from
'
react-i18next
'
import
{
Link
}
from
'
react-router-dom
'
import
{
format
}
from
'
date-fns
'
interface
RoleLineProps
{
role
:
Role
pid
:
string
}
const
RoleLine
=
({
role
,
pid
}:
RoleLineProps
)
=>
{
const
[
t
,
i18n
]
=
useTranslation
(
'
common
'
)
console
.
log
(
role
)
return
(
<
TableRow
sx
=
{
{
'
&:last-child td, &:last-child th
'
:
{
border
:
0
}
}
}
>
<
TableCell
align
=
"left"
>
{
i18n
.
language
===
'
en
'
?
role
.
name_en
:
role
.
name_nb
}
</
TableCell
>
<
TableCell
component
=
"th"
scope
=
"row"
>
{
role
.
start_date
?
format
(
role
.
start_date
,
'
yyyy-MM-dd
'
)
:
null
}
-
{
'
'
}
{
format
(
role
.
end_date
,
'
yyyy-MM-dd
'
)
}
</
TableCell
>
<
TableCell
align
=
"left"
>
{
i18n
.
language
===
'
en
'
?
role
.
ou_en
:
role
.
ou_nb
}
</
TableCell
>
<
TableCell
>
<
Button
variant
=
"contained"
component
=
{
Link
}
to
=
{
`/sponsor/guest/
${
pid
}
/roles/
${
role
.
id
}
`
}
>
{
t
(
'
sponsor.choose
'
)
}
</
Button
>
</
TableCell
>
</
TableRow
>
)
}
interface
UserRoleLineProps
{
role
:
Role
}
export
const
UserRoleLine
=
({
role
}:
UserRoleLineProps
)
=>
{
const
[,
i18n
]
=
useTranslation
(
'
common
'
)
console
.
log
(
role
)
return
(
<
TableRow
sx
=
{
{
'
&:last-child td, &:last-child th
'
:
{
border
:
0
}
}
}
>
<
TableCell
align
=
"left"
>
{
i18n
.
language
===
'
en
'
?
role
.
name_en
:
role
.
name_nb
}
</
TableCell
>
<
TableCell
component
=
"th"
scope
=
"row"
>
{
role
.
start_date
?
format
(
role
.
start_date
,
'
yyyy-MM-dd
'
)
:
null
}
-
{
'
'
}
{
format
(
role
.
end_date
,
'
yyyy-MM-dd
'
)
}
</
TableCell
>
<
TableCell
align
=
"left"
>
{
i18n
.
language
===
'
en
'
?
role
.
ou_en
:
role
.
ou_nb
}
</
TableCell
>
</
TableRow
>
)
}
export
default
RoleLine
This diff is collapsed.
Click to expand it.
frontend/src/routes/sponsor/guest/guestInfo/index.tsx
+
2
−
34
View file @
5e7f84b0
import
{
Link
,
useParams
,
useHistory
}
from
'
react-router-dom
'
import
{
Link
,
useParams
,
useHistory
}
from
'
react-router-dom
'
import
Page
from
'
components/page
'
import
Page
from
'
components/page
'
import
RoleLine
from
'
components/roleLine
'
import
{
useTranslation
}
from
'
react-i18next
'
import
{
useTranslation
}
from
'
react-i18next
'
import
{
import
{
Button
,
Button
,
...
@@ -20,8 +21,7 @@ import {
...
@@ -20,8 +21,7 @@ import {
}
from
'
@mui/material
'
}
from
'
@mui/material
'
import
{
Guest
,
Role
}
from
'
interfaces
'
import
{
Guest
,
Role
}
from
'
interfaces
'
import
SponsorInfoButtons
from
'
routes/components/sponsorInfoButtons
'
import
SponsorInfoButtons
from
'
routes/components/sponsorInfoButtons
'
import
{
format
}
from
'
date-fns
'
import
{
useEffect
,
useState
}
from
'
react
'
import
React
,
{
useEffect
,
useState
}
from
'
react
'
import
{
SubmitHandler
,
useForm
}
from
'
react-hook-form
'
import
{
SubmitHandler
,
useForm
}
from
'
react-hook-form
'
import
{
isValidEmail
,
submitJsonOpts
}
from
'
../../../../utils
'
import
{
isValidEmail
,
submitJsonOpts
}
from
'
../../../../utils
'
...
@@ -29,11 +29,6 @@ type GuestInfoParams = {
...
@@ -29,11 +29,6 @@ type GuestInfoParams = {
pid
:
string
pid
:
string
}
}
interface
RoleLineProps
{
role
:
Role
pid
:
string
}
type
GuestInfoProps
=
{
type
GuestInfoProps
=
{
guest
:
Guest
guest
:
Guest
roles
:
Role
[]
roles
:
Role
[]
...
@@ -41,33 +36,6 @@ type GuestInfoProps = {
...
@@ -41,33 +36,6 @@ type GuestInfoProps = {
resend
:
()
=>
void
resend
:
()
=>
void
}
}
const
RoleLine
=
({
role
,
pid
}:
RoleLineProps
)
=>
{
const
[
t
,
i18n
]
=
useTranslation
(
'
common
'
)
return
(
<
TableRow
sx
=
{
{
'
&:last-child td, &:last-child th
'
:
{
border
:
0
}
}
}
>
<
TableCell
align
=
"left"
>
{
i18n
.
language
===
'
en
'
?
role
.
name_en
:
role
.
name_nb
}
</
TableCell
>
<
TableCell
component
=
"th"
scope
=
"row"
>
{
role
.
start_date
?
format
(
role
.
start_date
,
'
yyyy-MM-dd
'
)
:
null
}
-
{
'
'
}
{
format
(
role
.
end_date
,
'
yyyy-MM-dd
'
)
}
</
TableCell
>
<
TableCell
align
=
"left"
>
{
i18n
.
language
===
'
en
'
?
role
.
ou_en
:
role
.
ou_nb
}
</
TableCell
>
<
TableCell
>
<
Button
variant
=
"contained"
component
=
{
Link
}
to
=
{
`/sponsor/guest/
${
pid
}
/roles/
${
role
.
id
}
`
}
>
{
t
(
'
sponsor.choose
'
)
}
</
Button
>
</
TableCell
>
</
TableRow
>
)
}
type
CancelConfirmationDialogProps
=
{
type
CancelConfirmationDialogProps
=
{
open
:
boolean
open
:
boolean
onClose
:
(
ok
:
boolean
)
=>
void
onClose
:
(
ok
:
boolean
)
=>
void
...
...
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