a213121 commited on
Commit
b42622f
·
verified ·
1 Parent(s): 9a1e72b

more stuff

Browse files
Files changed (4) hide show
  1. components/terminal.js +90 -0
  2. index.html +6 -5
  3. style.css +24 -0
  4. terminal.html +46 -0
components/terminal.js ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomTerminal extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ :host {
7
+ display: block;
8
+ font-family: 'Courier New', monospace;
9
+ background-color: #1e1e1e;
10
+ color: #f0f0f0;
11
+ border-radius: 6px;
12
+ padding: 16px;
13
+ height: 400px;
14
+ overflow-y: auto;
15
+ }
16
+ .prompt {
17
+ color: #4CAF50;
18
+ margin-right: 8px;
19
+ }
20
+ .command {
21
+ color: #569CD6;
22
+ }
23
+ .output {
24
+ white-space: pre-wrap;
25
+ margin: 8px 0;
26
+ }
27
+ #input-line {
28
+ display: flex;
29
+ align-items: center;
30
+ }
31
+ #command-input {
32
+ background: transparent;
33
+ border: none;
34
+ color: white;
35
+ font-family: inherit;
36
+ font-size: inherit;
37
+ width: 100%;
38
+ outline: none;
39
+ }
40
+ </style>
41
+ <div id="terminal-output"></div>
42
+ <div id="input-line">
43
+ <span class="prompt">user@penguinos:~$</span>
44
+ <input type="text" id="command-input" autofocus>
45
+ </div>
46
+ `;
47
+
48
+ const commands = {
49
+ 'help': 'Available commands: help, about, clear, ls, neofetch, date',
50
+ 'about': 'PenguinOS v1.0 - Lightweight Linux Desktop Environment',
51
+ 'clear': () => { this.shadowRoot.getElementById('terminal-output').innerHTML = ''; return ''; },
52
+ 'ls': 'bin dev home lib32 media opt root sbin sys usr\nboot etc lib lib64 mnt proc run srv tmp var',
53
+ 'neofetch': 'OS: PenguinOS Linux x86_64\nHost: Virtual Machine\nKernel: 5.4.0-91-generic\nUptime: 2 hours, 15 minutes\nPackages: 1243 (dpkg)\nShell: bash 5.0.17\nResolution: 1920x1080\nDE: PenguinDE\nTheme: Penguin-Dark [GTK2/3]\nCPU: Intel i7-10700K (8) @ 3.800GHz\nGPU: VMware SVGA II Adapter\nMemory: 2184MiB / 7872MiB',
54
+ 'date': new Date().toString()
55
+ };
56
+
57
+ const input = this.shadowRoot.getElementById('command-input');
58
+ const output = this.shadowRoot.getElementById('terminal-output');
59
+
60
+ input.addEventListener('keydown', (e) => {
61
+ if (e.key === 'Enter') {
62
+ const command = input.value.trim();
63
+ input.value = '';
64
+
65
+ // Add command to output
66
+ const commandLine = document.createElement('div');
67
+ commandLine.innerHTML = `<span class="prompt">user@penguinos:~$</span> <span class="command">${command}</span>`;
68
+ output.appendChild(commandLine);
69
+
70
+ // Process command
71
+ let result = 'Command not found';
72
+ if (commands[command]) {
73
+ result = typeof commands[command] === 'function'
74
+ ? commands[command]()
75
+ : commands[command];
76
+ }
77
+
78
+ // Add output
79
+ const outputDiv = document.createElement('div');
80
+ outputDiv.className = 'output';
81
+ outputDiv.textContent = result;
82
+ output.appendChild(outputDiv);
83
+
84
+ // Scroll to bottom
85
+ this.scrollTop = this.scrollHeight;
86
+ }
87
+ });
88
+ }
89
+ }
90
+ customElements.define('custom-terminal', CustomTerminal);
index.html CHANGED
@@ -55,11 +55,11 @@
55
  </div>
56
  <div class="p-2">
57
  <div class="text-primary-300 uppercase text-xs font-bold px-4 py-2">Applications</div>
58
- <a href="#" class="flex items-center px-4 py-2 text-primary-200 hover:text-white rounded mx-2 mb-1">
59
  <i data-feather="terminal" class="mr-3"></i>
60
  Terminal
61
  </a>
62
- <a href="#" class="flex items-center px-4 py-2 text-primary-200 hover:text-white rounded mx-2 mb-1">
63
  <i data-feather="file-text" class="mr-3"></i>
64
  File Manager
65
  </a>
@@ -163,13 +163,13 @@
163
  <div class="bg-white rounded-lg shadow p-6 mb-6">
164
  <h3 class="text-lg font-semibold text-secondary-900 mb-4">Quick Access</h3>
165
  <div class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4">
166
- <a href="#" class="flex flex-col items-center p-4 rounded-lg hover:bg-gray-50 text-center">
167
  <div class="p-3 rounded-full bg-gray-100 text-primary-500 mb-2">
168
  <i data-feather="terminal"></i>
169
  </div>
170
  <span class="text-sm">Terminal</span>
171
  </a>
172
- <a href="#" class="flex flex-col items-center p-4 rounded-lg hover:bg-gray-50 text-center">
173
  <div class="p-3 rounded-full bg-gray-100 text-blue-500 mb-2">
174
  <i data-feather="file-text"></i>
175
  </div>
@@ -280,7 +280,8 @@
280
  <script>
281
  feather.replace();
282
  </script>
 
283
  <script src="script.js"></script>
284
- <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
285
  </body>
286
  </html>
 
55
  </div>
56
  <div class="p-2">
57
  <div class="text-primary-300 uppercase text-xs font-bold px-4 py-2">Applications</div>
58
+ <a href="terminal.html" class="flex items-center px-4 py-2 text-primary-200 hover:text-white rounded mx-2 mb-1">
59
  <i data-feather="terminal" class="mr-3"></i>
60
  Terminal
61
  </a>
62
+ <a href="#" class="flex items-center px-4 py-2 text-primary-200 hover:text-white rounded mx-2 mb-1">
63
  <i data-feather="file-text" class="mr-3"></i>
64
  File Manager
65
  </a>
 
163
  <div class="bg-white rounded-lg shadow p-6 mb-6">
164
  <h3 class="text-lg font-semibold text-secondary-900 mb-4">Quick Access</h3>
165
  <div class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4">
166
+ <a href="terminal.html" class="flex flex-col items-center p-4 rounded-lg hover:bg-gray-50 text-center">
167
  <div class="p-3 rounded-full bg-gray-100 text-primary-500 mb-2">
168
  <i data-feather="terminal"></i>
169
  </div>
170
  <span class="text-sm">Terminal</span>
171
  </a>
172
+ <a href="#" class="flex flex-col items-center p-4 rounded-lg hover:bg-gray-50 text-center">
173
  <div class="p-3 rounded-full bg-gray-100 text-blue-500 mb-2">
174
  <i data-feather="file-text"></i>
175
  </div>
 
280
  <script>
281
  feather.replace();
282
  </script>
283
+ <script src="components/terminal.js"></script>
284
  <script src="script.js"></script>
285
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
286
  </body>
287
  </html>
style.css CHANGED
@@ -86,6 +86,30 @@ nav::-webkit-scrollbar-thumb:hover {
86
  background-color: #27c93f;
87
  }
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  /* Add button active states */
90
  button:active {
91
  transform: scale(0.95);
 
86
  background-color: #27c93f;
87
  }
88
 
89
+ /* Terminal window controls */
90
+ .window-controls {
91
+ display: flex;
92
+ gap: 8px;
93
+ }
94
+
95
+ .window-btn {
96
+ width: 12px;
97
+ height: 12px;
98
+ border-radius: 50%;
99
+ cursor: pointer;
100
+ }
101
+
102
+ .window-btn.close {
103
+ background-color: #ff5f56;
104
+ }
105
+
106
+ .window-btn.minimize {
107
+ background-color: #ffbd2e;
108
+ }
109
+
110
+ .window-btn.maximize {
111
+ background-color: #27c93f;
112
+ }
113
  /* Add button active states */
114
  button:active {
115
  transform: scale(0.95);
terminal.html ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="h-full">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Terminal - PenguinOS</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ </head>
11
+ <body class="bg-gray-100 h-full">
12
+ <div class="flex h-full">
13
+ <!-- Sidebar -->
14
+ <div class="w-64 bg-primary-900 text-white h-full">
15
+ <!-- Same sidebar as index.html -->
16
+ </div>
17
+
18
+ <!-- Main Content -->
19
+ <div class="flex-1 flex flex-col overflow-hidden">
20
+ <!-- Top Bar -->
21
+ <header class="bg-white border-b border-gray-200 p-4 flex items-center justify-between">
22
+ <div class="flex items-center">
23
+ <i data-feather="menu" class="mr-4 cursor-pointer text-secondary-500"></i>
24
+ <h1 class="text-lg font-semibold">Terminal</h1>
25
+ </div>
26
+ <div class="flex items-center space-x-2">
27
+ <div class="window-btn close"></div>
28
+ <div class="window-btn minimize"></div>
29
+ <div class="window-btn maximize"></div>
30
+ </div>
31
+ </header>
32
+
33
+ <!-- Terminal Content -->
34
+ <main class="flex-1 p-6">
35
+ <custom-terminal></custom-terminal>
36
+ </main>
37
+ </div>
38
+ </div>
39
+
40
+ <script>
41
+ feather.replace();
42
+ </script>
43
+ <script src="components/terminal.js"></script>
44
+ <script src="script.js"></script>
45
+ </body>
46
+ </html>