Update category management and RSS endpoint handling
This commit is contained in:
@ -5,10 +5,11 @@ import EpisodeList from "./components/EpisodeList";
|
||||
import FeedDetail from "./components/FeedDetail";
|
||||
import FeedList from "./components/FeedList";
|
||||
import FeedManager from "./components/FeedManager";
|
||||
import RSSEndpoints from "./components/RSSEndpoints";
|
||||
|
||||
function App() {
|
||||
const location = useLocation();
|
||||
const isMainPage = ["/", "/feeds", "/categories", "/feed-requests"].includes(
|
||||
const isMainPage = ["/", "/feeds", "/categories", "/feed-requests", "/rss-endpoints"].includes(
|
||||
location.pathname,
|
||||
);
|
||||
|
||||
@ -48,6 +49,12 @@ function App() {
|
||||
>
|
||||
フィードリクエスト
|
||||
</Link>
|
||||
<Link
|
||||
to="/rss-endpoints"
|
||||
className={`tab ${location.pathname === "/rss-endpoints" ? "active" : ""}`}
|
||||
>
|
||||
RSS配信
|
||||
</Link>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
@ -58,6 +65,7 @@ function App() {
|
||||
<Route path="/feeds" element={<FeedList />} />
|
||||
<Route path="/categories" element={<CategoryList />} />
|
||||
<Route path="/feed-requests" element={<FeedManager />} />
|
||||
<Route path="/rss-endpoints" element={<RSSEndpoints />} />
|
||||
<Route path="/episode/:episodeId" element={<EpisodeDetail />} />
|
||||
<Route path="/feeds/:feedId" element={<FeedDetail />} />
|
||||
</Routes>
|
||||
|
@ -18,7 +18,6 @@ interface CategoryGroup {
|
||||
|
||||
function CategoryList() {
|
||||
const [groupedFeeds, setGroupedFeeds] = useState<CategoryGroup>({});
|
||||
const [categories, setCategories] = useState<string[]>([]);
|
||||
const [selectedCategory, setSelectedCategory] = useState<string | null>(null);
|
||||
const [filteredFeeds, setFilteredFeeds] = useState<Feed[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@ -52,10 +51,9 @@ function CategoryList() {
|
||||
}
|
||||
|
||||
const groupedData = await groupedResponse.json();
|
||||
const categoriesData = await categoriesResponse.json();
|
||||
await categoriesResponse.json();
|
||||
|
||||
setGroupedFeeds(groupedData.groupedFeeds || {});
|
||||
setCategories(categoriesData.categories || []);
|
||||
} catch (err) {
|
||||
console.error("Category fetch error:", err);
|
||||
setError(err instanceof Error ? err.message : "エラーが発生しました");
|
||||
@ -72,11 +70,6 @@ function CategoryList() {
|
||||
return groupedFeeds[category]?.length || 0;
|
||||
};
|
||||
|
||||
const getTotalEpisodesCount = (feeds: Feed[]) => {
|
||||
// This would require an additional API call to get episode counts per feed
|
||||
// For now, just return the feed count
|
||||
return feeds.length;
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
return <div className="loading">読み込み中...</div>;
|
||||
|
199
frontend/src/components/RSSEndpoints.tsx
Normal file
199
frontend/src/components/RSSEndpoints.tsx
Normal file
@ -0,0 +1,199 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
interface RSSEndpoint {
|
||||
title: string;
|
||||
url: string;
|
||||
description: string;
|
||||
feedCategory?: string;
|
||||
}
|
||||
|
||||
interface RSSEndpointsData {
|
||||
main: RSSEndpoint;
|
||||
categories: RSSEndpoint[];
|
||||
feeds: RSSEndpoint[];
|
||||
}
|
||||
|
||||
export default function RSSEndpoints() {
|
||||
const [endpoints, setEndpoints] = useState<RSSEndpointsData | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [copiedUrl, setCopiedUrl] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
fetchRSSEndpoints();
|
||||
}, []);
|
||||
|
||||
const fetchRSSEndpoints = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await fetch("/api/rss-endpoints");
|
||||
if (!response.ok) {
|
||||
throw new Error("RSS エンドポイント情報の取得に失敗しました");
|
||||
}
|
||||
const data = await response.json();
|
||||
setEndpoints(data.endpoints);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "エラーが発生しました");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const copyToClipboard = async (url: string) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(url);
|
||||
setCopiedUrl(url);
|
||||
setTimeout(() => setCopiedUrl(null), 2000);
|
||||
} catch (err) {
|
||||
console.error("クリップボードへのコピーに失敗しました:", err);
|
||||
}
|
||||
};
|
||||
|
||||
const openInNewTab = (url: string) => {
|
||||
window.open(url, "_blank");
|
||||
};
|
||||
|
||||
if (loading) return <div className="loading">読み込み中...</div>;
|
||||
if (error) return <div className="error">エラー: {error}</div>;
|
||||
if (!endpoints) return <div className="error">データが見つかりません</div>;
|
||||
|
||||
return (
|
||||
<div className="rss-endpoints">
|
||||
<div className="rss-endpoints-header">
|
||||
<h1>RSS 配信エンドポイント</h1>
|
||||
<p>以下のRSSフィードURLをポッドキャストアプリに追加して音声コンテンツをお楽しみください。</p>
|
||||
</div>
|
||||
|
||||
{/* メインフィード */}
|
||||
<section className="rss-section">
|
||||
<h2>📻 メインフィード</h2>
|
||||
<div className="rss-endpoint-card main-feed">
|
||||
<div className="endpoint-header">
|
||||
<h3>{endpoints.main.title}</h3>
|
||||
<span className="endpoint-badge main">全エピソード</span>
|
||||
</div>
|
||||
<p className="endpoint-description">{endpoints.main.description}</p>
|
||||
<div className="endpoint-url">
|
||||
<code>{endpoints.main.url}</code>
|
||||
<div className="endpoint-actions">
|
||||
<button
|
||||
onClick={() => copyToClipboard(endpoints.main.url)}
|
||||
className={`copy-btn ${copiedUrl === endpoints.main.url ? "copied" : ""}`}
|
||||
title="URLをコピー"
|
||||
>
|
||||
{copiedUrl === endpoints.main.url ? "✓" : "📋"}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => openInNewTab(endpoints.main.url)}
|
||||
className="open-btn"
|
||||
title="新しいタブで開く"
|
||||
>
|
||||
🔗
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* カテゴリ別フィード */}
|
||||
{endpoints.categories.length > 0 && (
|
||||
<section className="rss-section">
|
||||
<h2>🏷️ カテゴリ別フィード</h2>
|
||||
<div className="rss-endpoints-grid">
|
||||
{endpoints.categories.map((endpoint, index) => (
|
||||
<div key={index} className="rss-endpoint-card">
|
||||
<div className="endpoint-header">
|
||||
<h3>{endpoint.title}</h3>
|
||||
<span className="endpoint-badge category">カテゴリ</span>
|
||||
</div>
|
||||
<p className="endpoint-description">{endpoint.description}</p>
|
||||
<div className="endpoint-url">
|
||||
<code>{endpoint.url}</code>
|
||||
<div className="endpoint-actions">
|
||||
<button
|
||||
onClick={() => copyToClipboard(endpoint.url)}
|
||||
className={`copy-btn ${copiedUrl === endpoint.url ? "copied" : ""}`}
|
||||
title="URLをコピー"
|
||||
>
|
||||
{copiedUrl === endpoint.url ? "✓" : "📋"}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => openInNewTab(endpoint.url)}
|
||||
className="open-btn"
|
||||
title="新しいタブで開く"
|
||||
>
|
||||
🔗
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{/* フィード別フィード */}
|
||||
{endpoints.feeds.length > 0 && (
|
||||
<section className="rss-section">
|
||||
<h2>📡 フィード別配信</h2>
|
||||
<div className="rss-endpoints-grid">
|
||||
{endpoints.feeds.map((endpoint, index) => (
|
||||
<div key={index} className="rss-endpoint-card">
|
||||
<div className="endpoint-header">
|
||||
<h3>{endpoint.title}</h3>
|
||||
<div className="endpoint-badges">
|
||||
<span className="endpoint-badge feed">フィード</span>
|
||||
{endpoint.feedCategory && (
|
||||
<span className="endpoint-badge category-tag">
|
||||
{endpoint.feedCategory}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<p className="endpoint-description">{endpoint.description}</p>
|
||||
<div className="endpoint-url">
|
||||
<code>{endpoint.url}</code>
|
||||
<div className="endpoint-actions">
|
||||
<button
|
||||
onClick={() => copyToClipboard(endpoint.url)}
|
||||
className={`copy-btn ${copiedUrl === endpoint.url ? "copied" : ""}`}
|
||||
title="URLをコピー"
|
||||
>
|
||||
{copiedUrl === endpoint.url ? "✓" : "📋"}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => openInNewTab(endpoint.url)}
|
||||
className="open-btn"
|
||||
title="新しいタブで開く"
|
||||
>
|
||||
🔗
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{/* 使用方法の説明 */}
|
||||
<section className="rss-section usage-info">
|
||||
<h2>📱 使用方法</h2>
|
||||
<div className="usage-cards">
|
||||
<div className="usage-card">
|
||||
<h3>1. ポッドキャストアプリを選択</h3>
|
||||
<p>Apple Podcasts、Google Podcasts、Spotify、Pocket Casts など、RSS フィードに対応したポッドキャストアプリを使用してください。</p>
|
||||
</div>
|
||||
<div className="usage-card">
|
||||
<h3>2. RSS フィードを追加</h3>
|
||||
<p>上記のURLをコピーして、ポッドキャストアプリの「フィードを追加」や「URLから購読」機能を使用してください。</p>
|
||||
</div>
|
||||
<div className="usage-card">
|
||||
<h3>3. エピソードを楽しむ</h3>
|
||||
<p>フィードが追加されると、新しいエピソードが自動的にアプリに配信されます。</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -223,3 +223,301 @@ body {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* Feed management specific styles */
|
||||
.feed-manager {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.feed-section {
|
||||
margin-bottom: 2rem;
|
||||
padding: 1.5rem;
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.feed-section h2 {
|
||||
margin: 0 0 1rem 0;
|
||||
color: #495057;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* RSS Endpoints specific styles */
|
||||
.rss-endpoints {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.rss-endpoints-header {
|
||||
text-align: center;
|
||||
margin-bottom: 2rem;
|
||||
padding: 1.5rem;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.rss-endpoints-header h1 {
|
||||
margin: 0 0 0.5rem 0;
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.rss-endpoints-header p {
|
||||
margin: 0;
|
||||
opacity: 0.9;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.rss-section {
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
.rss-section h2 {
|
||||
margin: 0 0 1.5rem 0;
|
||||
color: #2c3e50;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
border-bottom: 2px solid #3498db;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.rss-endpoints-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.rss-endpoint-card {
|
||||
background: white;
|
||||
border: 1px solid #e1e8ed;
|
||||
border-radius: 12px;
|
||||
padding: 1.5rem;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
transition: all 0.2s ease;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.rss-endpoint-card:hover {
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.rss-endpoint-card.main-feed {
|
||||
grid-column: 1 / -1;
|
||||
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
||||
color: white;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.rss-endpoint-card.main-feed .endpoint-header h3 {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.rss-endpoint-card.main-feed .endpoint-description {
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.endpoint-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 1rem;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.endpoint-header h3 {
|
||||
margin: 0;
|
||||
color: #2c3e50;
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
.endpoint-badges {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.endpoint-badge {
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 20px;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.endpoint-badge.main {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.endpoint-badge.category {
|
||||
background: #e3f2fd;
|
||||
color: #1976d2;
|
||||
}
|
||||
|
||||
.endpoint-badge.feed {
|
||||
background: #f3e5f5;
|
||||
color: #7b1fa2;
|
||||
}
|
||||
|
||||
.endpoint-badge.category-tag {
|
||||
background: #e8f5e8;
|
||||
color: #2e7d32;
|
||||
}
|
||||
|
||||
.endpoint-description {
|
||||
color: #666;
|
||||
margin-bottom: 1rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.endpoint-url {
|
||||
background: #f8f9fa;
|
||||
border: 1px solid #e9ecef;
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.rss-endpoint-card.main-feed .endpoint-url {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.endpoint-url code {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #495057;
|
||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
||||
font-size: 0.9rem;
|
||||
word-break: break-all;
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
.rss-endpoint-card.main-feed .endpoint-url code {
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.endpoint-actions {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.copy-btn, .open-btn {
|
||||
background: #3498db;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 0.5rem;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
font-size: 1rem;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.copy-btn:hover, .open-btn:hover {
|
||||
background: #2980b9;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.copy-btn.copied {
|
||||
background: #27ae60;
|
||||
}
|
||||
|
||||
.rss-endpoint-card.main-feed .copy-btn,
|
||||
.rss-endpoint-card.main-feed .open-btn {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.rss-endpoint-card.main-feed .copy-btn:hover,
|
||||
.rss-endpoint-card.main-feed .open-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.rss-endpoint-card.main-feed .copy-btn.copied {
|
||||
background: rgba(39, 174, 96, 0.8);
|
||||
}
|
||||
|
||||
.usage-info {
|
||||
background: #f8f9fa;
|
||||
border-radius: 12px;
|
||||
padding: 2rem;
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
.usage-cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 1.5rem;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.usage-card {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
padding: 1.5rem;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.usage-card h3 {
|
||||
margin: 0 0 1rem 0;
|
||||
color: #2c3e50;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.usage-card p {
|
||||
margin: 0;
|
||||
color: #666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.rss-endpoints {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.rss-endpoints-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.endpoint-url {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.endpoint-url code {
|
||||
min-width: unset;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.endpoint-actions {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.usage-cards {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user