make this site oerational for previewing
Browse files- components/navbar.js +10 -4
- index.html +14 -7
- script.js +55 -59
components/navbar.js
CHANGED
|
@@ -70,7 +70,13 @@ class CustomNavbar extends HTMLElement {
|
|
| 70 |
</div>
|
| 71 |
|
| 72 |
<div class="actions">
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
</div>
|
| 71 |
|
| 72 |
<div class="actions">
|
| 73 |
+
<button class="action-btn" id="voice-btn" title="Voice Input">
|
| 74 |
+
<i data-feather="mic"></i>
|
| 75 |
+
</button>
|
| 76 |
+
<span id="voice-status" class="text-xs"></span>
|
| 77 |
+
<button class="action-btn" id="screen-share-btn" title="Share Screen">
|
| 78 |
+
<i data-feather="monitor"></i>
|
| 79 |
+
</button>
|
| 80 |
+
<button class="dark-mode-toggle action-btn" id="dark-mode-toggle" title="Toggle Dark Mode">
|
| 81 |
+
<i data-feather="moon"></i>
|
| 82 |
+
</button>
|
index.html
CHANGED
|
@@ -34,13 +34,20 @@
|
|
| 34 |
</div>
|
| 35 |
</div>
|
| 36 |
<script src="script.js"></script>
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 45 |
</body>
|
| 46 |
</html>
|
|
|
|
| 34 |
</div>
|
| 35 |
</div>
|
| 36 |
<script src="script.js"></script>
|
| 37 |
+
<script>
|
| 38 |
+
feather.replace();
|
| 39 |
+
// Mock Supabase client for preview
|
| 40 |
+
window.supabase = {
|
| 41 |
+
from: () => ({
|
| 42 |
+
select: () => Promise.resolve({ data: [], error: null }),
|
| 43 |
+
insert: () => Promise.resolve({ error: null }),
|
| 44 |
+
on: () => ({ subscribe: () => {} })
|
| 45 |
+
}),
|
| 46 |
+
channel: () => ({
|
| 47 |
+
on: () => ({ subscribe: () => {} })
|
| 48 |
+
})
|
| 49 |
+
};
|
| 50 |
+
</script>
|
| 51 |
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 52 |
</body>
|
| 53 |
</html>
|
script.js
CHANGED
|
@@ -44,25 +44,18 @@ function initVoiceControls() {
|
|
| 44 |
}
|
| 45 |
});
|
| 46 |
}
|
| 47 |
-
|
| 48 |
async function processVoiceInput(audioBlob) {
|
| 49 |
-
//
|
| 50 |
-
const
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
const { text } = await response.json();
|
| 60 |
-
await sendMessage(text);
|
| 61 |
-
} catch (err) {
|
| 62 |
-
console.error('Error processing voice input:', err);
|
| 63 |
-
}
|
| 64 |
}
|
| 65 |
-
|
| 66 |
function initScreenShare() {
|
| 67 |
const screenShareBtn = document.getElementById('screen-share-btn');
|
| 68 |
|
|
@@ -89,36 +82,26 @@ function initScreenShare() {
|
|
| 89 |
}
|
| 90 |
});
|
| 91 |
}
|
| 92 |
-
|
| 93 |
async function initChat() {
|
| 94 |
-
// Load chat history
|
| 95 |
-
const
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
.
|
| 111 |
-
|
| 112 |
-
event: 'INSERT',
|
| 113 |
-
schema: 'public',
|
| 114 |
-
table: 'messages'
|
| 115 |
-
}, (payload) => {
|
| 116 |
-
const messageElement = createMessageElement(payload.new);
|
| 117 |
-
document.getElementById('chat-container').appendChild(messageElement);
|
| 118 |
-
})
|
| 119 |
-
.subscribe();
|
| 120 |
}
|
| 121 |
-
|
| 122 |
function createMessageElement(message) {
|
| 123 |
const messageDiv = document.createElement('div');
|
| 124 |
messageDiv.className = `message mb-4 p-3 rounded-lg max-w-3/4 ${
|
|
@@ -143,20 +126,33 @@ function createMessageElement(message) {
|
|
| 143 |
feather.replace({ scope: messageDiv });
|
| 144 |
return messageDiv;
|
| 145 |
}
|
| 146 |
-
|
| 147 |
async function sendMessage(content) {
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
.insert([{ content, is_user: true }]);
|
| 151 |
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
}
|
| 45 |
});
|
| 46 |
}
|
|
|
|
| 47 |
async function processVoiceInput(audioBlob) {
|
| 48 |
+
// Mock voice processing for preview
|
| 49 |
+
const mockResponses = [
|
| 50 |
+
"Hello! How can I help you today?",
|
| 51 |
+
"I'm an AI assistant here to answer your questions.",
|
| 52 |
+
"The weather looks nice today, isn't it?",
|
| 53 |
+
"Would you like me to search for something?",
|
| 54 |
+
"I can help with various topics including technology, science, and more."
|
| 55 |
+
];
|
| 56 |
+
const randomResponse = mockResponses[Math.floor(Math.random() * mockResponses.length)];
|
| 57 |
+
await sendMessage(randomResponse);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
}
|
|
|
|
| 59 |
function initScreenShare() {
|
| 60 |
const screenShareBtn = document.getElementById('screen-share-btn');
|
| 61 |
|
|
|
|
| 82 |
}
|
| 83 |
});
|
| 84 |
}
|
|
|
|
| 85 |
async function initChat() {
|
| 86 |
+
// Load mock chat history for preview
|
| 87 |
+
const mockMessages = [
|
| 88 |
+
{
|
| 89 |
+
content: "Welcome to ChatVerse!",
|
| 90 |
+
is_user: false,
|
| 91 |
+
created_at: new Date().toISOString()
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
content: "Try sending a message or using voice input",
|
| 95 |
+
is_user: false,
|
| 96 |
+
created_at: new Date().toISOString()
|
| 97 |
+
}
|
| 98 |
+
];
|
| 99 |
|
| 100 |
+
const chatContainer = document.getElementById('chat-container');
|
| 101 |
+
mockMessages.forEach(msg => {
|
| 102 |
+
chatContainer.appendChild(createMessageElement(msg));
|
| 103 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
}
|
|
|
|
| 105 |
function createMessageElement(message) {
|
| 106 |
const messageDiv = document.createElement('div');
|
| 107 |
messageDiv.className = `message mb-4 p-3 rounded-lg max-w-3/4 ${
|
|
|
|
| 126 |
feather.replace({ scope: messageDiv });
|
| 127 |
return messageDiv;
|
| 128 |
}
|
|
|
|
| 129 |
async function sendMessage(content) {
|
| 130 |
+
// Mock message sending for preview
|
| 131 |
+
const chatContainer = document.getElementById('chat-container');
|
|
|
|
| 132 |
|
| 133 |
+
// Add user message
|
| 134 |
+
const userMsg = {
|
| 135 |
+
content,
|
| 136 |
+
is_user: true,
|
| 137 |
+
created_at: new Date().toISOString()
|
| 138 |
+
};
|
| 139 |
+
chatContainer.appendChild(createMessageElement(userMsg));
|
| 140 |
+
|
| 141 |
+
// Add mock AI response after delay
|
| 142 |
+
setTimeout(async () => {
|
| 143 |
+
const mockResponses = [
|
| 144 |
+
"I understand you're asking about " + content,
|
| 145 |
+
"That's an interesting question about " + content,
|
| 146 |
+
"Let me think about " + content,
|
| 147 |
+
"I can help with " + content,
|
| 148 |
+
content + " is something I know about."
|
| 149 |
+
];
|
| 150 |
+
const aiMsg = {
|
| 151 |
+
content: mockResponses[Math.floor(Math.random() * mockResponses.length)],
|
| 152 |
+
is_user: false,
|
| 153 |
+
created_at: new Date().toISOString()
|
| 154 |
+
};
|
| 155 |
+
chatContainer.appendChild(createMessageElement(aiMsg));
|
| 156 |
+
chatContainer.scrollTop = chatContainer.scrollHeight;
|
| 157 |
+
}, 1000);
|
| 158 |
+
}
|