Unverified Commit a9c499f7 authored by Ridwan Amode's avatar Ridwan Amode Committed by GitHub
Browse files

ENSWBSITES-1170: Ordering filters alphabetically (#511)

* ENSWBSITES-1170: Ordering filters alphabetically
protein coding comes first and then the rest are alphabetically ordered
parent c19fa0da
Pipeline #170414 passed with stages
in 8 minutes and 57 seconds
...@@ -73,7 +73,9 @@ const TranscriptsFilter = (props: Props) => { ...@@ -73,7 +73,9 @@ const TranscriptsFilter = (props: Props) => {
.map((a) => a.so_term) .map((a) => a.so_term)
.filter(Boolean) as string[]; .filter(Boolean) as string[];
const uniqueBiotypes = Array.from(new Set(biotypes)); const uniqueBiotypes = Array.from(new Set(biotypes)).sort((a, b) => {
return sortBiotypes(a, b);
});
// TODO: Add protein coding options in RadioOptions if there are protein coding biotype // TODO: Add protein coding options in RadioOptions if there are protein coding biotype
const initialFilters = uniqueBiotypes.reduce((accumulator, biotype): { const initialFilters = uniqueBiotypes.reduce((accumulator, biotype): {
...@@ -153,4 +155,14 @@ const TranscriptsFilter = (props: Props) => { ...@@ -153,4 +155,14 @@ const TranscriptsFilter = (props: Props) => {
); );
}; };
const sortBiotypes = (a: string, b: string) => {
if (a === 'protein_coding') {
return -1;
} else if (b === 'protein_coding') {
return 1;
} else {
return a.localeCompare(b);
}
};
export default TranscriptsFilter; export default TranscriptsFilter;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment