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
f6a43c01
There was an error fetching the commit references. Please try again later.
Commit
f6a43c01
authored
11 months ago
by
Marek Veselý
Browse files
Options
Downloads
Patches
Plain Diff
feat: add the option to create new items in recipients
parent
7db2d28a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/email/EmailContactSelector/index.tsx
+27
-1
27 additions, 1 deletion
frontend/src/email/EmailContactSelector/index.tsx
with
27 additions
and
1 deletion
frontend/src/email/EmailContactSelector/index.tsx
+
27
−
1
View file @
f6a43c01
...
...
@@ -2,7 +2,7 @@ import { MenuItem, Tooltip } from '@blueprintjs/core'
import
type
{
ItemRenderer
}
from
'
@blueprintjs/select
'
import
{
MultiSelect
}
from
'
@blueprintjs/select
'
import
type
{
EmailParticipant
}
from
'
@inject/graphql/fragments/EmailParticipant.generated
'
import
type
{
Dispatch
,
FC
,
SetStateAction
}
from
'
react
'
import
type
{
Dispatch
,
FC
,
MouseEventHandler
,
SetStateAction
}
from
'
react
'
import
{
memo
,
useCallback
,
useMemo
}
from
'
react
'
import
type
{
ExtendedItemRenderer
}
from
'
../typing
'
...
...
@@ -67,6 +67,7 @@ const EmailContactSelector: FC<EmailContactSelectorProps> = ({
)
const
onItemSelect
=
useCallback
(
(
i
:
string
)
=>
// TODO: add validation
setSelectedContacts
(
prev
=>
{
if
(
prev
.
includes
(
i
))
{
return
prev
.
filter
(
x
=>
x
!==
i
)
...
...
@@ -80,6 +81,29 @@ const EmailContactSelector: FC<EmailContactSelectorProps> = ({
[
setSelectedContacts
]
)
const
createNewItemFromQuery
:
(
query
:
string
)
=>
string
|
string
[]
=
useCallback
((
query
:
string
)
=>
query
,
[])
const
createNewItemRenderer
:
(
query
:
string
,
active
:
boolean
,
handleClick
:
MouseEventHandler
<
HTMLElement
>
)
=>
undefined
|
JSX
.
Element
=
useCallback
(
(
query
:
string
,
active
:
boolean
,
handleClick
:
MouseEventHandler
<
HTMLElement
>
)
=>
(
<
MenuItem
active
=
{
active
}
onClick
=
{
handleClick
}
roleStructure
=
'listoption'
shouldDismissPopover
=
{
false
}
text
=
{
query
}
/>
),
[]
)
return
(
<
MultiSelect
<
string
>
placeholder
=
'
Recipients
'
...
...
@@ -98,6 +122,8 @@ const EmailContactSelector: FC<EmailContactSelectorProps> = ({
popoverContentProps
=
{{
style
:
{
maxHeight
:
'
50vh
'
,
overflowY
:
'
auto
'
,
overflowX
:
'
hidden
'
},
}}
createNewItemFromQuery
=
{
createNewItemFromQuery
}
createNewItemRenderer
=
{
createNewItemRenderer
}
/
>
)
}
...
...
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