@@ -11,12 +11,12 @@ export default function App() {
11
11
< Head />
12
12
< div >
13
13
< Switch >
14
- < Route path = "/cfp/:type /:country" render = { renderCFP } />
15
- < Route path = "/cfp/:type /" render = { renderCFP } />
14
+ < Route path = "/cfp/:topic /:country" render = { renderCFP } />
15
+ < Route path = "/cfp/:topic /" render = { renderCFP } />
16
16
< Route path = "/cfp" render = { renderCFP } />
17
- < Route path = "/:year/:type /:country" render = { redirect } />
18
- < Route path = "/:type /:country" render = { redirectOrRender } />
19
- < Route path = "/:type " component = { ConferencePage } />
17
+ < Route path = "/:year/:topic /:country" render = { redirect } />
18
+ < Route path = "/:topic /:country" render = { redirectOrRender } />
19
+ < Route path = "/:topic " component = { ConferencePage } />
20
20
< Route exact path = "/" component = { ConferencePage } />
21
21
< Route component = { ConferencePage } />
22
22
</ Switch >
@@ -29,30 +29,30 @@ function renderCFP({match}) {
29
29
}
30
30
31
31
function redirect ( props ) {
32
- const { type , country} = props . match . params ;
32
+ const { topic , country} = props . match . params ;
33
33
34
- return < Redirect to = { `/${ type } /${ country } ` } state = { { status : 301 } } /> ;
34
+ return < Redirect to = { `/${ topic } /${ country } ` } state = { { status : 301 } } /> ;
35
35
}
36
36
37
37
/*
38
- Old routes were /:year/:type and now is /:type /:country
39
- If we detect that :type is a year, the user actually wanted to reach
40
- the new route /:type
38
+ Old routes were /:year/:topic and now is /:topic /:country
39
+ If we detect that :topic is a year, the user actually wanted to reach
40
+ the new route /:topic
41
41
*/
42
42
function redirectOrRender ( props ) {
43
- const { type , country} = props . match . params ;
43
+ const { topic , country} = props . match . params ;
44
44
45
- if ( isYear ( type ) ) {
45
+ if ( isYear ( topic ) ) {
46
46
return < Redirect to = { `/${ country } ` } state = { { status : 301 } } /> ;
47
47
} else {
48
- return < ConferencePage { ...props } fallback = { redirectToType } /> ;
48
+ return < ConferencePage { ...props } fallback = { redirectToTopic } /> ;
49
49
}
50
50
}
51
51
52
52
function isYear ( year ) {
53
53
return ( year . length === 4 && ! isNaN ( parseInt ( year , 10 ) ) ) ;
54
54
}
55
55
56
- function redirectToType ( type ) {
57
- return < Redirect to = { `/${ type } ` } state = { { status : 301 } } /> ;
56
+ function redirectToTopic ( topic ) {
57
+ return < Redirect to = { `/${ topic } ` } state = { { status : 301 } } /> ;
58
58
}
0 commit comments