Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,060 --> 00:00:03,770
So let's now connect this,
2
00:00:03,770 --> 00:00:05,800
quote item links here.
3
00:00:05,800 --> 00:00:07,510
Where there isn't a quote item component
4
00:00:07,510 --> 00:00:09,400
I get this anchor tag.
5
00:00:09,400 --> 00:00:12,620
And this at the moment is basically just a placeholder
6
00:00:12,620 --> 00:00:15,780
so that we see this button link here.
7
00:00:15,780 --> 00:00:19,100
But it's not how we actually wanna create that link.
8
00:00:19,100 --> 00:00:22,420
We could stick to anchor tag with the ref attribute.
9
00:00:22,420 --> 00:00:25,150
But then you learned we have the problem
10
00:00:25,150 --> 00:00:29,100
that we actually will send a request and reload the page.
11
00:00:29,100 --> 00:00:31,750
And that's not something we wanna do.
12
00:00:31,750 --> 00:00:35,530
Instead, we wanna stay in the loaded Single Page Application
13
00:00:35,530 --> 00:00:40,530
and let React Router do the URL changing and page updating.
14
00:00:40,800 --> 00:00:43,530
And therefore in this quote item component,
15
00:00:43,530 --> 00:00:45,550
instead of using an anchor tag,
16
00:00:45,550 --> 00:00:50,300
we wanna import the link component from react router dom
17
00:00:50,300 --> 00:00:55,150
and then replace this anchor tag with this link component.
18
00:00:55,150 --> 00:00:57,510
Now this link component needs to prompt
19
00:00:57,510 --> 00:01:01,610
and here we now need to set the path we wanna go to.
20
00:01:01,610 --> 00:01:03,390
Now when it comes to that path,
21
00:01:03,390 --> 00:01:05,180
we have to keep in mind
22
00:01:05,180 --> 00:01:07,610
that for the clothes detail page here,
23
00:01:07,610 --> 00:01:11,260
we actually have this dynamic segment in the URL.
24
00:01:11,260 --> 00:01:12,880
And we need that segment
25
00:01:12,880 --> 00:01:16,870
so that we can extract the data in that quote detail page
26
00:01:16,870 --> 00:01:20,823
and load the appropriate close data for the selected quote.
27
00:01:21,920 --> 00:01:24,810
Now therefore, the path to which you wanna link
28
00:01:24,810 --> 00:01:27,480
should be slash quotes, flash
29
00:01:27,480 --> 00:01:31,970
and then some concrete value for this place holder.
30
00:01:31,970 --> 00:01:35,640
So here, we actually wanna create a dynamic value,
31
00:01:35,640 --> 00:01:38,690
because we wanna derive this path dynamically.
32
00:01:38,690 --> 00:01:41,710
And I'll do this with a template literal here.
33
00:01:41,710 --> 00:01:45,380
And it will always start with slash quotes.
34
00:01:45,380 --> 00:01:48,520
But then we have a segment there after,
35
00:01:48,520 --> 00:01:51,560
which is different for every code item.
36
00:01:51,560 --> 00:01:55,010
So inject this here into this template literal.
37
00:01:55,010 --> 00:01:58,710
And there, we could expect that we get this ID prop
38
00:01:58,710 --> 00:02:02,410
which identifies this specific quote item.
39
00:02:02,410 --> 00:02:06,380
And indeed we will get an ID prop because in code list,
40
00:02:06,380 --> 00:02:08,930
I'm setting an ID prop here.
41
00:02:08,930 --> 00:02:11,360
So we can extract props ID here
42
00:02:11,360 --> 00:02:14,730
to construct the path to this concrete quote,
43
00:02:14,730 --> 00:02:16,530
which we're outputting in this list.
44
00:02:18,190 --> 00:02:20,120
With that if we save this,
45
00:02:20,120 --> 00:02:22,370
if we now click View full screen,
46
00:02:22,370 --> 00:02:25,440
we view the quote detail page for q1.
47
00:02:25,440 --> 00:02:26,660
So for the first quote
48
00:02:27,650 --> 00:02:30,220
and here for the second quote it's q2.
49
00:02:30,220 --> 00:02:31,453
So that works.
50
00:02:32,430 --> 00:02:35,020
And with that we can also continue working
51
00:02:35,020 --> 00:02:38,210
on that quote detail page a little bit.
52
00:02:38,210 --> 00:02:42,500
Because there I don't just wanna output this dummy content.
53
00:02:42,500 --> 00:02:46,410
Instead, I wanna output the actual quote data.
54
00:02:46,410 --> 00:02:49,350
And later we'll fetch this from a database.
55
00:02:49,350 --> 00:02:52,670
For the moment I'll just use some dummy data.
56
00:02:52,670 --> 00:02:56,853
And I'll copy this dummy quotes array from all quotes,
57
00:02:57,810 --> 00:03:00,840
and also add it here in quote detail.
58
00:03:00,840 --> 00:03:02,830
And of course we could do for all the define
59
00:03:02,830 --> 00:03:05,860
at once in some global file and export it,
60
00:03:05,860 --> 00:03:07,150
but it's just some dummy data
61
00:03:07,150 --> 00:03:08,990
which we'll remove later anyways
62
00:03:08,990 --> 00:03:11,580
so copying it here is fine.
63
00:03:11,580 --> 00:03:13,150
And now that it is copied,
64
00:03:13,150 --> 00:03:15,740
we can use this dummy quotes array
65
00:03:15,740 --> 00:03:20,740
to get the appropriate quote which you want to output here.
66
00:03:20,960 --> 00:03:22,643
We can get that quote,
67
00:03:23,870 --> 00:03:26,700
which we store maybe in a constant name quote
68
00:03:26,700 --> 00:03:28,820
simply by reaching out to dummy quotes
69
00:03:28,820 --> 00:03:32,240
and then finding an item where the quote
70
00:03:32,240 --> 00:03:34,710
we're having a look at in this array
71
00:03:34,710 --> 00:03:39,710
has an ID which is equal to parents dot ID dot quote ID.
72
00:03:41,660 --> 00:03:44,957
So equal to the ID we have in the URL.
73
00:03:44,957 --> 00:03:49,050
And dot quote ID well because we have quote ID
74
00:03:49,050 --> 00:03:52,053
as a placeholder name here in the route definition.
75
00:03:53,810 --> 00:03:56,910
With this we identify one of our quotes
76
00:03:56,910 --> 00:03:59,773
and we can be offered an output this quote data.
77
00:04:00,640 --> 00:04:03,330
Now for that I prepared another component,
78
00:04:03,330 --> 00:04:05,990
the highlighted quote component
79
00:04:05,990 --> 00:04:10,250
which simply well outputs and styles as single quote
80
00:04:10,250 --> 00:04:13,070
and therefore we can use this component here
81
00:04:13,070 --> 00:04:18,070
all import the highlighted word component from components,
82
00:04:19,610 --> 00:04:21,779
quotes, highlighted quote
83
00:04:24,010 --> 00:04:27,140
and replace this h1 tag in this paragraph
84
00:04:27,140 --> 00:04:29,010
with highlighted quote
85
00:04:29,010 --> 00:04:31,350
and now this highlighted quote component,
86
00:04:31,350 --> 00:04:33,146
once a text prop and an author prop
87
00:04:33,146 --> 00:04:35,609
and hence all set these two props,
88
00:04:35,609 --> 00:04:40,609
all set text equal to quote dot text
89
00:04:42,210 --> 00:04:45,853
and author equal to quotes dot author.
90
00:04:47,030 --> 00:04:51,100
Now of course, we could be visiting this quote detail page
91
00:04:51,100 --> 00:04:54,720
with an ID which is not part of this quote array.
92
00:04:54,720 --> 00:04:56,620
So we also might wanna handle this
93
00:04:56,620 --> 00:04:59,780
we might wanna check if quote is undefined,
94
00:04:59,780 --> 00:05:02,680
so if not quote, if we didn't find a quote
95
00:05:02,680 --> 00:05:05,750
for the ID we had in the URL,
96
00:05:05,750 --> 00:05:09,720
because of course a user can enter anything in that URL,
97
00:05:09,720 --> 00:05:10,890
I can click on these links
98
00:05:10,890 --> 00:05:13,660
and I only have quotes that actually exist.
99
00:05:13,660 --> 00:05:16,370
But I can manually enter q free here
100
00:05:16,370 --> 00:05:18,400
and then I'll not have a quote
101
00:05:18,400 --> 00:05:21,430
and therefore we might want to handle that case.
102
00:05:21,430 --> 00:05:25,130
And if we don't have a quote, we wanna return
103
00:05:25,130 --> 00:05:27,940
and display some fallback content,
104
00:05:27,940 --> 00:05:31,223
maybe a paragraph where we say no quote found,
105
00:05:33,130 --> 00:05:34,960
anything like that.
106
00:05:34,960 --> 00:05:39,960
And with that if I enter q free here, we get no quote found.
107
00:05:40,070 --> 00:05:43,020
Of course we could change the styling of that text.
108
00:05:43,020 --> 00:05:47,120
But if I do enter a valid ID, I see that quote instead.
109
00:05:47,120 --> 00:05:48,860
And it style like this because
110
00:05:48,860 --> 00:05:50,963
of highlighted quote component.
111
00:05:53,180 --> 00:05:55,800
So whichever also putting some dummy data
112
00:05:55,800 --> 00:05:58,310
on this quote detail page.
113
00:05:58,310 --> 00:06:00,740
Now lets get back to rounding its self
114
00:06:00,740 --> 00:06:03,010
and dive into more rounding features
115
00:06:03,010 --> 00:06:06,430
which we also might need in application which we're building
9187
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.