improve order even more
This commit is contained in:
+5
-2
@@ -100,6 +100,7 @@ const Force = ({ force, onePerPage }) => {
|
||||
{units.map((unit, index) => (
|
||||
<Unit
|
||||
key={index}
|
||||
index={index}
|
||||
unit={unit}
|
||||
catalog={catalog}
|
||||
onePerPage={onePerPage}
|
||||
@@ -110,7 +111,7 @@ const Force = ({ force, onePerPage }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const Unit = ({ unit, catalog, onePerPage }) => {
|
||||
const Unit = ({ unit, index, catalog, onePerPage }) => {
|
||||
let {
|
||||
name,
|
||||
weapons,
|
||||
@@ -151,7 +152,9 @@ const Unit = ({ unit, catalog, onePerPage }) => {
|
||||
|
||||
return (
|
||||
<div
|
||||
className={"avoid-page-break " + (onePerPage ? "page-break" : "")}
|
||||
className={
|
||||
"avoid-page-break " + (onePerPage && index !== 0 ? "page-break" : "")
|
||||
}
|
||||
style={{
|
||||
fontWeight: 500,
|
||||
border: "2px solid var(--primary-color)",
|
||||
|
||||
+5
-2
@@ -278,11 +278,14 @@ export class Unit extends BaseNotes {
|
||||
// Sort force units by role and name
|
||||
this.models.sort(CompareModel);
|
||||
this.modelStats.sort((a, b) => {
|
||||
if (!a.wounds) return 1;
|
||||
var wounds_order = parseInt(a.wounds) - parseInt(b.wounds);
|
||||
var leadership_order = parseInt(a.leadership) - parseInt(b.leadership);
|
||||
var move_order = parseInt(a.move) - parseInt(b.move);
|
||||
return (
|
||||
-wounds_order || -leadership_order || b.name.length - a.name.length
|
||||
-wounds_order ||
|
||||
-leadership_order ||
|
||||
-move_order ||
|
||||
b.name.length - a.name.length
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user