projectsPath: types.optional(types.string, homepath), envPath: types.optional(types.string, homepath), indexFiles: types.optional(types.boolean, false), highlightProjectsWithoutRepo: types.optional(types.boolean, false), showHomeSidebar: types.optional(types.boolean, true), horizontalLayout: types.optional(types.boolean, false), automaticallyReleasePorts: types.optional(types.boolean, true), groupScriptsByPrefix: types.optional(types.boolean, true), showScriptsDescriptions: types.optional(types.boolean, true), showScriptsCommands: types.optional(types.boolean, true), labelScriptsCommands: types.optional(types.boolean, true), verticalScriptsLayout: types.optional(types.boolean, false), openProjectWhenRunning: types.optional(types.boolean, false) }) .actions(self => ({
types .model('Temperature', { message: types.string, location: types.string, loading: types.boolean }) .actions(self => ({ fetch() { self.loading = true window.fetch(`https://api.openweathermap.org/data/2.5/weather?q=${self.location}&units=metric`) .then(res => res.json() .then(json => { self.update(json) })) }, setLocation(city) { self.location = city self.fetch() }, update(data) { self.message = data.message self.location = data.cod self.loading = false } }))
types .model("CategoriesStore", { categories: types.map(Category), areCategoriesLoaded: types.boolean }) .views(self => ({ get blog() { return getParent(self); }, get allCategories() { return self.categories.values(); } })) .actions(self => { const fetchCategories = flow(function* fetchCategories() { try { const querySnapshot = yield firestore.collection("categories").get(); querySnapshot.forEach(doc => { const category = doc.data(); self.categories.put(category); }); self.areCategoriesLoaded = true; } catch (e) {} }); return { fetchCategories }; })
types .model({ error: types.string, fetching: types.boolean, users: types.array(User) })
types .model("PostsStore", { posts: types.map(Post), arePostsLoaded: types.boolean, sortBy: types.enumeration("sortBy", [ PostsOrder.Newest,