Skip to content

Commit

Permalink
Release v1.0.28 (#31)
Browse files Browse the repository at this point in the history
* Fix value display

* Add supporting doc

* Change shadow on cards (#15)

* Refresh notif (#16)

* Notif and update

* Display refresh notif

* PWA mode (#17)

* No console (#18)

* Drop shadow on member card (#24)

* Release v1.0.27 (#25)

* Confirm delete (#28)

* Remove drafts from profile service (#29)

* Release v1.0.28 (#30)
  • Loading branch information
gregory-latinier authored Aug 16, 2020
1 parent bc7baa5 commit 79fd577
Showing 4 changed files with 34 additions and 60 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hyphadac-quasar",
"version": "1.0.27",
"version": "1.0.28",
"description": "HyphaDAO",
"productName": "HyphaDAO",
"cordovaId": "org.cordova.quasar.app",
20 changes: 18 additions & 2 deletions src/pages/proposals/components/draft-proposal-card.vue
Original file line number Diff line number Diff line change
@@ -134,9 +134,25 @@ q-card.draft
q-item-section Edit
q-item(
clickable
v-close-popup
@click="deleteDraft(draft.id)"
)
q-popup-proxy
.confirm.column.q-pa-sm
| Are you sure you want to delete this draft?
.row.flex.justify-between.q-mt-sm
q-btn(
color="primary"
label="No"
dense
flat
v-close-popup="-1"
)
q-btn(
color="primary"
label="Yes"
dense
@click="deleteDraft(draft.id)"
v-close-popup="-1"
)
q-item-section(style="max-width: 20px;")
q-icon(name="fas fa-trash-alt" size="14px")
q-item-section Delete
2 changes: 1 addition & 1 deletion src/pages/proposals/components/proposal-card.vue
Original file line number Diff line number Diff line change
@@ -225,7 +225,7 @@ q-card.proposal(v-if="isFiltered")
img.icon(v-if="origin === 'assignment' || type === 'assignment'" src="~assets/icons/assignments.svg")
img.icon(v-if="origin === 'contribution' || type === 'contribution'" src="~assets/icons/past.svg")
q-card-section
.type(@click="showCardFullContent") {{ type }} #[br] {{ origin }}
.type(@click="showCardFullContent") {{ type }} {{ origin }}
.title(@click="details = !details") {{ title }}
q-card-section.description(v-show="details")
p {{ description | truncate(150) }}
70 changes: 14 additions & 56 deletions src/store/profiles/actions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Turndown from 'turndown'
import { Notify } from 'quasar'

export const connectProfileApi = async function ({ commit }) {
await this.$ppp.authApi().signIn()
@@ -45,21 +44,8 @@ export const getPublicProfile = async function ({ commit, state, rootGetters },
return profile
}

export const getDrafts = async function ({ commit, state }, username) {
if (state.loadings[username]) {
while (!state.profiles[username]) {
await sleep(200)
}
}
if (state.profiles[username]) {
commit('setDrafts', state.profiles[username].publicData.drafts || [])
} else {
commit('setLoading', username)
const profile = (await this.$ppp.profileApi().getProfiles([username]))[username]
if (!profile) return null
commit('addProfile', { profile, username })
commit('setDrafts', profile.publicData.drafts || [])
}
export const getDrafts = async function ({ commit }) {
commit('setDrafts', JSON.parse(localStorage.getItem('drafts') || []))
}

export const getTokensAmounts = async function (context, account) {
@@ -279,48 +265,20 @@ export const deleteDraft = async function ({ commit, state, dispatch }, id) {
}

export const saveDraft = async function ({ commit, state, dispatch }, data) {
try {
if (!state.connected) {
await dispatch('connectProfileApi')
}
const drafts = [...state.drafts]
// replace an existing draft
if (data) {
const { type, draft } = data
const idx = drafts.findIndex(d => d.draft.id === draft.id && d.type === type)
if (idx >= 0) {
drafts[idx] = { type, draft }
} else {
drafts.push({ type, draft })
}
}

const profile = await this.$ppp.profileApi().getProfile('BASE_AND_APP')
if (!profile) {
Notify.create({
color: 'red',
message: 'Please create profile before submitting a proposal.',
position: 'bottom',
timeout: 10000,
actions: [
{ label: 'Dismiss', color: 'white', handler: () => { /* ... */ } }
]
})
return false
const drafts = [...state.drafts]
// replace an existing draft
if (data) {
const { type, draft } = data
const idx = drafts.findIndex(d => d.draft.id === draft.id && d.type === type)
if (idx >= 0) {
drafts[idx] = { type, draft }
} else {
drafts.push({ type, draft })
}
await this.$ppp.profileApi().register({
...profile,
publicData: {
...profile.publicData,
drafts
}
})
commit('setDrafts', drafts)
return true
} catch (e) {
this.$sentry.captureException(e)
return false
}
localStorage.setItem('drafts', JSON.stringify(drafts))
commit('setDrafts', drafts)
return true
}

const sleep = (ms) => {

0 comments on commit 79fd577

Please sign in to comment.