From 2c3cad528a247c771bca136466337877f76f280f Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Thu, 12 Feb 2026 21:59:55 -0800 Subject: Implement Frontend Feed List with tests --- frontend/coverage/src/components/FeedList.css.html | 226 ++++++++++++++++++++ frontend/coverage/src/components/FeedList.tsx.html | 235 +++++++++++++++++++++ frontend/coverage/src/components/Login.css.html | 2 +- frontend/coverage/src/components/Login.tsx.html | 2 +- frontend/coverage/src/components/index.html | 44 +++- 5 files changed, 500 insertions(+), 9 deletions(-) create mode 100644 frontend/coverage/src/components/FeedList.css.html create mode 100644 frontend/coverage/src/components/FeedList.tsx.html (limited to 'frontend/coverage/src/components') diff --git a/frontend/coverage/src/components/FeedList.css.html b/frontend/coverage/src/components/FeedList.css.html new file mode 100644 index 0000000..cd14b1b --- /dev/null +++ b/frontend/coverage/src/components/FeedList.css.html @@ -0,0 +1,226 @@ + + + + + + Code coverage report for src/components/FeedList.css + + + + + + + + + +
+
+

All files / src/components FeedList.css

+
+ +
+ 0% + Statements + 0/0 +
+ + +
+ 0% + Branches + 0/0 +
+ + +
+ 0% + Functions + 0/0 +
+ + +
+ 0% + Lines + 0/0 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
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  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + 
.feed-list {
+    padding: 1rem;
+    background: white;
+    border-radius: 8px;
+    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+}
+ 
+.feed-list h2 {
+    margin-top: 0;
+    border-bottom: 1px solid #eee;
+    padding-bottom: 0.5rem;
+}
+ 
+.feed-list-items {
+    list-style: none;
+    padding: 0;
+    margin: 0;
+}
+ 
+.feed-item {
+    padding: 0.75rem 0;
+    border-bottom: 1px solid #f0f0f0;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+}
+ 
+.feed-item:last-child {
+    border-bottom: none;
+}
+ 
+.feed-title {
+    text-decoration: none;
+    color: #333;
+    font-weight: 500;
+}
+ 
+.feed-title:hover {
+    color: #007bff;
+}
+ 
+.feed-category {
+    background: #e9ecef;
+    padding: 0.2rem 0.5rem;
+    border-radius: 4px;
+    font-size: 0.8rem;
+    color: #666;
+}
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/frontend/coverage/src/components/FeedList.tsx.html b/frontend/coverage/src/components/FeedList.tsx.html new file mode 100644 index 0000000..d7344a2 --- /dev/null +++ b/frontend/coverage/src/components/FeedList.tsx.html @@ -0,0 +1,235 @@ + + + + + + Code coverage report for src/components/FeedList.tsx + + + + + + + + + +
+
+

All files / src/components FeedList.tsx

+
+ +
+ 94.44% + Statements + 17/18 +
+ + +
+ 83.33% + Branches + 10/12 +
+ + +
+ 100% + Functions + 6/6 +
+ + +
+ 93.75% + Lines + 15/16 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
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  +  +  +  +  +9x +9x +9x +  +9x +5x +  +3x +  +  +3x +  +  +3x +3x +  +  +1x +1x +  +  +  +9x +4x +  +3x +  +  +  +  +  +  +  +2x +  +  +  +  +  +  +  +  +  +  +  + 
import { useEffect, useState } from 'react';
+import type { Feed } from '../types';
+import './FeedList.css';
+ 
+export default function FeedList() {
+    const [feeds, setFeeds] = useState<Feed[]>([]);
+    const [loading, setLoading] = useState(true);
+    const [error, setError] = useState('');
+ 
+    useEffect(() => {
+        fetch('/api/feed/')
+            .then((res) => {
+                Iif (!res.ok) {
+                    throw new Error('Failed to fetch feeds');
+                }
+                return res.json();
+            })
+            .then((data) => {
+                setFeeds(data);
+                setLoading(false);
+            })
+            .catch((err) => {
+                setError(err.message);
+                setLoading(false);
+            });
+    }, []);
+ 
+    if (loading) return <div className="feed-list-loading">Loading feeds...</div>;
+    if (error) return <div className="feed-list-error">Error: {error}</div>;
+ 
+    return (
+        <div className="feed-list">
+            <h2>Feeds</h2>
+            {feeds.length === 0 ? (
+                <p>No feeds found.</p>
+            ) : (
+                <ul className="feed-list-items">
+                    {feeds.map((feed) => (
+                        <li key={feed._id} className="feed-item">
+                            <a href={feed.web_url} target="_blank" rel="noopener noreferrer" className="feed-title">
+                                {feed.title || feed.url}
+                            </a>
+                            {feed.category && <span className="feed-category">{feed.category}</span>}
+                        </li>
+                    ))}
+                </ul>
+            )}
+        </div>
+    );
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/frontend/coverage/src/components/Login.css.html b/frontend/coverage/src/components/Login.css.html index 3c90f72..2fb506b 100644 --- a/frontend/coverage/src/components/Login.css.html +++ b/frontend/coverage/src/components/Login.css.html @@ -259,7 +259,7 @@ button[type="submit"]:hover {