aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-08-12 14:50:41 +0000
committerLibravatar GitHub <noreply@github.com>2021-08-12 20:20:41 +0530
commit10e706230f11606a83a86837c820a6c338d29a4f (patch)
tree9862aaae7d6a3a0be97bfda68739d3036f0f7848 /src
parentUpdate recipes for bringing in darkmode support for: (diff)
downloadferdium-app-10e706230f11606a83a86837c820a6c338d29a4f.tar.gz
ferdium-app-10e706230f11606a83a86837c820a6c338d29a4f.tar.zst
ferdium-app-10e706230f11606a83a86837c820a6c338d29a4f.zip
Services now support aliases!!!! (#1774)
Users can now search for the services not only based on the name, but also the alias (partial match, case-insensitive), when adding new services. fixes #1614, #1615, #1291
Diffstat (limited to 'src')
-rw-r--r--src/components/settings/recipes/RecipeItem.js5
-rw-r--r--src/containers/settings/RecipesScreen.js2
-rw-r--r--src/models/Recipe.js3
-rw-r--r--src/models/RecipePreview.js2
-rw-r--r--src/styles/recipes.scss5
5 files changed, 16 insertions, 1 deletions
diff --git a/src/components/settings/recipes/RecipeItem.js b/src/components/settings/recipes/RecipeItem.js
index 12e3775f6..55f415bd5 100644
--- a/src/components/settings/recipes/RecipeItem.js
+++ b/src/components/settings/recipes/RecipeItem.js
@@ -28,6 +28,11 @@ export default @observer class RecipeItem extends Component {
28 alt="" 28 alt=""
29 /> 29 />
30 <span className="recipe-teaser__label">{recipe.name}</span> 30 <span className="recipe-teaser__label">{recipe.name}</span>
31 {recipe.aliases && recipe.aliases.length > 0 && (
32 <span className="recipe-teaser__alias_label">
33 {`Aliases: ${recipe.aliases.join(', ')}`}
34 </span>
35 )}
31 </button> 36 </button>
32 ); 37 );
33 } 38 }
diff --git a/src/containers/settings/RecipesScreen.js b/src/containers/settings/RecipesScreen.js
index ff3c688fa..52bf31383 100644
--- a/src/containers/settings/RecipesScreen.js
+++ b/src/containers/settings/RecipesScreen.js
@@ -128,7 +128,7 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
128 // All search recipes from local recipes 128 // All search recipes from local recipes
129 ...this.createPreviews( 129 ...this.createPreviews(
130 this.customRecipes 130 this.customRecipes
131 .filter((service) => service.name.toLowerCase().includes(this.state.needle.toLowerCase())), 131 .filter((service) => service.name.toLowerCase().includes(this.state.needle.toLowerCase()) || (service.aliases || []).some(alias => alias.toLowerCase().includes(this.state.needle.toLowerCase()))),
132 ), 132 ),
133 ]) : recipeFilter; 133 ]) : recipeFilter;
134 134
diff --git a/src/models/Recipe.js b/src/models/Recipe.js
index e616055d6..0d97d4472 100644
--- a/src/models/Recipe.js
+++ b/src/models/Recipe.js
@@ -12,6 +12,8 @@ export default class Recipe {
12 12
13 version = ''; 13 version = '';
14 14
15 aliases = [];
16
15 path = ''; 17 path = '';
16 18
17 serviceURL = ''; 19 serviceURL = '';
@@ -61,6 +63,7 @@ export default class Recipe {
61 this.id = data.id || this.id; 63 this.id = data.id || this.id;
62 this.name = data.name || this.name; 64 this.name = data.name || this.name;
63 this.version = data.version || this.version; 65 this.version = data.version || this.version;
66 this.aliases = data.aliases || this.aliases;
64 this.path = data.path; 67 this.path = data.path;
65 68
66 this.serviceURL = data.config.serviceURL || this.serviceURL; 69 this.serviceURL = data.config.serviceURL || this.serviceURL;
diff --git a/src/models/RecipePreview.js b/src/models/RecipePreview.js
index 7a37ccb56..6a9ce3080 100644
--- a/src/models/RecipePreview.js
+++ b/src/models/RecipePreview.js
@@ -9,6 +9,8 @@ export default class RecipePreview {
9 9
10 featured = false; 10 featured = false;
11 11
12 aliases = [];
13
12 constructor(data) { 14 constructor(data) {
13 if (!data.id) { 15 if (!data.id) {
14 throw Error('RecipePreview requires Id'); 16 throw Error('RecipePreview requires Id');
diff --git a/src/styles/recipes.scss b/src/styles/recipes.scss
index 37c2febf6..628d28f05 100644
--- a/src/styles/recipes.scss
+++ b/src/styles/recipes.scss
@@ -69,6 +69,11 @@
69 display: block; 69 display: block;
70 } 70 }
71 71
72 .recipe-teaser__alias_label {
73 display: block;
74 font-size: x-small;
75 }
76
72 h2 { 77 h2 {
73 z-index: 10; 78 z-index: 10;
74 } 79 }