diff --git a/src/components/BookmarkList.tsx b/src/components/BookmarkList.tsx index cd5c453e..f59538f7 100644 --- a/src/components/BookmarkList.tsx +++ b/src/components/BookmarkList.tsx @@ -13,7 +13,7 @@ import { ViewMode } from './Bookmarks' import { usePullToRefresh } from 'use-pull-to-refresh' import RefreshIndicator from './RefreshIndicator' import { BookmarkSkeleton } from './Skeletons' -import { groupIndividualBookmarks, hasContent, getBookmarkSets, getBookmarksWithoutSet } from '../utils/bookmarkUtils' +import { groupIndividualBookmarks, hasContent, getBookmarkSets, getBookmarksWithoutSet, hasCreationDate } from '../utils/bookmarkUtils' import { UserSettings } from '../services/settingsService' import AddBookmarkModal from './AddBookmarkModal' import { createWebBookmark } from '../services/webBookmarkService' @@ -100,6 +100,7 @@ export const BookmarkList: React.FC = ({ // Merge and flatten all individual bookmarks from all lists const allIndividualBookmarks = bookmarks.flatMap(b => b.individualBookmarks || []) .filter(hasContent) + .filter(b => !settings?.hideBookmarksWithoutCreationDate || hasCreationDate(b)) // Apply filter const filteredBookmarks = filterBookmarksByType(allIndividualBookmarks, selectedFilter) diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 45039dde..3e4e3e67 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -41,6 +41,7 @@ const DEFAULT_SETTINGS: UserSettings = { paragraphAlignment: 'justify', syncReadingPosition: true, autoMarkAsReadOnCompletion: false, + hideBookmarksWithoutCreationDate: false, } interface SettingsProps { diff --git a/src/components/Settings/LayoutBehaviorSettings.tsx b/src/components/Settings/LayoutBehaviorSettings.tsx index 86cf70ae..02d943b5 100644 --- a/src/components/Settings/LayoutBehaviorSettings.tsx +++ b/src/components/Settings/LayoutBehaviorSettings.tsx @@ -130,6 +130,19 @@ const LayoutBehaviorSettings: React.FC = ({ setting Automatically mark as read at 100% + +
+ +
) } diff --git a/src/services/settingsService.ts b/src/services/settingsService.ts index fb4736c3..61a2541b 100644 --- a/src/services/settingsService.ts +++ b/src/services/settingsService.ts @@ -61,6 +61,8 @@ export interface UserSettings { // Reading position sync syncReadingPosition?: boolean // default: false (opt-in) autoMarkAsReadOnCompletion?: boolean // default: false (opt-in) + // Bookmark filtering + hideBookmarksWithoutCreationDate?: boolean // default: false } export async function loadSettings( diff --git a/src/utils/bookmarkUtils.tsx b/src/utils/bookmarkUtils.tsx index dd09cfcf..dc671a14 100644 --- a/src/utils/bookmarkUtils.tsx +++ b/src/utils/bookmarkUtils.tsx @@ -118,6 +118,16 @@ export function hasContent(bookmark: IndividualBookmark): boolean { return hasValidContent || hasId } +// Check if bookmark has a real creation date (not "Now" / current time) +export function hasCreationDate(bookmark: IndividualBookmark): boolean { + if (!bookmark.created_at) return false + // If timestamp is missing or equals current time (within 1 second), consider it invalid + const now = Math.floor(Date.now() / 1000) + const createdAt = Math.floor(bookmark.created_at) + // If created_at is within 1 second of now, it's likely missing/placeholder + return Math.abs(createdAt - now) > 1 +} + // Bookmark sets helpers (kind 30003) export interface BookmarkSet { name: string