From bfe8847d72cd0893230f2e654242658214943e61 Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Sat, 2 Oct 2021 09:24:32 +0200 Subject: chore: convert various files from JS to TS (#2010) --- src/features/communityRecipes/store.js | 32 ---------------------------- src/features/communityRecipes/store.ts | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 32 deletions(-) delete mode 100644 src/features/communityRecipes/store.js create mode 100644 src/features/communityRecipes/store.ts (limited to 'src/features/communityRecipes') diff --git a/src/features/communityRecipes/store.js b/src/features/communityRecipes/store.js deleted file mode 100644 index 05e18e2f7..000000000 --- a/src/features/communityRecipes/store.js +++ /dev/null @@ -1,32 +0,0 @@ -import { computed } from 'mobx'; -import { FeatureStore } from '../utils/FeatureStore'; - -const debug = require('debug')('Ferdi:feature:communityRecipes:store'); - -export class CommunityRecipesStore extends FeatureStore { - start(stores, actions) { - debug('start'); - this.stores = stores; - this.actions = actions; - } - - stop() { - debug('stop'); - super.stop(); - } - - @computed get communityRecipes() { - if (!this.stores) return []; - - return this.stores.recipePreviews.dev.map(recipePreview => { - // TODO: Need to figure out if this is even necessary/used - recipePreview.isDevRecipe = !!recipePreview.author.some( - author => author.email === this.stores.user.data.email, - ); - - return recipePreview; - }); - } -} - -export default CommunityRecipesStore; diff --git a/src/features/communityRecipes/store.ts b/src/features/communityRecipes/store.ts new file mode 100644 index 000000000..a8d358ba0 --- /dev/null +++ b/src/features/communityRecipes/store.ts @@ -0,0 +1,39 @@ +import { computed } from 'mobx'; +import { FeatureStore } from '../utils/FeatureStore'; + +const debug = require('debug')('Ferdi:feature:communityRecipes:store'); + +export class CommunityRecipesStore extends FeatureStore { + stores: any; + + actions: any; + + start(stores: any, actions: any) { + debug('start'); + this.stores = stores; + this.actions = actions; + } + + stop() { + debug('stop'); + super.stop(); + } + + @computed get communityRecipes() { + if (!this.stores) return []; + + return this.stores.recipePreviews.dev.map( + (recipePreview: { isDevRecipe: boolean; author: any[] }) => { + // TODO: Need to figure out if this is even necessary/used + recipePreview.isDevRecipe = !!recipePreview.author.some( + (author: { email: any }) => + author.email === this.stores.user.data.email, + ); + + return recipePreview; + }, + ); + } +} + +export default CommunityRecipesStore; -- cgit v1.2.3-70-g09d2