MCPcopy Create free account
hub / github.com/Everoot/everoot.github.io / VscodeComponent

Class VscodeComponent

src/app/components/apps/vscode/vscode.ts:11–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9 styleUrl: './vscode.css',
10})
11export class VscodeComponent implements OnInit {
12 // Using github1s to view code in browser
13 // This is not my work, but it's amazing!
14 // Original repo: https://github.com/conwnet/github1s
15 // You can change this to your own repository
16 private githubRepo = 'everoot/everoot.github.io';
17 private defaultPath = 'src/app/app.ts';
18 github1sUrl: string;
19 safeGithub1sUrl: SafeResourceUrl;
20
21 constructor(private sanitizer: DomSanitizer) {
22 // Build the github1s URL
23 this.github1sUrl = `https://github1s.com/${this.githubRepo}/blob/HEAD/${this.defaultPath}`;
24 this.safeGithub1sUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.github1sUrl);
25 }
26
27 ngOnInit() {
28 // Load last viewed path from localStorage if available
29 const lastPath = localStorage.getItem('vscode-path');
30 if (lastPath) {
31 this.github1sUrl = `https://github1s.com/${this.githubRepo}/blob/HEAD/${lastPath}`;
32 this.safeGithub1sUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.github1sUrl);
33 }
34 }
35
36 // Method to navigate to a specific file (can be called from parent if needed)
37 navigateToFile(filePath: string) {
38 this.github1sUrl = `https://github1s.com/${this.githubRepo}/blob/HEAD/${filePath}`;
39 this.safeGithub1sUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.github1sUrl);
40 localStorage.setItem('vscode-path', filePath);
41 }
42}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected