mirror of
https://github.com/dergigi/boris.git
synced 2026-02-23 16:04:29 +01:00
fix: resolve all linter errors and type issues
- Remove unused state variables (readsMap, linksMap) by using only setters - Move VALID_FILTERS constant outside component to fix exhaustive-deps warning - Remove unused isReading variable in ReadingProgressIndicator - Remove unused extractUrlFromBookmark function and IndividualBookmark import - Fix type errors in linksFromBookmarks by extracting metadata from tags instead of non-existent properties
This commit is contained in:
@@ -41,6 +41,9 @@ interface MeProps {
|
||||
|
||||
type TabType = 'highlights' | 'reading-list' | 'reads' | 'links' | 'writings'
|
||||
|
||||
// Valid reading progress filters
|
||||
const VALID_FILTERS: ReadingProgressFilterType[] = ['all', 'unopened', 'started', 'reading', 'completed']
|
||||
|
||||
const Me: React.FC<MeProps> = ({ relayPool, activeTab: propActiveTab, pubkey: propPubkey }) => {
|
||||
const activeAccount = Hooks.useActiveAccount()
|
||||
const navigate = useNavigate()
|
||||
@@ -53,9 +56,9 @@ const Me: React.FC<MeProps> = ({ relayPool, activeTab: propActiveTab, pubkey: pr
|
||||
const [highlights, setHighlights] = useState<Highlight[]>([])
|
||||
const [bookmarks, setBookmarks] = useState<Bookmark[]>([])
|
||||
const [reads, setReads] = useState<ReadItem[]>([])
|
||||
const [readsMap, setReadsMap] = useState<Map<string, ReadItem>>(new Map())
|
||||
const [, setReadsMap] = useState<Map<string, ReadItem>>(new Map())
|
||||
const [links, setLinks] = useState<ReadItem[]>([])
|
||||
const [linksMap, setLinksMap] = useState<Map<string, ReadItem>>(new Map())
|
||||
const [, setLinksMap] = useState<Map<string, ReadItem>>(new Map())
|
||||
const [writings, setWritings] = useState<BlogPostPreview[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [loadedTabs, setLoadedTabs] = useState<Set<TabType>>(new Set())
|
||||
@@ -64,8 +67,7 @@ const Me: React.FC<MeProps> = ({ relayPool, activeTab: propActiveTab, pubkey: pr
|
||||
const [bookmarkFilter, setBookmarkFilter] = useState<BookmarkFilterType>('all')
|
||||
|
||||
// Initialize reading progress filter from URL param
|
||||
const validFilters: ReadingProgressFilterType[] = ['all', 'unopened', 'started', 'reading', 'completed']
|
||||
const initialFilter = urlFilter && validFilters.includes(urlFilter as ReadingProgressFilterType)
|
||||
const initialFilter = urlFilter && VALID_FILTERS.includes(urlFilter as ReadingProgressFilterType)
|
||||
? (urlFilter as ReadingProgressFilterType)
|
||||
: 'all'
|
||||
const [readingProgressFilter, setReadingProgressFilter] = useState<ReadingProgressFilterType>(initialFilter)
|
||||
@@ -79,7 +81,7 @@ const Me: React.FC<MeProps> = ({ relayPool, activeTab: propActiveTab, pubkey: pr
|
||||
|
||||
// Sync filter state with URL changes
|
||||
useEffect(() => {
|
||||
const filterFromUrl = urlFilter && validFilters.includes(urlFilter as ReadingProgressFilterType)
|
||||
const filterFromUrl = urlFilter && VALID_FILTERS.includes(urlFilter as ReadingProgressFilterType)
|
||||
? (urlFilter as ReadingProgressFilterType)
|
||||
: 'all'
|
||||
setReadingProgressFilter(filterFromUrl)
|
||||
|
||||
@@ -22,7 +22,6 @@ export const ReadingProgressIndicator: React.FC<ReadingProgressIndicatorProps> =
|
||||
// Determine reading state based on progress (matching readingProgressUtils.ts logic)
|
||||
const progressDecimal = clampedProgress / 100
|
||||
const isStarted = progressDecimal > 0 && progressDecimal <= 0.10
|
||||
const isReading = progressDecimal > 0.10 && progressDecimal <= 0.94
|
||||
|
||||
// Determine bar color based on state
|
||||
let barColorClass = ''
|
||||
|
||||
Reference in New Issue
Block a user