mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-05 23:36:37 +00:00
refactor(recovery): centralize item type derivation
This commit is contained in:
parent
e64f1c5811
commit
702336baf9
11 changed files with 93 additions and 34 deletions
|
|
@ -25,6 +25,7 @@ import {
|
|||
} from '@/utils/recoveryEmptyStatePresentation';
|
||||
import {
|
||||
getRecoveryItemTypePresentation,
|
||||
getRecoveryRollupItemTypeKey,
|
||||
normalizeRecoveryItemTypeQueryValue,
|
||||
} from '@/utils/recoveryItemTypePresentation';
|
||||
import {
|
||||
|
|
@ -124,12 +125,8 @@ export const RecoveryProtectedInventorySection: Component<
|
|||
return multiplier * leftLabel.localeCompare(rightLabel);
|
||||
}
|
||||
case 'type': {
|
||||
const leftType = getRecoveryItemTypePresentation(
|
||||
left.display?.itemType || left.display?.subjectType || left.subjectRef?.type,
|
||||
)?.label.toLowerCase();
|
||||
const rightType = getRecoveryItemTypePresentation(
|
||||
right.display?.itemType || right.display?.subjectType || right.subjectRef?.type,
|
||||
)?.label.toLowerCase();
|
||||
const leftType = getRecoveryItemTypePresentation(getRecoveryRollupItemTypeKey(left))?.label.toLowerCase();
|
||||
const rightType = getRecoveryItemTypePresentation(getRecoveryRollupItemTypeKey(right))?.label.toLowerCase();
|
||||
return multiplier * (leftType || '').localeCompare(rightType || '');
|
||||
}
|
||||
case 'platform': {
|
||||
|
|
@ -376,11 +373,7 @@ export const RecoveryProtectedInventorySection: Component<
|
|||
getSourcePlatformLabel(left).localeCompare(getSourcePlatformLabel(right)),
|
||||
);
|
||||
const itemTypePresentation =
|
||||
getRecoveryItemTypePresentation(
|
||||
rollup.display?.itemType ||
|
||||
rollup.display?.subjectType ||
|
||||
rollup.subjectRef?.type,
|
||||
) || null;
|
||||
getRecoveryItemTypePresentation(getRecoveryRollupItemTypeKey(rollup)) || null;
|
||||
const nowMs = Date.now();
|
||||
const issueTone: RecoveryIssueTone = getRecoveryRollupIssueTone(rollup, nowMs);
|
||||
const issueRailClass =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue