mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-27 08:16:20 +00:00
refactor if into switch case
This commit is contained in:
parent
ced7b887d2
commit
747bc943a9
|
@ -853,25 +853,29 @@ export function commentsToFlatNodes(comments: CommentView[]): CommentNodeI[] {
|
|||
}
|
||||
|
||||
export function convertCommentSortType(sort: SortType): CommentSortType {
|
||||
if (
|
||||
sort == "TopAll" ||
|
||||
sort == "TopHour" ||
|
||||
sort == "TopSixHour" ||
|
||||
sort == "TopTwelveHour" ||
|
||||
sort == "TopDay" ||
|
||||
sort == "TopWeek" ||
|
||||
sort == "TopMonth" ||
|
||||
sort == "TopYear"
|
||||
) {
|
||||
switch(sort) {
|
||||
case "TopAll":
|
||||
case "TopHour":
|
||||
case "TopSixHour":
|
||||
case "TopTwelveHour":
|
||||
case "TopDay":
|
||||
case "TopWeek":
|
||||
case "TopMonth":
|
||||
case "TopYear": {
|
||||
return "Top";
|
||||
} else if (sort == "New") {
|
||||
}
|
||||
case "New": {
|
||||
return "New";
|
||||
} else if (sort == "Hot" || sort == "Active") {
|
||||
}
|
||||
case "Hot":
|
||||
case "Active": {
|
||||
return "Hot";
|
||||
} else {
|
||||
}
|
||||
default: {
|
||||
return "Hot";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function buildCommentsTree(
|
||||
comments: CommentView[],
|
||||
|
|
Loading…
Reference in a new issue