Merge pull request #48 from itzMiney/development

made some slight improvements to the terminal emulator
This commit is contained in:
Michael authored and GitHub committed 2026-03-17 20:36:32 +01:00
commit 5527acfb6a
5 files changed
+145 -58

No files matched your search

+13 -24
View File
@@ -14,21 +14,13 @@ a {
color: inherit; color: inherit;
} }
.height-container {
min-height: 100vh;
align-content: center;
justify-content: center;
display: flex;
flex-direction: column;
}
.content-bg { .content-bg {
position: relative; position: relative;
display: block; display: block;
} }
.about-header { .landing-container {
display: flex; display: flex;
color: white; color: white;
width: 100%; width: 100%;
@@ -38,11 +30,7 @@ a {
text-align: center; text-align: center;
} }
.title-box { .landing-container h1 {
display: block;
}
.about-header h1 {
margin-bottom: 0; margin-bottom: 0;
font-weight: 700; font-weight: 700;
background: linear-gradient(45deg, #c3acff 0%, #a6ffb0 100%); background: linear-gradient(45deg, #c3acff 0%, #a6ffb0 100%);
@@ -51,7 +39,7 @@ a {
color: transparent; color: transparent;
} }
.about-header .subtitle { .landing-container .subtitle {
font-size: 1.2rem; font-size: 1.2rem;
font-style: italic; font-style: italic;
margin-top: 5px; margin-top: 5px;
@@ -105,11 +93,10 @@ a {
} }
.about-container { .about-container {
max-width: 100%; max-width: 100%;
height: 100%;
overflow: clip; overflow: clip;
min-height: calc(100vh - 80px);
color: white; color: white;
background: #2e2940; background: #2e2940;
padding: 80px 0 80px 0;
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
z-index: 1; z-index: 1;
display: flex; display: flex;
@@ -125,30 +112,31 @@ a {
} }
.terminal-title { .titlebar {
background: #26242e; background: #26242e;
max-width: 900px;
padding: 4px 8px 2px 8px; padding: 4px 8px 2px 8px;
margin: auto 0; margin: auto 0;
border-radius: 20px 20px 0 0; border-radius: 15px 15px 0 0;
} }
.window-title { .window-title {
display: inline-flex; display: inline-flex;
width: calc(100% - 85px); width: calc(100% - 85px);
justify-content: center;
} }
.window-title p { .window-title p {
margin: 0 0 0 85px; margin: 0 0 0 85px;
width: 100%;
text-align: center; text-align: center;
} }
.window-buttons { .window-actions {
display: inline-flex; display: inline-flex;
width: 85px; width: 85px;
} }
.window-buttons p { .window-actions p {
margin: 0; margin: 0;
width: 100%; width: 100%;
text-align: right; text-align: right;
@@ -156,11 +144,12 @@ a {
.terminal-window { .terminal-window {
background: #1b1920; background: #1b1920;
height: 540px; height: 520px;
max-width: 900px;
margin: 0; margin: 0;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
border-radius: 0 0 20px 20px; border-radius: 0 0 15px 15px;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
+4 -6
View File
@@ -5,8 +5,7 @@
'linear-gradient(180deg,#1b172c 0%, #0b0b0f 100%);' 'linear-gradient(180deg,#1b172c 0%, #0b0b0f 100%);'
"> ">
</app-parallax> </app-parallax>
<div class="height-container"> <div class="landing-container">
<div class="about-header">
<div class="title-box"> <div class="title-box">
<h1 [ngStyle]="{'font-size': isMobile ? '4rem' : '5rem'}"><code>itzMiney</code></h1> <h1 [ngStyle]="{'font-size': isMobile ? '4rem' : '5rem'}"><code>itzMiney</code></h1>
<p class="subtitle">{{ 'ABOUT_SUB' | translate}}</p> <p class="subtitle">{{ 'ABOUT_SUB' | translate}}</p>
@@ -18,13 +17,12 @@
<div class="separator"></div> <div class="separator"></div>
<section id="content" #contentTrigger></section> <section id="content" #contentTrigger></section>
<div class="about-container"> <div class="about-container">
<div class="about-content" [ngStyle]="{'padding': isMobile ? '0 10px;' : '0 25px'}"> <div class="terminal" [ngStyle]="{'margin': isMobile ? '10px;' : '25px'}">
<div class="terminal-title"> <div class="titlebar">
<div class="window-title"><p><code>Konsole</code></p></div> <div class="window-buttons"><p>🟡 🟣 🔴</p></div> <div class="window-title"><p><code>Konsole</code></p></div> <div class="window-actions"><p>🟡 🟣 🔴</p></div>
</div> </div>
<div class="terminal-window" [ngStyle]="{'width': isMobile ? '100%' : '900px' }"> <div class="terminal-window" [ngStyle]="{'width': isMobile ? '100%' : '900px' }">
<app-terminal-emulator [bootOnVisible]="terminalShouldBoot"></app-terminal-emulator> <app-terminal-emulator [bootOnVisible]="terminalShouldBoot"></app-terminal-emulator>
</div> </div>
</div> </div>
</div> </div>
</div>
@@ -1,6 +1,6 @@
.terminal-container { .terminal-container {
padding: 0 22px; padding: 0 22px;
height: 526px; height: 498px;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
scroll-behavior: smooth; scroll-behavior: smooth;
@@ -23,23 +23,19 @@ h2 {
.input-shell { .input-shell {
position: relative; position: relative;
display: inline-block; display: inline-block;
min-width: 0;
} }
.input-mirror { .input-mirror {
display: inline-block; display: inline-block;
white-space: none;
font: inherit;
line-height: inherit; line-height: inherit;
} }
.input-placeholder {
display: inline;
}
.terminal-field { .terminal-field {
position: absolute; position: absolute;
inset: 0; inset: 0;
width: 100%; width: 100%;
min-width: 0;
padding: 0; padding: 0;
margin: 0; margin: 0;
border: none; border: none;
@@ -51,21 +47,39 @@ h2 {
letter-spacing: inherit; letter-spacing: inherit;
} }
.cursorblink { .input-mirror,
margin-left: -12px; .terminal-field {
animation: cursorBlink 1.25s infinite; font-family: monospace;
}
.cursor-block {
display: inline-block;
width: 1ch;
height: 1.2em;
background: white;
color: #1b1920;
vertical-align: baseline;
}
.cursor-block.blink {
animation: cursorBlink 1.05s steps(1) infinite;
}
@keyframes cursorBlink {
0%, 50% {
background: white;
color: #1b1920;
}
50.01%, 100% {
background: transparent;
color: white;
}
} }
.terminal-error { .terminal-error {
color: #ff7a7a; color: #ff7a7a;
} }
@keyframes cursorBlink {
0% { opacity: 1; }
50% { opacity: 0; }
100% { opacity: 1; }
}
.category { .category {
max-width: 200px; max-width: 200px;
} }
@@ -106,7 +120,8 @@ a.green {
} }
img { img {
max-width: 30%; width: 30%;
height: auto;
border-radius: 15px; border-radius: 15px;
} }
@@ -125,6 +140,7 @@ img {
} }
.tech-stack li { .tech-stack li {
font-size: 1rem;
color: #649aff; color: #649aff;
margin-bottom: 5px; margin-bottom: 5px;
} }
@@ -43,21 +43,28 @@
<span class="prompt">$ </span> <span class="prompt">$ </span>
<span class="input-shell"> <span class="input-shell">
<span class="input-mirror"> <span class="input-mirror" aria-hidden="true">
{{ command }} <span>{{ beforeCursor }}</span>
@if (!command) {
<span class="input-placeholder">&nbsp;</span> <span class="cursor-block" [class.blink]="isFocused && shouldBlink">
} {{ cursorChar || '\u00A0' }}
<span class="cursorblink">&#9608;</span>
</span> </span>
<span>{{ afterCursor }}</span>
</span>
<input <input
#terminalInput #terminalInput
type="text" type="text"
[(ngModel)]="command" [(ngModel)]="command"
(keydown.enter)="runCommand()" (input)="handleCursorActivity()"
(click)="handleCursorActivity()"
(keyup)="handleCursorActivity()"
(keydown)="onKeydown($event)"
(keydown.enter)="$event.preventDefault(); runCommand()"
(focus)="onFocus()"
(blur)="onBlur()"
class="terminal-field" class="terminal-field"
autocomplete="off"
spellcheck="false"
/> />
</span> </span>
</h2> </h2>
@@ -69,7 +76,13 @@
</ng-template> </ng-template>
<ng-template #catTemplate> <ng-template #catTemplate>
<img alt="cat" class="fade-in" src="https://files.itz.sh/itzmineydev/lilguy.jpg"> <img
alt="cat"
class="fade-in"
src="https://files.itz.sh/itzmineydev/lilguy.jpg"
(load)="scrollToBottom()"
/>
<p>lil goober</p>
</ng-template> </ng-template>
<ng-template #toolsTemplate> <ng-template #toolsTemplate>
@@ -42,6 +42,11 @@ export class TerminalEmulatorComponent implements OnInit, OnChanges {
booting = true; booting = true;
private hasBooted = false; private hasBooted = false;
caretIndex = 0;
isFocused = false;
shouldBlink = true;
private blinkResumeTimer: ReturnType<typeof setTimeout> | null = null;
private rootEntries: TerminalEntry[] = [ private rootEntries: TerminalEntry[] = [
{ name: 'about.txt', type: 'file' }, { name: 'about.txt', type: 'file' },
{ name: 'tools', type: 'dir' }, { name: 'tools', type: 'dir' },
@@ -185,6 +190,7 @@ export class TerminalEmulatorComponent implements OnInit, OnChanges {
} }
this.command = ''; this.command = '';
this.caretIndex = 0;
this.scrollToBottom(); this.scrollToBottom();
} }
@@ -261,13 +267,78 @@ export class TerminalEmulatorComponent implements OnInit, OnChanges {
} }
} }
get beforeCursor(): string {
return this.command.slice(0, this.caretIndex);
}
get cursorChar(): string {
const ch = this.command[this.caretIndex];
if (ch === ' ') return '\u00A0';
return ch ?? '\u00A0';
}
get afterCursor(): string {
return this.command.slice(this.caretIndex + (this.caretIndex < this.command.length ? 1 : 0));
}
handleCursorActivity(): void {
this.syncCursor();
this.restartBlink();
}
focusInput() { focusInput() {
if (!this.booting && this.terminalInput) { if (!this.booting && this.terminalInput) {
this.terminalInput.nativeElement.focus(); this.terminalInput.nativeElement.focus();
this.syncCursor();
} }
} }
private scrollToBottom() { onFocus(): void {
this.isFocused = true;
this.restartBlink();
this.syncCursor();
}
onBlur(): void {
this.isFocused = false;
this.shouldBlink = false;
if (this.blinkResumeTimer) {
clearTimeout(this.blinkResumeTimer);
this.blinkResumeTimer = null;
}
this.syncCursor();
}
onKeydown(_: KeyboardEvent): void {
queueMicrotask(() => {
this.syncCursor();
this.restartBlink();
});
}
syncCursor(): void {
const input = this.terminalInput?.nativeElement;
if (!input) return;
this.caretIndex = input.selectionStart ?? this.command.length;
}
private restartBlink(): void {
this.shouldBlink = false;
if (this.blinkResumeTimer) {
clearTimeout(this.blinkResumeTimer);
}
this.blinkResumeTimer = setTimeout(() => {
this.shouldBlink = true;
}, 10);
}
protected scrollToBottom() {
setTimeout(() => { setTimeout(() => {
if (!this.terminalOutput) return; if (!this.terminalOutput) return;
const el = this.terminalContainer.nativeElement; const el = this.terminalContainer.nativeElement;