Chapter ${chapterNumber}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?
Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus.
`, + `Chapter ${chapterNumber}
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain.
These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted.
The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness.
No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure.
To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?
`, + `Chapter ${chapterNumber}
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.
Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus.
Omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
`, + `Chapter ${chapterNumber}
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio.
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
`, + `Chapter ${chapterNumber}
In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted.
The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness.
Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it?
But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue.
These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted.
`, + ]; + + return patterns[chapterNumber % 5]; +}; + +const mockNovels: NovelItem[] = [ + { + id: undefined, + name: 'The Great Adventure', + path: 'the-great-adventure', + cover: 'https://picsum.photos/seed/novel1/300/450', + }, + { + id: undefined, + name: 'Mystery of the Old Manor', + path: 'mystery-of-the-old-manor', + cover: 'https://picsum.photos/seed/novel2/300/450', + }, + { + id: undefined, + name: "Dragon's Quest", + path: 'dragons-quest', + cover: 'https://picsum.photos/seed/novel3/300/450', + }, + { + id: undefined, + name: 'Love in the City', + path: 'love-in-the-city', + cover: 'https://picsum.photos/seed/novel4/300/450', + }, + { + id: undefined, + name: "The Warrior's Path", + path: 'the-warriors-path', + cover: 'https://picsum.photos/seed/novel5/300/450', + }, + { + id: undefined, + name: 'Science Fiction Tales', + path: 'science-fiction-tales', + cover: 'https://picsum.photos/seed/novel6/300/450', + }, + { + id: undefined, + name: 'Fantasy World', + path: 'fantasy-world', + cover: 'https://picsum.photos/seed/novel7/300/450', + }, + { + id: undefined, + name: 'The Lost Kingdom', + path: 'the-lost-kingdom', + cover: 'https://picsum.photos/seed/novel8/300/450', + }, + { + id: undefined, + name: 'Modern Life', + path: 'modern-life', + cover: 'https://picsum.photos/seed/novel9/300/450', + }, + { + id: undefined, + name: 'Historical Drama', + path: 'historical-drama', + cover: 'https://picsum.photos/seed/novel10/300/450', + }, +]; + +const getNovelByPath = ( + path: string, +): + | { + name: string; + author: string; + summary: string; + status: NovelStatus; + cover: string; + } + | undefined => { + const novels: Record< + string, + { + name: string; + author: string; + summary: string; + status: NovelStatus; + cover: string; + } + > = { + 'the-great-adventure': { + name: 'The Great Adventure', + author: 'Dev Author', + summary: + 'An epic tale of adventure across mysterious lands. Join our hero as they traverse mountains, forests, and deserts in search of the legendary treasure. Along the way, they will face dangerous enemies, make unlikely friends, and discover secrets that will change the world.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/novel1/300/450', + }, + 'mystery-of-the-old-manor': { + name: 'Mystery of the Old Manor', + author: 'Dev Author', + summary: + 'A gripping mystery set in an old Victorian manor. When the wealthy owner dies under suspicious circumstances, it falls to the young detective to unravel the truth behind the locked rooms and family secrets.', + status: NovelStatus.Completed, + cover: 'https://picsum.photos/seed/novel2/300/450', + }, + 'dragons-quest': { + name: "Dragon's Quest", + author: 'Dev Author', + summary: + 'A young dragon rider must bond with her dragon and save the kingdom from an ancient evil. Follow her journey as she trains, fights, and grows stronger alongside her scaled companion.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/novel3/300/450', + }, + 'love-in-the-city': { + name: 'Love in the City', + author: 'Dev Author', + summary: + "Modern romance in a bustling city. Three friends navigate love, career, and friendship in this heartwarming tale of finding one's place in the world.", + status: NovelStatus.OnHiatus, + cover: 'https://picsum.photos/seed/novel4/300/450', + }, + 'the-warriors-path': { + name: "The Warrior's Path", + author: 'Dev Author', + summary: + 'A martial arts epic following a young disciple as he trains under legendary masters and competes in tournaments across ancient China. Strength, honor, and perseverance define his journey.', + status: NovelStatus.Completed, + cover: 'https://picsum.photos/seed/novel5/300/450', + }, + 'science-fiction-tales': { + name: 'Science Fiction Tales', + author: 'Dev Author', + summary: + 'A collection of interconnected stories set in a future where humanity has colonized the stars. Explore alien worlds, advanced technology, and the human condition in this visionary work.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/novel6/300/450', + }, + 'fantasy-world': { + name: 'Fantasy World', + author: 'Dev Author', + summary: + 'Magic, wizards, and epic battles await in this high fantasy adventure. When dark forces threaten the realm, a group of unlikely heroes must band together to save everything they love.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/novel7/300/450', + }, + 'the-lost-kingdom': { + name: 'The Lost Kingdom', + author: 'Dev Author', + summary: + 'Centuries ago, a mighty kingdom vanished without a trace. Now, an explorer has discovered its ruins. What secrets await in the lost kingdom?', + status: NovelStatus.PublishingFinished, + cover: 'https://picsum.photos/seed/novel8/300/450', + }, + 'modern-life': { + name: 'Modern Life', + author: 'Dev Author', + summary: + 'A slice-of-life comedy following the daily adventures of office workers in a tech startup. Hilarity ensues as they deal with bosses, deadlines, and each other.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/novel9/300/450', + }, + 'historical-drama': { + name: 'Historical Drama', + author: 'Dev Author', + summary: + 'Set in ancient times, this drama follows the political intrigue and personal struggles of nobles in a powerful dynasty. Betrayal, loyalty, and ambition clash in this epic tale.', + status: NovelStatus.Completed, + cover: 'https://picsum.photos/seed/novel10/300/450', + }, + }; + return novels[path]; +}; + +const generateChapters = ( + novelPath: string, + chapterCount: number, +): ChapterItem[] => { + const chapters: ChapterItem[] = []; + for (let i = 1; i <= chapterCount; i++) { + chapters.push({ + name: `Chapter ${i}`, + path: `${novelPath}/chapter-${i}`, + chapterNumber: i, + }); + } + return chapters; +}; + +const devNovelPlugin: Plugin = { + id: 'dev-novel', + name: 'Dev Novel', + site: 'Dev', + lang: 'English', + version: '1.0.0', + url: '', + iconUrl: 'https://picsum.photos/seed/devnovel/300/450', + imageRequestInit: { + headers: { 'User-Agent': 'Mozilla/5.0' }, + }, + pluginSettings: { + provideNewContent: { + label: 'Provide new chapters on update', + value: true, + type: 'Switch', + }, + }, + popularNovels: async (_page: number): PromiseChapter ${chapterNumber}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?
Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus.
`, + `Chapter ${chapterNumber}
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain.
These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted.
The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness.
No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure.
To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?
`, + `Chapter ${chapterNumber}
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.
Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus.
Omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
`, + `Chapter ${chapterNumber}
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio.
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
`, + `Chapter ${chapterNumber}
In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted.
The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness.
Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it?
But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue.
These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted.
`, + ]; + + return patterns[chapterNumber % 5]; +}; + +const mockPagedNovels: NovelItem[] = [ + { + id: undefined, + name: 'The Epic Saga', + path: 'the-epic-saga', + cover: 'https://picsum.photos/seed/paged1/300/450', + }, + { + id: undefined, + name: 'Tales of Tomorrow', + path: 'tales-of-tomorrow', + cover: 'https://picsum.photos/seed/paged2/300/450', + }, + { + id: undefined, + name: 'The Infinite Story', + path: 'the-infinite-story', + cover: 'https://picsum.photos/seed/paged3/300/450', + }, + { + id: undefined, + name: 'Chronicles of the Realm', + path: 'chronicles-of-the-realm', + cover: 'https://picsum.photos/seed/paged4/300/450', + }, + { + id: undefined, + name: 'Beyond the Stars', + path: 'beyond-the-stars', + cover: 'https://picsum.photos/seed/paged5/300/450', + }, + { + id: undefined, + name: 'The Forgotten Path', + path: 'the-forgotten-path', + cover: 'https://picsum.photos/seed/paged6/300/450', + }, + { + id: undefined, + name: 'Legends Rise', + path: 'legends-rise', + cover: 'https://picsum.photos/seed/paged7/300/450', + }, + { + id: undefined, + name: 'Shadows of Tomorrow', + path: 'shadows-of-tomorrow', + cover: 'https://picsum.photos/seed/paged8/300/450', + }, + { + id: undefined, + name: 'The Endless Journey', + path: 'the-endless-journey', + cover: 'https://picsum.photos/seed/paged9/300/450', + }, + { + id: undefined, + name: 'Realms of Magic', + path: 'realms-of-magic', + cover: 'https://picsum.photos/seed/paged10/300/450', + }, +]; + +const getPagedNovelByPath = ( + path: string, +): + | { + name: string; + author: string; + summary: string; + status: NovelStatus; + cover: string; + } + | undefined => { + const novels: Record< + string, + { + name: string; + author: string; + summary: string; + status: NovelStatus; + cover: string; + } + > = { + 'the-epic-saga': { + name: 'The Epic Saga', + author: 'Dev Author', + summary: + 'An epic multi-volume saga spanning generations. This paged novel demonstrates how chapters are organized across multiple pages. Each page contains several chapters, allowing for organized content delivery.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/paged1/300/450', + }, + 'tales-of-tomorrow': { + name: 'Tales of Tomorrow', + author: 'Dev Author', + summary: + 'A collection of futuristic stories. With three pages of content, this novel showcases the paged novel format, perfect for long-running series with many chapters.', + status: NovelStatus.Completed, + cover: 'https://picsum.photos/seed/paged2/300/450', + }, + 'the-infinite-story': { + name: 'The Infinite Story', + author: 'Dev Author', + summary: + 'A never-ending tale that continues forever. This paged novel is perfect for testing chapter pagination and page-based loading functionality.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/paged3/300/450', + }, + 'chronicles-of-the-realm': { + name: 'Chronicles of the Realm', + author: 'Dev Author', + summary: + 'An epic fantasy saga with multiple volumes. Each page contains several chapters, demonstrating how large series can be organized efficiently.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/paged4/300/450', + }, + 'beyond-the-stars': { + name: 'Beyond the Stars', + author: 'Dev Author', + summary: + 'A science fiction epic exploring the cosmos. With new pages added on update, this novel demonstrates dynamic pagination for growing series.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/paged5/300/450', + }, + 'the-forgotten-path': { + name: 'The Forgotten Path', + author: 'Dev Author', + summary: + 'A mystery adventure through forgotten lands. This novel showcases the paged format with chapters organized across multiple pages.', + status: NovelStatus.OnHiatus, + cover: 'https://picsum.photos/seed/paged6/300/450', + }, + 'legends-rise': { + name: 'Legends Rise', + author: 'Dev Author', + summary: + 'Heroes emerge from humble beginnings to change the world. A long-running series perfect for testing pagination and updates.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/paged7/300/450', + }, + 'shadows-of-tomorrow': { + name: 'Shadows of Tomorrow', + author: 'Dev Author', + summary: + 'A dystopian tale of a world on the brink. Multiple pages of content demonstrate how chapter pagination handles larger novels.', + status: NovelStatus.Completed, + cover: 'https://picsum.photos/seed/paged8/300/450', + }, + 'the-endless-journey': { + name: 'The Endless Journey', + author: 'Dev Author', + summary: + 'A traveler explores countless worlds in an endless adventure. This paged novel is excellent for testing dynamic page generation.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/paged9/300/450', + }, + 'realms-of-magic': { + name: 'Realms of Magic', + author: 'Dev Author', + summary: + 'Magic users battle for control of magical realms. A long series with pages that grow on update to test pagination fully.', + status: NovelStatus.Ongoing, + cover: 'https://picsum.photos/seed/paged10/300/450', + }, + }; + return novels[path]; +}; + +const DEFAULT_PAGES = 3; +const CHAPTERS_PER_PAGE = 7; + +const generateChaptersForPage = ( + novelPath: string, + page: number, +): ChapterItem[] => { + const chapters: ChapterItem[] = []; + const startChapter = (page - 1) * CHAPTERS_PER_PAGE + 1; + const endChapter = page * CHAPTERS_PER_PAGE; + + for (let i = startChapter; i <= endChapter; i++) { + chapters.push({ + name: `Chapter ${i}`, + path: `${novelPath}/chapter-${i}`, + chapterNumber: i, + page: String(page), + }); + } + return chapters; +}; + +const generateAllChapters = ( + novelPath: string, + totalPages: number, +): ChapterItem[] => { + const chapters: ChapterItem[] = []; + for (let page = 1; page <= totalPages; page++) { + chapters.push(...generateChaptersForPage(novelPath, page)); + } + return chapters; +}; + +const devPagedNovelPlugin: Plugin = { + id: 'dev-paged-novel', + name: 'Dev Paged Novel', + site: 'Dev', + lang: 'English', + version: '1.0.0', + url: '', + iconUrl: 'https://picsum.photos/seed/devpaged/300/450', + imageRequestInit: { + headers: { 'User-Agent': 'Mozilla/5.0' }, + }, + pluginSettings: { + provideNewContent: { + label: 'Provide new chapters on update', + value: true, + type: 'Switch', + }, + provideNewPages: { + label: 'Provide new pages on update', + value: false, + type: 'Switch', + }, + }, + popularNovels: async (_page: number): PromiseLorem ipsum dolor sit amet, consectetuer adipiscing +elit. Aenean commodo ligula eget dolor. Aenean massa +strong. Cum sociis natoque penatibus +et magnis dis parturient montes, nascetur ridiculus +mus. Donec quam felis, ultricies nec, pellentesque +eu, pretium quis, sem. Nulla consequat massa quis +enim. Donec pede justo, fringilla vel, aliquet nec, +vulputate eget, arcu. In enim justo, rhoncus ut, +imperdiet a, venenatis vitae, justo. Nullam dictum +felis eu pede link +mollis pretium. Integer tincidunt. Cras dapibus. +Vivamus elementum semper nisi. Aenean vulputate +eleifend tellus. Aenean leo ligula, porttitor eu, +consequat vitae, eleifend ac, enim. Aliquam lorem ante, +dapibus in, viverra quis, feugiat a, tellus. Phasellus +viverra nulla ut metus varius laoreet. Quisque rutrum. +Aenean imperdiet. Etiam ultricies nisi vel augue. +Curabitur ullamcorper ultricies nisi.
+Lorem ipsum dolor sit amet, consectetuer adipiscing +elit. Aenean commodo ligula eget dolor. Aenean massa. +Cum sociis natoque penatibus et magnis dis parturient +montes, nascetur ridiculus mus. Donec quam felis, +ultricies nec, pellentesque eu, pretium quis, sem.
+Lorem ipsum dolor sit amet, consectetuer adipiscing +elit. Aenean commodo ligula eget dolor. Aenean massa. +Cum sociis natoque penatibus et magnis dis parturient +montes, nascetur ridiculus mus. Donec quam felis, +ultricies nec, pellentesque eu, pretium quis, sem.
+Lorem ipsum dolor sit amet, consectetuer adipiscing +elit. Aenean commodo ligula eget dolor. Aenean massa. +Cum sociis natoque penatibus et magnis dis parturient +montes, nascetur ridiculus mus. Donec quam felis, +ultricies nec, pellentesque eu, pretium quis, sem.
+ +Lorem ipsum dolor sit amet, consectetuer adipiscing +elit. Aenean commodo ligula eget dolor. Aenean massa. +Cum sociis natoque penatibus et magnis dis parturient +montes, nascetur ridiculus mus. Donec quam felis, +ultricies nec, pellentesque eu, pretium quis, sem.
+| Entry Header 1 | +Entry Header 2 | +Entry Header 3 | +Entry Header 4 | +
|---|---|---|---|
| Entry First Line 1 | +Entry First Line 2 | +Entry First Line 3 | +Entry First Line 4 | +
| Entry Line 1 | +Entry Line 2 | +Entry Line 3 | +Entry Line 4 | +
| Entry Last Line 1 | +Entry Last Line 2 | +Entry Last Line 3 | +Entry Last Line 4 | +
Lorem ipsum dolor sit amet, consectetuer adipiscing +elit. Aenean commodo ligula eget dolor. Aenean massa. +Cum sociis natoque penatibus et magnis dis parturient +montes, nascetur ridiculus mus. Donec quam felis, +ultricies nec, pellentesque eu, pretium quis, sem.
+ +`; + +export const dummyText = + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean lobortis, diam sed malesuada bibendum, nulla libero scelerisque sapien, nec interdum nisl ipsum ac ipsum. In lacinia eros ut quam commodo, in finibus augue ultricies. Vestibulum ex purus, condimentum eget sem at, molestie semper mi. Mauris ac feugiat quam. Pellentesque sagittis bibendum nibh eu lacinia. Aenean rhoncus, velit sit amet mollis egestas, diam turpis ornare velit, a dictum elit velit in erat. Quisque luctus in sem a vulputate.\n\nPellentesque id tempus orci, non finibus tortor. Suspendisse in neque non eros eleifend hendrerit vitae a lacus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae;'; diff --git a/src/screens/settings/SettingsCustomCodeScreen/Modals/ReplaceItemModal.tsx b/src/screens/settings/SettingsCustomCodeScreen/Modals/ReplaceItemModal.tsx new file mode 100644 index 0000000000..695f1702f3 --- /dev/null +++ b/src/screens/settings/SettingsCustomCodeScreen/Modals/ReplaceItemModal.tsx @@ -0,0 +1,280 @@ +import { AnimatedIconButton, List } from '@components'; +import KeyboardAvoidingModal from '@components/Modal/KeyboardAvoidingModal'; +import { WINDOW_HEIGHT } from '@gorhom/bottom-sheet'; +import { useBoolean } from '@hooks/index'; +import { FlashList } from '@shopify/flash-list'; +import { LinearGradient } from 'expo-linear-gradient'; +import React, { useCallback, useEffect, useMemo, useRef } from 'react'; +import { TextInput as RNTextInput, StyleSheet } from 'react-native'; +import { TextInput } from 'react-native-paper'; +import Animated, { + FadeIn, + FadeOut, + useAnimatedStyle, + useSharedValue, + withTiming, +} from 'react-native-reanimated'; +import { + LIST_ITEM_LINE_HEIGHT, + RemoveItem, + ReplaceItem, +} from '../Components/ListItems'; +import { useChapterReaderSettings, useTheme } from '@hooks/persisted'; + +const AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient); + +type ReplaceItemModalProps = { + showReplace?: boolean; + listExpanded: boolean; + toggleList: () => void; +}; + +const ReplaceItemModal = ({ + showReplace = false, + listExpanded = false, + toggleList, +}: ReplaceItemModalProps) => { + const theme = useTheme(); + const modal = useBoolean(false); + const { + setChapterReaderSettings: setSettings, + replaceText, + removeText, + } = useChapterReaderSettings(); + const replaceArray = useMemo(() => { + return Object.entries(replaceText); + }, [replaceText]); + + const arrayLength = showReplace ? replaceArray.length : removeText.length; + + const textRef = useRef