Skip to content

Commit 6108b17

Browse files
committed
feat: show the floating panel by default, close #717
1 parent 2bf439d commit 6108b17

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

packages/devtools/client/pages/index.vue

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
<script setup lang="ts">
22
import { definePageMeta } from '#imports'
33
import { ref } from 'vue'
4+
import { useClient } from '~/composables/client'
45
import { isFirstVisit } from '~/composables/storage'
6+
import { useDevToolsOptions } from '~/composables/storage-options'
57
import { telemetryEnabled } from '~/composables/telemetry'
6-
import { useDevToolsOptions } from '../composables/storage-options'
78
89
definePageMeta({
910
layout: 'none',
1011
})
1112
13+
const client = useClient()
1214
const telemetryModel = ref(true)
13-
const enableFloatPanel = ref(true)
1415
1516
const {
1617
showPanel,
1718
} = useDevToolsOptions('ui')
1819
1920
function visit() {
2021
telemetryEnabled.value = telemetryModel.value
21-
if (showPanel.value == null && enableFloatPanel.value)
22-
showPanel.value = true
2322
isFirstVisit.value = false
2423
}
24+
25+
function hideFloatingPanel() {
26+
showPanel.value = false
27+
client.value.devtools.close()
28+
}
2529
</script>
2630

2731
<template>
@@ -44,12 +48,12 @@ function visit() {
4448
<NButton to="/modules/overview" n="lg primary" @click="visit">
4549
<span>Get Started</span>
4650
</NButton>
51+
<NButton v-if="showPanel !== false" n="borderless orange" @click="hideFloatingPanel">
52+
<span>Always hide the floating panel</span>
53+
</NButton>
4754
</div>
4855
<div p4>
4956
<div flex="~ col gap-2" mxa>
50-
<NCheckbox v-if="showPanel == null" v-model="enableFloatPanel" n="green6">
51-
<span op50>Show floating panel from now on</span>
52-
</NCheckbox>
5357
<NCheckbox v-model="telemetryModel" n="green6">
5458
<span op50>Send anonymous statistics, help us improving DevTools</span>
5559
<NLink href="https://github.com/nuxt/devtools#anonymous-usage-analytics" target="_blank" ml1 op35 v-text="'Learn more'" />

packages/devtools/client/pages/settings.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ watchEffect(() => {
231231
</NCheckbox>
232232

233233
<NCheckbox v-model="showPanel" n-primary>
234-
<span>Always show the floating panel</span>
234+
<span>Show the floating panel</span>
235235
</NCheckbox>
236236

237237
<div mx--2 my1 h-1px border="b base" op75 />

packages/devtools/src/constant.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const defaultTabOptions: NuxtDevToolsOptions = {
3333
interactionCloseOnOutsideClick: false,
3434
showExperimentalFeatures: false,
3535
showHelpButtons: true,
36-
showPanel: null,
36+
showPanel: true,
3737
scale: 1,
3838
minimizePanelInactive: 5000,
3939
hiddenTabs: [],

packages/devtools/src/runtime/plugins/view/Main.vue

+2-9
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,7 @@ const panelMargins = reactive({
1919
})
2020
2121
const safeArea = useScreenSafeArea()
22-
2322
const isSafari = navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome')
24-
let isInit = true
25-
26-
watchEffect(() => {
27-
if (state.value.open)
28-
isInit = false
29-
})
3023
3124
watchEffect(() => {
3225
panelMargins.left = safeArea.left.value + 10
@@ -182,8 +175,8 @@ const isHidden = computed(() => {
182175
return false
183176
if (settings.ui.showPanel === false)
184177
return true
185-
// If not explicitly set, hide the panel on first load
186-
return isInit
178+
// If not explicitly set, show the panel
179+
return false
187180
})
188181
189182
const isMinimized = computed(() => {

0 commit comments

Comments
 (0)