Improved UI

- add buefy for slider and checkboxes
- update/translate text
- add warning
- transition
This commit is contained in:
Matt Rider 2019-06-07 10:16:55 -03:00
parent bf352dca92
commit 6e420d68d1
8 changed files with 111 additions and 40 deletions

View File

@ -10,7 +10,7 @@ $easeOut: cubic-bezier(0.19, 1, 0.22, 1);
&::before { &::before {
@include border-radius($border-radius-x-large); @include border-radius($border-radius-x-large);
box-shadow: inset 0 0 0 5px $color-danger; box-shadow: inset 0 0 0 5px $color-danger;
content: ""; content: '';
display: block; display: block;
position: absolute; position: absolute;
width: 100%; width: 100%;
@ -102,10 +102,10 @@ hr {
height: 1px !important; height: 1px !important;
} }
[class$=menu-trigger] { [class$='menu-trigger'] {
user-select: none; user-select: none;
} }
[class$=menu-popover] { [class$='menu-popover'] {
display: inline-block; display: inline-block;
nav { nav {
@ -145,10 +145,11 @@ hr {
} }
} }
[class$="menu-popover"] { [class$='menu-popover'] {
min-width: 130px; min-width: 130px;
a, button { a,
button {
display: flex; display: flex;
align-content: center; align-content: center;
align-items: center; align-items: center;

View File

@ -2,9 +2,8 @@
<div> <div>
<ds-card hover> <ds-card hover>
<ds-space /> <ds-space />
<ds-form v-model="formData">
<ds-flex> <ds-flex>
<ds-flex-item width="10%" /> <ds-flex-item width="5%" />
<ds-flex-item> <ds-flex-item>
<ds-icon name="warning" size="xxx-large" class="delete-warning-icon" /> <ds-icon name="warning" size="xxx-large" class="delete-warning-icon" />
</ds-flex-item> </ds-flex-item>
@ -13,46 +12,85 @@
</ds-flex-item> </ds-flex-item>
<ds-container> <ds-container>
<ds-space /> <ds-space />
<ds-heading tag="h3"> <ds-heading tag="h4">{{ $t('settings.delete.accountDescription') }}</ds-heading>
This is a destructive action and to proceed you must choose to take this action by
selecting the 'I really want to delete my account' from the dropdown This cannot be
undone, please consider your actions carefully!
</ds-heading>
</ds-container> </ds-container>
</ds-flex> </ds-flex>
<ds-space /> <ds-space />
<ds-section> <ds-container>
<transition name="slide-up">
<div v-if="deleteEnabled">
<div class="field">
<div class="control">
<b-checkbox
type="is-danger"
:disabled="!currentUser.contributionsCount"
v-model="formData.deleteContributions"
>
{{ $t('settings.delete.countPosts', { count: currentUser.contributionsCount }) }}
</b-checkbox>
</div>
</div>
<div class="field">
<div class="control">
<b-checkbox
type="is-danger"
:disabled="!currentUser.commentsCount"
v-model="formData.deleteComments"
>
{{ $t('settings.delete.countComments', { count: currentUser.commentsCount }) }}
</b-checkbox>
</div>
</div>
<div class="message is-danger">
<div class="message-body" v-html="$t('settings.delete.accountWarning')"></div>
</div>
</div>
</transition>
</ds-container>
<template slot="footer">
<ds-container>
<ds-flex> <ds-flex>
<ds-flex-item width="50%"> <ds-flex-item width="40%">
<ds-select <div class="columns is-mobile">
v-model="accept" <div class="column">
:options="['', 'I really want to delete my account']" <b-switch type="is-danger" v-model="deleteEnabled"></b-switch>
@input="enableDeletion" </div>
placeholder="Are you sure you want to delete your account?" </div>
/>
</ds-flex-item> </ds-flex-item>
<ds-flex-item width="10%" /> <ds-flex-item width="20%" />
<ds-flex-item> <ds-flex-item>
<ds-button icon="trash" danger :disabled="disabled"> <ds-button icon="trash" danger :disabled="isLoading || !deleteEnabled">
{{ $t('settings.delete.name') }} {{ $t('settings.delete.name') }}
</ds-button> </ds-button>
</ds-flex-item> </ds-flex-item>
</ds-flex> </ds-flex>
</ds-section> </ds-container>
</ds-form> </template>
</ds-card> </ds-card>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
export default { export default {
name: 'DeleteAccount', name: 'DeleteAccount',
data() { data() {
return { return {
formData: {}, formData: {
accept: null, deleteContributions: false,
disabled: true, deleteComments: false,
},
deleteEnabled: false,
isLoading: false,
countPosts: 0,
countComments: 0,
} }
}, },
computed: {
...mapGetters({
currentUser: 'auth/user',
}),
},
methods: { methods: {
enableDeletion() { enableDeletion() {
if (this.accept === 'I really want to delete my account') { if (this.accept === 'I really want to delete my account') {

View File

@ -74,7 +74,11 @@
"name": "Download Data" "name": "Download Data"
}, },
"delete": { "delete": {
"name": "Delete my User Account" "name": "Delete my User Account",
"countPosts": "Delete my {count} posts",
"countComments": "Delete my {count} comments",
"accountDescription": "Be aware that your Post and Comments are important to our community. If you still choose to delete those you have to mark them below.",
"accountWarning": "You <b>CAN'T MANAGE</b> and <b>CAN'T RECOVER</b> your Account, Posts... after deleting your account!"
}, },
"organizations": { "organizations": {
"name": "My Organizations" "name": "My Organizations"

View File

@ -81,6 +81,7 @@ module.exports = {
{ src: '~/plugins/v-tooltip.js', ssr: false }, { src: '~/plugins/v-tooltip.js', ssr: false },
{ src: '~/plugins/izi-toast.js', ssr: false }, { src: '~/plugins/izi-toast.js', ssr: false },
{ src: '~/plugins/vue-filters.js' }, { src: '~/plugins/vue-filters.js' },
{ src: '~/plugins/buefy.js' },
], ],
router: { router: {

View File

@ -57,6 +57,7 @@
"accounting": "~0.4.1", "accounting": "~0.4.1",
"apollo-cache-inmemory": "~1.5.1", "apollo-cache-inmemory": "~1.5.1",
"apollo-client": "~2.6.1", "apollo-client": "~2.6.1",
"buefy": "^0.7.7",
"cookie-universal-nuxt": "~2.0.14", "cookie-universal-nuxt": "~2.0.14",
"cross-env": "~5.2.0", "cross-env": "~5.2.0",
"date-fns": "2.0.0-alpha.29", "date-fns": "2.0.0-alpha.29",

12
webapp/plugins/buefy.js Normal file
View File

@ -0,0 +1,12 @@
import Vue from 'vue'
import Buefy from 'buefy'
import 'buefy/dist/buefy.css'
Vue.use(Buefy, {
defaultIconPack: 'fa',
defaultTooltipAnimated: true,
defaultTooltipType: 'is-black',
defaultToastDuration: 6000,
defaultSnackbarDuration: 5000,
defaultNoticeQueue: true,
})

View File

@ -79,6 +79,8 @@ export const actions = {
role role
about about
locationName locationName
contributionsCount
commentsCount
socialMedia { socialMedia {
id id
url url

View File

@ -2689,6 +2689,13 @@ bser@^2.0.0:
dependencies: dependencies:
node-int64 "^0.4.0" node-int64 "^0.4.0"
buefy@^0.7.7:
version "0.7.7"
resolved "https://registry.yarnpkg.com/buefy/-/buefy-0.7.7.tgz#0e0dea84e776959bf2c23110541d67a94eaaa1de"
integrity sha512-UuPD+/749s6XzRL2INoJxykOygcBo1pVlLlSJ7wodY228LGOYsURXSkMrCxeemwhvWzSq/UJ+D8X9BkyIw6Tww==
dependencies:
bulma "0.7.5"
buffer-equal-constant-time@1.0.1: buffer-equal-constant-time@1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819"
@ -2723,6 +2730,11 @@ builtin-status-codes@^3.0.0:
resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8"
integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=
bulma@0.7.5:
version "0.7.5"
resolved "https://registry.yarnpkg.com/bulma/-/bulma-0.7.5.tgz#35066c37f82c088b68f94450be758fc00a967208"
integrity sha512-cX98TIn0I6sKba/DhW0FBjtaDpxTelU166pf7ICXpCCuplHWyu6C9LYZmL5PEsnePIeJaiorsTEzzNk3Tsm1hw==
busboy@^0.3.1: busboy@^0.3.1:
version "0.3.1" version "0.3.1"
resolved "https://registry.yarnpkg.com/busboy/-/busboy-0.3.1.tgz#170899274c5bf38aae27d5c62b71268cd585fd1b" resolved "https://registry.yarnpkg.com/busboy/-/busboy-0.3.1.tgz#170899274c5bf38aae27d5c62b71268cd585fd1b"