Skip to content

Commit 66e59ae

Browse files
committed
fix: improve UI layout of pages tab
1 parent c930126 commit 66e59ae

5 files changed

Lines changed: 32 additions & 26 deletions

File tree

packages/devtools-ui-kit/src/components/NTextInput.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const props = withDefaults(
1616
type: 'text',
1717
},
1818
)
19+
1920
const emit = defineEmits<{ (...args: any): void }>()
2021
const input = useVModel(props, 'modelValue', emit, { passive: true })
2122
</script>

packages/devtools/client/components/RoutesTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function getMiddlewarePath(name: any) {
6464
v-text="'active'"
6565
/>
6666
<NBadge
67-
v-if="matchedPending.find(m => m.name === item.name)"
67+
v-else-if="matchedPending.find(m => m.name === item.name)"
6868
n="teal"
6969
title="next"
7070
v-text="'next'"

packages/devtools/client/composables/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function useClient() {
88
return useState<NuxtDevtoolsHostClient>('devtools-client')
99
}
1010

11-
export function useClientRoute() {
11+
export function useClientRoute(): ComputedRef<ReturnType<typeof useRoute>> {
1212
const client = useClient()
1313
return computed(() => client.value?.nuxt.vueApp.config.globalProperties?.$route)
1414
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script setup lang="ts">
2+
definePageMeta({
3+
layout: 'none',
4+
})
5+
</script>
6+
7+
<template>
8+
<div h-screen w-screen bg-black />
9+
</template>

packages/devtools/client/pages/modules/pages.vue

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script setup lang="ts">
2-
import { nextTick } from 'vue'
3-
42
definePageMeta({
53
icon: 'carbon-tree-view-alt',
64
title: 'Pages',
@@ -20,21 +18,15 @@ const layouts = useLayouts()
2018
2119
const routes = useMergedRouteList()
2220
23-
const middleware = computed(() => {
24-
return serverApp.value?.middleware || []
25-
})
26-
21+
const middleware = computed(() => serverApp.value?.middleware || [])
2722
const routeInput = ref('')
2823
29-
until(route).toBeTruthy().then((v) => {
30-
routeInput.value = v.path
31-
})
24+
onMounted(() => {
25+
if (route.value)
26+
routeInput.value = route.value.path
3227
33-
until(router).toBeTruthy().then((v) => {
34-
v.afterEach(() => {
35-
nextTick(() => {
36-
routeInput.value = route.value.path
37-
})
28+
router.value?.afterEach((to) => {
29+
routeInput.value = to.fullPath
3830
})
3931
})
4032
@@ -44,13 +36,12 @@ async function navigate() {
4436
}
4537
4638
const routeInputMatched = computed(() => {
47-
if (routeInput.value === route.value.path)
48-
return []
4939
return router.value.resolve(routeInput.value || '/').matched
5040
})
5141
5242
function navigateToRoute(path: string) {
5343
router.value.push(path)
44+
routeInput.value = path
5445
}
5546
</script>
5647

@@ -85,18 +76,23 @@ function navigateToRoute(path: string) {
8576
</div>
8677
</div>
8778
<NSectionBlock
88-
v-if="routeInputMatched.length"
8979
icon="carbon-tree-view"
9080
text="Matched Routes"
9181
:padding="false"
9282
>
93-
<RoutesTable
94-
:pages="routeInputMatched"
95-
:layouts="layouts || []"
96-
:matched="[]"
97-
:matched-pending="routeInputMatched"
98-
@navigate="navigateToRoute"
99-
/>
83+
<div min-h-14>
84+
<RoutesTable
85+
v-if="routeInputMatched.length"
86+
:pages="routeInputMatched"
87+
:layouts="layouts || []"
88+
:matched="route.matched"
89+
:matched-pending="routeInputMatched"
90+
@navigate="navigateToRoute"
91+
/>
92+
<div v-else class="py-4 text-center">
93+
<span op50>No routes matched</span>
94+
</div>
95+
</div>
10096
</NSectionBlock>
10197
<NSectionBlock
10298
icon="carbon-tree-view-alt"

0 commit comments

Comments
 (0)