Refactor the category detail component