Skip to content

Commit 147ef9f

Browse files
committed
add to open/close history whenever a session/workspace is opened.
1 parent 0935103 commit 147ef9f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/extension/codemic.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ class CodeMic {
343343
const listing = this.welcome?.sessions.find(s => s.head.id === req.sessionId);
344344
assert(listing);
345345
const session = Session.Core.fromListing(this.context, listing);
346+
await session.core.writeHistoryOpenClose();
346347
await this.openScreen({ screen: t.Screen.Player, session, load: false });
347348

348349
// await this.updateFrontend();
@@ -353,6 +354,7 @@ class CodeMic {
353354
assert(listing);
354355
const session = Session.Core.fromListing(this.context, listing);
355356
if (!listing.local) await session.download({ skipIfExists: true });
357+
await session.core.writeHistoryOpenClose();
356358
await this.openScreen({ screen: t.Screen.Recorder, session });
357359

358360
// await this.updateFrontend();
@@ -391,6 +393,15 @@ class CodeMic {
391393
if (!workspace) return ok;
392394

393395
// if (Session.Core.sessionExists(workspace))
396+
try {
397+
const head = await Session.Core.readLocalHead(workspace);
398+
if (head) {
399+
const session = Session.Core.fromLocal(this.context, head, workspace);
400+
await session.core.writeHistoryOpenClose();
401+
}
402+
} catch (error) {
403+
console.error(error);
404+
}
394405

395406
await VscWorkspace.setUpWorkspace_MAY_RESTART_VSCODE(this.context, {
396407
screen: t.Screen.Welcome,

src/view/session_head.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function SessionListing(props: SessionListingProps) {
5959
a.onClick?.();
6060
};
6161

62-
const lastOpenedTimestamp = history && lib.getSessionHistoryItemLastOpenTimestamp(history);
62+
// const lastOpenedTimestamp = history && lib.getSessionHistoryItemLastOpenTimestamp(history);
6363
const liked = props.user?.metadata?.likes.includes(head.id);
6464

6565
const actions = _.compact<Action>([
@@ -115,13 +115,13 @@ export function SessionListing(props: SessionListingProps) {
115115
<TextToParagraphs text={head.description} />
116116
</div>
117117
)*/}
118-
{lastOpenedTimestamp && (
118+
{/*lastOpenedTimestamp && (
119119
<div className="footer">
120120
<span className="footer-item timestamp">
121121
Last opened <TimeFromNow timestamp={lastOpenedTimestamp} />
122122
</span>
123123
</div>
124-
)}
124+
)*/}
125125
{publication?.publishTimestamp && (
126126
<div className="footer">
127127
<span className="footer-item timestamp">

0 commit comments

Comments
 (0)