Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,480 --> 00:00:06,200
So let's now output the filtered events we identified,
2
00:00:06,200 --> 00:00:09,971
for this of course, we can again use our event list
3
00:00:09,971 --> 00:00:12,700
component which we created at the beginning of this module.
4
00:00:12,700 --> 00:00:16,410
So import event list from going up, going up,
5
00:00:16,410 --> 00:00:20,280
components, events, event list,
6
00:00:20,280 --> 00:00:24,230
and then here all output,
7
00:00:24,230 --> 00:00:29,230
event, woops event, list like this, and set my items equal
8
00:00:30,170 --> 00:00:33,820
to the filtered events array, which we're producing here
9
00:00:36,680 --> 00:00:40,770
Now if we save this and I do enter a valid combination
10
00:00:40,770 --> 00:00:45,770
like slash events slash 2021 slash 5.
11
00:00:45,910 --> 00:00:49,400
I'm looking for events from May, 2021.
12
00:00:49,400 --> 00:00:52,950
And you see, I do render two events here because indeed
13
00:00:52,950 --> 00:00:57,950
I do have two events, which date is in May, 2021.
14
00:00:58,770 --> 00:01:00,883
So these are being displayed here then.
15
00:01:01,900 --> 00:01:04,819
So that's working, that's working as it should.
16
00:01:04,819 --> 00:01:07,810
And therefore, now let's just finish this app up,
17
00:01:07,810 --> 00:01:10,720
Polish it a little bit, add a couple of extra styles
18
00:01:10,720 --> 00:01:14,500
and components, and then wrap up this module.
19
00:01:14,500 --> 00:01:17,280
So to Polish this all a little bit,
20
00:01:17,280 --> 00:01:19,610
I'll start by adding a new component
21
00:01:19,610 --> 00:01:21,380
which I prepared for you.
22
00:01:21,380 --> 00:01:24,710
Attached you find a results title, sip file
23
00:01:24,710 --> 00:01:28,300
which contains a results title component and its styles.
24
00:01:28,300 --> 00:01:30,450
And you should drag the JavaScript
25
00:01:30,450 --> 00:01:33,570
and to CSS file, which is part of that attached sub file
26
00:01:33,570 --> 00:01:35,973
into your events folder.
27
00:01:37,140 --> 00:01:40,510
So that in there you then have the results title JS file
28
00:01:40,510 --> 00:01:43,990
and the results titled modules CSS file.
29
00:01:43,990 --> 00:01:45,920
And that's a very simple component,
30
00:01:45,920 --> 00:01:49,000
which adjust when a render on top of the event list here
31
00:01:49,000 --> 00:01:51,130
in the slack component.
32
00:01:51,130 --> 00:01:54,900
So here I'll, then I'll put the results title
33
00:01:54,900 --> 00:01:57,570
and replace that diff with a fragment,
34
00:01:57,570 --> 00:02:00,840
and make sure that we import both results title
35
00:02:00,840 --> 00:02:04,520
as well as fragment in this component now,
36
00:02:04,520 --> 00:02:06,960
Fragment from react and results title
37
00:02:06,960 --> 00:02:09,550
from this file we just added.
38
00:02:09,550 --> 00:02:12,140
Now results title, this component
39
00:02:12,140 --> 00:02:14,570
actually wants a date property
40
00:02:14,570 --> 00:02:18,640
a date prop, which had then outputs in a human readable way,
41
00:02:18,640 --> 00:02:21,160
and therefore we should make sure that we provide
42
00:02:21,160 --> 00:02:26,160
this date prop and to pass that to results title,
43
00:02:26,887 --> 00:02:30,830
down here, I'll create a date constant
44
00:02:30,830 --> 00:02:33,700
where I instantiate a new date object
45
00:02:33,700 --> 00:02:37,660
to which I pass my numb year and numb month,
46
00:02:37,660 --> 00:02:41,010
that is a way of creating a date based on a year month.
47
00:02:41,010 --> 00:02:42,400
The only important thing here is
48
00:02:42,400 --> 00:02:44,940
that you need to deduct one from the month
49
00:02:44,940 --> 00:02:48,840
because that is a zero based index year for the month.
50
00:02:48,840 --> 00:02:52,340
The date constructor function expects the month to begin
51
00:02:52,340 --> 00:02:56,880
at zero, not at one, which is why I deduct one here.
52
00:02:56,880 --> 00:02:59,626
And then we can set the date prop
53
00:02:59,626 --> 00:03:02,720
on results title and pass in our date object.
54
00:03:02,720 --> 00:03:07,250
And that way with that we just have this little extra detail
55
00:03:07,250 --> 00:03:11,393
on top of that and we can now go back to all events again.
56
00:03:12,600 --> 00:03:16,000
Now I also want to Polish messages like this one here
57
00:03:16,000 --> 00:03:18,270
when we didn't find any events
58
00:03:18,270 --> 00:03:20,943
or when we have an invalid filter, like for ABC
59
00:03:22,150 --> 00:03:24,620
I want to present this in a nicer way
60
00:03:24,620 --> 00:03:26,530
and also provide a button
61
00:03:26,530 --> 00:03:29,393
to go back to the all events page then.
62
00:03:30,750 --> 00:03:34,010
And therefor this and this slack page component.
63
00:03:34,010 --> 00:03:37,470
Let's work on this error message here.
64
00:03:37,470 --> 00:03:40,570
When we don't find any matching events
65
00:03:40,570 --> 00:03:44,180
I'll wrap this paragraph in a fragment.
66
00:03:44,180 --> 00:03:46,610
So we need to import fragment from react,
67
00:03:46,610 --> 00:03:48,100
but we already did so before,
68
00:03:48,100 --> 00:03:49,950
so that should already be there.
69
00:03:49,950 --> 00:03:52,200
And we put the paragraph in there
70
00:03:52,200 --> 00:03:56,830
so that below the paragraph, we can also output a button.
71
00:03:56,830 --> 00:04:01,227
So we need to import button from our own component file.
72
00:04:01,227 --> 00:04:04,950
And the With the button added here on the button,
73
00:04:04,950 --> 00:04:09,660
I'll say show all events and that should be be a link,
74
00:04:09,660 --> 00:04:12,243
So I will set the link prop two slash event.
75
00:04:13,590 --> 00:04:15,640
Know that buttons should actually be centered,
76
00:04:15,640 --> 00:04:20,290
so wrap it in a Dev with that global center clause.
77
00:04:20,290 --> 00:04:22,443
I showed you in one of the last lecture.
78
00:04:24,660 --> 00:04:29,660
And I'll do that Same thing for this invalid filter error.
79
00:04:30,180 --> 00:04:32,160
I'll wrap this in a fragment as well
80
00:04:32,160 --> 00:04:35,970
and add my button here, as well as this paragraph
81
00:04:35,970 --> 00:04:38,240
move that all into the fragment.
82
00:04:38,240 --> 00:04:41,713
So that here, we also got a way of going back.
83
00:04:42,710 --> 00:04:45,670
Now we have the button but the message still looks ugly.
84
00:04:45,670 --> 00:04:49,050
And for that, I prepared a never component for you
85
00:04:49,050 --> 00:04:51,040
which you all defined attached.
86
00:04:51,040 --> 00:04:55,010
It's a component you should move into your UI folder,
87
00:04:55,010 --> 00:04:59,460
the error alert component which is attached
88
00:04:59,460 --> 00:05:03,470
this error alert component gives us a nice container
89
00:05:03,470 --> 00:05:05,740
for error messages like this.
90
00:05:05,740 --> 00:05:08,060
And therefore in the Slack component
91
00:05:08,060 --> 00:05:10,298
we should import error alert from
92
00:05:10,298 --> 00:05:15,250
and then dive into the UI folder in the components folder
93
00:05:15,250 --> 00:05:18,150
and into the error alert file.
94
00:05:18,150 --> 00:05:21,560
And then simply wrap the paragraph here
95
00:05:21,560 --> 00:05:23,900
for the invalid filter for example,
96
00:05:23,900 --> 00:05:26,880
with error alert with this component
97
00:05:26,880 --> 00:05:29,550
simply wrap it around this paragraph.
98
00:05:29,550 --> 00:05:34,200
And if you do so, this now looks nicer,
99
00:05:34,200 --> 00:05:37,990
now for the case that we don't find any events,
100
00:05:37,990 --> 00:05:40,040
I also want to use that component.
101
00:05:40,040 --> 00:05:42,747
So they'll for, for this error message down here
102
00:05:42,747 --> 00:05:44,830
for the no events found message.
103
00:05:44,830 --> 00:05:49,830
We can also wrap this into an error alert like that.
104
00:05:51,240 --> 00:05:53,830
I also want to use that error alert
105
00:05:53,830 --> 00:05:56,540
in the event ID page here,
106
00:05:56,540 --> 00:05:58,030
because here also have the case
107
00:05:58,030 --> 00:06:03,030
that we didn't find any event for a chosen event ID
108
00:06:03,520 --> 00:06:06,080
and there for here justice before,
109
00:06:06,080 --> 00:06:11,080
all import error alert from going up going up,
110
00:06:11,690 --> 00:06:14,970
components, UI error alert,
111
00:06:14,970 --> 00:06:18,150
and then wrap this paragraph with it.
112
00:06:18,150 --> 00:06:21,883
So error alert wrapped around this paragraph,
113
00:06:22,870 --> 00:06:26,380
so that if we do a look for an event which doesn't exist
114
00:06:26,380 --> 00:06:29,900
for example, slash events slash test.
115
00:06:29,900 --> 00:06:32,930
So just one dynamic segment after events
116
00:06:32,930 --> 00:06:36,498
but a segment value which doesn't match any event ID.
117
00:06:36,498 --> 00:06:38,343
I get no event found.
118
00:06:39,570 --> 00:06:42,310
And with that, we should be good.
119
00:06:42,310 --> 00:06:46,950
Now we wired up all those different values and pages
120
00:06:46,950 --> 00:06:50,270
and they're now all working the way they should work.
121
00:06:50,270 --> 00:06:53,936
We can filter, we can show all events,
122
00:06:53,936 --> 00:06:55,775
we can dive into a single event
123
00:06:55,775 --> 00:07:00,113
and we made that work with standard react and next JS.
10056
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.