import { chromium } from 'playwright';

async function takeNxtgaugeScreenshot() {
  const browser = await chromium.launch({ headless: true });
  const page = await browser.newPage();
  page.setViewportSize({ width: 1440, height: 900 });
  
  console.log('Navigating to nxtgauge admin...');
  await page.goto('http://localhost:3000/admin', { waitUntil: 'load' });
  await page.waitForTimeout(5000);
  
  // Take screenshot
  console.log('Taking screenshot...');
  await page.screenshot({ path: '/tmp/nxtgauge-admin.png', fullPage: true });
  
  // Get sidebar structure info
  const sidebarInfo = await page.evaluate(() => {
    const sidebar = document.querySelector('aside');
    if (sidebar) {
      const styles = window.getComputedStyle(sidebar);
      return {
        width: styles.width,
        background: styles.background,
        borderRight: styles.borderRight,
      };
    }
    return 'not found';
  });
  console.log('Sidebar styles:', sidebarInfo);
  
  await browser.close();
  console.log('Screenshot saved');
}

takeNxtgaugeScreenshot().catch(console.error);
