File size: 2,091 Bytes
4d70170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<script lang="ts">
import SplitPane from '@front/features/layout/SplitPane.vue'
import { computed, defineComponent, ref } from 'vue'
import PluginListItem from './PluginListItem.vue'
import PluginHome from './PluginHome.vue'

import { usePlugins } from '.'

export default defineComponent({
  components: {
    SplitPane,
    PluginListItem,
    PluginHome,
  },

  setup() {
    const { plugins } = usePlugins()

    const search = ref('')

    const filteredPlugins = computed(() => {
      if (search.value) {
        const reg = new RegExp(search.value, 'i')
        return plugins.value.filter(p => p.label.match(reg) != null)
      }
      return plugins.value
    })

    return {
      plugins: filteredPlugins,
      search,
    }
  },
})
</script>

<template>
  <div class="h-full">
    <PluginHome
      v-if="!plugins.length"
      no-plugins
    />
    <SplitPane
      v-else
      save-id="plugins"
      :default-split="30"
    >
      <template #left>
        <div class="h-full flex flex-col">
          <div class="flex-none flex items-center border-b border-gray-200 dark:border-gray-700">
            <VueInput
              v-model="search"
              icon-left="search"
              placeholder="Filter devtools plugins..."
              select-all
              class="flex-1 w-0 flat"
            />

            <VueButton
              :to="{
                name: 'global-settings',
              }"
              icon-left="settings"
              icon-right="arrow_forward"
              class="flat"
            >
              Settings
            </VueButton>
          </div>
          <div class="overflow-y-auto">
            <PluginListItem
              v-for="plugin of plugins"
              :key="plugin.id"
              :plugin="plugin"
            />
          </div>
        </div>
      </template>

      <template #right>
        <div class="h-full overflow-y-auto">
          <router-view />
        </div>
      </template>
    </SplitPane>
  </div>
</template>

<style scoped>
.vue-ui-icon :deep(svg) {
  fill: currentColor;
}
</style>