Skip to content

Fix toggle terminal visibility #363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/runtime/src/lesson-files.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// where is global?
import { describe, test, expect, beforeAll, vi, afterAll, beforeEach } from 'vitest';
import { LessonFilesFetcher } from './lesson-files.js';

Expand Down
7 changes: 7 additions & 0 deletions packages/runtime/src/store/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ export class TerminalStore {
}

hasTerminalPanel() {
// This condition checks if the 'metadata' object exists and whether the 'terminal' property within the metadata is explicitly set to 'false'.
// If the 'terminal' property is false, it returns 'false', which likely disables or hides the terminal in the user interface.
// However, if the 'metadata' object itself or the 'terminal' property is undefined or true, this condition is bypassed, and the terminal remains enabled.

/*if(this.metadata && this.metadata.terminal === false) {
return false;
}*/
return this.terminalConfig.get().panels.length > 0;
}

Expand Down
23 changes: 23 additions & 0 deletions packages/types/src/schemas/part.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@ export const partSchema = baseSchema.extend({
.describe(
'The list of chapters in this part. The order of this array defines the order of the chapters. If not specified a folder-based numbering system is used instead.',
),
terminal: z
.boolean()
.optional()
.describe('Controls whether the terminal is visible for this part. Defaults to true.'),
});

export type PartSchema = z.infer<typeof partSchema>;

// This schema defines the structure of a "part" in the tutorial.
// The `type` is fixed as 'part', applying only to parts.
// `chapters` is an optional array to list chapters, ordered by folder if not provided.
// The `terminal` flag controls terminal visibility: `false` hides it, defaults to `true` (visible).
/*export const partSchema = baseSchema.extend({
type: z.literal('part'),
chapters: z
.array(z.string())
.optional()
.describe(
'The list of chapters in this part. The order of this array defines the order of the chapters. If not specified a folder-based numbering system is used instead.',
),
terminal: z
.boolean()
.optional()
.describe('Controls whether the terminal is visible for this part. Defaults to true.'),
});
*/
Loading