Skip to content

Commit

Permalink
Backport device sort from development
Browse files Browse the repository at this point in the history
  • Loading branch information
amberstarlight committed Jul 17, 2024
1 parent 3a14f47 commit 3f28f56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@
"husky": "^7.0.4",
"prettier": "^2.4.1",
"react-scripts": "4.0.3"
}
},
"packageManager": "[email protected]+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
}
9 changes: 8 additions & 1 deletion src/components/DeviceList/DeviceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
import { Link } from 'wouter';
import DeviceCard from '../DeviceCard/DeviceCard';

const deviceSort = (a, b) => {
a.friendly_name[0] - b.friendly_name[0] ||
a.friendly_name.localeCompare(b.friendly_name, undefined, {
numeric: true,
});
};

function DeviceList(props) {
return (
<div>
{props.devices.map((device) => (
{props.devices.sort(deviceSort).map((device) => (
<Link
href={`/devices/${device.friendly_name}`}
key={device.ieee_address}
Expand Down

0 comments on commit 3f28f56

Please sign in to comment.