-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy path+layout.svelte
More file actions
202 lines (187 loc) · 6.08 KB
/
+layout.svelte
File metadata and controls
202 lines (187 loc) · 6.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<script lang="ts">
import '../app.scss';
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { base } from '$app/paths';
import { Sun, Moon, Mail, Github, Menu, X, Key, LogIn } from 'lucide-svelte';
const loginUrl = import.meta.env.VITE_CTX_LOGIN_URL || `${base}/login`;
let { children } = $props();
let theme = $state('dark');
let mobileMenuOpen = $state(false);
onMount(() => {
const saved = localStorage.getItem('theme');
if (saved) {
theme = saved;
document.documentElement.setAttribute('data-theme', saved);
}
// Global Escape key handler for mobile menu
const handleEscape = (e: KeyboardEvent) => {
if (e.key === 'Escape' && mobileMenuOpen) {
closeMobileMenu();
}
};
document.addEventListener('keydown', handleEscape);
// Close mobile menu when resizing past breakpoint
const handleResize = () => {
if (window.innerWidth > 1024 && mobileMenuOpen) {
closeMobileMenu();
}
};
window.addEventListener('resize', handleResize);
return () => {
document.removeEventListener('keydown', handleEscape);
window.removeEventListener('resize', handleResize);
};
});
function toggleTheme() {
theme = theme === 'dark' ? 'light' : 'dark';
document.documentElement.setAttribute('data-theme', theme);
localStorage.setItem('theme', theme);
}
function toggleMobileMenu() {
mobileMenuOpen = !mobileMenuOpen;
}
function closeMobileMenu() {
mobileMenuOpen = false;
}
// Check if we're on the contact page
let isContactPage = $derived($page.route.id === '/contact');
</script>
<header class="header">
<div class="header-left">
<a href="{base}/" class="logo">
<img src="{base}/favicon.png" alt="Context Engine" class="logo-icon-img" />
Context Engine
</a>
<span class="byok-pill" data-tooltip="Bring Your Own LLM Key">
<Key size={12} />
<span>BYOK</span>
</span>
<nav class="nav">
<a
href="https://www.npmjs.com/package/@context-engine-bridge/context-engine-mcp-bridge"
class="nav-link"
target="_blank"
>
<svg viewBox="0 0 24 24" fill="currentColor" width="16" height="16">
<path
d="M0 7.334v8h6.666v1.332H12v-1.332h12v-8H0zm6.666 6.664H5.334v-4H3.999v4H1.335V8.667h5.331v5.331zm4 0v1.336H8.001V8.667h5.334v5.332h-2.669v-.001zm12.001 0h-1.33v-4h-1.336v4h-1.335v-4h-1.33v4h-2.671V8.667h8.002v5.331zM10.665 10H12v2.667h-1.335V10z"
/>
</svg>
NPM Bridge
</a>
<a
href="https://github.com/Context-Engine-AI/Context-Engine"
class="nav-link"
target="_blank"
>
<Github size={16} />
GitHub
</a>
<a
href="https://marketplace.visualstudio.com/items?itemName=context-engine.context-engine-uploader"
class="nav-link"
target="_blank"
>
<svg viewBox="0 0 24 24" fill="currentColor" width="16" height="16">
<path
d="M17.583.063a1.5 1.5 0 00-1.032.392 1.5 1.5 0 00-.001 0L7.332 9.057 2.983 5.602a1 1 0 00-1.283.082L.313 7.012A1 1 0 000 7.748v8.504a1 1 0 00.313.736l1.387 1.328a1 1 0 001.283.082l4.349-3.455 9.218 8.602a1.5 1.5 0 001.033.392 1.5 1.5 0 00.417-.063l4.5-1.5a1.5 1.5 0 001-1.415V1.541a1.5 1.5 0 00-1-1.415l-4.5-1.5a1.5 1.5 0 00-.417-.063zM18 6.927v10.146L10.893 12z"
/>
</svg>
VS Code <span style="font-size:11px;opacity:0.7">(OSS)</span>
</a>
</nav>
</div>
<div class="header-right">
<a href="mailto:support@context-engine.ai" class="btn btn-ghost desktop-only">
<Mail size={16} />
Support
</a>
<button class="icon-btn" onclick={toggleTheme} aria-label="Toggle theme">
{#if theme === 'dark'}
<span class="sun-icon"><Sun size={18} /></span>
{:else}
<span class="moon-icon"><Moon size={18} /></span>
{/if}
</button>
<a href={loginUrl} class="btn btn-login desktop-only">
<LogIn size={16} />
Login / Sign Up
</a>
<button
class="icon-btn mobile-menu-btn"
onclick={toggleMobileMenu}
aria-label={mobileMenuOpen ? 'Close menu' : 'Open menu'}
aria-expanded={mobileMenuOpen}
aria-controls="mobile-menu"
>
{#if mobileMenuOpen}
<X size={24} />
{:else}
<Menu size={24} />
{/if}
</button>
</div>
</header>
<!-- Mobile Menu Overlay -->
{#if mobileMenuOpen}
<div class="mobile-menu-overlay" onclick={closeMobileMenu} role="none"></div>
<nav class="mobile-menu" id="mobile-menu">
<a
href="https://www.npmjs.com/package/@context-engine-bridge/context-engine-mcp-bridge"
class="mobile-nav-link"
target="_blank"
rel="noopener noreferrer"
onclick={closeMobileMenu}
>
<svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
<path
d="M0 7.334v8h6.666v1.332H12v-1.332h12v-8H0zm6.666 6.664H5.334v-4H3.999v4H1.335V8.667h5.331v5.331zm4 0v1.336H8.001V8.667h5.334v5.332h-2.669v-.001zm12.001 0h-1.33v-4h-1.336v4h-1.335v-4h-1.33v4h-2.671V8.667h8.002v5.331zM10.665 10H12v2.667h-1.335V10z"
/>
</svg>
NPM Bridge
</a>
<a
href="https://github.com/Context-Engine-AI/Context-Engine"
class="mobile-nav-link"
target="_blank"
rel="noopener noreferrer"
onclick={closeMobileMenu}
>
<Github size={20} />
GitHub
</a>
<a
href="https://marketplace.visualstudio.com/items?itemName=context-engine.context-engine-uploader"
class="mobile-nav-link"
target="_blank"
rel="noopener noreferrer"
onclick={closeMobileMenu}
>
<svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
<path
d="M17.583.063a1.5 1.5 0 00-1.032.392 1.5 1.5 0 00-.001 0L7.332 9.057 2.983 5.602a1 1 0 00-1.283.082L.313 7.012A1 1 0 000 7.748v8.504a1 1 0 00.313.736l1.387 1.328a1 1 0 001.283.082l4.349-3.455 9.218 8.602a1.5 1.5 0 001.033.392 1.5 1.5 0 00.417-.063l4.5-1.5a1.5 1.5 0 001-1.415V1.541a1.5 1.5 0 00-1-1.415l-4.5-1.5a1.5 1.5 0 00-.417-.063zM18 6.927v10.146L10.893 12z"
/>
</svg>
VS Code Extension
</a>
<a href="mailto:support@context-engine.ai" class="mobile-nav-link" onclick={closeMobileMenu}>
<Mail size={20} />
Support
</a>
<a href={loginUrl} class="mobile-nav-link mobile-login-link" onclick={closeMobileMenu}>
<LogIn size={20} />
Login / Sign Up
</a>
</nav>
{/if}
<main>
{@render children()}
</main>
<style>
main {
position: relative;
z-index: 1;
min-height: calc(100vh - 64px);
}
</style>