From 93903eedf9af97d316d956d14fdf8898a2deeed1 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 2 Jan 2026 23:51:23 +0000 Subject: [PATCH] feat: Move "Small websites" filter to settings dialog Co-authored-by: aider (gemini/gemini-2.5-pro) --- webclient/src/App.js | 16 +++++++++++++++- webclient/src/Feed.js | 24 ++++++++++-------------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/webclient/src/App.js b/webclient/src/App.js index d134436..a62369b 100644 --- a/webclient/src/App.js +++ b/webclient/src/App.js @@ -25,6 +25,7 @@ function App() { const [bodyFontSize, setBodyFontSize] = useState(Number(localStorage.getItem('bodyFontSize')) || defaultBodyFontSize); const [bodyFont, setBodyFont] = useState(localStorage.getItem('bodyFont') || 'Sans Serif'); const [articleFont, setArticleFont] = useState(localStorage.getItem('articleFont') || 'Apparatus SIL'); + const [filterSmallweb, setFilterSmallweb] = useState(() => localStorage.getItem('filterSmallweb') === 'true'); const updateCache = useCallback((key, value) => { cache.current[key] = value; @@ -50,6 +51,12 @@ function App() { localStorage.setItem('theme', 'red'); }; + const handleFilterChange = e => { + const isChecked = e.target.checked; + setFilterSmallweb(isChecked); + localStorage.setItem('filterSmallweb', isChecked); + }; + const changeBodyFont = (font) => { setBodyFont(font); localStorage.setItem('bodyFont', font); @@ -164,6 +171,13 @@ function App() { +
+

Feed

+
+ + +
+

Font Size

@@ -237,7 +251,7 @@ function App() {
- } /> + } />
} /> diff --git a/webclient/src/Feed.js b/webclient/src/Feed.js index 1d42cdf..6e5d76c 100644 --- a/webclient/src/Feed.js +++ b/webclient/src/Feed.js @@ -1,21 +1,22 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import { Link } from 'react-router-dom'; import { Helmet } from 'react-helmet'; import localForage from 'localforage'; import { sourceLink, infoLine, logos } from './utils.js'; -function Feed({ updateCache }) { +function Feed({ updateCache, filterSmallweb }) { const [stories, setStories] = useState(() => JSON.parse(localStorage.getItem('stories')) || false); const [error, setError] = useState(''); const [loadingStatus, setLoadingStatus] = useState(null); - const [filterSmallweb, setFilterSmallweb] = useState(() => localStorage.getItem('filterSmallweb') === 'true'); + const isInitialMount = useRef(true); - const handleFilterChange = e => { - const isChecked = e.target.checked; - setStories(false); - setFilterSmallweb(isChecked); - localStorage.setItem('filterSmallweb', isChecked); - }; + useEffect(() => { + if (isInitialMount.current) { + isInitialMount.current = false; + } else { + setStories(false); + } + }, [filterSmallweb]); useEffect(() => { const controller = new AbortController(); @@ -125,11 +126,6 @@ function Feed({ updateCache }) { -
- - -
- {error &&
Connection error? Click to expand.