Skip to content

Commit

Permalink
Thinking status for suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustem Mussabekov committed May 16, 2024
1 parent 9030d98 commit 70ce037
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/data/modules/persistConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (RAINDROP_ENVIRONMENT == 'browser')
else
storage = require('@react-native-async-storage/async-storage').default

const version = 38
const version = 39

export default {
key: 'primary',
Expand Down
3 changes: 3 additions & 0 deletions src/data/reducers/predictions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default function(state = initialState, action){switch (action.type) {
case c.PREDICTIONS_LOAD_REQ:{
return state
.set('status', 'loading')
.set('updateDate', null)
}

case c.PREDICTIONS_LOAD_SUCCESS:{
Expand All @@ -29,6 +30,7 @@ export default function(state = initialState, action){switch (action.type) {
return state
.set('status', 'loaded')
.set('items', items)
.set('updateDate', action.updateDate)
}

case c.PREDICTIONS_LOAD_ERROR:{
Expand Down Expand Up @@ -78,5 +80,6 @@ export default function(state = initialState, action){switch (action.type) {
const initialState = Immutable({
status: 'idle', //idle|loading|loaded|error
items: [],
updateDate: null,
apply_status: {} // _id: loading|success|error
})
5 changes: 2 additions & 3 deletions src/data/sagas/predictions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ export default function* () {

function* load() {
try {
const { predictions, raindrops } = yield call(Api.get, 'predictions?version=1')
const res = yield call(Api.get, 'predictions?version=1')

yield put({
type: c.PREDICTIONS_LOAD_SUCCESS,
predictions,
raindrops
...res
})
} catch (error) {
yield put({
Expand Down
12 changes: 12 additions & 0 deletions src/routes/suggestions/predictions/empty.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
import React from 'react'
import links from '~config/links'
import { useSelector } from 'react-redux'

import Alert from '~co/common/alert'

export default function MySuggestionsPredictionsEmpty() {
const updateDate = useSelector(state=>state.predictions.updateDate)

if (!updateDate)
return (
<Alert>
<b>💭 Thinking&hellip;</b><br />
Check back later for suggestions tailored to your bookmarks
</Alert>
)

return (
<Alert>
<b>Not enough data yet</b><br />
Expand Down

0 comments on commit 70ce037

Please sign in to comment.