diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 4de93c0..d6c05d8 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -184,9 +184,7 @@ function App() { const updatedParams = { ...params, ...settings }; const baseCommitObject = { - date_created: new Date(), variants: [{ code: "" }, { code: "" }], - selectedVariantIndex: 0, }; const commitInputObject = @@ -345,9 +343,7 @@ function App() { const commit = createCommit({ type: "code_create", parentHash: null, - date_created: new Date(), variants: [{ code }], - selectedVariantIndex: 0, inputs: null, }); addCommit(commit); diff --git a/frontend/src/components/commits/types.ts b/frontend/src/components/commits/types.ts index 68c97ff..173663a 100644 --- a/frontend/src/components/commits/types.ts +++ b/frontend/src/components/commits/types.ts @@ -7,7 +7,7 @@ export type Variant = { export type BaseCommit = { hash: CommitHash; parentHash: CommitHash | null; - date_created: Date; + dateCreated: Date; variants: Variant[]; selectedVariantIndex: number; }; diff --git a/frontend/src/components/commits/utils.ts b/frontend/src/components/commits/utils.ts index 9a20809..874f67e 100644 --- a/frontend/src/components/commits/utils.ts +++ b/frontend/src/components/commits/utils.ts @@ -8,10 +8,10 @@ import { export function createCommit( commit: - | Omit - | Omit - | Omit + | Omit + | Omit + | Omit ): Commit { const hash = nanoid(); - return { ...commit, hash }; + return { ...commit, hash, dateCreated: new Date(), selectedVariantIndex: 0 }; } diff --git a/frontend/src/components/history/HistoryDisplay.tsx b/frontend/src/components/history/HistoryDisplay.tsx index b0a02e5..e08c8a2 100644 --- a/frontend/src/components/history/HistoryDisplay.tsx +++ b/frontend/src/components/history/HistoryDisplay.tsx @@ -22,7 +22,7 @@ export default function HistoryDisplay({ shouldDisableReverts }: Props) { // Put all commits into an array and sort by created date (oldest first) const flatHistory = Object.values(commits).sort( (a, b) => - new Date(a.date_created).getTime() - new Date(b.date_created).getTime() + new Date(a.dateCreated).getTime() - new Date(b.dateCreated).getTime() ); // Annotate history items with a summary, parent version, etc.