Skip to content

Commit 6e20b65

Browse files
Move JS to separate file
1 parent 276d137 commit 6e20b65

File tree

5 files changed

+76
-74
lines changed

5 files changed

+76
-74
lines changed

assets/css/marketing.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,10 @@ body .btn-secondary-home-action:focus{
919919
background:linear-gradient(90deg, #be5188 0%, #805ac3 100%)
920920
}
921921

922+
.section- pulumi-copilot{
923+
display:none
924+
}
925+
922926
@media (min-width: 640px) {
923927
.sm\:container {
924928
width: 100%;

assets/js/bundle.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

layouts/index.html

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -405,76 +405,4 @@ <h2 class="text-3xl md:text-4xl lg:text-6xl font-semibold">What cloud infrastruc
405405
</div>
406406
</div>
407407

408-
409-
<script>
410-
let isNeoMode = false;
411-
412-
function toggleNeoMode() {
413-
const neoInterface = document.getElementById('neo-interface');
414-
const neoToggle = document.getElementById('neo-mode-toggle');
415-
const neoContent = neoInterface.querySelector('div');
416-
const mainContent = document.getElementById('main-content');
417-
418-
isNeoMode = !isNeoMode;
419-
420-
if (isNeoMode) {
421-
// Add neo-active class to body to trigger all styling
422-
document.body.classList.add('neo-active');
423-
// Focus the input when opening neo mode
424-
setTimeout(() => {
425-
const input = document.getElementById('neo-input');
426-
if (input) {
427-
input.focus();
428-
console.log('Neo input focused'); // Debug log
429-
430-
// Double-check focus worked, retry if needed
431-
setTimeout(() => {
432-
if (document.activeElement !== input) {
433-
input.focus();
434-
console.log('Neo input re-focused'); // Debug log
435-
}
436-
}, 100);
437-
}
438-
}, 600); // Wait for full animation duration (0.4s + 0.1s delay + buffer)
439-
} else {
440-
// Remove neo-active class to restore normal state
441-
document.body.classList.remove('neo-active');
442-
// Clear the input when closing neo mode
443-
const input = document.getElementById('neo-input');
444-
if (input) {
445-
input.value = '';
446-
}
447-
}
448-
}
449-
450-
function submitNeoQuery() {
451-
const input = document.getElementById('neo-input');
452-
const query = input.value.trim();
453-
454-
if (query) {
455-
// Encode the query for URL safety
456-
const encodedQuery = encodeURIComponent(query);
457-
// Redirect to Pulumi Neo app with the query
458-
window.location.href = `https://app.pulumi.com/neo?prompt=${encodedQuery}`;
459-
}
460-
}
461-
462-
function populateNeoInput(prompt) {
463-
const input = document.getElementById('neo-input');
464-
input.value = prompt;
465-
input.focus();
466-
}
467-
468-
// Allow Enter key to submit
469-
document.addEventListener('DOMContentLoaded', function () {
470-
const neoInput = document.getElementById('neo-input');
471-
if (neoInput) {
472-
neoInput.addEventListener('keypress', function (e) {
473-
if (e.key === 'Enter') {
474-
submitNeoQuery();
475-
}
476-
});
477-
}
478-
});
479-
</script>
480408
{{ end }}

theme/src/ts/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import "./redirects";
2424
import "./algolia/autocomplete";
2525
import "./terraform-compare";
2626
import "./external-links";
27+
import "./neo-mode";
2728

2829
// Register all Stencil components.
2930
defineCustomElements();

theme/src/ts/neo-mode.ts

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
$(function () {
2+
let isNeoMode = false;
3+
4+
// Make functions available globally for onclick handlers
5+
(window as any).toggleNeoMode = toggleNeoMode;
6+
(window as any).submitNeoQuery = submitNeoQuery;
7+
(window as any).populateNeoInput = populateNeoInput;
8+
9+
function toggleNeoMode() {
10+
isNeoMode = !isNeoMode;
11+
12+
if (isNeoMode) {
13+
// Add neo-active class to body to trigger all styling
14+
document.body.classList.add('neo-active');
15+
// Focus the input when opening neo mode
16+
setTimeout(() => {
17+
const input = document.getElementById('neo-input') as HTMLInputElement;
18+
if (input) {
19+
input.focus();
20+
21+
// Double-check focus worked, retry if needed
22+
setTimeout(() => {
23+
if (document.activeElement !== input) {
24+
input.focus();
25+
}
26+
}, 100);
27+
}
28+
}, 600); // Wait for full animation duration (0.4s + 0.1s delay + buffer)
29+
} else {
30+
// Remove neo-active class to restore normal state
31+
document.body.classList.remove('neo-active');
32+
// Clear the input when closing neo mode
33+
const input = document.getElementById('neo-input') as HTMLInputElement;
34+
if (input) {
35+
input.value = '';
36+
}
37+
}
38+
}
39+
40+
function submitNeoQuery() {
41+
const input = document.getElementById('neo-input') as HTMLInputElement;
42+
const query = input?.value.trim();
43+
44+
if (query) {
45+
// Encode the query for URL safety
46+
const encodedQuery = encodeURIComponent(query);
47+
// Redirect to Pulumi Neo app with the query
48+
window.location.href = `https://app.pulumi.com/neo?prompt=${encodedQuery}`;
49+
}
50+
}
51+
52+
function populateNeoInput(prompt: string) {
53+
const input = document.getElementById('neo-input') as HTMLInputElement;
54+
if (input) {
55+
input.value = prompt;
56+
input.focus();
57+
}
58+
}
59+
60+
// Allow Enter key to submit
61+
const neoInput = document.getElementById('neo-input') as HTMLInputElement;
62+
if (neoInput) {
63+
neoInput.addEventListener('keypress', function (e) {
64+
if (e.key === 'Enter') {
65+
submitNeoQuery();
66+
}
67+
});
68+
}
69+
});

0 commit comments

Comments
 (0)