From 6a6bfe0c6875a1d8ccb1a6fdc409f595202ef38e Mon Sep 17 00:00:00 2001 From: Fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Fri, 27 May 2022 05:35:00 +0500 Subject: [PATCH] feat(ui): add emby as a mediaServerType to the import user button Add emby as a mediaServerType to the import user button and replace any reference to Jellyfin with mediaServerName --- .../UserList/JellyfinImportModal.tsx | 38 +++++++++++++------ src/components/UserList/index.tsx | 17 ++++++--- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/components/UserList/JellyfinImportModal.tsx b/src/components/UserList/JellyfinImportModal.tsx index 295938b2f..2bfdf6269 100644 --- a/src/components/UserList/JellyfinImportModal.tsx +++ b/src/components/UserList/JellyfinImportModal.tsx @@ -15,15 +15,15 @@ interface JellyfinImportProps { } const messages = defineMessages({ - importfromJellyfin: 'Import Jellyfin Users', + importfromJellyfin: 'Import {mediaServerName} Users', importfromJellyfinerror: - 'Something went wrong while importing Jellyfin users.', + 'Something went wrong while importing {mediaServerName} users.', importedfromJellyfin: - '{userCount} Jellyfin {userCount, plural, one {user} other {users}} imported successfully!', + '{userCount} {mediaServerName} {userCount, plural, one {user} other {users}} imported successfully!', user: 'User', - noJellyfinuserstoimport: 'There are no Jellyfin users to import.', + noJellyfinuserstoimport: 'There are no {mediaServerName} users to import.', newJellyfinsigninenabled: - 'The Enable New Jellyfin Sign-In setting is currently enabled. Jellyfin users with library access do not need to be imported in order to sign in.', + 'The Enable New {mediaServerName} Sign-In setting is currently enabled. {mediaServerName} users with library access do not need to be imported in order to sign in.', }); const JellyfinImportModal: React.FC = ({ @@ -66,6 +66,8 @@ const JellyfinImportModal: React.FC = ({ strong: function strong(msg) { return {msg}; }, + mediaServerName: + process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin', }), { autoDismiss: true, @@ -77,10 +79,16 @@ const JellyfinImportModal: React.FC = ({ onComplete(); } } catch (e) { - addToast(intl.formatMessage(messages.importfromJellyfinerror), { - autoDismiss: true, - appearance: 'error', - }); + addToast( + intl.formatMessage(messages.importfromJellyfinerror, { + mediaServerName: + process.env.JELLYFIN_TYPE == 'emby' ? 'Emby' : 'Jellyfin', + }), + { + autoDismiss: true, + appearance: 'error', + } + ); } finally { setImporting(false); } @@ -110,7 +118,10 @@ const JellyfinImportModal: React.FC = ({ return ( } onOk={() => { importUsers(); @@ -126,6 +137,8 @@ const JellyfinImportModal: React.FC = ({ {settings.currentSettings.newPlexLogin && ( {msg} @@ -240,7 +253,10 @@ const JellyfinImportModal: React.FC = ({ ) : ( )} diff --git a/src/components/UserList/index.tsx b/src/components/UserList/index.tsx index d37f250f1..5eb951736 100644 --- a/src/components/UserList/index.tsx +++ b/src/components/UserList/index.tsx @@ -503,13 +503,18 @@ const UserList: React.FC = () => { > - {intl.formatMessage(messages.importfromplex, { - mediaServerName: - settings.currentSettings.mediaServerType === + {process.env.JELLYFIN_TYPE == 'emby' + ? intl.formatMessage(messages.importfromplex, { + mediaServerName: 'Emby', + }) + : settings.currentSettings.mediaServerType === MediaServerType.PLEX - ? 'Plex' - : 'Jellyfin', - })} + ? intl.formatMessage(messages.importfromplex, { + mediaServerName: 'Plex', + }) + : intl.formatMessage(messages.importfromplex, { + mediaServerName: 'Jellyfin', + })}