Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PB138 - Film Database Group Project
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tomáš Havlíček
PB138 - Film Database Group Project
Commits
8099a309
There was an error fetching the commit references. Please try again later.
Commit
8099a309
authored
2 years ago
by
Lukáš Kratochvíl
Browse files
Options
Downloads
Patches
Plain Diff
feat: SearchPage - added form interface, deleted example data
parent
7e879c7b
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/components/SearchPage.tsx
+17
-42
17 additions, 42 deletions
frontend/src/components/SearchPage.tsx
with
17 additions
and
42 deletions
frontend/src/components/SearchPage.tsx
+
17
−
42
View file @
8099a309
...
...
@@ -18,42 +18,6 @@ import { CategoryIO, DirectorIO, MovieIO } from "./Preview";
const
{
Option
}
=
Select
;
//TODO replace with result of input search and API call
const
resultsExample
:
MovieIO
[]
=
[
{
id
:
"
789
"
,
name
:
"
Saw
"
,
originalName
:
"
Saw
"
,
intro
:
"
Jigsaw is the bad guy and this is the game
"
,
picture
:
"
https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftse3.mm.bing.net%2Fth%3Fid%3DOIP.Jo6M-3oyAlMsB4-F__Z9bwHaHa%26pid%3DApi&f=1
"
,
publishedAt
:
"
1.6.2000
"
,
runTimeMinutes
:
120
,
director
:
{
id
:
"
123456789
"
,
name
:
"
Karel
"
,
surname
:
"
Macka
"
,
birthDate
:
"
20.2.1987
"
,
},
},
{
id
:
"
999
"
,
name
:
"
Saw 2
"
,
originalName
:
"
Saw 2
"
,
intro
:
"
The sequel to the first one
"
,
picture
:
"
https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fimages01.kaleidescape.com%2Ftransformed%2Fcovers%2F1134x1624s%2F189%2F18976008.jpg&f=1&nofb=1
"
,
publishedAt
:
"
1.1.2002
"
,
runTimeMinutes
:
150
,
director
:
{
id
:
"
123456789
"
,
name
:
"
Karel
"
,
surname
:
"
Vomacka
"
,
birthDate
:
"
20.2.1987
"
,
},
},
];
const
runtimeMarks
=
{
0
:
"
0
"
,
30
:
"
30
"
,
...
...
@@ -77,6 +41,15 @@ const yearMarks = {
2020
:
"
2020
"
,
};
interface
IFormProps
{
name
:
string
;
originalName
:
string
;
runTimeMinutes
:
number
[];
publishedAt
:
number
[];
categoryId
:
string
;
directorId
:
string
;
};
//for searching movies
export
const
SearchPage
=
()
=>
{
const
[
pressed
,
setPressed
]
=
useState
(
true
);
//may modify or delete in future
...
...
@@ -87,6 +60,8 @@ export const SearchPage = () => {
const
[
categories
,
setCategories
]
=
useState
<
CategoryIO
[]
>
([]);
const
[
directors
,
setDirectors
]
=
useState
<
DirectorIO
[]
>
([]);
const
[
resultMovies
,
setResultMovies
]
=
useState
<
MovieIO
[]
>
([]);
useEffect
(()
=>
{
const
fetchData
=
async
()
=>
{
try
{
...
...
@@ -104,7 +79,7 @@ export const SearchPage = () => {
}, []);
// here will be API call for search on BE, everything needed is in values
const onSubmit = (values:
any
) =>
{
const onSubmit =
async
(values:
IFormProps
) =>
{
alert
(
JSON
.
stringify
(
values
));
}
;
...
...
@@ -219,7 +194,7 @@ export const SearchPage = () => {
</
Row
>
<
Row
gutter
=
{
20
}
>
<
Col
span
=
{
12
}
>
<
Form
.
Item
name
=
"run
t
ime"
label
=
"Runtime minutes"
>
<
Form
.
Item
name
=
"run
T
ime
Minutes
"
label
=
"Runtime minutes"
>
<
Slider
marks
=
{
runtimeMarks
}
range
=
{
{
draggableTrack
:
true
}
}
...
...
@@ -233,7 +208,7 @@ export const SearchPage = () => {
<
Row
gutter
=
{
20
}
>
<
Col
span
=
{
12
}
>
<
Form
.
Item
name
=
"published"
label
=
"Year published"
>
<
Form
.
Item
name
=
"published
At
"
label
=
"Year published"
>
<
Slider
marks
=
{
yearMarks
}
range
=
{
{
draggableTrack
:
true
}
}
...
...
@@ -247,7 +222,7 @@ export const SearchPage = () => {
</
Row
>
<
Row
gutter
=
{
20
}
>
<
Col
span
=
{
6
}
>
<
Form
.
Item
name
=
"category"
label
=
"Category"
>
<
Form
.
Item
name
=
"category
Id
"
label
=
"Category"
>
<
Select
showSearch
style
=
{
{
width
:
"
100%
"
}
}
...
...
@@ -275,7 +250,7 @@ export const SearchPage = () => {
</
Form
.
Item
>
</
Col
>
<
Col
span
=
{
6
}
>
<
Form
.
Item
name
=
"director"
label
=
"Director"
>
<
Form
.
Item
name
=
"director
Id
"
label
=
"Director"
>
<
Select
showSearch
style
=
{
{
width
:
"
100%
"
}
}
...
...
@@ -351,7 +326,7 @@ export const SearchPage = () => {
};
//here change to view movie
}
}
columns
=
{
columns
}
dataSource
=
{
result
sExample
}
dataSource
=
{
result
Movies
}
bordered
title
=
{
()
=>
"
Results
"
}
/>
...
...
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