willianjusten / nba-nextjs

See NBA game results and standings powered by Next.js
https://nba.willianjusten.com.br
26 stars 2 forks source link

Order the Games in a better way #1

Closed willianjusten closed 5 months ago

willianjusten commented 6 months ago

We should display in the following order:

Similar to what NBA does:

image

Probably you can create a method like:

function customSort(a, b) {
    const priority = {
        2: 0, // Games Happening
        1: 1, // Games that will happen
        3: 2  // Games finished
    };

    return priority[a.status] - priority[b.status];
}

data.sort(customSort);

We have those in 2 places as I'm aware of:

We can even might refactor to be only one component