diff --git a/src/App.tsx b/src/App.tsx
index d351e88..0329305 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -12,6 +12,11 @@ enum Conlang {
Juteyuji = 'juteyuji',
}
+enum SearchDirection {
+ ToConlang,
+ ToEnglish
+}
+
const renderConlang = (conlang: Conlang): string => {
if (conlang === Conlang.Saimiar) {
return 'Saimiar';
@@ -107,7 +112,7 @@ const Results = (props) => {
const num = props.searchResults.length;
const renderedName = renderConlang(conlang);
- const searchType = (props.direction === 'toConlang') ? `English -> ${renderedName}` : `${renderedName} -> English`;
+ const searchType = (props.direction === SearchDirection.ToConlang) ? `English -> ${renderedName}` : `${renderedName} -> English`;
const header = (
Searched for { props.searchTerm }, { searchType }, found { num } result(s)
@@ -167,7 +172,7 @@ class App extends Component {
this.setState({searchResults: null, searchTerm: null, direction: null});
} else {
makeRequest(request, (json) => {
- this.setState({searchResults: json, searchTerm, direction: 'toEnglish'});
+ this.setState({searchResults: json, searchTerm, direction: SearchDirection.ToEnglish});
});
}
}
@@ -178,7 +183,7 @@ class App extends Component {
this.setState({searchResults: null, searchTerm: null, direction: null});
} else {
makeRequest(request, (json) => {
- this.setState({searchResults: json, searchTerm, direction: 'toEnglish'});
+ this.setState({searchResults: json, searchTerm, direction: SearchDirection.ToEnglish});
});
}
}
@@ -191,7 +196,7 @@ class App extends Component {
this.setState({searchResults: null, searchTerm: null});
} else {
makeRequest(request, (json) => {
- this.setState({searchResults: json, searchTerm, direction: 'toConlang'});
+ this.setState({searchResults: json, searchTerm, direction: SearchDirection.ToConlang});
});
}
}