aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/communityRecipes/store.ts
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-10-02 09:24:32 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-02 09:24:32 +0200
commitbfe8847d72cd0893230f2e654242658214943e61 (patch)
tree3384b02ebad7a74cbb106ddd95546e0e24ff0bb8 /src/features/communityRecipes/store.ts
parentfix: Fix navigation shortcut accelerator for non-macos (fixes #1172) (#2012) (diff)
downloadferdium-app-bfe8847d72cd0893230f2e654242658214943e61.tar.gz
ferdium-app-bfe8847d72cd0893230f2e654242658214943e61.tar.zst
ferdium-app-bfe8847d72cd0893230f2e654242658214943e61.zip
chore: convert various files from JS to TS (#2010)
Diffstat (limited to 'src/features/communityRecipes/store.ts')
-rw-r--r--src/features/communityRecipes/store.ts39
1 files changed, 39 insertions, 0 deletions
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 @@
1import { computed } from 'mobx';
2import { FeatureStore } from '../utils/FeatureStore';
3
4const debug = require('debug')('Ferdi:feature:communityRecipes:store');
5
6export class CommunityRecipesStore extends FeatureStore {
7 stores: any;
8
9 actions: any;
10
11 start(stores: any, actions: any) {
12 debug('start');
13 this.stores = stores;
14 this.actions = actions;
15 }
16
17 stop() {
18 debug('stop');
19 super.stop();
20 }
21
22 @computed get communityRecipes() {
23 if (!this.stores) return [];
24
25 return this.stores.recipePreviews.dev.map(
26 (recipePreview: { isDevRecipe: boolean; author: any[] }) => {
27 // TODO: Need to figure out if this is even necessary/used
28 recipePreview.isDevRecipe = !!recipePreview.author.some(
29 (author: { email: any }) =>
30 author.email === this.stores.user.data.email,
31 );
32
33 return recipePreview;
34 },
35 );
36 }
37}
38
39export default CommunityRecipesStore;