feat: remove AI thumbnails, rewrite frontend with React (v1.3.0)
Remove all AI thumbnail generation infrastructure (too expensive, poor results) and rewrite the public-facing article feed as a React SPA mounted via WordPress shortcode. Changes: - Remove thumbnail generation, OG scraping, and image download code from fetcher, LLM, and admin classes - Replace server-rendered PHP templates with React component (PeptideNewsFeed.jsx) using WordPress-bundled React/ReactDOM - Add Babel build pipeline for JSX transpilation - Update REST API to serve ai_summary instead of thumbnail fields - Redesign public CSS: clean card layout, loading skeletons, dark mode, responsive, no thumbnail imagery - Remove dead admin settings (llm_image_model, thumbnail_fallback) - Fix call_openrouter() visibility for Content Filter cross-class use - Bump version to 1.3.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,114 +1,79 @@
|
||||
/**
|
||||
* Peptide News Aggregator – Public Styles
|
||||
* Peptide News Feed — Public Styles
|
||||
*
|
||||
* Styles for the front-end display of peptide news articles.
|
||||
* Clean, modern news feed layout without thumbnails.
|
||||
* Focuses on readability and content hierarchy.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @since 1.2.2 Rewritten for list layout with thumbnail left / text right.
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
||||
/* ── Feed container ────────────────────────────────────────────── */
|
||||
.pn-news-feed {
|
||||
max-width: 760px;
|
||||
margin: 0 auto;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
||||
Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
||||
color: #1a1a2e;
|
||||
line-height: 1.6;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* ── Articles list ─────────────────────────────────────────────── */
|
||||
.pn-articles-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
||||
}
|
||||
|
||||
.pn-no-articles p {
|
||||
text-align: center;
|
||||
color: #666;
|
||||
padding: 2rem 1rem;
|
||||
font-size: 0.9375rem;
|
||||
}
|
||||
|
||||
/* ── Individual article row ────────────────────────────────────── */
|
||||
/* ── Individual article ────────────────────────────────────────── */
|
||||
.pn-article {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
gap: 1.25rem;
|
||||
padding: 1.25rem 0;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
padding: 1.5rem 0;
|
||||
border-bottom: 1px solid #e8eaed;
|
||||
transition: background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.pn-article:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.pn-article:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.pn-article:hover {
|
||||
background-color: #fafbfc;
|
||||
}
|
||||
|
||||
/* ── Thumbnail (left column, fixed width) ──────────────────────── */
|
||||
.pn-article-thumb {
|
||||
flex: 0 0 160px;
|
||||
width: 160px;
|
||||
min-height: 100px;
|
||||
overflow: hidden;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.pn-article-thumb a {
|
||||
display: block;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.pn-article-thumb img {
|
||||
width: 100%;
|
||||
height: 110px;
|
||||
object-fit: cover;
|
||||
border-radius: 6px;
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.pn-article:hover .pn-article-thumb img {
|
||||
transform: scale(1.03);
|
||||
}
|
||||
|
||||
/* ── Content (right column, flexible) ──────────────────────────── */
|
||||
.pn-article-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* ── Meta line (source · date) ─────────────────────────────────── */
|
||||
.pn-article-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
font-size: 0.8rem;
|
||||
color: #777;
|
||||
margin-bottom: 0.35rem;
|
||||
margin-bottom: 0.375rem;
|
||||
font-size: 0.8125rem;
|
||||
color: #6b7280;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.pn-source {
|
||||
font-weight: 600;
|
||||
color: #555;
|
||||
color: #4b5563;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.025em;
|
||||
font-size: 0.7rem;
|
||||
letter-spacing: 0.03em;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.pn-separator {
|
||||
color: #ccc;
|
||||
color: #d1d5db;
|
||||
}
|
||||
|
||||
.pn-date {
|
||||
color: #888;
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
/* ── Title ─────────────────────────────────────────────────────── */
|
||||
.pn-article-title {
|
||||
font-size: 1.05rem;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
margin: 0 0 0.4rem;
|
||||
color: #1a1a2e;
|
||||
margin: 0 0 0.5rem;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.pn-article-title a {
|
||||
@@ -118,23 +83,23 @@
|
||||
}
|
||||
|
||||
.pn-article-title a:hover {
|
||||
color: #0073aa;
|
||||
color: #2563eb;
|
||||
}
|
||||
|
||||
.pn-article-title a:focus,
|
||||
.pn-article-thumb a:focus {
|
||||
outline: 2px solid #0073aa;
|
||||
.pn-article-title a:focus-visible {
|
||||
outline: 2px solid #2563eb;
|
||||
outline-offset: 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* ── Excerpt / AI summary ──────────────────────────────────────── */
|
||||
.pn-article-excerpt {
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.6;
|
||||
color: #555;
|
||||
margin: 0 0 0.5rem;
|
||||
font-size: 0.9375rem;
|
||||
line-height: 1.65;
|
||||
color: #4b5563;
|
||||
margin: 0 0 0.625rem;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -142,9 +107,9 @@
|
||||
/* ── Author ────────────────────────────────────────────────────── */
|
||||
.pn-author {
|
||||
display: inline-block;
|
||||
font-size: 0.775rem;
|
||||
color: #888;
|
||||
margin-bottom: 0.35rem;
|
||||
font-size: 0.8125rem;
|
||||
color: #9ca3af;
|
||||
margin-bottom: 0.375rem;
|
||||
}
|
||||
|
||||
.pn-author::before {
|
||||
@@ -156,60 +121,266 @@
|
||||
.pn-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem;
|
||||
margin-top: 0.25rem;
|
||||
gap: 0.375rem;
|
||||
margin-top: 0.375rem;
|
||||
}
|
||||
|
||||
.pn-tag {
|
||||
display: inline-block;
|
||||
font-size: 0.7rem;
|
||||
background: #f0f4f8;
|
||||
color: #4a6fa5;
|
||||
padding: 0.15rem 0.55rem;
|
||||
border-radius: 12px;
|
||||
font-size: 0.6875rem;
|
||||
background: #eff6ff;
|
||||
color: #1d4ed8;
|
||||
padding: 0.1875rem 0.625rem;
|
||||
border-radius: 100px;
|
||||
line-height: 1.5;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
/* ── Compact layout override (for widgets) ─────────────────────── */
|
||||
.pn-layout-compact .pn-article {
|
||||
gap: 0.85rem;
|
||||
padding: 0.75rem 0;
|
||||
/* ── Loading skeleton ──────────────────────────────────────────── */
|
||||
.pn-loading {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.pn-layout-compact .pn-article-thumb {
|
||||
flex: 0 0 80px;
|
||||
width: 80px;
|
||||
min-height: 56px;
|
||||
.pn-skeleton-card {
|
||||
padding: 1.5rem 0;
|
||||
border-bottom: 1px solid #e8eaed;
|
||||
}
|
||||
|
||||
.pn-layout-compact .pn-article-thumb img {
|
||||
height: 56px;
|
||||
.pn-skeleton-card:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.pn-layout-compact .pn-article-title {
|
||||
font-size: 0.9rem;
|
||||
.pn-skeleton-line {
|
||||
background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: pn-shimmer 1.5s ease-in-out infinite;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.pn-layout-compact .pn-article-excerpt,
|
||||
.pn-layout-compact .pn-author,
|
||||
.pn-layout-compact .pn-tags {
|
||||
display: none;
|
||||
.pn-skeleton-meta {
|
||||
width: 140px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
/* ── Responsive: stack on small screens ────────────────────────── */
|
||||
.pn-skeleton-title {
|
||||
width: 85%;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.pn-skeleton-excerpt {
|
||||
width: 100%;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.pn-skeleton-excerpt-short {
|
||||
width: 60%;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.pn-skeleton-tags {
|
||||
display: flex;
|
||||
gap: 0.375rem;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.pn-skeleton-tag {
|
||||
width: 64px;
|
||||
height: 22px;
|
||||
border-radius: 100px;
|
||||
background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: pn-shimmer 1.5s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes pn-shimmer {
|
||||
0% { background-position: 200% 0; }
|
||||
100% { background-position: -200% 0; }
|
||||
}
|
||||
|
||||
/* ── Error state ───────────────────────────────────────────────── */
|
||||
.pn-error {
|
||||
text-align: center;
|
||||
padding: 2.5rem 1rem;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.pn-error p {
|
||||
font-size: 0.9375rem;
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
.pn-retry-btn {
|
||||
display: inline-block;
|
||||
padding: 0.5rem 1.25rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: #2563eb;
|
||||
background: #eff6ff;
|
||||
border: 1px solid #bfdbfe;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.pn-retry-btn:hover {
|
||||
background: #dbeafe;
|
||||
border-color: #93c5fd;
|
||||
}
|
||||
|
||||
.pn-retry-btn:focus-visible {
|
||||
outline: 2px solid #2563eb;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* ── Empty state ───────────────────────────────────────────────── */
|
||||
.pn-empty {
|
||||
text-align: center;
|
||||
padding: 2.5rem 1rem;
|
||||
}
|
||||
|
||||
.pn-empty p {
|
||||
font-size: 0.9375rem;
|
||||
color: #6b7280;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ── Pagination ────────────────────────────────────────────────── */
|
||||
.pn-pagination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 1rem;
|
||||
padding: 1.5rem 0 0.5rem;
|
||||
margin-top: 0.5rem;
|
||||
border-top: 1px solid #e8eaed;
|
||||
}
|
||||
|
||||
.pn-page-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0.5rem 1rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: #374151;
|
||||
background: #fff;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.pn-page-btn:hover:not(:disabled) {
|
||||
background: #f9fafb;
|
||||
border-color: #9ca3af;
|
||||
}
|
||||
|
||||
.pn-page-btn:disabled {
|
||||
color: #d1d5db;
|
||||
border-color: #e5e7eb;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.pn-page-btn:focus-visible {
|
||||
outline: 2px solid #2563eb;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.pn-page-info {
|
||||
font-size: 0.8125rem;
|
||||
color: #6b7280;
|
||||
min-width: 100px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* ── Responsive ────────────────────────────────────────────────── */
|
||||
@media (max-width: 600px) {
|
||||
.pn-article {
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
.pn-article-title {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.pn-article-thumb {
|
||||
flex: none;
|
||||
width: 100%;
|
||||
.pn-article-excerpt {
|
||||
font-size: 0.875rem;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.pn-article-thumb img {
|
||||
height: 180px;
|
||||
.pn-pagination {
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.pn-page-btn {
|
||||
padding: 0.375rem 0.75rem;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Dark mode support via prefers-color-scheme ────────────────── */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.pn-news-feed {
|
||||
color: #e5e7eb;
|
||||
}
|
||||
|
||||
.pn-article {
|
||||
border-bottom-color: #374151;
|
||||
}
|
||||
|
||||
.pn-article-title {
|
||||
color: #f3f4f6;
|
||||
}
|
||||
|
||||
.pn-article-title a:hover {
|
||||
color: #60a5fa;
|
||||
}
|
||||
|
||||
.pn-source {
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
.pn-article-excerpt {
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
.pn-tag {
|
||||
background: #1e3a5f;
|
||||
color: #93c5fd;
|
||||
}
|
||||
|
||||
.pn-skeleton-line,
|
||||
.pn-skeleton-tag {
|
||||
background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
|
||||
background-size: 200% 100%;
|
||||
}
|
||||
|
||||
.pn-page-btn {
|
||||
color: #e5e7eb;
|
||||
background: #1f2937;
|
||||
border-color: #4b5563;
|
||||
}
|
||||
|
||||
.pn-page-btn:hover:not(:disabled) {
|
||||
background: #374151;
|
||||
}
|
||||
|
||||
.pn-page-btn:disabled {
|
||||
color: #4b5563;
|
||||
border-color: #374151;
|
||||
}
|
||||
|
||||
.pn-retry-btn {
|
||||
color: #60a5fa;
|
||||
background: #1e3a5f;
|
||||
border-color: #1d4ed8;
|
||||
}
|
||||
|
||||
.pn-pagination {
|
||||
border-top-color: #374151;
|
||||
}
|
||||
|
||||
.pn-skeleton-card {
|
||||
border-bottom-color: #374151;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user