the terminal is no longer just styling but an actual tiny terminal emulator lol
This commit is contained in:
1 parent
7451fe33b7
commit
4f18ef5844
8 files changed
+584
-116
No files matched your search
@@ -109,7 +109,7 @@ a {
|
||||
min-height: calc(100vh - 80px);
|
||||
color: white;
|
||||
background: #2e2940;
|
||||
padding: 80px 0 0 0;
|
||||
padding: 80px 0 80px 0;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
@@ -154,75 +154,14 @@ a {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.terminal-bg {
|
||||
.terminal-window {
|
||||
background: #1b1920;
|
||||
padding: 8px 22px 11px 22px;
|
||||
margin: 0 0 80px 0;
|
||||
border-radius: 0 0 20px 20px;
|
||||
}
|
||||
|
||||
.terminal-bg h2 {
|
||||
line-height: 1.2;
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.terminal-bg a.secret {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.terminal-bg a {
|
||||
color: #cb84df;
|
||||
}
|
||||
|
||||
.terminal-bg p {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.cursorblink {
|
||||
animation: cursorBlink 1.25s infinite;
|
||||
}
|
||||
|
||||
@keyframes cursorBlink {
|
||||
0% { opacity: 1; }
|
||||
50% { opacity: 0; }
|
||||
100% { opacity: 1; }
|
||||
}
|
||||
|
||||
.category {
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.category h4 {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
margin: 0 0 5px 0;
|
||||
background: #74ef85;
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.tech-stack {
|
||||
text-align: left;
|
||||
align-items: flex-start;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.tech-stack ul {
|
||||
list-style: none;
|
||||
width: 900px;
|
||||
height: 540px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
.tech-stack li {
|
||||
color: #649aff;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.tech-stack li:hover {
|
||||
color: #ffffff;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
border-radius: 0 0 20px 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
|
||||
@@ -16,52 +16,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator"></div>
|
||||
<section id="content"></section>
|
||||
<section id="content" #contentTrigger></section>
|
||||
<div class="about-container">
|
||||
<div class="about-content" [ngStyle]="{'padding': isMobile ? '0 10px;' : '0 25px'}">
|
||||
<div class="terminal-title">
|
||||
<div class="window-title"><p><code>Konsole</code></p></div> <div class="window-buttons"><p>🟡 🟣 🔴</p></div>
|
||||
</div>
|
||||
<div class="terminal-bg">
|
||||
<code>
|
||||
<h2>$ <a class="secret" href="https://files.itz.sh/itzmineydev/lilguy.jpg" target="_blank">cat</a> about.txt</h2>
|
||||
<p [innerHTML]="'ABOUT' | translate"></p>
|
||||
<h2>$ ls tools/</h2>
|
||||
<div class="tech-stack">
|
||||
<div class="category">
|
||||
<h4>Runtimes</h4>
|
||||
<ul>
|
||||
<a href="https://nginx.org/en/" target="_blank"><li>NGiNX</li></a>
|
||||
<a href="https://nodejs.org/" target="_blank"><li>Node.js</li></a>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="category">
|
||||
<h4>{{ 'TECHSTACK_LANGS' | translate }}</h4>
|
||||
<ul>
|
||||
<a href="https://www.typescriptlang.org/" target="_blank"><li>TypeScript</li></a>
|
||||
<a href="https://go.dev/" target="_blank"><li>Go</li></a>
|
||||
<a href="https://html.spec.whatwg.org/" target="_blank"><li>CSS & HTML</li></a>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="category">
|
||||
<h4>Frameworks</h4>
|
||||
<ul>
|
||||
<a href="https://angular.dev/" target="_blank"><li>Angular</li></a>
|
||||
<a href="https://express.com/" target="_blank"><li>Express</li></a>
|
||||
<a href="https://flask.palletsprojects.com/en/stable/" target="_blank"><li>Flask</li></a>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="category">
|
||||
<h4>{{ 'TECHSTACK_DBS' | translate }}</h4>
|
||||
<ul>
|
||||
<a href="https://www.mysql.com/" target="_blank"><li>MySQL</li></a>
|
||||
<a href="https://mariadb.org/" target="_blank"><li>MariaDB</li></a>
|
||||
<a href="https://www.postgresql.org/" target="_blank"><li>PostgreSQL</li></a>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<h2>$ <span class="cursorblink">█</span></h2>
|
||||
</code>
|
||||
<div class="terminal-window">
|
||||
<app-terminal-emulator [bootOnVisible]="terminalShouldBoot"></app-terminal-emulator>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import {Component, OnInit, ViewEncapsulation} from '@angular/core';
|
||||
import {AfterViewInit, Component, ElementRef, HostListener, OnInit, ViewChild, ViewEncapsulation} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../shared/services/device-detector.service';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {TranslatePipe} from '@ngx-translate/core';
|
||||
import {ParallaxComponent} from '../shared/parallax/parallax.component';
|
||||
import {NgStyle} from '@angular/common';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {TerminalEmulatorComponent} from '../shared/terminal-emulator/terminal-emulator.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-about',
|
||||
@@ -12,22 +14,48 @@ import {NgStyle} from '@angular/common';
|
||||
imports: [
|
||||
TranslatePipe,
|
||||
ParallaxComponent,
|
||||
NgStyle
|
||||
NgStyle,
|
||||
FormsModule,
|
||||
TerminalEmulatorComponent
|
||||
],
|
||||
styleUrls: ['./about.component.css']
|
||||
})
|
||||
export class AboutComponent implements OnInit {
|
||||
export class AboutComponent implements OnInit, AfterViewInit {
|
||||
isMobile: boolean = false;
|
||||
terminalShouldBoot: boolean = false;
|
||||
|
||||
@ViewChild('contentTrigger') contentTrigger!: ElementRef;
|
||||
|
||||
constructor(
|
||||
private deviceService: DeviceDetectorService,
|
||||
private titleService: Title,
|
||||
) {}
|
||||
private titleService: Title
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('itzMiney\'s Home');
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.checkTerminalTrigger();
|
||||
}
|
||||
|
||||
@HostListener('window:scroll')
|
||||
onWindowScroll() {
|
||||
this.checkTerminalTrigger();
|
||||
}
|
||||
|
||||
private checkTerminalTrigger() {
|
||||
if (this.terminalShouldBoot || !this.contentTrigger) return;
|
||||
|
||||
const rect = this.contentTrigger.nativeElement.getBoundingClientRect();
|
||||
|
||||
if (rect.top <= 0) {
|
||||
this.terminalShouldBoot = true;
|
||||
}
|
||||
}
|
||||
|
||||
scrollDown() {
|
||||
document.getElementById('content')?.scrollIntoView({behavior: 'smooth'});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
.terminal-container {
|
||||
padding: 0 22px;
|
||||
height: 526px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
h2 {
|
||||
line-height: 1.2;
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.terminal-input-line {
|
||||
cursor: text;
|
||||
margin: 8px 0 0 0;
|
||||
}
|
||||
|
||||
.prompt {
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.input-shell {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.input-mirror {
|
||||
display: inline-block;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.input-placeholder {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.terminal-field {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
outline: none;
|
||||
background: transparent;
|
||||
color: transparent;
|
||||
caret-color: transparent;
|
||||
font: inherit;
|
||||
letter-spacing: inherit;
|
||||
}
|
||||
|
||||
.cursorblink {
|
||||
margin-left: -12px;
|
||||
animation: cursorBlink 1.25s infinite;
|
||||
}
|
||||
|
||||
.terminal-error {
|
||||
color: #ff7a7a;
|
||||
}
|
||||
|
||||
@keyframes cursorBlink {
|
||||
0% { opacity: 1; }
|
||||
50% { opacity: 0; }
|
||||
100% { opacity: 1; }
|
||||
}
|
||||
|
||||
.category {
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.category h4 {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
margin: 0 0 5px 0;
|
||||
color: #74ef85;
|
||||
}
|
||||
|
||||
.ls-entry {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
margin: 0 15px 0 0;
|
||||
}
|
||||
|
||||
.ls-file {
|
||||
color: #74ef85;
|
||||
}
|
||||
|
||||
.ls-dir {
|
||||
color: #649aff;
|
||||
}
|
||||
|
||||
.ls-html {
|
||||
color: #dc2961;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
a.green {
|
||||
color: #cb84df;
|
||||
text-decoration: underline;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 30%;
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.tech-stack {
|
||||
text-align: left;
|
||||
align-items: flex-start;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.tech-stack ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
.tech-stack li {
|
||||
color: #649aff;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.tech-stack li:hover {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.fade-in {
|
||||
animation: terminalFade 220ms ease forwards;
|
||||
}
|
||||
|
||||
@keyframes terminalFade {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(4px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<div class="terminal-container" #terminalContainer xmlns="http://www.w3.org/1999/html">
|
||||
<div class="terminal-output" #terminalOutput>
|
||||
@for (line of history; track $index; let isLast = $last) {
|
||||
@if (line.type === 'command') {
|
||||
<code>
|
||||
<h2>
|
||||
{{ line.text }}
|
||||
@if (booting && isLast) {
|
||||
<span class="cursorblink">█</span>
|
||||
}
|
||||
</h2>
|
||||
</code>
|
||||
} @else if (line.type === 'template') {
|
||||
<code>
|
||||
<ng-container [ngTemplateOutlet]="line.template"></ng-container>
|
||||
</code>
|
||||
} @else if (line.type === 'entries') {
|
||||
<div class="ls-output fade-in">
|
||||
@for (entry of line.entries; track entry.name) {
|
||||
<code>
|
||||
<span class="ls-entry" [class]="'ls-' + entry.type">
|
||||
{{ entry.name }}
|
||||
</span>
|
||||
</code>
|
||||
}
|
||||
</div>
|
||||
} @else if (line.type === 'error') {
|
||||
<code>
|
||||
<p class="terminal-error fade-in">{{ line.text }}</p>
|
||||
</code>
|
||||
} @else {
|
||||
<code>
|
||||
<p class="fade-in">{{ line.text }}</p>
|
||||
</code>
|
||||
}
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
@if (!booting) {
|
||||
<code>
|
||||
<h2 class="terminal-input-line" (click)="focusInput()">
|
||||
<span class="prompt">$ </span>
|
||||
|
||||
<span class="input-shell">
|
||||
<span class="input-mirror">
|
||||
{{ command }}
|
||||
@if (!command) {
|
||||
<span class="input-placeholder"> </span>
|
||||
}
|
||||
<span class="cursorblink">█</span>
|
||||
</span>
|
||||
<input
|
||||
#terminalInput
|
||||
type="text"
|
||||
[(ngModel)]="command"
|
||||
(keydown.enter)="runCommand()"
|
||||
class="terminal-field"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
/>
|
||||
</span>
|
||||
</h2>
|
||||
</code>
|
||||
}
|
||||
</div>
|
||||
<ng-template #aboutTemplate>
|
||||
<p class="fade-in" [innerHTML]="'ABOUT' | translate"></p>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #catTemplate>
|
||||
<img alt="cat" class="fade-in" src="https://files.itz.sh/itzmineydev/lilguy.jpg">
|
||||
</ng-template>
|
||||
|
||||
<ng-template #toolsTemplate>
|
||||
<div class="tech-stack fade-in">
|
||||
<div class="category">
|
||||
<h4>Runtimes</h4>
|
||||
<ul>
|
||||
<a href="https://nginx.org/en/" target="_blank"><li>NGiNX</li></a>
|
||||
<a href="https://nodejs.org/" target="_blank"><li>Node.js</li></a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="category">
|
||||
<h4>{{ 'TECHSTACK_LANGS' | translate }}</h4>
|
||||
<ul>
|
||||
<a href="https://www.typescriptlang.org/" target="_blank"><li>TypeScript</li></a>
|
||||
<a href="https://go.dev/" target="_blank"><li>Go</li></a>
|
||||
<a href="https://html.spec.whatwg.org/" target="_blank"><li>CSS & HTML</li></a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="category">
|
||||
<h4>Frameworks</h4>
|
||||
<ul>
|
||||
<a href="https://angular.dev/" target="_blank"><li>Angular</li></a>
|
||||
<a href="https://express.com/" target="_blank"><li>Express</li></a>
|
||||
<a href="https://flask.palletsprojects.com/en/stable/" target="_blank"><li>Flask</li></a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="category">
|
||||
<h4>{{ 'TECHSTACK_DBS' | translate }}</h4>
|
||||
<ul>
|
||||
<a href="https://www.mysql.com/" target="_blank"><li>MySQL</li></a>
|
||||
<a href="https://mariadb.org/" target="_blank"><li>MariaDB</li></a>
|
||||
<a href="https://www.postgresql.org/" target="_blank"><li>PostgreSQL</li></a>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
@@ -0,0 +1,278 @@
|
||||
import {Component, ElementRef, Input, OnChanges, OnInit, SimpleChanges, TemplateRef, ViewChild, ViewEncapsulation} from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import {TranslatePipe} from '@ngx-translate/core';
|
||||
import {NgTemplateOutlet} from '@angular/common';
|
||||
|
||||
type TerminalLine =
|
||||
| { type: 'command'; text: string }
|
||||
| { type: 'output'; text: string }
|
||||
| { type: 'error'; text: string }
|
||||
| { type: 'template'; template: TemplateRef<any> }
|
||||
| { type: 'entries'; entries: TerminalEntry[] };
|
||||
|
||||
type TerminalEntryType = 'file' | 'dir' | 'html';
|
||||
interface TerminalEntry {
|
||||
name: string;
|
||||
type: TerminalEntryType;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-terminal-emulator',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
standalone: true,
|
||||
imports: [FormsModule, TranslatePipe, NgTemplateOutlet],
|
||||
templateUrl: './terminal-emulator.component.html',
|
||||
styleUrl: './terminal-emulator.component.css'
|
||||
})
|
||||
|
||||
export class TerminalEmulatorComponent implements OnInit, OnChanges {
|
||||
@ViewChild('terminalContainer') terminalContainer!: ElementRef<HTMLDivElement>;
|
||||
@ViewChild('terminalOutput') terminalOutput!: ElementRef<HTMLDivElement>;
|
||||
@ViewChild('terminalInput') terminalInput!: ElementRef<HTMLInputElement>;
|
||||
|
||||
@ViewChild('aboutTemplate') aboutTemplate!: TemplateRef<any>;
|
||||
@ViewChild('catTemplate') catTemplate!: TemplateRef<any>;
|
||||
@ViewChild('toolsTemplate') toolsTemplate!: TemplateRef<any>;
|
||||
|
||||
@Input() bootOnVisible = false;
|
||||
|
||||
history: TerminalLine[] = [];
|
||||
command = '';
|
||||
booting = true;
|
||||
private hasBooted = false;
|
||||
|
||||
private rootEntries: TerminalEntry[] = [
|
||||
{ name: 'about.txt', type: 'file' },
|
||||
{ name: 'tools', type: 'dir' },
|
||||
{ name: 'portfolio.html', type: 'html' },
|
||||
{ name: 'blog.html', type: 'html' },
|
||||
{ name: 'socials.html', type: 'html' }
|
||||
];
|
||||
|
||||
constructor(private router: Router) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.booting = false;
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (changes['bootOnVisible']?.currentValue && !this.hasBooted) {
|
||||
this.hasBooted = true;
|
||||
void this.playIntro();
|
||||
}
|
||||
}
|
||||
|
||||
private async playIntro() {
|
||||
this.booting = true;
|
||||
|
||||
await this.typeCommand('cat about.txt');
|
||||
this.history.push({
|
||||
type: 'template',
|
||||
template: this.aboutTemplate
|
||||
});
|
||||
this.scrollToBottom();
|
||||
|
||||
await this.sleep(400);
|
||||
|
||||
await this.typeCommand('ls tools/');
|
||||
this.history.push({
|
||||
type: 'template',
|
||||
template: this.toolsTemplate
|
||||
});
|
||||
this.scrollToBottom();
|
||||
|
||||
await this.sleep(300);
|
||||
|
||||
this.booting = false;
|
||||
|
||||
setTimeout(() => {
|
||||
this.focusInput();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
private async typeCommand(text: string) {
|
||||
let current = '';
|
||||
|
||||
this.history.push({ type: 'command', text: '$ ' });
|
||||
const commandIndex = this.history.length - 1;
|
||||
|
||||
for (const char of text) {
|
||||
current += char;
|
||||
this.history[commandIndex] = {
|
||||
type: 'command',
|
||||
text: `$ ${current}`
|
||||
};
|
||||
this.scrollToBottom();
|
||||
await this.sleep(50);
|
||||
}
|
||||
}
|
||||
|
||||
runCommand() {
|
||||
const cmd = this.command.trim();
|
||||
if (!cmd || this.booting) return;
|
||||
|
||||
this.history.push({ type: 'command', text: `$ ${cmd}` });
|
||||
|
||||
const parts = cmd.toLowerCase().split(/\s+/);
|
||||
const base = parts[0];
|
||||
const arg = parts.slice(1).join(' ');
|
||||
|
||||
switch (base) {
|
||||
case 'help':
|
||||
this.history.push({
|
||||
type: 'output',
|
||||
text: 'Available commands: help, clear, whoami, ls, cat, portfolio, blog, socials'
|
||||
});
|
||||
break;
|
||||
|
||||
case 'whoami':
|
||||
this.history.push({
|
||||
type: 'output',
|
||||
text: 'itzMiney'
|
||||
});
|
||||
break;
|
||||
|
||||
case 'ls':
|
||||
this.handleLs(arg);
|
||||
break;
|
||||
|
||||
case 'cat':
|
||||
this.handleCat(arg);
|
||||
break;
|
||||
|
||||
case 'portfolio':
|
||||
this.history.push({
|
||||
type: 'output',
|
||||
text: 'Opening portfolio...'
|
||||
});
|
||||
void this.router.navigate(['/portfolio']);
|
||||
break;
|
||||
|
||||
case 'blog':
|
||||
this.history.push({
|
||||
type: 'output',
|
||||
text: 'Opening blog...'
|
||||
});
|
||||
void this.router.navigate(['/blog']);
|
||||
break;
|
||||
|
||||
case 'socials':
|
||||
this.history.push({
|
||||
type: 'output',
|
||||
text: 'Opening socials...'
|
||||
});
|
||||
void this.router.navigate(['/socials']);
|
||||
break;
|
||||
|
||||
case 'clear':
|
||||
this.history = [];
|
||||
this.command = '';
|
||||
this.scrollToBottom();
|
||||
return;
|
||||
|
||||
default:
|
||||
this.history.push({
|
||||
type: 'error',
|
||||
text: `command not found: ${cmd}`
|
||||
});
|
||||
}
|
||||
|
||||
this.command = '';
|
||||
this.scrollToBottom();
|
||||
}
|
||||
|
||||
private handleLs(arg: string) {
|
||||
const normalized = arg.replace(/\/+$/, '');
|
||||
|
||||
if (!normalized) {
|
||||
this.history.push({
|
||||
type: 'entries',
|
||||
entries: this.rootEntries
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (normalized === 'tools') {
|
||||
this.history.push({
|
||||
type: 'template',
|
||||
template: this.toolsTemplate
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.history.push({
|
||||
type: 'error',
|
||||
text: `ls: cannot access '${arg}': No such file or directory`
|
||||
});
|
||||
}
|
||||
|
||||
private handleCat(arg: string) {
|
||||
const normalized = arg.trim();
|
||||
|
||||
if (!normalized) {
|
||||
this.history.push({
|
||||
type: 'template',
|
||||
template: this.catTemplate
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
switch (normalized) {
|
||||
case 'about.txt':
|
||||
this.history.push({
|
||||
type: 'template',
|
||||
template: this.aboutTemplate
|
||||
});
|
||||
break;
|
||||
|
||||
case 'portfolio.html':
|
||||
this.history.push({
|
||||
type: 'output',
|
||||
text: 'Navigate to /portfolio'
|
||||
});
|
||||
break;
|
||||
|
||||
case 'blog.html':
|
||||
this.history.push({
|
||||
type: 'output',
|
||||
text: 'Navigate to /blog'
|
||||
});
|
||||
break;
|
||||
|
||||
case 'socials.html':
|
||||
this.history.push({
|
||||
type: 'output',
|
||||
text: 'Navigate to /socials'
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
this.history.push({
|
||||
type: 'error',
|
||||
text: `cat: ${arg}: No such file or directory`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
focusInput() {
|
||||
if (!this.booting && this.terminalInput) {
|
||||
this.terminalInput.nativeElement.focus();
|
||||
}
|
||||
}
|
||||
|
||||
private scrollToBottom() {
|
||||
setTimeout(() => {
|
||||
if (!this.terminalOutput) return;
|
||||
const el = this.terminalContainer.nativeElement;
|
||||
el.scrollTo({
|
||||
top: el.scrollHeight,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private sleep(ms: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user