feat: Move "Small websites" filter to settings dialog

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-01-02 23:51:23 +00:00
parent e0f523cc1c
commit 93903eedf9
2 changed files with 25 additions and 15 deletions
+10 -14
View File
@@ -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 }) {
<meta name="robots" content="index" />
</Helmet>
<div style={{marginBottom: '1rem'}}>
<input type="checkbox" id="filter-smallweb" className="checkbox" checked={filterSmallweb} onChange={handleFilterChange} />
<label htmlFor="filter-smallweb">Small websites</label>
</div>
{error &&
<details style={{marginBottom: '1rem'}}>
<summary>Connection error? Click to expand.</summary>