File size: 2,346 Bytes
54862ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Recommendations - BookNest</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}">
    <!-- Link to Google Fonts for better typography -->
    <link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap" rel="stylesheet">
</head>
<body class="index-page">
    <!-- Include Navigation Bar -->
    {% include 'navbar.html' %}

    <!-- Flash Messages -->
    {% with messages = get_flashed_messages(with_categories=true) %}
      {% if messages %}
        <div class="flash-messages">
          {% for category, message in messages %}
            <div class="alert alert-{{ category }}">{{ message }}</div>
          {% endfor %}
        </div>
      {% endif %}
    {% endwith %}

    <!-- Recommendations Form -->
    <div class="container">
        <h1>Get Book Recommendations</h1>
        <form action="{{ url_for('index') }}" method="POST" class="auth-form">
            <label for="book1">Book 1:</label>
            <input type="text" name="book1" id="book1" placeholder="Enter book title" required>

            <label for="book2">Book 2:</label>
            <input type="text" name="book2" id="book2" placeholder="Enter book title">

            <label for="book3">Book 3:</label>
            <input type="text" name="book3" id="book3" placeholder="Enter book title">

            <button type="submit">Get Recommendations</button>
        </form>
    </div>

    <!-- Recommendations Results -->
    {% if recommendations %}
    <div class="container">
        <h2>Recommended Books:</h2>
        <div class="recommendations">
            {% for book in recommendations %}
                <div class="book-card">
                    <img src="{{ book.image_url }}" alt="{{ book.title }}" class="book-image">
                    <h3>{{ book.title }}</h3>
                    <p><strong>Authors:</strong> {{ book.authors | join(', ') }}</p>
                    <a href="{{ url_for('book_detail', title=book.title|url_encode) }}" class="btn">View Details</a>
                </div>
            {% endfor %}
        </div>
    </div>
    {% endif %}

    <!-- Include Footer -->
    {% include 'footer.html' %}
</body>
</html>