show story progress and reset last read when resetting progress.
This commit is contained in:
@@ -72,16 +72,8 @@ export default function StoryCard({
|
||||
return new Date(dateString).toLocaleDateString();
|
||||
};
|
||||
|
||||
const calculateReadingPercentage = (story: Story): number => {
|
||||
if (!story.readingPosition) return 0;
|
||||
|
||||
const totalLength = story.contentPlain?.length || story.contentHtml?.length || 0;
|
||||
if (totalLength === 0) return 0;
|
||||
|
||||
return Math.round((story.readingPosition / totalLength) * 100);
|
||||
};
|
||||
|
||||
const readingPercentage = calculateReadingPercentage(story);
|
||||
// Use the pre-calculated percentage from the backend
|
||||
const readingPercentage = story.readingProgressPercentage || 0;
|
||||
|
||||
if (viewMode === 'list') {
|
||||
return (
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface Story {
|
||||
tags: Tag[];
|
||||
tagNames?: string[] | null; // Used in search results
|
||||
readingPosition?: number;
|
||||
readingProgressPercentage?: number; // Pre-calculated percentage (0-100) from backend
|
||||
lastReadAt?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
|
||||
Reference in New Issue
Block a user