commit dba2b74f2f8f1949d432518555fa0ae3c1509b5a
parent efcb279baaea7581ffc60a9f3e3aff651b0b7007
Author: AMIT DUTTA <amitdutta4255@gmail.com>
Date: Thu, 5 Mar 2026 22:08:59 +0530
Update fmt.Println message from 'Hello' to 'Goodbye'
Diffstat:
| M | index.html | | | 110 | +++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------- |
1 file changed, 71 insertions(+), 39 deletions(-)
diff --git a/index.html b/index.html
@@ -165,6 +165,7 @@
<!-- Dependencies -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.6/ace.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.6/ext-beautify.js"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.6/ext-language_tools.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lz-string/1.5.0/lz-string.min.js"></script>
</head>
<body class="flex flex-col text-sm antialiased selection:bg-veyrix-accent/30">
@@ -732,7 +733,7 @@
</div>
<!-- History Modal -->
- <div id="history-modal" class="hidden bg-veyrix-surface border border-veyrix-border rounded-lg w-full max-w-sm shadow-2xl modal-content pointer-events-auto flex flex-col overflow-hidden mb-auto md:mb-0 mt-4 md:mt-0">
+ <div id="history-modal" class="hidden bg-veyrix-surface border border-veyrix-border rounded-lg w-full max-w-sm shadow-2xl modal-content pointer-events-auto flex flex-col overflow-hidden mb-auto md:mb-0 mt-4 md:mt-0 z-[100]">
<div class="p-4 border-b border-veyrix-border flex justify-between items-center bg-veyrix-bg">
<h3 class="font-semibold text-white">Version History</h3>
<button onclick="UI.hideModal()" class="text-veyrix-muted hover:text-white transition-colors">✕</button>
@@ -749,17 +750,12 @@
* VEYRIX IDE - CORE APPLICATION LOGIC
*/
-const APP_VERSION = '1.0.5';
+const APP_VERSION = '1.0.9';
// ===== FIREBASE CONFIGURATION =====
// Firebase initializes ONLY when Cloud Share is selected.
const firebaseConfig = {
- apiKey: "",
- authDomain: "",
- projectId: "",
- storageBucket: "",
- messagingSenderId: "",
- appId: ""
+
};
// Application State
@@ -899,6 +895,7 @@ window.addEventListener('beforeinstallprompt', (e) => {
// UI Manager
const UI = {
activeModal: null,
+ modalStack: [],
activeDropdownId: null,
toggleSidebar: (forceClose = false) => {
@@ -1022,7 +1019,7 @@ const UI = {
<span class="text-white">Version ${versionNumber}</span>
<span class="text-xs text-veyrix-muted">${date}</span>
</div>
- <button onclick="App.triggerRestore(${realIndex})" class="text-veyrix-accent hover:text-veyrix-accentHover text-xs font-medium px-3 py-1.5 rounded bg-veyrix-accent/10 hover:bg-veyrix-accent/20 transition-colors">Restore</button>
+ <button onclick="App.triggerRestore(${realIndex}, event)" class="text-veyrix-accent hover:text-veyrix-accentHover text-xs font-medium px-3 py-1.5 rounded bg-veyrix-accent/10 hover:bg-veyrix-accent/20 transition-colors">Restore</button>
`;
list.appendChild(el);
});
@@ -1031,12 +1028,19 @@ const UI = {
},
showModal: (id) => {
- if (UI.activeModal) UI.hideModal();
UI.closeAllDropdowns();
const overlay = document.getElementById('modal-overlay');
const modal = document.getElementById(id);
+
+ if (UI.activeModal && UI.activeModal.id !== id) {
+ UI.activeModal.classList.add('hidden');
+ UI.activeModal.classList.remove('modal-enter', 'modal-exit');
+ UI.modalStack.push(UI.activeModal);
+ }
+
overlay.classList.remove('hidden');
overlay.classList.add('flex');
+
modal.classList.remove('hidden');
modal.classList.add('modal-enter');
modal.classList.remove('modal-exit');
@@ -1062,16 +1066,43 @@ const UI = {
if (!UI.activeModal) return;
const overlay = document.getElementById('modal-overlay');
const modal = UI.activeModal;
+
modal.classList.remove('modal-enter');
modal.classList.add('modal-exit');
+
+ UI.activeModal = null; // Important to release current immediately
+
setTimeout(() => {
modal.classList.add('hidden');
- overlay.classList.add('hidden');
- overlay.classList.remove('flex');
- UI.activeModal = null;
+ modal.classList.remove('modal-exit');
+
+ if (UI.modalStack && UI.modalStack.length > 0) {
+ UI.activeModal = UI.modalStack.pop();
+ UI.activeModal.classList.remove('hidden');
+ UI.activeModal.classList.add('modal-enter');
+ } else {
+ overlay.classList.add('hidden');
+ overlay.classList.remove('flex');
+ }
}, 200);
},
+ closeAllModals: () => {
+ if (UI.activeModal) {
+ UI.activeModal.classList.add('hidden');
+ UI.activeModal.classList.remove('modal-enter', 'modal-exit');
+ }
+ UI.modalStack.forEach(m => {
+ m.classList.add('hidden');
+ m.classList.remove('modal-enter', 'modal-exit');
+ });
+ UI.modalStack = [];
+ UI.activeModal = null;
+ const overlay = document.getElementById('modal-overlay');
+ overlay.classList.add('hidden');
+ overlay.classList.remove('flex');
+ },
+
toast: (msg, type = 'info') => {
const container = document.getElementById('toast-container');
const toast = document.createElement('div');
@@ -1186,7 +1217,6 @@ const Cloud = {
return true;
} catch (e) {
console.error(e);
- UI.toast('Failed to initialize secure cloud share', 'error');
return false;
}
},
@@ -1207,11 +1237,12 @@ const Cloud = {
if(!file) return UI.toast('No file to share', 'error');
const btn = document.getElementById('btn-cloud-share');
- btn.innerHTML = `<svg class="animate-spin -ml-1 mr-2 h-4 w-4 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> Uploading...`;
+ const originalText = btn.innerHTML;
+ btn.innerHTML = `<svg class="animate-spin -ml-1 mr-2 h-4 w-4 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> Sharing project...`;
btn.disabled = true;
- if(await Cloud.loadFirebase()) {
- try {
+ try {
+ if(await Cloud.loadFirebase()) {
const pass = document.getElementById('cloud-password').value;
const passHash = await Utils.hashPassword(pass);
@@ -1232,20 +1263,21 @@ const Cloud = {
urlInput.value = url;
resDiv.classList.remove('hidden');
UI.toast('Uploaded to secure cloud');
- } catch(e) {
- console.error(e);
- UI.toast('Upload failed', 'error');
+ } else {
+ throw new Error("Firebase failed to load");
}
+ } catch(e) {
+ console.error(e);
+ UI.toast('Cloud share failed', 'error');
+ } finally {
+ btn.innerHTML = originalText;
+ btn.disabled = false;
}
-
- btn.innerHTML = `<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"></path></svg> Upload & Share`;
- btn.disabled = false;
},
- currentCloudDoc: null,
handleCloudLoad: async (id) => {
UI.toast('Loading from cloud...');
- if(await Cloud.loadFirebase()) {
- try {
+ try {
+ if(await Cloud.loadFirebase()) {
const docRef = window.fbFirestore.doc(window.fbDb, "shared_snippets", id);
const docSnap = await window.fbFirestore.getDoc(docRef);
@@ -1260,10 +1292,12 @@ const Cloud = {
} else {
UI.toast('Cloud file not found', 'error');
}
- } catch(e) {
- console.error(e);
- UI.toast('Failed to load cloud file', 'error');
+ } else {
+ throw new Error("Firebase failed to load");
}
+ } catch(e) {
+ console.error(e);
+ UI.toast('Failed to load cloud file', 'error');
}
},
verifyAndLoadCloudFile: async () => {
@@ -1467,11 +1501,6 @@ const App = {
}
}, 500));
- // Close modals on overlay click
- document.getElementById('modal-overlay').addEventListener('click', (e) => {
- if(e.target.id === 'modal-overlay') UI.hideModal();
- });
-
// Keyboard Shortcuts
window.addEventListener('keydown', (e) => {
if (e.ctrlKey && e.key === 's') { e.preventDefault(); App.saveCurrentFile(); }
@@ -1629,7 +1658,7 @@ const App = {
UI.toast('File saved');
},
- triggerDownload: async (id = null, e = null) => {
+triggerDownload: async (id = null, e = null, skipShareAttempt = false) => {
if(e) e.stopPropagation();
UI.closeAllDropdowns();
@@ -1642,7 +1671,8 @@ const App = {
const content = file.id === state.activeFileId ? state.editor.getValue() : file.content;
const fileName = Utils.getDisplayName(file);
- if (navigator.canShare) {
+ // Wrap the share attempt in the new flag
+ if (!skipShareAttempt && navigator.canShare) {
try {
const fileObj = new File([content], fileName, { type: 'application/octet-stream' });
if (navigator.canShare({ files: [fileObj] })) {
@@ -1709,7 +1739,8 @@ const App = {
UI.toast('Snapshot saved to history');
},
- triggerRestore: (index) => {
+ triggerRestore: (index, e) => {
+ if(e) e.stopPropagation();
UI.showConfirm(
"Restore Snapshot",
"Are you sure you want to restore this snapshot? Current unsaved changes will be lost.",
@@ -1723,6 +1754,7 @@ const App = {
if(!file || !file.snapshots || !file.snapshots[index]) return;
state.editor.setValue(file.snapshots[index].content, -1);
+ UI.closeAllModals();
UI.toast('Restored previous version');
App.saveCurrentFile(); // auto save after restore
},
@@ -1794,6 +1826,7 @@ const App = {
UI.updateTopBar();
}
UI.renderSidebar();
+ UI.closeAllModals();
UI.toast('File deleted');
}
);
@@ -1905,4 +1938,4 @@ if ('serviceWorker' in navigator) {
}
</script>
</body>
-</html>-
\ No newline at end of file
+</html>