From b4d364f7616a7bed85469d8655ff048b108aa786 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 20 Nov 2024 17:38:29 -0800 Subject: [PATCH] WIP: comment out checkpoint logic --- gui/src/components/History/index.tsx | 16 +++++++++---- gui/src/components/Layout.tsx | 6 ++--- .../components/StepContainer/EditActions.tsx | 23 +++++++++++++------ .../StepContainer/StepContainer.tsx | 6 ++--- .../mainInput/CodeBlockComponent.tsx | 2 +- gui/src/components/markdown/FilenameLink.tsx | 2 +- gui/src/pages/Edit/CodeToEdit.tsx | 18 ++++++++------- gui/src/redux/slices/editModeState.ts | 6 +---- 8 files changed, 46 insertions(+), 33 deletions(-) diff --git a/gui/src/components/History/index.tsx b/gui/src/components/History/index.tsx index 4aee636bd..e509a9be9 100644 --- a/gui/src/components/History/index.tsx +++ b/gui/src/components/History/index.tsx @@ -129,18 +129,26 @@ export function History() { return ( {index === 0 && date > yesterday && ( - Today + + Today + )} {date < yesterday && date > lastWeek && prevDate > yesterday && ( - This Week + + This Week + )} {date < lastWeek && date > lastMonth && prevDate > lastWeek && ( - This Month + + This Month + )} {date < lastMonth && prevDate > lastMonth && ( - Older + + Older + )} { useWebviewListener( "focusEdit", - async (payload) => { - dispatch(setIsInEditMode(true)); - dispatch(focusEdit(payload)); + async () => { + dispatch(focusEdit()); navigate("/edit"); }, [navigate], diff --git a/gui/src/components/StepContainer/EditActions.tsx b/gui/src/components/StepContainer/EditActions.tsx index d38255659..733ae623b 100644 --- a/gui/src/components/StepContainer/EditActions.tsx +++ b/gui/src/components/StepContainer/EditActions.tsx @@ -13,9 +13,11 @@ export interface EditActionsProps { } export default function EditActions({ index, item }: EditActionsProps) { - const curCheckpointIndex = useSelector( - (store: RootState) => store.state.curCheckpointIndex, - ); + // const curCheckpointIndex = useSelector( + // (store: RootState) => store.state.curCheckpointIndex, + // ); + + const active = useSelector((state: RootState) => state.state.active); const applyStates = useSelector( (state: RootState) => state.state.applyStates, @@ -29,10 +31,10 @@ export default function EditActions({ index, item }: EditActionsProps) { (state) => state.status === "closed", ); - const isCurCheckpoint = Math.floor(index / 2) === curCheckpointIndex; + // const isCurCheckpoint = Math.floor(index / 2) === curCheckpointIndex; const hasPendingApplies = pendingApplyStates.length > 0; - console.log({ isCurCheckpoint, curCheckpointIndex, index }); + if (active) return; return (
- {isCurCheckpoint && ( + {/* {isCurCheckpoint && (
{hasPendingApplies && ( )} {hasClosedAllStreams && }
- )} + )} */} + +
+ {hasPendingApplies && ( + + )} + {/* {hasClosedAllStreams && } */} +
curCheckpointIndex; + // const isStepAheadOfCurCheckpoint = + // isInEditMode && Math.floor(props.index / 2) > curCheckpointIndex; useEffect(() => { if (!active) { @@ -76,7 +76,7 @@ export default function StepContainer(props: StepContainerProps) { return (
{ const isFirstContextItem = false; // TODO: fix this, decided not worth the insane renders for now return ( - + - + {getBasename(rif.filepath)} diff --git a/gui/src/pages/Edit/CodeToEdit.tsx b/gui/src/pages/Edit/CodeToEdit.tsx index 562c37028..b72847b10 100644 --- a/gui/src/pages/Edit/CodeToEdit.tsx +++ b/gui/src/pages/Edit/CodeToEdit.tsx @@ -36,14 +36,16 @@ export default function WorkingSet() { } } - const codeToEditItems = editModeState.codeToEdit.map((code, i) => ( - - )); + const codeToEditItems = [...editModeState.codeToEdit] + .reverse() + .map((code, i) => ( + + )); return (
{ + state.isInEditMode = true; state.editStatus = "not-started"; state.previousInputs = []; state.fileAfterEdit = undefined; @@ -40,7 +41,6 @@ export const editModeStateSlice = createSlice({ state.editStatus = "streaming"; }, removeCodeToEdit: (state, { payload }: PayloadAction) => { - // Remove entry from codeToEdit that doesn't match the payload's filepath and contents state.codeToEdit = state.codeToEdit.filter( (entry) => !( @@ -96,9 +96,6 @@ export const editModeStateSlice = createSlice({ state.editStatus = "done"; state.previousInputs = []; }, - setIsInEditMode: (state, { payload }: PayloadAction) => { - state.isInEditMode = payload; - }, }, }); @@ -111,6 +108,5 @@ export const { removeCodeToEdit, focusEdit, clearCodeToEdit, - setIsInEditMode, } = editModeStateSlice.actions; export default editModeStateSlice.reducer;