// right-column.jsx - RightColumn component
// Loaded after sortof-shared.jsx; defines globals that sortof-app.jsx references.
// Shows when a user has sorted many mods that don't belong to the active build,
// suggesting they switch builds and re-sort. Only counts remove-only mismatches
// (no swap available); those can't be fixed any other way.
function SwitchBuildBanner({ warnings, pzBuild, onSwitchBuildAndSort }) {
const otherBuild = pzBuild === 'B41' ? 'B42' : 'B41';
const removeOnly = (warnings || []).filter(w =>
w.tag === 'build-mismatch' &&
Array.isArray(w.actions) &&
!w.actions.some(a => a.type === 'swap-wsid')
);
const totalMods = (D.SORTED_ORDER || []).length;
if (removeOnly.length < 5 || totalMods === 0 || removeOnly.length / totalMods < 0.2) return null;
return (
{removeOnly.length} mods are {pzBuild}-incompatible with no {pzBuild} equivalent:
are you on the wrong build?
);
}
function RightColumn({ state, counts, progress, emptyVariant, successVariant, modTableDefault, pzBuild, setPzBuild, branchSelections, onToggleBranch, expandedWsids, onToggleExpansion, inputWsids, onAddWsid, onPickBranch, onSwapWsid, onRemoveWsid, onAutoFixAddDeps, onAutoFixSwaps, onAutoFixRemoves, onRetry, onSwitchBuildAndSort, inputWsidList, unknownWsids, failedWsids, diffOpen, setDiffOpen, activeJobId, isShortlinkView, onDismissShortlink }) {
const isTerminalDone = state === 'success' || state === 'done';
const isInflightPartial = state === 'partial' || state === 'queued' || state === 'draining';
const showWarnings = isTerminalDone || isInflightPartial;
const showOutputs = isTerminalDone || isInflightPartial;
const _allWarnings = [...(D.WARNINGS || []), ...unknownRemovalWarnings(unknownWsids), ...failedIndexWarnings(failedWsids)];
return (
<>
{showWarnings && (
<>
>
)}
{state === 'cold' && (
❄ cold
indexing {counts.queued} {counts.queued === 1 ? 'mod' : 'mods'} we haven't seen before. try again in ~30s. or don't, we're not your boss.
)}
{state === 'error' && (() => {
const warns = (D.WARNINGS || []);
const retryWarn = [...warns].reverse().find(w => w.tag === 'retry');
const reason = retryWarn ? retryWarn.msg : 'something failed - check warnings above';
const hasCached = (D.MOD_DB || []).length > 0;
return (
⚠ err
{reason}{hasCached ? ' · cached results below still valid' : ''}
);
})()}
{isShortlinkView && }
{state === 'idle' && }
{(state === 'loading' || state === 'expanding') && (
{state === 'expanding' ? 'expanding your collection…' : 'parsing your collection…'}
resolving dependencies. applying rules. probably fine.
)}
{showOutputs && (
<>
{isInflightPartial && (
showing cached subset · {counts.queued + (counts.parsing || 0)} mods still in flight
)}
{diffOpen && (
setDiffOpen(false)}
/>
)}
{successVariant === 'stacked' &&
}
{successVariant === 'compact' &&
}
{successVariant === 'numbered' &&
}
>
)}
{(isTerminalDone && !isShortlinkView) && (
)}
{(isTerminalDone || isInflightPartial) && (
)}
>
);
}
Object.assign(window, { RightColumn });