Skip to content

Commit

Permalink
WIP: comment out checkpoint logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick-Erichsen committed Nov 21, 2024
1 parent f90d4bc commit b4d364f
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 33 deletions.
16 changes: 12 additions & 4 deletions gui/src/components/History/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,26 @@ export function History() {
return (
<Fragment key={index}>
{index === 0 && date > yesterday && (
<tr className={HEADER_CLASS}>Today</tr>
<tr className={HEADER_CLASS}>
<td colSpan={3}>Today</td>
</tr>
)}
{date < yesterday &&
date > lastWeek &&
prevDate > yesterday && (
<tr className={HEADER_CLASS}>This Week</tr>
<tr className={HEADER_CLASS}>
<td colSpan={3}>This Week</td>
</tr>
)}
{date < lastWeek && date > lastMonth && prevDate > lastWeek && (
<tr className={HEADER_CLASS}>This Month</tr>
<tr className={HEADER_CLASS}>
<td colSpan={3}>This Month</td>
</tr>
)}
{date < lastMonth && prevDate > lastMonth && (
<tr className={HEADER_CLASS}>Older</tr>
<tr className={HEADER_CLASS}>
<td colSpan={3}>Older</td>
</tr>
)}

<HistoryTableRow
Expand Down
6 changes: 2 additions & 4 deletions gui/src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
setEditStatus,
addCodeToEdit,
focusEdit,
setIsInEditMode,
} from "../redux/slices/editModeState";
import { setShowDialog } from "../redux/slices/uiStateSlice";
import {
Expand Down Expand Up @@ -193,9 +192,8 @@ const Layout = () => {

useWebviewListener(
"focusEdit",
async (payload) => {
dispatch(setIsInEditMode(true));
dispatch(focusEdit(payload));
async () => {
dispatch(focusEdit());
navigate("/edit");
},
[navigate],
Expand Down
23 changes: 16 additions & 7 deletions gui/src/components/StepContainer/EditActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -29,25 +31,32 @@ 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 (
<div
className={`mx-2 mb-2 mt-2 flex h-7 items-center justify-between pb-0 text-xs text-gray-400`}
>
<div className="flex-1" />

{isCurCheckpoint && (
{/* {isCurCheckpoint && (
<div className="flex-2 flex justify-center">
{hasPendingApplies && (
<AcceptRejectAllButtons pendingApplyStates={pendingApplyStates} />
)}
{hasClosedAllStreams && <UndoAndRedoButtons />}
</div>
)}
)} */}

<div className="flex-2 flex justify-center">
{hasPendingApplies && (
<AcceptRejectAllButtons pendingApplyStates={pendingApplyStates} />
)}
{/* {hasClosedAllStreams && <UndoAndRedoButtons />} */}
</div>

<div className="flex flex-1 justify-end">
<CopyIconButton
Expand Down
6 changes: 3 additions & 3 deletions gui/src/components/StepContainer/StepContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export default function StepContainer(props: StepContainerProps) {
);
const uiConfig = useUIConfig();
const shouldHideActions = active && props.isLast;
const isStepAheadOfCurCheckpoint =
isInEditMode && Math.floor(props.index / 2) > curCheckpointIndex;
// const isStepAheadOfCurCheckpoint =
// isInEditMode && Math.floor(props.index / 2) > curCheckpointIndex;

useEffect(() => {
if (!active) {
Expand Down Expand Up @@ -76,7 +76,7 @@ export default function StepContainer(props: StepContainerProps) {

return (
<div
className={isStepAheadOfCurCheckpoint ? "opacity-25" : "relative"}
// className={isStepAheadOfCurCheckpoint ? "opacity-25" : "relative"}
style={{
minHeight: props.isLast ? "50vh" : 0,
}}
Expand Down
2 changes: 1 addition & 1 deletion gui/src/components/mainInput/CodeBlockComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const CodeBlockComponent = (props: any) => {
const isFirstContextItem = false; // TODO: fix this, decided not worth the insane renders for now

return (
<NodeViewWrapper className="code-block-with-content" as="p">
<NodeViewWrapper className="code-block-with-content" as="div">

This comment has been minimized.

Copy link
@goWrongWay

goWrongWay Dec 11, 2024

why, This time it caused problems with Chinese input.Image
Image

<CodeSnippetPreview
borderColor={
isFirstContextItem
Expand Down
2 changes: 1 addition & 1 deletion gui/src/components/markdown/FilenameLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function FilenameLink({ rif }: FilenameLinkProps) {
onClick={onClick}
>
<FileIcon filename={rif.filepath} height="20px" width="20px" />
<span className="align-middle underline underline-offset-2">
<span className="align-baseline underline underline-offset-2 mb-0.5">
{getBasename(rif.filepath)}
</span>
</span>
Expand Down
18 changes: 10 additions & 8 deletions gui/src/pages/Edit/CodeToEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ export default function WorkingSet() {
}
}

const codeToEditItems = editModeState.codeToEdit.map((code, i) => (
<CodeToEditListItem
key={code.filepath + i}
code={code}
onDelete={onDelete}
onClickFilename={onClickFilename}
/>
));
const codeToEditItems = [...editModeState.codeToEdit]
.reverse()
.map((code, i) => (
<CodeToEditListItem
key={code.filepath + i}
code={code}
onDelete={onDelete}
onClickFilename={onClickFilename}
/>
));

return (
<div
Expand Down
6 changes: 1 addition & 5 deletions gui/src/redux/slices/editModeState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const editModeStateSlice = createSlice({
state.fileAfterEdit = undefined;
},
focusEdit: (state) => {
state.isInEditMode = true;
state.editStatus = "not-started";
state.previousInputs = [];
state.fileAfterEdit = undefined;
Expand All @@ -40,7 +41,6 @@ export const editModeStateSlice = createSlice({
state.editStatus = "streaming";
},
removeCodeToEdit: (state, { payload }: PayloadAction<CodeToEdit>) => {
// Remove entry from codeToEdit that doesn't match the payload's filepath and contents
state.codeToEdit = state.codeToEdit.filter(
(entry) =>
!(
Expand Down Expand Up @@ -96,9 +96,6 @@ export const editModeStateSlice = createSlice({
state.editStatus = "done";
state.previousInputs = [];
},
setIsInEditMode: (state, { payload }: PayloadAction<boolean>) => {
state.isInEditMode = payload;
},
},
});

Expand All @@ -111,6 +108,5 @@ export const {
removeCodeToEdit,
focusEdit,
clearCodeToEdit,
setIsInEditMode,
} = editModeStateSlice.actions;
export default editModeStateSlice.reducer;

0 comments on commit b4d364f

Please sign in to comment.