/**
* @copyright 2026 NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Component, OnInit, inject, signal, computed } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { ArtService } from '../../services/art.service';
import { AuthService } from '../../services/auth.service';
import { CommentsService } from '../../services/comments.service';
import { SanitizeService } from '../../services/sanitize.service';
import { SuggestionService } from '../../services/suggestion.service';
import { PaginationComponent } from '../shared/pagination.component';
import { LikeButtonComponent } from '../shared/like-button.component';
import { CommentDisplayComponent } from '../comment-display/comment-display.component';
import { Art, CreateArtDto, UpdateArtDto, Comment, SuggestionEntity, Link } from '@library/shared-types';
@Component({
selector: 'app-art-gallery',
standalone: true,
imports: [CommonModule, FormsModule, PaginationComponent, LikeButtonComponent, CommentDisplayComponent],
template: `
A note on AI-generated art: Yes, we understand the negative impacts of AI art on working artists.
However, seeing ourselves represented gives us gender euphoria and dopamine hits in an otherwise shitty and depressing world.
If you want to yell at someone about AI art, go find someone who's actually profiting from their AI slop instead of bothering us. Thanks!
That said, if you'd like to draw Naomi and send it our way, we'd be absolutely delighted to display it here!
@if (showAddForm() && authService.isAdmin()) {
}
@if (showSuggestForm() && !authService.isAdmin() && authService.isAuthenticated()) {
Suggest Art
Your suggestion will be reviewed by Naomi. If accepted, it will be added to the gallery!
Title
Artist
Image URL
Description (optional, used as alt text)
@if (suggestedArt.imageUrl) {
Preview:
}
Submit Suggestion
Cancel
}
@if (editingArt() && authService.isAdmin()) {
Edit Artwork
Title
Artist
Image URL (CDN)
Description (used as alt text)
@if (editArt.imageUrl) {
Preview:
}
Save Changes
Cancel
}
{{ showFilters() ? 'Hide' : 'Show' }} Advanced Filters
@if (selectedTags().length > 0) {
({{ selectedTags().length }})
}
@if (searchQuery() || selectedTags().length > 0) {
Clear All Filters
}
@if (showFilters()) {
}
@if (loading()) {
Loading gallery...
} @else if (filteredArtPieces().length === 0) {
No artwork found with these filters.
} @else {
@for (art of paginatedArtPieces(); track art.id) {
{{ art.title }}
by {{ art.artist }}
Added: {{ formatDate(art.dateAdded) }}
@if (art.tags && art.tags.length > 0) {
@for (tag of art.tags; track tag) {
{{ tag }}
}
}
@if (art.links && art.links.length > 0) {
}
@if (authService.isAdmin()) {
Edit
Delete
}
}
}
@if (lightboxArt()) {
×
{{ lightboxArt()!.title }}
by {{ lightboxArt()!.artist }}
}
`,
styles: [`
.container {
max-width: 1400px;
margin: 0 auto;
padding: 2rem;
}
.header-section {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 2rem;
gap: 0.5rem;
}
.header-section h2 {
margin: 0;
}
.subtitle {
color: var(--witch-mauve);
margin: 0;
font-style: italic;
}
.search-section {
display: flex;
gap: 1rem;
align-items: center;
margin-bottom: 1rem;
flex-wrap: wrap;
}
.search-input {
flex: 1;
min-width: 250px;
padding: 0.5rem 1rem;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 1rem;
}
.search-input:focus {
outline: none;
border-color: var(--witch-rose);
}
.advanced-filters {
background: #f8f9fa;
padding: 1rem;
border-radius: 8px;
margin-bottom: 1rem;
}
.filter-group h4 {
margin: 0 0 0.75rem 0;
color: #374151;
font-size: 0.95rem;
font-weight: 600;
}
.tags-filter {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
}
.tag-checkbox {
display: flex;
align-items: center;
gap: 0.5rem;
cursor: pointer;
padding: 0.25rem 0.75rem;
border: 1px solid #e5e7eb;
border-radius: 20px;
background: white;
transition: all 0.2s;
}
.tag-checkbox:hover {
border-color: var(--witch-rose);
background: #fff5f8;
}
.tag-checkbox input[type="checkbox"] {
width: 16px;
height: 16px;
cursor: pointer;
}
.tag-checkbox span {
font-size: 0.875rem;
color: #374151;
}
.no-tags {
color: #6b7280;
font-style: italic;
font-size: 0.875rem;
}
.disclaimer {
background: linear-gradient(135deg, var(--witch-lavender) 0%, var(--witch-mauve) 100%);
border: 2px solid var(--witch-plum);
border-radius: 8px;
padding: 1rem 1.5rem;
margin-bottom: 2rem;
max-width: 800px;
margin-left: auto;
margin-right: auto;
}
.disclaimer p {
margin: 0;
color: var(--witch-purple);
font-size: 0.95rem;
line-height: 1.6;
text-align: center;
}
.disclaimer p.callout {
margin-top: 0.75rem;
font-style: italic;
color: var(--witch-plum);
}
.disclaimer strong {
color: var(--witch-plum);
}
.add-form {
background: rgba(255, 255, 255, 0.95);
padding: 1.5rem;
border-radius: 8px;
margin-bottom: 2rem;
border: 2px solid var(--witch-lavender);
backdrop-filter: blur(10px);
max-width: 600px;
margin-left: auto;
margin-right: auto;
}
.suggest-form {
border: 2px solid #fdcb6e;
background: #fffdf5;
}
.suggest-note {
color: #666;
font-size: 0.9rem;
margin-bottom: 1rem;
font-style: italic;
}
.form-group {
margin-bottom: 1rem;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: var(--witch-plum);
}
.form-group input,
.form-group textarea {
width: 100%;
padding: 0.75rem;
border: 2px solid var(--witch-lavender);
border-radius: 4px;
font-size: 1rem;
background-color: var(--witch-moon);
color: var(--witch-purple);
transition: border-color 0.3s;
}
.form-group input:focus,
.form-group textarea:focus {
outline: none;
border-color: var(--witch-rose);
}
.image-preview {
margin: 1rem 0;
text-align: center;
}
.image-preview img {
max-width: 300px;
max-height: 200px;
border-radius: 8px;
border: 2px solid var(--witch-lavender);
}
.form-actions {
display: flex;
gap: 1rem;
justify-content: flex-end;
}
.loading, .empty-state {
text-align: center;
padding: 3rem;
color: var(--witch-mauve);
}
.gallery-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 2rem;
}
.art-card {
background: rgba(255, 255, 255, 0.95);
border-radius: 12px;
overflow: hidden;
box-shadow: 0 4px 12px var(--witch-shadow);
border: 2px solid var(--witch-lavender);
transition: transform 0.3s, box-shadow 0.3s;
}
.art-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 24px var(--witch-shadow);
}
.art-image-container {
width: 100%;
aspect-ratio: 1;
overflow: hidden;
cursor: pointer;
}
.art-image {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s;
}
.art-image:hover {
transform: scale(1.05);
}
.art-info {
padding: 1rem;
}
.art-info h3 {
margin: 0 0 0.5rem 0;
color: var(--witch-plum);
}
.artist {
color: var(--witch-mauve);
font-style: italic;
margin: 0 0 0.5rem 0;
}
.date-added {
font-size: 0.85rem;
color: var(--witch-mauve);
margin: 0 0 1rem 0;
}
.actions {
display: flex;
gap: 0.5rem;
margin-bottom: 1rem;
}
.btn {
padding: 0.5rem 1rem;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 0.9rem;
transition: all 0.3s;
}
.btn:hover {
opacity: 0.9;
transform: translateY(-2px);
}
.btn-primary {
background: #fdcb6e;
color: #333;
}
.btn-secondary {
background: #6b7280;
color: white;
}
.btn-danger {
background: #ef4444;
color: white;
}
.btn-sm {
padding: 0.25rem 0.75rem;
font-size: 0.85rem;
}
.btn-xs {
padding: 0.15rem 0.5rem;
font-size: 0.75rem;
}
/* Lightbox */
.lightbox {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.9);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.lightbox-content {
position: relative;
max-width: 90vw;
max-height: 90vh;
text-align: center;
}
.lightbox-content img {
max-width: 100%;
max-height: 80vh;
border-radius: 8px;
}
.lightbox-close {
position: absolute;
top: -40px;
right: 0;
background: none;
border: none;
color: white;
font-size: 2rem;
cursor: pointer;
}
.lightbox-info {
color: white;
margin-top: 1rem;
}
.lightbox-info h3 {
margin: 0;
color: white;
}
.lightbox-info p {
margin: 0.5rem 0 0 0;
opacity: 0.8;
}
/* Comments */
.comments-section {
margin-top: 1rem;
border-top: 1px solid var(--witch-lavender);
padding-top: 1rem;
}
.comments-toggle {
width: 100%;
}
.comments-container {
margin-top: 1rem;
}
.comment-form {
margin-bottom: 1rem;
}
.comment-form textarea {
width: 100%;
padding: 0.5rem;
border: 2px solid var(--witch-lavender);
border-radius: 4px;
font-size: 0.9rem;
background-color: var(--witch-moon);
color: var(--witch-purple);
resize: vertical;
margin-bottom: 0.5rem;
}
.comment-form textarea:focus {
outline: none;
border-color: var(--witch-rose);
}
.comment {
background: var(--witch-moon);
border: 1px solid var(--witch-lavender);
border-radius: 4px;
padding: 0.75rem;
margin-bottom: 0.5rem;
}
.comment-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.5rem;
flex-wrap: wrap;
}
.comment-avatar {
width: 24px;
height: 24px;
border-radius: 50%;
}
.comment-author {
font-weight: 500;
color: var(--witch-plum);
}
.discord-badge {
background: #5865f2;
color: white;
padding: 0.1rem 0.4rem;
border-radius: 3px;
font-size: 0.7rem;
font-weight: 500;
}
.vip-badge {
background: linear-gradient(135deg, #ffd700, #ffaa00);
color: #1a1a1a;
padding: 0.1rem 0.4rem;
border-radius: 3px;
font-size: 0.7rem;
font-weight: 600;
}
.mod-badge {
background: linear-gradient(135deg, #00b894, #00cec9);
color: white;
padding: 0.1rem 0.4rem;
border-radius: 3px;
font-size: 0.7rem;
font-weight: 600;
}
.staff-badge {
background: linear-gradient(135deg, #e84393, #fd79a8);
color: white;
padding: 0.1rem 0.4rem;
border-radius: 3px;
font-size: 0.7rem;
font-weight: 600;
}
.comment-date {
font-size: 0.75rem;
color: var(--witch-mauve);
}
.comment-content {
font-size: 0.9rem;
color: var(--witch-purple);
}
.comments-loading,
.no-comments {
text-align: center;
padding: 1rem;
color: var(--witch-mauve);
font-size: 0.9rem;
}
.banned-notice {
background: #fef2f2;
border: 1px solid #fecaca;
color: #991b1b;
padding: 0.75rem 1rem;
border-radius: 4px;
text-align: center;
margin-bottom: 1rem;
font-size: 0.9rem;
}
.comment-edit-form {
margin-top: 0.5rem;
}
.comment-edit-form textarea {
width: 100%;
padding: 0.5rem;
border: 2px solid var(--witch-lavender);
border-radius: 4px;
font-size: 0.9rem;
background-color: var(--witch-moon);
color: var(--witch-purple);
resize: vertical;
}
.comment-edit-form textarea:focus {
outline: none;
border-color: var(--witch-rose);
}
.comment-edit-actions {
display: flex;
gap: 0.5rem;
margin-top: 0.5rem;
}
.tags-input-container {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
padding: 0.5rem;
border: 2px solid var(--witch-lavender);
border-radius: 4px;
background: var(--witch-moon);
}
.tags-input-container input {
flex: 1;
min-width: 150px;
border: none;
padding: 0.25rem;
font-size: 0.9rem;
background: transparent;
}
.tags-input-container input:focus {
outline: none;
}
.tag {
display: inline-flex;
align-items: center;
gap: 0.25rem;
background: #fdcb6e;
color: #333;
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.85rem;
}
.tag-remove {
background: none;
border: none;
color: #333;
cursor: pointer;
padding: 0;
font-size: 1rem;
line-height: 1;
}
.tag-remove:hover {
opacity: 0.8;
}
.tags-display {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin: 0.5rem 0;
}
.tag-chip {
background: rgba(253, 203, 110, 0.2);
color: #b38f00;
padding: 0.2rem 0.5rem;
border-radius: 4px;
font-size: 0.8rem;
}
.links-list {
margin-bottom: 0.5rem;
}
.link-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5rem;
background: var(--witch-moon);
border-radius: 4px;
margin-bottom: 0.25rem;
}
.link-add-form {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.link-add-form input {
flex: 1;
min-width: 120px;
}
.links-display {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin: 0.5rem 0;
}
.external-link {
color: #b38f00;
text-decoration: none;
font-size: 0.85rem;
padding: 0.2rem 0.5rem;
background: rgba(253, 203, 110, 0.1);
border-radius: 4px;
transition: background 0.2s;
}
.external-link:hover {
background: rgba(253, 203, 110, 0.2);
text-decoration: underline;
}
`]
})
export class ArtGalleryComponent implements OnInit {
artService = inject(ArtService);
authService = inject(AuthService);
commentsService = inject(CommentsService);
sanitizeService = inject(SanitizeService);
suggestionService = inject(SuggestionService);
artPieces = signal