diff --git a/lesson_19/template/style.css b/lesson_19/template/style.css index e69de29bb..14954e681 100644 --- a/lesson_19/template/style.css +++ b/lesson_19/template/style.css @@ -0,0 +1,358 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: 'Poppins', sans-serif; + line-height: 1.6; + color: #333; + background-color: #ffffff; +} + +/* Typography */ +h1, h2, h3, h4, h5, h6 { + font-family: 'Montserrat', sans-serif; + font-weight: 700; + margin-bottom: 1rem; +} + +h2 { + font-size: 2.5rem; + font-weight: 800; + color: #2c3e50; +} + +h3 { + font-size: 1.5rem; + font-weight: 700; + color: #2c3e50; + margin-bottom: 1rem; +} + +p { + font-size: 1.1rem; + line-height: 1.7; + color: #555; + margin-bottom: 1.5rem; +} + +/* Highlight Text */ +.highlight { + color: #e74c3c; + font-style: normal; + font-weight: 900; +} + +/* Header Styles */ +.header { + background-color: #ffffff; + padding: 1rem 2rem; + display: flex; + justify-content: space-between; + align-items: center; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); + position: sticky; + top: 0; + z-index: 1000; +} + +.header-logo img { + height: 50px; + width: auto; +} + +.header-top-menu { + display: flex; + list-style: none; + gap: 2rem; +} + +.header-top-menu li a { + text-decoration: none; + color: #2c3e50; + font-weight: 600; + font-size: 1rem; + transition: color 0.3s ease; +} + +.header-top-menu li a:hover { + color: #e74c3c; +} + +.sign-up-button { + background-color: #e74c3c; + color: white; + padding: 0.75rem 1.5rem; + text-decoration: none; + border-radius: 5px; + font-weight: 600; + transition: all 0.3s ease; + border: 2px solid #e74c3c; +} + +.sign-up-button:hover { + background-color: transparent; + color: #e74c3c; + transform: translateY(-2px); + box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3); +} + +/* Main Content */ +.main { + min-height: calc(100vh - 120px); +} + +.content { + max-width: 1200px; + margin: 0 auto; +} + +/* Hero Section */ +.hero-section { + background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%); + color: white; + padding: 4rem 2rem; + text-align: center; + position: relative; + overflow: hidden; +} + +.hero-section::before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: url('data:image/svg+xml,'); + opacity: 0.3; +} + +.hero-content { + position: relative; + z-index: 2; + max-width: 800px; + margin: 0 auto; +} + +.hero-title { + font-size: 3rem; + font-weight: 800; + margin-bottom: 2rem; + line-height: 1.2; +} + +.hero-title .highlight { + color: #e74c3c; + position: relative; +} + +.hero-title .highlight::after { + content: ''; + position: absolute; + bottom: -5px; + left: 0; + right: 0; + height: 3px; + background-color: #e74c3c; + border-radius: 2px; +} + +.hero-text { + font-size: 1.3rem; + line-height: 1.7; + opacity: 0.95; + max-width: 700px; + margin: 0 auto; +} + +.hero-text span { + font-weight: 600; + color: #e74c3c; +} + +/* Programs Section */ +.programs-section { + padding: 4rem 2rem; + background-color: #f8f9fa; +} + +.programs-section h2 { + text-align: center; + margin-bottom: 3rem; + font-size: 2.5rem; +} + +.programs { + list-style: none; + display: grid; + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); + gap: 2rem; + max-width: 1000px; + margin: 0 auto; +} + +.program { + background: white; + padding: 2rem; + border-radius: 10px; + box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08); + transition: all 0.3s ease; + border-top: 4px solid #e74c3c; +} + +.program:hover { + transform: translateY(-5px); + box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); +} + +.program h3 { + color: #2c3e50; + margin-bottom: 1rem; + font-size: 1.4rem; +} + +.program p { + color: #666; + font-size: 1rem; + line-height: 1.6; +} + +/* Footer */ +.footer { + background-color: #2c3e50; + color: white; + text-align: center; + padding: 2rem; + font-size: 1rem; +} + +/* Responsive Design */ +@media (max-width: 768px) { + .header { + flex-direction: column; + gap: 1rem; + padding: 1rem; + } + + .header-top-menu { + flex-direction: column; + gap: 1rem; + text-align: center; + } + + .hero-title { + font-size: 2rem; + } + + .hero-text { + font-size: 1.1rem; + } + + .programs-section h2 { + font-size: 2rem; + } + + .programs { + grid-template-columns: 1fr; + gap: 1.5rem; + } + + .program { + padding: 1.5rem; + } +} + +@media (max-width: 480px) { + .header { + padding: 0.5rem; + } + + .hero-section { + padding: 2rem 1rem; + } + + .hero-title { + font-size: 1.8rem; + } + + .programs-section { + padding: 2rem 1rem; + } + + .program { + padding: 1rem; + } +} + +/* Additional Interactive Elements */ +.header-top-menu li a::after { + content: ''; + position: absolute; + bottom: -5px; + left: 0; + width: 0; + height: 2px; + background-color: #e74c3c; + transition: width 0.3s ease; +} + +.header-top-menu li { + position: relative; +} + +.header-top-menu li a:hover::after { + width: 100%; +} + +/* Smooth scrolling */ +html { + scroll-behavior: smooth; +} + +/* Focus styles for accessibility */ +.sign-up-button:focus, +.header-top-menu li a:focus { + outline: 2px solid #e74c3c; + outline-offset: 2px; +} + +/* Animation for hero content */ +@keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(30px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +.hero-content { + animation: fadeInUp 0.8s ease-out; +} + +/* Animation for program cards */ +@keyframes fadeInScale { + from { + opacity: 0; + transform: scale(0.9); + } + to { + opacity: 1; + transform: scale(1); + } +} + +.program { + animation: fadeInScale 0.6s ease-out; + animation-fill-mode: both; +} + +.program:nth-child(1) { animation-delay: 0.1s; } +.program:nth-child(2) { animation-delay: 0.2s; } +.program:nth-child(3) { animation-delay: 0.3s; } +.program:nth-child(4) { animation-delay: 0.4s; } \ No newline at end of file diff --git a/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/factory/LibraryDbDataLoader.java b/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/factory/LibraryDbDataLoader.java index b897de124..f42f080da 100644 --- a/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/factory/LibraryDbDataLoader.java +++ b/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/factory/LibraryDbDataLoader.java @@ -1,18 +1,22 @@ package com.codedifferently.lesson25.factory; -import com.codedifferently.lesson25.models.LibraryDataModel; -import com.codedifferently.lesson25.repository.LibraryGuestRepository; -import com.codedifferently.lesson25.repository.MediaItemRepository; import java.io.IOException; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.codedifferently.lesson25.models.LibraryDataModel; +import com.codedifferently.lesson25.repository.LibraryGuestRepository; +import com.codedifferently.lesson25.repository.LibraryUserRepository; +import com.codedifferently.lesson25.repository.MediaItemRepository; + /** A data loader that loads library data from a database. */ @Service public final class LibraryDbDataLoader implements LibraryDataLoader { @Autowired private MediaItemRepository mediaItemsRepository; @Autowired private LibraryGuestRepository libraryGuestRepository; + @Autowired private LibraryUserRepository libraryUserRepository; @Override public LibraryDataModel loadData() throws IOException { @@ -20,6 +24,7 @@ public LibraryDataModel loadData() throws IOException { model.mediaItems = mediaItemsRepository.findAll(); model.guests = libraryGuestRepository.findAll(); + model.users = libraryUserRepository.findAll(); return model; } diff --git a/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/models/LibraryDataModel.java b/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/models/LibraryDataModel.java index 6c268f962..0d8e9cba7 100644 --- a/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/models/LibraryDataModel.java +++ b/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/models/LibraryDataModel.java @@ -1,5 +1,10 @@ package com.codedifferently.lesson25.models; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import com.codedifferently.lesson25.library.Book; import com.codedifferently.lesson25.library.Dvd; import com.codedifferently.lesson25.library.Librarian; @@ -8,15 +13,12 @@ import com.codedifferently.lesson25.library.MediaItem; import com.codedifferently.lesson25.library.Newspaper; import com.codedifferently.lesson25.library.Patron; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; public class LibraryDataModel { public List mediaItems; public List guests; + public List users; public List getMediaItems() { List results = new ArrayList<>(); diff --git a/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/models/LibraryUserModel.java b/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/models/LibraryUserModel.java new file mode 100644 index 000000000..36ab36849 --- /dev/null +++ b/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/models/LibraryUserModel.java @@ -0,0 +1,10 @@ +package com.codedifferently.lesson25.models; + +public class LibraryUserModel { + + public String id; + public String email; + public String firstName; + public String lastName; + public String password; +} \ No newline at end of file diff --git a/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/repository/LibraryUserRepository.java b/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/repository/LibraryUserRepository.java new file mode 100644 index 000000000..36e4f2b01 --- /dev/null +++ b/lesson_25/db/db_app/src/main/java/com/codedifferently/lesson25/repository/LibraryUserRepository.java @@ -0,0 +1,9 @@ +package com.codedifferently.lesson25.repository; + +import java.util.List; + +import com.codedifferently.lesson25.models.LibraryUserModel; + +public interface LibraryUserRepository { + List findAll(); +} \ No newline at end of file diff --git a/lesson_25/db/db_app/src/main/resources/queries/jayden_ellis_queries.sql b/lesson_25/db/db_app/src/main/resources/queries/jayden_ellis_queries.sql new file mode 100644 index 000000000..ef64d3349 --- /dev/null +++ b/lesson_25/db/db_app/src/main/resources/queries/jayden_ellis_queries.sql @@ -0,0 +1,32 @@ +-- SQL Queries for Library Database Assignment +-- Author: Jayden Ellis +-- Date: December 17, 2025 + +-- Query 1: Count of media items by type +SELECT + type as media_type, + COUNT(*) as item_count +FROM media_items +GROUP BY type +ORDER BY item_count DESC; + +-- Query 2: Sum of total pages checked out by guests +SELECT + COALESCE(SUM(mi.pages), 0) as total_pages_checked_out +FROM checked_out_items coi +INNER JOIN media_items mi ON coi.media_item_id = mi.id +WHERE mi.pages IS NOT NULL AND mi.pages > 0; + +-- Query 3: All guests with their checked out items (LEFT JOIN to include guests with no checkouts) +SELECT + g.email as guest_email, + g.name as guest_name, + g.type as guest_type, + coi.id as checkout_id, + mi.id as media_item_id, + mi.title as item_title, + mi.type as media_type +FROM guests g +LEFT JOIN checked_out_items coi ON g.email = coi.email +LEFT JOIN media_items mi ON coi.media_item_id = mi.id +ORDER BY g.name, mi.title; \ No newline at end of file diff --git a/lesson_25/db/db_app/src/main/resources/queries/my_library_queries.sql b/lesson_25/db/db_app/src/main/resources/queries/my_library_queries.sql new file mode 100644 index 000000000..31c5bdd7d --- /dev/null +++ b/lesson_25/db/db_app/src/main/resources/queries/my_library_queries.sql @@ -0,0 +1,31 @@ +-- Library Database Queries +-- Author: Assignment Solution +-- Date: December 2025 + +-- Query 1: Count of media items by type +SELECT + type as media_type, + COUNT(*) as item_count +FROM media_items +GROUP BY type +ORDER BY item_count DESC; + +-- Query 2: Sum of total pages checked out by guests +SELECT + SUM(mi.pages) as total_pages_checked_out +FROM checked_out_items coi +INNER JOIN media_items mi ON coi.media_item_id = mi.id +WHERE mi.pages IS NOT NULL; + +-- Query 3: All guests with their checked out items (including guests with no checkouts) +SELECT + g.id as guest_id, + g.name as guest_name, + coi.id as checkout_id, + mi.id as media_item_id, + mi.title as item_title, + mi.type as media_type +FROM guests g +LEFT JOIN checked_out_items coi ON g.id = coi.guest_id +LEFT JOIN media_items mi ON coi.media_item_id = mi.id +ORDER BY g.name, mi.title; \ No newline at end of file