2024-10-05 19:15:25 +02:00
/ *
* Copyright ( C ) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License , v . 2.0 . If a copy of the MPL was not distributed with this
* file , You can obtain one at https : //mozilla.org/MPL/2.0/.
* /
2026-03-11 00:11:29 +01:00
import type { MessageDescriptor } from '@lingui/core' ;
2026-01-10 19:45:02 +01:00
import { msg } from '@lingui/core/macro' ;
2026-03-11 00:11:29 +01:00
import type { ChapterAction , ChapterListOptions , ChapterSortMode } from '@/features/chapter/Chapter.types.ts' ;
2024-10-05 19:15:25 +02:00
2025-11-29 15:26:57 +01:00
export const FALLBACK_CHAPTER = { id : - 1 , name : '' , realUrl : '' , isDownloaded : false , isBookmarked : false } ;
2025-02-17 03:51:07 +01:00
2024-10-05 19:15:25 +02:00
export const DEFAULT_CHAPTER_OPTIONS : ChapterListOptions = {
unread : undefined ,
downloaded : undefined ,
bookmarked : undefined ,
reverse : true ,
sortBy : 'source' ,
showChapterNumber : false ,
2025-06-09 15:32:04 +02:00
excludedScanlators : [ ] ,
2024-10-05 19:15:25 +02:00
} ;
2026-01-10 19:45:02 +01:00
export const CHAPTER_SORT_OPTIONS_TO_TRANSLATION : Record < ChapterSortMode , MessageDescriptor > = {
source : msg ` By source ` ,
chapterNumber : msg ` By chapter number ` ,
uploadedAt : msg ` By upload date ` ,
fetchedAt : msg ` By date fetched ` ,
2024-10-05 19:15:25 +02:00
} ;
2025-05-05 01:52:51 +02:00
2025-06-28 02:25:49 +02:00
export const CHAPTER_ACTION_TO_CONFIRMATION_REQUIRED : Record <
ChapterAction ,
{ always : boolean ; bulkAction : boolean ; bulkActionCountForce? : number }
> = {
download : { always : false , bulkAction : false , bulkActionCountForce : 300 } ,
delete : { always : true , bulkAction : true } ,
bookmark : { always : false , bulkAction : false } ,
unbookmark : { always : false , bulkAction : true } ,
mark_as_read : { always : false , bulkAction : true } ,
mark_as_unread : { always : false , bulkAction : true } ,
} ;
2025-05-05 01:52:51 +02:00
export const CHAPTER_ACTION_TO_TRANSLATION : {
[ key in ChapterAction ] : {
action : {
2026-01-10 19:45:02 +01:00
single : MessageDescriptor ;
selected : MessageDescriptor ;
2025-05-05 01:52:51 +02:00
} ;
2026-01-10 19:45:02 +01:00
confirmation? : MessageDescriptor ;
success : MessageDescriptor ;
error : MessageDescriptor ;
2025-05-05 01:52:51 +02:00
} ;
} = {
download : {
action : {
2026-01-10 19:45:02 +01:00
single : msg ` Download ` ,
selected : msg ` Download selected ` ,
2025-05-05 01:52:51 +02:00
} ,
2026-01-10 19:45:02 +01:00
confirmation : msg ` {count, plural, one {You are about to download one chapter} other {You are about to download # chapters. \ nSuwayomi is not a mass downloader and too many downloads can get you banned from sources and/or cause performance issues.}} ` ,
success : msg ` {count, plural, one {Download added} other {# downloads added}} ` ,
error : msg ` {count, plural, one {Could not add the download} other {Could not add downloads}} ` ,
2025-05-05 01:52:51 +02:00
} ,
delete : {
action : {
2026-01-10 19:45:02 +01:00
single : msg ` Delete ` ,
selected : msg ` Delete selected ` ,
2025-05-05 01:52:51 +02:00
} ,
2026-01-10 19:45:02 +01:00
confirmation : msg ` {count, plural, one {You are about to delete one download} other {You are about to delete # downloads}} ` ,
success : msg ` {count, plural, one {Chapter deleted} other {# chapters deleted}} ` ,
error : msg ` {count, plural, one {Could not delete the chapter} other {Could not delete chapters}} ` ,
2025-05-05 01:52:51 +02:00
} ,
bookmark : {
action : {
2026-01-10 19:45:02 +01:00
single : msg ` Add bookmark ` ,
selected : msg ` Bookmark selected ` ,
2025-05-05 01:52:51 +02:00
} ,
2026-01-10 19:45:02 +01:00
success : msg ` {count, plural, one {Chapter bookmarked} other {# chapters bookmarked}} ` ,
error : msg ` {count, plural, one {Could not bookmark the chapter} other {Could not bookmark chapters}} ` ,
2025-05-05 01:52:51 +02:00
} ,
unbookmark : {
action : {
2026-01-10 19:45:02 +01:00
single : msg ` Remove bookmark ` ,
selected : msg ` Remove bookmarks from selected ` ,
2025-05-05 01:52:51 +02:00
} ,
2026-01-10 19:45:02 +01:00
confirmation : msg ` {count, plural, one {You are about to remove one bookmark} other {You are about to remove # bookmarks}} ` ,
success : msg ` {count, plural, one {Chapter bookmark removed} other {# chapter bookmarks removed}} ` ,
error : msg ` {count, plural, one {Could not remove the bookmark} other {Could not remove the bookmarks}} ` ,
2025-05-05 01:52:51 +02:00
} ,
mark_as_read : {
action : {
2026-01-10 19:45:02 +01:00
single : msg ` Mark as read ` ,
selected : msg ` Mark selected as read ` ,
2025-05-05 01:52:51 +02:00
} ,
2026-01-10 19:45:02 +01:00
confirmation : msg ` {count, plural, one {You are about to mark one chapter as read} other {You are about to mark # chapters as read}} ` ,
success : msg ` {count, plural, one {Chapter marked as read} other {# chapters marked as read}} ` ,
error : msg ` {count, plural, one {Could not mark the chapter as read} other {Could not mark chapters as read}} ` ,
2025-05-05 01:52:51 +02:00
} ,
mark_as_unread : {
action : {
2026-01-10 19:45:02 +01:00
single : msg ` Mark as unread ` ,
selected : msg ` Mark selected as unread ` ,
2025-05-05 01:52:51 +02:00
} ,
2026-01-10 19:45:02 +01:00
confirmation : msg ` {count, plural, one {You are about to mark one chapter as unread} other {You are about to mark # chapters as unread}} ` ,
success : msg ` {count, plural, one {Chapter marked as unread} other {# chapters marked as unread}} ` ,
error : msg ` {count, plural, one {Could not mark the chapter as unread} other {Could not mark chapters as unread}} ` ,
2025-05-05 01:52:51 +02:00
} ,
} ;