Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fabcity-map-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Map
fabcity-map-frontend
Commits
da95dcca
Commit
da95dcca
authored
3 years ago
by
Fabian Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
Add poi category select
parent
16edc132
No related branches found
Branches containing commit
No related tags found
1 merge request
!20
Develop
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/Form/AddPoiForm.tsx
+18
-7
18 additions, 7 deletions
src/components/Form/AddPoiForm.tsx
with
18 additions
and
7 deletions
src/components/Form/AddPoiForm.tsx
+
18
−
7
View file @
da95dcca
...
...
@@ -15,7 +15,7 @@ import Spinner from '../Spinner';
import
type
{
CreatePoiMutationMutationVariables
,
Mutation
}
from
'
../../generated/graphql
'
;
import
SelectInput
from
'
./SelectInput
'
;
type
RelationStatus
Option
=
{
label
:
string
;
value
:
string
};
type
StringSelect
Option
=
{
label
:
string
;
value
:
string
};
const
AddPoiForm
:
React
.
FC
=
()
=>
{
const
[
formData
,
setFormData
]
=
useState
<
PointOfInterestFormData
>
({
...
...
@@ -38,7 +38,8 @@ const AddPoiForm: React.FC = () => {
const
history
=
useHistory
();
const
{
data
}
=
usePoiData
();
const
[
tagOptions
,
setTagOptions
]
=
useState
<
Tag
[]
>
([]);
const
[
relationStatusOptions
,
setRelationStatusOptions
]
=
useState
<
RelationStatusOption
[]
>
([]);
const
[
categoryOptions
,
setCatgeoryOptions
]
=
useState
<
StringSelectOption
[]
>
([]);
const
[
relationStatusOptions
,
setRelationStatusOptions
]
=
useState
<
StringSelectOption
[]
>
([]);
const
[
selectedTags
,
setSelectedTags
]
=
useState
<
Tag
[]
>
([]);
const
setNotification
=
useStore
((
state
)
=>
state
.
setNotification
);
...
...
@@ -123,6 +124,10 @@ const AddPoiForm: React.FC = () => {
.
filter
((
poi
)
=>
!!
poi
.
relationStatus
)
.
map
((
poi
)
=>
({
label
:
poi
.
relationStatus
,
value
:
poi
.
relationStatus
}));
setRelationStatusOptions
(
relationStatuses
);
const
categories
=
removeDuplicateObjects
(
data
,
'
category
'
)
.
filter
((
poi
)
=>
!!
poi
.
category
)
.
map
((
poi
)
=>
({
label
:
poi
.
category
,
value
:
poi
.
category
}));
setCatgeoryOptions
(
categories
);
}
},
[
data
]);
...
...
@@ -153,21 +158,27 @@ const AddPoiForm: React.FC = () => {
/>
<
TagInput
label
=
{
'
Tags
'
}
tags
=
{
selectedTags
}
options
=
{
tagOptions
}
onTagsChange
=
{
setSelectedTags
}
/>
<
TextInput
label
=
{
'
Name des Orts
'
}
name
=
{
'
name
'
}
value
=
{
formData
.
name
}
onChange
=
{
handleInputChange
}
required
/>
<
Tex
tInput
<
Selec
tInput
label
=
{
'
Kategorie
'
}
name
=
{
'
category
'
}
value
=
{
formData
.
category
}
onChange
=
{
handleInputChange
}
required
name
=
{
'
category
'
}
options
=
{
categoryOptions
}
onChange
=
{
(
selectedOption
)
=>
setFormData
((
prev
)
=>
({
...
prev
,
category
:
selectedOption
?
(
selectedOption
as
StringSelectOption
).
value
:
''
,
}))
}
/>
<
SelectInput
label
=
{
'
Verhältnis zum Fab City Hamburg e.V.
'
}
required
name
=
{
'
relationStatus
'
}
options
=
{
relationStatusOptions
}
onChange
=
{
(
selectedOption
)
=>
setFormData
((
prev
)
=>
({
...
prev
,
relationStatus
:
selectedOption
?
(
selectedOption
as
RelationStatus
Option
).
value
:
''
,
relationStatus
:
selectedOption
?
(
selectedOption
as
StringSelect
Option
).
value
:
''
,
}))
}
/>
...
...
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