From 5bcb94621decf0c59127acd3ccabfc9931c73d50 Mon Sep 17 00:00:00 2001 From: Jeremy Smitherman Date: Sat, 14 Feb 2026 17:00:35 -0600 Subject: [PATCH] Added triggers that add complete and pb class names to splitlist elements, and added some examples in the default css skin --- .../src/components/editor/SplitEditor.tsx | 4 +- .../src/components/splitter/SegmentList.tsx | 64 +++++++++++++----- session/service.go | 3 +- skin/default-skin.zip | Bin 1853 -> 2778 bytes 4 files changed, 52 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/editor/SplitEditor.tsx b/frontend/src/components/editor/SplitEditor.tsx index 8cc0349..2c93c0a 100644 --- a/frontend/src/components/editor/SplitEditor.tsx +++ b/frontend/src/components/editor/SplitEditor.tsx @@ -446,11 +446,11 @@ export default function SplitEditor({ splitFilePayload }: SplitEditorParams) {
- + setAttempts(Number(e.target.value))} value={attempts ?? 0} - id="attempts" + id="runattempts" name="attempts" inputMode="numeric" /> diff --git a/frontend/src/components/splitter/SegmentList.tsx b/frontend/src/components/splitter/SegmentList.tsx index 442b9f0..bc0a0db 100644 --- a/frontend/src/components/splitter/SegmentList.tsx +++ b/frontend/src/components/splitter/SegmentList.tsx @@ -188,9 +188,39 @@ function isVisible(id: string, parentById: Map, expandedP } export default function SegmentList({ sessionPayload, comparison }: SplitListParameters) { + const [completeClassName, setCompleteClassName] = React.useState(""); const activeRowRef = useRef(null); const containerRef = useRef(null); + useEffect(() => { + let className = ""; + if (sessionPayload.loaded_split_file && + sessionPayload.current_run && + sessionPayload.leaf_segments) { + if(Object.keys(sessionPayload.current_run.splits).length + == sessionPayload.leaf_segments.length) { + className = "complete"; + + const pb = sessionPayload.loaded_split_file.pb; + console.log(sessionPayload.loaded_split_file) + if (pb) { + const segments = sessionPayload.leaf_segments; + if (segments) { + const finalSplit = segments[segments.length - 1].id; + const finalTime = sessionPayload.current_run.splits[finalSplit].current_cumulative; + if (finalTime < pb.total_time) { + className += " pb"; + } + } + } + } + setCompleteClassName(className); + } else { + setCompleteClassName(""); + } + + }, [sessionPayload]); + const targets = useMemo(() => { let cumulative = 0; const results: Targets = { cumulative: {}, individual: {} }; @@ -353,7 +383,7 @@ export default function SegmentList({ sessionPayload, comparison }: SplitListPar // Delta pulled from last leaf vs its cumulative target let parentDelta: JSX.Element | null = null; - if (lastLeafId && lastLeafSplit) { + if (lastLeafId) { const leafSeg = segmentById.get(lastLeafId); const cTarget = targets.cumulative[lastLeafId] ?? null; const iTarget = targets.individual[lastLeafId] ?? null; @@ -363,19 +393,21 @@ export default function SegmentList({ sessionPayload, comparison }: SplitListPar } if (cTarget != null) { - const delta = lastLeafSplit.current_cumulative - cTarget; - parentDelta = getDeltaDisplayTime(delta); + if (lastLeafSplit != null) { + const delta = lastLeafSplit.current_cumulative - cTarget; + parentDelta = getDeltaDisplayTime(delta); + } } } main.push( - + {toggle} {segmentData.Segment.name} - {parentDelta} - {parentComparison} + {parentDelta} + {parentComparison} , ); continue; @@ -423,26 +455,26 @@ export default function SegmentList({ sessionPayload, comparison }: SplitListPar ]); return ( -
-
-

+
+
+

{sessionPayload.loaded_split_file?.game_name}

-

+

{sessionPayload.loaded_split_file?.game_category}

-
{sessionPayload.loaded_split_file?.attempts}
+
{sessionPayload.loaded_split_file?.attempts}
-
-
- +
+
+
{mainRows}
-
- +
+
{finalRow}
diff --git a/session/service.go b/session/service.go index 1a259f3..bd09bc0 100644 --- a/session/service.go +++ b/session/service.go @@ -131,6 +131,7 @@ func (s *Service) SetLoadedSplitFile(sf SplitFile) { s.currentSegmentIndex = -1 s.sessionState = Idle s.dirty = false + s.loadedSplitFile.BuildStats() logger.Infof(logModule, "%s loaded in session (segments total/leaf %d/%d)", sf.GameName, len(sf.Segments), len(s.leafSegments)) } @@ -151,6 +152,7 @@ func (s *Service) Split() SplitResult { case Running: return s.advanceRun() case Finished: + s.loadedSplitFile.BuildStats() s.resetLocked() return SplitReset case Paused: @@ -326,7 +328,6 @@ func (s *Service) resetLocked() { func (s *Service) PersistRunToSession() { if s.currentRun != nil { s.loadedSplitFile.Runs = append(s.loadedSplitFile.Runs, *s.currentRun) - s.loadedSplitFile.BuildStats() logger.Info(logModule, "run persisted to session, new stats built") } else { logger.Warn(logModule, "persist requested on nil current run") diff --git a/skin/default-skin.zip b/skin/default-skin.zip index e61bcf96a1eb9754b712df1f9ebc735cef75915f..fc15023e46df40c3aaa10017b229a2709c7fc1d3 100644 GIT binary patch delta 1201 zcmdnXcT2QBz?+#xgn@y9gTb`jFQ%-`XRQ$<1H%#~1_mCWXmWmTK~8E(s$Oz&aqpzF zS%(dHj=yi+*Q_8i>(LTFk8Km<%I+q<*`Qt!eABe|?SqQc$d|j%XI`pJ(V2bF?b?6! zn;u*&!9N!4?DSszic5AOFyR)9`q$$3kG-L@_fkumN=!B!Ock=wjDx1A!XzAM$P1e2)^;%QE^N?V0jz zCI8aaFYGDRi#sN(Dr;U}=KgQ5w)M^;&GNMyd$(8{?|yTxXr9{r@28sM8S5oZ9JHHc zyrgH!lNHS+i-J>_nq0kSNvSg#{H4c&Yx@PBb@<=bjY?F|T_dS{=Ecmp z$9FFgh$vTC?s-Evuk9JzTCsbFJLY|G&g^Y_y1UQ2*!5A`Jl6$0N~igM2{7$6nW=wS z#Wzp2*nalhSRUWH-N9}zbWfgmz%cI;%O8_PwG+r46IkUjO-2+jvTO{u1%4zj@xrwT7g|rCMJ5e{Dy- z@T7%Wr*~`4pIg{}=xkS0otFIcKog_(jcuEJWuA6BT1a`c%)0zM`QP&$I}cTT?ao@W zLXQzN#*Yk6`xhuC9+`em{TuYNtCl zHH)Sd*O=z)wR_~2?qict_@ut%cssk*JDJ~y_Y27SZYLhH7CmJlw8a2Z3^1Lg zR)7)bc=cN z8a64A7bl-&la}cQCfbtB+|(j0E}6tGt+bMzfuSt1s2C#63QFP(>_FHK^nooXyD$I% DM~KW_ delta 285 zcmca5x|dHpz?+#xgn@y9gCSy%cMRWk`C?NbFJ*EuqoW{~DIWuh{N&4wKFmOMo1ZhU zV*)c~ut_t58Qa(=Gg_e-0W^jah*3diUP@|(UUG49fHxzP2m{>a$$L4anPM0w-{O=8 z88=ynOFC>dP-}5PPG(6-Y7rJKF)8e4w|obx`OAoIQw%c$LrG>XR&A5#a!D&yu`n={ WB^DJ!jAdm5Ig%9!C4olqfq4KgQ$4f*