From 551ea18caf50353c4c8dbeba5e42d266dbbfb54d Mon Sep 17 00:00:00 2001 From: Bogdan Date: Fri, 4 Aug 2023 03:38:24 +0300 Subject: [PATCH] Simplify column translations --- .../Components/Page/Sidebar/PageSidebar.js | 128 +++++------------- .../Page/Sidebar/PageSidebarItem.js | 4 +- frontend/src/RootFolder/RootFolders.tsx | 12 +- .../ManageDownloadClientsModalContent.tsx | 24 +--- .../Manage/ManageImportListsModalContent.tsx | 24 +--- .../Manage/ManageIndexersModalContent.tsx | 28 +--- frontend/src/System/Backup/Backups.js | 12 +- frontend/src/System/Logs/Files/LogFiles.js | 8 +- .../src/System/Status/DiskSpace/DiskSpace.js | 12 +- frontend/src/System/Status/Health/Health.js | 8 +- .../src/System/Tasks/Queued/QueuedTasks.js | 20 +-- .../System/Tasks/Scheduled/ScheduledTasks.js | 20 +-- 12 files changed, 76 insertions(+), 224 deletions(-) diff --git a/frontend/src/Components/Page/Sidebar/PageSidebar.js b/frontend/src/Components/Page/Sidebar/PageSidebar.js index ba07578da..9f42c7c99 100644 --- a/frontend/src/Components/Page/Sidebar/PageSidebar.js +++ b/frontend/src/Components/Page/Sidebar/PageSidebar.js @@ -21,22 +21,16 @@ const SIDEBAR_WIDTH = parseInt(dimensions.sidebarWidth); const links = [ { iconName: icons.SERIES_CONTINUING, - get title() { - return translate('Series'); - }, + title: () => translate('Series'), to: '/', alias: '/series', children: [ { - get title() { - return translate('AddNew'); - }, + title: () => translate('AddNew'), to: '/add/new' }, { - get title() { - return translate('LibraryImport'); - }, + title: () => translate('LibraryImport'), to: '/add/import' } ] @@ -44,36 +38,26 @@ const links = [ { iconName: icons.CALENDAR, - get title() { - return translate('Calendar'); - }, + title: () => translate('Calendar'), to: '/calendar' }, { iconName: icons.ACTIVITY, - get title() { - return translate('Activity'); - }, + title: () => translate('Activity'), to: '/activity/queue', children: [ { - get title() { - return translate('Queue'); - }, + title: () => translate('Queue'), to: '/activity/queue', statusComponent: QueueStatusConnector }, { - get title() { - return translate('History'); - }, + title: () => translate('History'), to: '/activity/history' }, { - get title() { - return translate('Blocklist'); - }, + title: () => translate('Blocklist'), to: '/activity/blocklist' } ] @@ -81,21 +65,15 @@ const links = [ { iconName: icons.WARNING, - get title() { - return translate('Wanted'); - }, + title: () => translate('Wanted'), to: '/wanted/missing', children: [ { - get title() { - return translate('Missing'); - }, + title: () => translate('Missing'), to: '/wanted/missing' }, { - get title() { - return translate('CutoffUnmet'); - }, + title: () => translate('CutoffUnmet'), to: '/wanted/cutoffunmet' } ] @@ -103,87 +81,59 @@ const links = [ { iconName: icons.SETTINGS, - get title() { - return translate('Settings'); - }, + title: () => translate('Settings'), to: '/settings', children: [ { - get title() { - return translate('MediaManagement'); - }, + title: () => translate('MediaManagement'), to: '/settings/mediamanagement' }, { - get title() { - return translate('Profiles'); - }, + title: () => translate('Profiles'), to: '/settings/profiles' }, { - get title() { - return translate('Quality'); - }, + title: () => translate('Quality'), to: '/settings/quality' }, { - get title() { - return translate('CustomFormats'); - }, + title: () => translate('CustomFormats'), to: '/settings/customformats' }, { - get title() { - return translate('Indexers'); - }, + title: () => translate('Indexers'), to: '/settings/indexers' }, { - get title() { - return translate('DownloadClients'); - }, + title: () => translate('DownloadClients'), to: '/settings/downloadclients' }, { - get title() { - return translate('ImportLists'); - }, + title: () => translate('ImportLists'), to: '/settings/importlists' }, { - get title() { - return translate('Connect'); - }, + title: () => translate('Connect'), to: '/settings/connect' }, { - get title() { - return translate('Metadata'); - }, + title: () => translate('Metadata'), to: '/settings/metadata' }, { - get title() { - return translate('MetadataSource'); - }, + title: () => translate('MetadataSource'), to: '/settings/metadatasource' }, { - get title() { - return translate('Tags'); - }, + title: () => translate('Tags'), to: '/settings/tags' }, { - get title() { - return translate('General'); - }, + title: () => translate('General'), to: '/settings/general' }, { - get title() { - return translate('UI'); - }, + title: () => translate('UI'), to: '/settings/ui' } ] @@ -191,46 +141,32 @@ const links = [ { iconName: icons.SYSTEM, - get title() { - return translate('System'); - }, + title: () => translate('System'), to: '/system/status', children: [ { - get title() { - return translate('Status'); - }, + title: () => translate('Status'), to: '/system/status', statusComponent: HealthStatusConnector }, { - get title() { - return translate('Tasks'); - }, + title: () => translate('Tasks'), to: '/system/tasks' }, { - get title() { - return translate('Backup'); - }, + title: () => translate('Backup'), to: '/system/backup' }, { - get title() { - return translate('Updates'); - }, + title: () => translate('Updates'), to: '/system/updates' }, { - get title() { - return translate('Events'); - }, + title: () => translate('Events'), to: '/system/events' }, { - get title() { - return translate('LogFiles'); - }, + title: () => translate('LogFiles'), to: '/system/logs/files' } ] diff --git a/frontend/src/Components/Page/Sidebar/PageSidebarItem.js b/frontend/src/Components/Page/Sidebar/PageSidebarItem.js index 9ad78db6b..754071c79 100644 --- a/frontend/src/Components/Page/Sidebar/PageSidebarItem.js +++ b/frontend/src/Components/Page/Sidebar/PageSidebarItem.js @@ -64,7 +64,7 @@ class PageSidebarItem extends Component { } - {title} + {typeof title === 'function' ? title() : title} { @@ -88,7 +88,7 @@ class PageSidebarItem extends Component { PageSidebarItem.propTypes = { iconName: PropTypes.object, - title: PropTypes.string.isRequired, + title: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired, to: PropTypes.string.isRequired, isActive: PropTypes.bool, isActiveParent: PropTypes.bool, diff --git a/frontend/src/RootFolder/RootFolders.tsx b/frontend/src/RootFolder/RootFolders.tsx index 961797abe..d887b5b56 100644 --- a/frontend/src/RootFolder/RootFolders.tsx +++ b/frontend/src/RootFolder/RootFolders.tsx @@ -13,23 +13,17 @@ import RootFolderRow from './RootFolderRow'; const rootFolderColumns = [ { name: 'path', - get label() { - return translate('Path'); - }, + label: () => translate('Path'), isVisible: true, }, { name: 'freeSpace', - get label() { - return translate('FreeSpace'); - }, + label: () => translate('FreeSpace'), isVisible: true, }, { name: 'unmappedFolders', - get label() { - return translate('UnmappedFolders'); - }, + label: () => translate('UnmappedFolders'), isVisible: true, }, { diff --git a/frontend/src/Settings/DownloadClients/DownloadClients/Manage/ManageDownloadClientsModalContent.tsx b/frontend/src/Settings/DownloadClients/DownloadClients/Manage/ManageDownloadClientsModalContent.tsx index 21f45cc97..cc8a1eb35 100644 --- a/frontend/src/Settings/DownloadClients/DownloadClients/Manage/ManageDownloadClientsModalContent.tsx +++ b/frontend/src/Settings/DownloadClients/DownloadClients/Manage/ManageDownloadClientsModalContent.tsx @@ -36,49 +36,37 @@ type OnSelectedChangeCallback = React.ComponentProps< const COLUMNS = [ { name: 'name', - get label() { - return translate('Name'); - }, + label: () => translate('Name'), isSortable: true, isVisible: true, }, { name: 'implementation', - get label() { - return translate('Implementation'); - }, + label: () => translate('Implementation'), isSortable: true, isVisible: true, }, { name: 'enable', - get label() { - return translate('Enabled'); - }, + label: () => translate('Enabled'), isSortable: true, isVisible: true, }, { name: 'priority', - get label() { - return translate('Priority'); - }, + label: () => translate('Priority'), isSortable: true, isVisible: true, }, { name: 'removeCompletedDownloads', - get label() { - return translate('RemoveCompleted'); - }, + label: () => translate('RemoveCompleted'), isSortable: true, isVisible: true, }, { name: 'removeFailedDownloads', - get label() { - return translate('RemoveFailed'); - }, + label: () => translate('RemoveFailed'), isSortable: true, isVisible: true, }, diff --git a/frontend/src/Settings/ImportLists/ImportLists/Manage/ManageImportListsModalContent.tsx b/frontend/src/Settings/ImportLists/ImportLists/Manage/ManageImportListsModalContent.tsx index 5d78e38d2..60619c662 100644 --- a/frontend/src/Settings/ImportLists/ImportLists/Manage/ManageImportListsModalContent.tsx +++ b/frontend/src/Settings/ImportLists/ImportLists/Manage/ManageImportListsModalContent.tsx @@ -36,49 +36,37 @@ type OnSelectedChangeCallback = React.ComponentProps< const COLUMNS = [ { name: 'name', - get label() { - return translate('Name'); - }, + label: () => translate('Name'), isSortable: true, isVisible: true, }, { name: 'implementation', - get label() { - return translate('Implementation'); - }, + label: () => translate('Implementation'), isSortable: true, isVisible: true, }, { name: 'qualityProfileId', - get label() { - return translate('QualityProfile'); - }, + label: () => translate('QualityProfile'), isSortable: true, isVisible: true, }, { name: 'rootFolderPath', - get label() { - return translate('RootFolder'); - }, + label: () => translate('RootFolder'), isSortable: true, isVisible: true, }, { name: 'enableAutomaticAdd', - get label() { - return translate('AutoAdd'); - }, + label: () => translate('AutoAdd'), isSortable: true, isVisible: true, }, { name: 'tags', - get label() { - return translate('Tags'); - }, + label: () => translate('Tags'), isSortable: true, isVisible: true, }, diff --git a/frontend/src/Settings/Indexers/Indexers/Manage/ManageIndexersModalContent.tsx b/frontend/src/Settings/Indexers/Indexers/Manage/ManageIndexersModalContent.tsx index da24b4412..37c4a3153 100644 --- a/frontend/src/Settings/Indexers/Indexers/Manage/ManageIndexersModalContent.tsx +++ b/frontend/src/Settings/Indexers/Indexers/Manage/ManageIndexersModalContent.tsx @@ -36,57 +36,43 @@ type OnSelectedChangeCallback = React.ComponentProps< const COLUMNS = [ { name: 'name', - get label() { - return translate('Name'); - }, + label: () => translate('Name'), isSortable: true, isVisible: true, }, { name: 'implementation', - get label() { - return translate('Implementation'); - }, + label: () => translate('Implementation'), isSortable: true, isVisible: true, }, { name: 'enableRss', - get label() { - return translate('EnableRSS'); - }, + label: () => translate('EnableRSS'), isSortable: true, isVisible: true, }, { name: 'enableAutomaticSearch', - get label() { - return translate('EnableAutomaticSearch'); - }, + label: () => translate('EnableAutomaticSearch'), isSortable: true, isVisible: true, }, { name: 'enableInteractiveSearch', - get label() { - return translate('EnableInteractiveSearch'); - }, + label: () => translate('EnableInteractiveSearch'), isSortable: true, isVisible: true, }, { name: 'priority', - get label() { - return translate('Priority'); - }, + label: () => translate('Priority'), isSortable: true, isVisible: true, }, { name: 'tags', - get label() { - return translate('Tags'); - }, + label: () => translate('Tags'), isSortable: true, isVisible: true, }, diff --git a/frontend/src/System/Backup/Backups.js b/frontend/src/System/Backup/Backups.js index fa78dd769..8f7a5b0a5 100644 --- a/frontend/src/System/Backup/Backups.js +++ b/frontend/src/System/Backup/Backups.js @@ -21,23 +21,17 @@ const columns = [ }, { name: 'name', - get label() { - return translate('Name'); - }, + label: () => translate('Name'), isVisible: true }, { name: 'size', - get label() { - return translate('Size'); - }, + label: () => translate('Size'), isVisible: true }, { name: 'time', - get label() { - return translate('Time'); - }, + label: () => translate('Time'), isVisible: true }, { diff --git a/frontend/src/System/Logs/Files/LogFiles.js b/frontend/src/System/Logs/Files/LogFiles.js index 23b3bb40e..281a2960c 100644 --- a/frontend/src/System/Logs/Files/LogFiles.js +++ b/frontend/src/System/Logs/Files/LogFiles.js @@ -19,16 +19,12 @@ import LogFilesTableRow from './LogFilesTableRow'; const columns = [ { name: 'filename', - get label() { - return translate('Filename'); - }, + label: () => translate('Filename'), isVisible: true }, { name: 'lastWriteTime', - get label() { - return translate('LastWriteTime'); - }, + label: () => translate('LastWriteTime'), isVisible: true }, { diff --git a/frontend/src/System/Status/DiskSpace/DiskSpace.js b/frontend/src/System/Status/DiskSpace/DiskSpace.js index 30aef6ce2..d287fed07 100644 --- a/frontend/src/System/Status/DiskSpace/DiskSpace.js +++ b/frontend/src/System/Status/DiskSpace/DiskSpace.js @@ -15,23 +15,17 @@ import styles from './DiskSpace.css'; const columns = [ { name: 'path', - get label() { - return translate('Location'); - }, + label: () => translate('Location'), isVisible: true }, { name: 'freeSpace', - get label() { - return translate('FreeSpace'); - }, + label: () => translate('FreeSpace'), isVisible: true }, { name: 'totalSpace', - get label() { - return translate('TotalSpace'); - }, + label: () => translate('TotalSpace'), isVisible: true }, { diff --git a/frontend/src/System/Status/Health/Health.js b/frontend/src/System/Status/Health/Health.js index 8c021ed66..fedbf9903 100644 --- a/frontend/src/System/Status/Health/Health.js +++ b/frontend/src/System/Status/Health/Health.js @@ -94,16 +94,12 @@ const columns = [ }, { name: 'message', - get label() { - return translate('Message'); - }, + label: () => translate('Message'), isVisible: true }, { name: 'actions', - get label() { - return translate('Actions'); - }, + label: () => translate('Actions'), isVisible: true } ]; diff --git a/frontend/src/System/Tasks/Queued/QueuedTasks.js b/frontend/src/System/Tasks/Queued/QueuedTasks.js index 30301702c..dac38f1d4 100644 --- a/frontend/src/System/Tasks/Queued/QueuedTasks.js +++ b/frontend/src/System/Tasks/Queued/QueuedTasks.js @@ -15,37 +15,27 @@ const columns = [ }, { name: 'commandName', - get label() { - return translate('Name'); - }, + label: () => translate('Name'), isVisible: true }, { name: 'queued', - get label() { - return translate('Queued'); - }, + label: () => translate('Queued'), isVisible: true }, { name: 'started', - get label() { - return translate('Started'); - }, + label: () => translate('Started'), isVisible: true }, { name: 'ended', - get label() { - return translate('Ended'); - }, + label: () => translate('Ended'), isVisible: true }, { name: 'duration', - get label() { - return translate('Duration'); - }, + label: () => translate('Duration'), isVisible: true }, { diff --git a/frontend/src/System/Tasks/Scheduled/ScheduledTasks.js b/frontend/src/System/Tasks/Scheduled/ScheduledTasks.js index c1b17122d..bec151613 100644 --- a/frontend/src/System/Tasks/Scheduled/ScheduledTasks.js +++ b/frontend/src/System/Tasks/Scheduled/ScheduledTasks.js @@ -10,37 +10,27 @@ import ScheduledTaskRowConnector from './ScheduledTaskRowConnector'; const columns = [ { name: 'name', - get label() { - return translate('Name'); - }, + label: () => translate('Name'), isVisible: true }, { name: 'interval', - get label() { - return translate('Interval'); - }, + label: () => translate('Interval'), isVisible: true }, { name: 'lastExecution', - get label() { - return translate('LastExecution'); - }, + label: () => translate('LastExecution'), isVisible: true }, { name: 'lastDuration', - get label() { - return translate('LastDuration'); - }, + label: () => translate('LastDuration'), isVisible: true }, { name: 'nextExecution', - get label() { - return translate('NextExecution'); - }, + label: () => translate('NextExecution'), isVisible: true }, {