← back to Wine Finder

test.html

170 lines

<!DOCTYPE html>
<html>
<head>
<style>
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: #0a0a0a;
  color: #ffffff;
  min-height: 100vh;
}

.header {
  background: #111111;
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.header h1 {
  margin: 0;
  font-size: 32px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.container {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

.card {
  background: #111111;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 20px;
}

.search-box {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  padding: 14px 20px;
  background: #151515;
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #ffffff;
  font-size: 16px;
}

.search-input:focus {
  outline: none;
  border-color: #ec4899;
}

.btn {
  padding: 14px 32px;
  background: linear-gradient(135deg, #ec4899, #db2777);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

#results {
  display: none;
}

.wine-item {
  background: #151515;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
}

.wine-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.wine-price {
  font-size: 24px;
  font-weight: 700;
  color: #ec4899;
}
</style>
</head>
<body>
<div class="header">
  <h1>🍷 Red Thunder Wine Tracker</h1>
  <p style="margin: 5px 0 0 0; color: #666; font-size: 12px; letter-spacing: 2px;">PREMIUM WINE INTELLIGENCE</p>
</div>

<div class="container">
  <div class="card">
    <h2 style="margin: 0 0 20px 0; font-size: 24px;">Search Wines</h2>
    <div class="search-box">
      <input type="text" id="search" class="search-input" placeholder="Enter wine name or winery...">
      <button class="btn" onclick="searchWines()">Search</button>
    </div>
  </div>

  <div class="card" id="results">
    <h2 style="margin: 0 0 20px 0; font-size: 24px;">Results</h2>
    <div id="wineList"></div>
  </div>
</div>

<script>
async function searchWines() {
  const query = document.getElementById('search').value;
  if (!query) {
    alert('Please enter a search term');
    return;
  }

  try {
    const response = await fetch('/api/scraper/search', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ query })
    });

    const data = await response.json();

    if (data.success && data.wines.length > 0) {
      document.getElementById('results').style.display = 'block';
      const html = data.wines.map(wine => `
        <div class="wine-item">
          <div class="wine-name">${wine.name}</div>
          <div class="wine-price">$${wine.price.toFixed(2)}</div>
          <div style="margin-top: 8px; font-size: 14px; color: #999;">
            ${wine.vintage} • ${wine.rating} pts • ${wine.availability}
          </div>
        </div>
      `).join('');
      document.getElementById('wineList').innerHTML = html;
    } else {
      alert('No wines found');
    }
  } catch (error) {
    console.error(error);
    alert('Search failed');
  }
}

document.getElementById('search').addEventListener('keypress', (e) => {
  if (e.key === 'Enter') searchWines();
});
</script>
</body>
</html>