From 571d97f66b39a2b00335da3dd4299fdffc4c3485 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Mon, 15 Jan 2024 23:02:40 +0100 Subject: [PATCH 1/2] Show add extension repo info in case no repo is defined --- src/i18n/locale/en.json | 1 + src/screens/Extensions.tsx | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index a1841d15e0..16f4af93de 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -223,6 +223,7 @@ } }, "label": { + "add_repository_info": "You have to add a extension repository to be able to install extensions", "installation_failed": "Could not install the extension", "installed_successfully": "Extension installed", "installing_file": "Installing extension fileā€¦", diff --git a/src/screens/Extensions.tsx b/src/screens/Extensions.tsx index 1ee21e0f5d..503c574bff 100644 --- a/src/screens/Extensions.tsx +++ b/src/screens/Extensions.tsx @@ -11,9 +11,10 @@ import { fromEvent } from 'file-selector'; import IconButton from '@mui/material/IconButton'; import AddIcon from '@mui/icons-material/Add'; import { StringParam, useQueryParam } from 'use-query-params'; -import { Tooltip, useMediaQuery } from '@mui/material'; +import { Button, Stack, Tooltip, Typography, useMediaQuery } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { useTheme } from '@mui/material/styles'; +import { Link } from 'react-router-dom'; import { requestManager } from '@/lib/requests/RequestManager.ts'; import { extensionDefaultLangs, DefaultLanguage, langSortCmp } from '@/util/language'; import { useLocalStorage } from '@/util/useLocalStorage'; @@ -99,7 +100,8 @@ export function Extensions() { const isMobileWidth = useMediaQuery(theme.breakpoints.down('sm')); const { data: serverSettingsData } = requestManager.useGetServerSettings(); - const areMultipleReposInUse = !!serverSettingsData?.settings.extensionRepos.length; // tachiyomi repo is used by default + const areReposDefined = !!serverSettingsData?.settings.extensionRepos.length; + const areMultipleReposInUse = (serverSettingsData?.settings.extensionRepos.length ?? 0) > 1; const inputRef = useRef(null); const { setTitle, setAction } = useContext(NavBarContext); @@ -206,6 +208,18 @@ export function Extensions() { return ; } + const showAddRepoInfo = !allExtensions?.length && !areReposDefined; + if (showAddRepoInfo) { + return ( + + {t('extension.label.add_repository_info')} + + + ); + } + return ( <> {toasts} From d3a96abc986b3e80d51704df257001340fd5915f Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Mon, 15 Jan 2024 23:05:35 +0100 Subject: [PATCH 2/2] Update extension repositories localization --- src/i18n/locale/en.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index 16f4af93de..67b244955e 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -250,9 +250,9 @@ } }, "label": { - "description": "Add custom repositories from which extensions can be installed", + "description": "Add repositories from which extensions can be installed", "disclaimer": "Suwayomi does not provide any support for 3rd party repositories or extensions!
Use with caution as there could be malicious actors making those repositories.
You as the user need to verify the security and that you trust any repository or extension.", - "title": "Custom repositories" + "title": "Extension repositories" } } }