Skip to content

Commit

Permalink
feat: clear storage button
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Feb 15, 2024
1 parent 056ce1d commit 3fb20ca
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/app-frontend/src/assets/style/index.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ html, body, #app {

/* Buttons */

.vue-ui-button:not(.flat):not(.vue-ui-dropdown-button) {
.vue-ui-button:not(.flat):not(.vue-ui-dropdown-button):not(.primary):not(.secondary):not(.danger) {
@apply dark:bg-gray-700 dark:hover:!bg-gray-600;
}

Expand Down
34 changes: 34 additions & 0 deletions packages/app-frontend/src/features/settings/GlobalSettings.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { ref } from 'vue'
import { useLocalStorage } from '@vueuse/core'
import { clearStorage } from '@vue-devtools/shared-utils'
import { supportsScreenshot } from '../timeline/composable/screenshot'
type Tab = 'global' | 'components' | 'timeline'
Expand All @@ -10,6 +11,8 @@ const tab = ref<Tab>('global')
const hideAppSelector = useLocalStorage('split-pane-collapsed-left-app-select-pane', false)
const hideTimelineCanvas = useLocalStorage('split-pane-collapsed-left-timeline-right', false)
const hideEvents = useLocalStorage('split-pane-collapsed-right-timeline-right', false)
const confirmClearStorage = ref(false)
</script>

<template>
Expand Down Expand Up @@ -98,6 +101,12 @@ const hideEvents = useLocalStorage('split-pane-collapsed-right-timeline-right',
<VueSwitch v-model="$shared.debugInfo">
Enable
</VueSwitch>

<VueButton
@click="confirmClearStorage = true"
>
Clear storage
</VueButton>
</VueFormField>
</div>

Expand Down Expand Up @@ -197,6 +206,31 @@ const hideEvents = useLocalStorage('split-pane-collapsed-right-timeline-right',
</VueSwitch>
</VueFormField>
</div>

<VueModal
v-if="confirmClearStorage"
title="Clear storage"
@close="confirmClearStorage = false"
>
<div class="p-6 space-y-6">
<p>
Are you sure you want to clear all storage?
</p>
<div class="flex justify-end gap-2">
<VueButton
@click="confirmClearStorage = false"
>
Cancel
</VueButton>
<VueButton
class="danger"
@click="clearStorage();confirmClearStorage = false"
>
Clear
</VueButton>
</div>
</div>
</VueModal>
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default defineComponent({
const rootElement = ref<HTMLElement | null>(null)
onMounted(async () => {
await nextTick()
rootElement.value.focus()
rootElement.value?.focus()
})
useDisableScroll()
Expand Down

0 comments on commit 3fb20ca

Please sign in to comment.