mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-30 23:27:55 -05:00
weapon pool affects build tab order
This commit is contained in:
@@ -113,9 +113,24 @@ const UserPage: React.FC<RouteComponentProps & UserPageProps> = ({ id }) => {
|
||||
content: (
|
||||
<TabPanel key={1}>
|
||||
<BuildTab
|
||||
builds={builds.sort(
|
||||
(a, b) => weapons.indexOf(a.weapon) - weapons.indexOf(b.weapon)
|
||||
)}
|
||||
builds={builds.sort((a, b) => {
|
||||
const weaponPool = user.weapons
|
||||
if (weaponPool) {
|
||||
if (
|
||||
weaponPool.includes(a.weapon) &&
|
||||
weaponPool.includes(b.weapon)
|
||||
) {
|
||||
return (
|
||||
weaponPool.indexOf(a.weapon) - weaponPool.indexOf(b.weapon)
|
||||
)
|
||||
}
|
||||
const poolComparision =
|
||||
weaponPool.indexOf(b.weapon) - weaponPool.indexOf(a.weapon)
|
||||
|
||||
if (poolComparision !== 0) return poolComparision
|
||||
}
|
||||
return weapons.indexOf(a.weapon) - weapons.indexOf(b.weapon)
|
||||
})}
|
||||
canModifyBuilds={userLean?.discord_id === user.discord_id}
|
||||
/>
|
||||
</TabPanel>
|
||||
|
||||
Reference in New Issue
Block a user