function initMyComputer()

in src/gemini_95/index.ts [1568:1614]


function initMyComputer(windowElement: HTMLDivElement): void {
    const cDriveIcon = windowElement.querySelector('#c-drive-icon') as HTMLDivElement;
    const cDriveContent = windowElement.querySelector('#c-drive-content') as HTMLDivElement;
    const secretImageIcon = windowElement.querySelector('#secret-image-icon') as HTMLDivElement;

    if (!cDriveIcon || !cDriveContent || !secretImageIcon) {
        console.error("My Computer elements not found!");
        return;
    }

    // --- C Drive Click Logic ---
    cDriveIcon.addEventListener('click', () => {
        cDriveIcon.style.display = 'none'; // Hide C: icon
        cDriveContent.style.display = 'block'; // Show secret file icon
        // Update window title (optional)
        // const titleSpan = windowElement.querySelector('.window-title') as HTMLSpanElement;
        // if (titleSpan) titleSpan.textContent = 'C:\\';
    });

    // --- Secret File Click Logic ---
    secretImageIcon.addEventListener('click', () => {
        const imageViewerWindow = document.getElementById('imageViewer') as HTMLDivElement | null;
        const imageViewerImg = document.getElementById('image-viewer-img') as HTMLImageElement | null;
        const imageViewerTitle = document.getElementById('image-viewer-title') as HTMLSpanElement | null;

        if (!imageViewerWindow || !imageViewerImg || !imageViewerTitle) {
            console.error("Image viewer elements not found!");
            alert("Image Viewer application files are corrupted!"); // User-friendly error
            return;
        }

        // Configure Image Viewer
        // Using a placeholder image as "http://myimage.png" is not a valid URL
        const imageUrl = 'https://storage.googleapis.com/gemini-95-icons/%40ammaar%2B%40olacombe.png'; // Placeholder: "Surprised Pikachu"
        imageViewerImg.src = imageUrl;
        imageViewerImg.alt = 'dontshowthistoanyone.jpg';
        imageViewerTitle.textContent = 'dontshowthistoanyone.jpg - Image Viewer';

        // Open the Image Viewer window using the existing openApp function
        // This handles bringing it to front, creating taskbar icon etc.
        openApp('imageViewer');
    });

    // Ensure initial state on open (show C drive, hide content)
    cDriveIcon.style.display = 'inline-flex';
    cDriveContent.style.display = 'none';
}