changes_3

This commit is contained in:
Mateusz Gruszczyński
2026-05-20 07:38:59 +02:00
parent 5bb32234d4
commit 7401feff63

View File

@@ -1,4 +1,5 @@
// Note: User-facing toast and modal copy is centralized here. export const messagesSource = `
const APP_MESSAGES = { const APP_MESSAGES = {
actions: { actions: {
raw_torrent: 'Add torrent', raw_torrent: 'Add torrent',
@@ -18,21 +19,21 @@ const APP_MESSAGES = {
}, },
toast: { toast: {
operationStarted: ({ action }) => `${actionLabel(action)} started`, operationStarted: ({ action }) => \`\${actionLabel(action)} started\`,
operationDone: ({ action }) => `${actionLabel(action)} done`, operationDone: ({ action }) => \`\${actionLabel(action)} done\`,
operationFailed: ({ action, error }) => operationFailed: ({ action, error }) =>
`${actionLabel(action)} failed: ${error || 'unknown error'}`, \`\${actionLabel(action)} failed: \${error || 'unknown error'}\`,
actionQueued: ({ action, parts }) => actionQueued: ({ action, parts }) =>
Number(parts || 1) > 1 Number(parts || 1) > 1
? `${actionLabel(action)} queued in ${parts} parts` ? \`\${actionLabel(action)} queued in \${parts} parts\`
: `${actionLabel(action)} queued`, : \`\${actionLabel(action)} queued\`,
moveQueued: ({ parts, physical }) => moveQueued: ({ parts, physical }) =>
Number(parts || 1) > 1 Number(parts || 1) > 1
? `Move queued in ${parts} parts` ? \`Move queued in \${parts} parts\`
: physical : physical
? 'Physical move queued' ? 'Physical move queued'
: 'Move queued', : 'Move queued',
@@ -40,7 +41,7 @@ const APP_MESSAGES = {
addQueued: () => 'Torrent add queued', addQueued: () => 'Torrent add queued',
addQueuedSkipped: ({ count }) => addQueuedSkipped: ({ count }) =>
`Torrent add queued, skipped ${count} duplicate torrent(s)`, \`Torrent add queued, skipped \${count} duplicate torrent(s)\`,
addTooLarge: () => addTooLarge: () =>
'One or more .torrent files exceed the current rTorrent XML-RPC upload limit. Open rTorrent config and set network.xmlrpc.size_limit to e.g. 16M.', 'One or more .torrent files exceed the current rTorrent XML-RPC upload limit. Open rTorrent config and set network.xmlrpc.size_limit to e.g. 16M.',
@@ -48,12 +49,12 @@ const APP_MESSAGES = {
dropOnlyTorrents: () => 'Drop .torrent files only', dropOnlyTorrents: () => 'Drop .torrent files only',
droppedAddedSkipped: ({ queued, skipped }) => droppedAddedSkipped: ({ queued, skipped }) =>
`Added ${queued} torrent(s), skipped ${skipped} duplicate(s)`, \`Added \${queued} torrent(s), skipped \${skipped} duplicate(s)\`,
droppedAdded: ({ queued }) => `Added ${queued} torrent(s)`, droppedAdded: ({ queued }) => \`Added \${queued} torrent(s)\`,
droppedSkipped: ({ skipped }) => droppedSkipped: ({ skipped }) =>
`Skipped ${skipped} duplicate torrent(s)`, \`Skipped \${skipped} duplicate torrent(s)\`,
droppedNone: () => 'No torrents were added', droppedNone: () => 'No torrents were added',
@@ -65,9 +66,9 @@ const APP_MESSAGES = {
downloadStarted: () => 'Download started', downloadStarted: () => 'Download started',
chunkActionDone: ({ action }) => `${actionLabel(action)} done`, chunkActionDone: ({ action }) => \`\${actionLabel(action)} done\`,
trackerActionDone: ({ action }) => `${actionLabel(action)} done`, trackerActionDone: ({ action }) => \`\${actionLabel(action)} done\`,
pathPickerUnavailable: () => 'Path picker is unavailable', pathPickerUnavailable: () => 'Path picker is unavailable',
@@ -78,56 +79,48 @@ const APP_MESSAGES = {
recommendedColumnsApplied: () => 'Recommended columns applied', recommendedColumnsApplied: () => 'Recommended columns applied',
jobLogsCleared: ({ deleted }) => jobLogsCleared: ({ deleted }) =>
`Cleared ${deleted || 0} finished job log(s)`, \`Cleared \${deleted || 0} finished job log(s)\`,
emergencyJobLogsCleared: ({ deleted }) => emergencyJobLogsCleared: ({ deleted }) =>
`Emergency cleanup removed ${deleted || 0} job log(s)`, \`Emergency cleanup removed \${deleted || 0} job log(s)\`,
rtorrentConfigSaved: ({ updated }) => rtorrentConfigSaved: ({ updated }) =>
`rTorrent config saved (${updated || 0})`, \`rTorrent config saved (\${updated || 0})\`,
rtorrentConfigReset: ({ removed }) => rtorrentConfigReset: ({ removed }) =>
`rTorrent config reset (${removed || 0} override(s) removed)`, \`rTorrent config reset (\${removed || 0} override(s) removed)\`,
automationLogsDeleted: ({ deleted }) => automationLogsDeleted: ({ deleted }) =>
`Automation logs deleted: ${deleted || 0}`, \`Automation logs deleted: \${deleted || 0}\`,
cleanupDone: ({ deleted }) => `Cleanup done (${deleted})`, cleanupDone: ({ deleted }) => \`Cleanup done (\${deleted})\`,
plannerApplied: ({ dryRun, paused, resumed, limitsChanged }) => plannerApplied: ({ dryRun, paused, resumed, limitsChanged }) =>
`${dryRun ? 'Planner dry-run' : 'Planner applied'}: paused ${ \`\${dryRun ? 'Planner dry-run' : 'Planner applied'}: paused \${paused || 0}, resumed \${resumed || 0}, limits \${limitsChanged ? 'changed' : 'unchanged'}\`,
paused || 0
}, resumed ${resumed || 0}, limits ${
limitsChanged ? 'changed' : 'unchanged'
}`,
rssQueued: ({ queued }) => `RSS queued ${queued || 0} item(s)`, rssQueued: ({ queued }) => \`RSS queued \${queued || 0} item(s)\`,
smartQueueCheckQueued: () => smartQueueCheckQueued: () =>
'Smart Queue check queued. It will continue in the background.', 'Smart Queue check queued. It will continue in the background.',
automationForceRunDone: ({ count }) => automationForceRunDone: ({ count }) =>
`Automation force run done (${count || 0} torrent item(s))`, \`Automation force run done (\${count || 0} torrent item(s))\`,
automationsApplied: ({ count, batches }) => automationsApplied: ({ count, batches }) =>
batches batches
? `Automations applied ${count || 0} torrent(s) in ${ ? \`Automations applied \${count || 0} torrent(s) in \${batches || 0} batch(es)\`
batches || 0 : \`Automations applied \${count || 0} item(s)\`,
} batch(es)`
: `Automations applied ${count || 0} item(s)`,
torrentStatsError: ({ error }) => `Torrent stats: ${error}`, torrentStatsError: ({ error }) => \`Torrent stats: \${error}\`,
startupConfigApplied: ({ count }) => startupConfigApplied: ({ count }) =>
`Startup rTorrent config applied (${count || 0})`, \`Startup rTorrent config applied (\${count || 0})\`,
startupConfigFailed: ({ error }) => startupConfigFailed: ({ error }) =>
`Startup rTorrent config: ${error}`, \`Startup rTorrent config: \${error}\`,
plannerSocketResult: ({ paused, resumed, dryRun }) => plannerSocketResult: ({ paused, resumed, dryRun }) =>
`Planner: paused ${paused || 0}, resumed ${resumed || 0}${ \`Planner: paused \${paused || 0}, resumed \${resumed || 0}\${dryRun ? ' dry-run' : ''}\`
dryRun ? ' dry-run' : ''
}`
} }
}; };
@@ -139,7 +132,7 @@ function actionLabel(action) {
} }
return key return key
? key.replace(/[_-]+/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase()) ? key.replace(/[_-]+/g, ' ').replace(/\\b\\w/g, (c) => c.toUpperCase())
: 'Operation'; : 'Operation';
} }
@@ -154,3 +147,4 @@ function appMessage(key, params = {}) {
function toastMessage(key, type = 'secondary', params = {}) { function toastMessage(key, type = 'secondary', params = {}) {
toast(appMessage(key, params), type); toast(appMessage(key, params), type);
} }
`;