Skip to content

Commit

Permalink
Merge pull request #7555 from hassnian/nuxt/issue-004
Browse files Browse the repository at this point in the history
fix: minting Settings not persistent after page refresh or navigating around the page
  • Loading branch information
preschian authored Oct 10, 2023
2 parents 6f48e0a + 2074dbe commit 611203b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions components/settings/Minting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
{{ $t('Minting Settings') }}
</div>
<div class="py-2 is-flex">
<Support :value="hasSupport" :show-price="false" />
<Support v-model="hasSupport" :show-price="false" />
<NeoTooltip :label="$t('support.tooltip')" position="bottom" multiline>
<NeoIcon icon="info-circle" />
</NeoTooltip>
</div>
<div class="py-2 is-flex">
<Support
:value="hasCarbonOffset"
v-model="hasCarbonOffset"
:price="1"
:active-message="$t('carbonOffset.carbonOffsetYes')"
:passive-message="$t('carbonOffset.carbonOffsetNo')" />
Expand Down
19 changes: 9 additions & 10 deletions components/shared/Support.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<NeoSwitch v-model="model" :type="type" :rounded="false">
<div class="is-flex is-align-items-center">
<span class="mr-2">
{{ value ? `${$t(activeMessage)}${priceString}` : $t(passiveMessage) }}
{{
modelValue ? `${$t(activeMessage)}${priceString}` : $t(passiveMessage)
}}
</span>
<slot name="tooltip" />
</div>
Expand All @@ -15,12 +17,12 @@ import { NeoSwitch } from '@kodadot1/brick'
const props = withDefaults(
defineProps<{
value: boolean
modelValue: boolean
showPrice?: boolean
price?: number
activeMessage: string
passiveMessage: string
type: string
activeMessage?: string
passiveMessage?: string
type?: string
}>(),
{
showPrice: true,
Expand All @@ -30,10 +32,7 @@ const props = withDefaults(
type: '',
},
)
const emit = defineEmits(['input'])
const model = useVModel(props, 'modelValue')
const priceString = ref(props.showPrice ? ` ($ ${round(props.price)})` : '')
const model = computed({
get: () => props.value,
set: (value: boolean) => emit('input', value),
})
</script>

0 comments on commit 611203b

Please sign in to comment.