Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/app/components/results/DebugPanels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ const DebugPanels: React.FC = observer(() => {
const store = useStore();
if (!store.debug) return null;

const { calc, player, selectedLoadout } = store;
const {
calc, player, selectedLoadout, prefs,
} = store;
const details: DetailEntry[] = calc.loadouts[selectedLoadout]?.details || [];
const specDetails: DetailEntry[] = calc.loadouts[selectedLoadout]?.specDetails || [];
const npcDetails: DetailEntry[] = calc.loadouts[selectedLoadout]?.npcDetails || [];

return (
<>
<SectionAccordion
defaultIsOpen={prefs.debug?.itemIdsExpanded || false}
onIsOpenChanged={(v) => store.updatePreferences({ debug: { itemIdsExpanded: v } })}
title={(
<div className="flex items-center gap-2">
<div className="w-6 flex justify-center"><LazyImage src={debug.src} /></div>
Expand All @@ -28,7 +32,7 @@ const DebugPanels: React.FC = observer(() => {
</div>
)}
>
<table className="w-full my-5">
<table className="w-full">
<thead>
<tr>
<th className="text-center w-1/4 border-x border-y font-bold font-serif bg-btns-400 dark:bg-dark-500 text-white">Slot</th>
Expand All @@ -50,6 +54,8 @@ const DebugPanels: React.FC = observer(() => {
</table>
</SectionAccordion>
<SectionAccordion
defaultIsOpen={prefs.debug?.calcDetailsExpanded || false}
onIsOpenChanged={(v) => store.updatePreferences({ debug: { calcDetailsExpanded: v } })}
title={(
<div className="flex items-center gap-2">
<div className="w-6 flex justify-center"><LazyImage src={debug.src} /></div>
Expand All @@ -58,7 +64,6 @@ const DebugPanels: React.FC = observer(() => {
</h3>
</div>
)}
defaultIsOpen
>
<table className="w-full">
<thead>
Expand All @@ -78,6 +83,8 @@ const DebugPanels: React.FC = observer(() => {
</table>
</SectionAccordion>
<SectionAccordion
defaultIsOpen={prefs.debug?.specDetailsExpanded || false}
onIsOpenChanged={(v) => store.updatePreferences({ debug: { specDetailsExpanded: v } })}
title={(
<div className="flex items-center gap-2">
<div className="w-6 flex justify-center"><LazyImage src={debug.src} /></div>
Expand All @@ -86,7 +93,6 @@ const DebugPanels: React.FC = observer(() => {
</h3>
</div>
)}
defaultIsOpen={false}
>
<table className="w-full">
<thead>
Expand All @@ -106,6 +112,8 @@ const DebugPanels: React.FC = observer(() => {
</table>
</SectionAccordion>
<SectionAccordion
defaultIsOpen={prefs.debug?.npcDetailsExpanded || false}
onIsOpenChanged={(v) => store.updatePreferences({ debug: { npcDetailsExpanded: v } })}
title={(
<div className="flex items-center gap-2">
<div className="w-6 flex justify-center"><LazyImage src={debug.src} /></div>
Expand All @@ -114,7 +122,6 @@ const DebugPanels: React.FC = observer(() => {
</h3>
</div>
)}
defaultIsOpen={false}
>
<table className="w-full">
<thead>
Expand Down
2 changes: 1 addition & 1 deletion src/state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ class GlobalState implements State {

updatePreferences(pref: PartialDeep<Preferences>) {
// Update local state store
this.prefs = Object.assign(this.prefs, pref);
this.prefs = merge(this.prefs, pref);

if (pref && Object.prototype.hasOwnProperty.call(pref, 'manualMode')) {
// Reset player bonuses to their worn equipment
Expand Down
7 changes: 7 additions & 0 deletions src/types/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ export interface Preferences {
hitDistsHideZeros: boolean; // legacy name
hitDistShowSpec: boolean;
resultsExpanded: boolean;

debug?: {
itemIdsExpanded?: boolean;
calcDetailsExpanded?: boolean;
specDetailsExpanded?: boolean;
npcDetailsExpanded?: boolean;
}
}

export interface ChartEntry {
Expand Down