You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

preferences.vue 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <div class="settings-fields">
  3. <PageHeader>
  4. <h2 class="title">
  5. <span class="icon"><font-awesome-icon icon="sliders-h" /></span>
  6. <span>Photo Preferences</span>
  7. </h2>
  8. <h3 class="subtitle">
  9. Default preferences for new photos.
  10. <AppTip tooltip="You can change these options individually in each photo." />
  11. </h3>
  12. <template v-slot:right>
  13. <button class="button button--danger" @click="reset()">
  14. <span>Reset</span>
  15. </button>
  16. </template>
  17. </PageHeader>
  18. <AppNotification v-if="value$.preferences.mode === 3" name="advanced-mode" class="notification--info">
  19. <span class="icon"><font-awesome-icon icon="exclamation-triangle" /></span>
  20. <span>Custom masks mode is recommended only for experienced users. <a href="https://dreamtime.tech/docs/guide/custom-masks/" target="_blank">Click here to visit the guide</a>.</span>
  21. </AppNotification>
  22. <SettingsPreferences v-model="value$.preferences" />
  23. </div>
  24. </template>
  25. <script>
  26. import { cloneDeep, merge } from 'lodash'
  27. import Swal from 'sweetalert2/dist/sweetalert2'
  28. import { VModel } from '~/mixins'
  29. export default {
  30. mixins: [VModel],
  31. methods: {
  32. async reset() {
  33. const response = await Swal.fire({
  34. title: 'Are you sure?',
  35. text: 'This will set all options in this section to their default values.',
  36. icon: 'warning',
  37. showCancelButton: true,
  38. confirmButtonColor: '#F44336',
  39. confirmButtonText: 'Yes',
  40. })
  41. if (!response.value) {
  42. return
  43. }
  44. // eslint-disable-next-line no-underscore-dangle
  45. const settings = cloneDeep($provider.settings._default.preferences)
  46. delete settings.advanced.device
  47. this.value$.preferences = merge(this.value$.preferences, settings)
  48. window.$redirect('/')
  49. },
  50. },
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. .title {
  55. @apply text-white text-lg font-bold mb-4 mt-0;
  56. }
  57. </style>