aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2019-09-28 17:04:16 +0200
committerLibravatar vantezzen <hello@vantezzen.io>2019-09-28 17:04:16 +0200
commit7040eaeacc295b8c1b19a32ce802060279a378da (patch)
tree107a3c5b6a624fc96e0c6b1e1e3b5eb601429d9a /src
parentReplace "invite friends" screen with "support Ferdi" screen (diff)
downloadferdium-app-7040eaeacc295b8c1b19a32ce802060279a378da.tar.gz
ferdium-app-7040eaeacc295b8c1b19a32ce802060279a378da.tar.zst
ferdium-app-7040eaeacc295b8c1b19a32ce802060279a378da.zip
Fix loading of recipe information
Diffstat (limited to 'src')
-rw-r--r--src/containers/settings/RecipesScreen.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/containers/settings/RecipesScreen.js b/src/containers/settings/RecipesScreen.js
index cff6bfd83..70b599d9c 100644
--- a/src/containers/settings/RecipesScreen.js
+++ b/src/containers/settings/RecipesScreen.js
@@ -1,4 +1,5 @@
1import { remote, shell } from 'electron'; 1import { remote, shell } from 'electron';
2import fs from 'fs-extra';
2import React, { Component } from 'react'; 3import React, { Component } from 'react';
3import PropTypes from 'prop-types'; 4import PropTypes from 'prop-types';
4import { autorun } from 'mobx'; 5import { autorun } from 'mobx';
@@ -12,12 +13,10 @@ import UserStore from '../../stores/UserStore';
12 13
13import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard'; 14import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard';
14import ErrorBoundary from '../../components/util/ErrorBoundary'; 15import ErrorBoundary from '../../components/util/ErrorBoundary';
15import { FRANZ_DEV_DOCS } from '../../config'; 16import { FRANZ_DEV_DOCS, RECIPES_PATH } from '../../config';
16import { communityRecipesStore } from '../../features/communityRecipes'; 17import { communityRecipesStore } from '../../features/communityRecipes';
17import RecipePreview from '../../models/RecipePreview'; 18import RecipePreview from '../../models/RecipePreview';
18 19
19import allFerdiRecipes from '../../../recipes/all.json';
20
21const { app } = remote; 20const { app } = remote;
22 21
23export default @inject('stores', 'actions') @observer class RecipesScreen extends Component { 22export default @inject('stores', 'actions') @observer class RecipesScreen extends Component {
@@ -40,6 +39,14 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
40 39
41 autorunDisposer = null; 40 autorunDisposer = null;
42 41
42 customRecipes = [];
43
44 constructor(props) {
45 super(props);
46
47 this.customRecipes = fs.readJsonSync(path.join(RECIPES_PATH, 'all.json'));
48 }
49
43 componentDidMount() { 50 componentDidMount() {
44 this.autorunDisposer = autorun(() => { 51 this.autorunDisposer = autorun(() => {
45 const { filter } = this.props.params; 52 const { filter } = this.props.params;
@@ -114,7 +121,7 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
114 if (filter === 'all') { 121 if (filter === 'all') {
115 recipeFilter = this.prepareRecipes([ 122 recipeFilter = this.prepareRecipes([
116 ...recipePreviews.all, 123 ...recipePreviews.all,
117 ...this.createPreviews(allFerdiRecipes), 124 ...this.createPreviews(this.customRecipes),
118 ]); 125 ]);
119 } else if (filter === 'dev') { 126 } else if (filter === 'dev') {
120 recipeFilter = communityRecipesStore.communityRecipes; 127 recipeFilter = communityRecipesStore.communityRecipes;
@@ -127,7 +134,7 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
127 ...recipePreviews.searchResults, 134 ...recipePreviews.searchResults,
128 // All search recipes from local recipes 135 // All search recipes from local recipes
129 ...this.createPreviews( 136 ...this.createPreviews(
130 allFerdiRecipes 137 this.customRecipes
131 .filter(service => service.name.toLowerCase().includes(this.state.needle.toLowerCase())), 138 .filter(service => service.name.toLowerCase().includes(this.state.needle.toLowerCase())),
132 ), 139 ),
133 ]) : recipeFilter; 140 ]) : recipeFilter;