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