Skip to content

Commit 79b9af3

Browse files
nimzcoNima Izadi
authored and
Nima Izadi
committed
Renamed type to topic
1 parent a986421 commit 79b9af3

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

Diff for: src/components/App/App.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ export default function App() {
1111
<Head />
1212
<div>
1313
<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} />
1616
<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} />
2020
<Route exact path="/" component={ConferencePage} />
2121
<Route component={ConferencePage} />
2222
</Switch>
@@ -29,30 +29,30 @@ function renderCFP({match}) {
2929
}
3030

3131
function redirect(props) {
32-
const {type, country} = props.match.params;
32+
const {topic, country} = props.match.params;
3333

34-
return <Redirect to={`/${type}/${country}`} state={{status: 301}} />;
34+
return <Redirect to={`/${topic}/${country}`} state={{status: 301}} />;
3535
}
3636

3737
/*
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
4141
*/
4242
function redirectOrRender(props) {
43-
const {type, country} = props.match.params;
43+
const {topic, country} = props.match.params;
4444

45-
if (isYear(type)) {
45+
if (isYear(topic)) {
4646
return <Redirect to={`/${country}`} state={{status: 301}} />;
4747
} else {
48-
return <ConferencePage {...props} fallback={redirectToType} />;
48+
return <ConferencePage {...props} fallback={redirectToTopic} />;
4949
}
5050
}
5151

5252
function isYear(year) {
5353
return (year.length === 4 && !isNaN(parseInt(year, 10)));
5454
}
5555

56-
function redirectToType(type) {
57-
return <Redirect to={`/${type}`} state={{status: 301}} />;
56+
function redirectToTopic(topic) {
57+
return <Redirect to={`/${topic}`} state={{status: 301}} />;
5858
}

Diff for: src/components/ConferencePage/ConferencePage.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ class ConferencePage extends Component {
7373

7474
render() {
7575
const {showPast, sortBy} = this.state;
76-
const {showCFP, match: {params: {type, country}}} = this.props;
77-
const addConferenceUrl = getAddConferenceUrl(type);
76+
const {showCFP, match: {params: {topic, country}}} = this.props;
77+
const addConferenceUrl = getAddConferenceUrl(topic);
7878

7979
return (
8080
<div>
8181
<Helmet>
8282
<title>Tech conferences | Confs.tech</title>
8383
</Helmet>
84-
<Favicon url={`/${type}.png`} />
84+
<Favicon url={`/${topic}.png`} />
8585
<header className={styles.Header}>
8686
<h1 className="visuallyHidden">
87-
List of all {type ? TOPICS[type] : 'tech'} conferences of {CURRENT_YEAR}
87+
List of all {topic ? TOPICS[topic] : 'tech'} conferences of {CURRENT_YEAR}
8888
{country ? ` in ${country}` : null}
8989
</h1>
9090
<Heading element="p">Find your next tech conference</Heading>
@@ -103,7 +103,7 @@ class ConferencePage extends Component {
103103
/>
104104
<RefinementList
105105
attributeName="topics"
106-
defaultRefinement={type ? [type] : []}
106+
defaultRefinement={topic ? [topic] : []}
107107
transformItems={transformTopicRefinements}
108108
/>
109109
<RefinementList

Diff for: src/components/config/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ const REPO_URLS = {
2222
general: 'https://github.com/tech-conferences/confs.tech',
2323
};
2424

25-
export function getAddConferenceUrl(type = 'JavaScript') {
26-
return `${REPO_URLS[type.toLocaleLowerCase()]}/issues/new`;
25+
export function getAddConferenceUrl(topic = 'JavaScript') {
26+
return `${REPO_URLS[topic.toLocaleLowerCase()]}/issues/new`;
2727
}

0 commit comments

Comments
 (0)