PluginPanel.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <script setup lang="ts">
  2. import { type Plugin } from '../../api/dto';
  3. interface Props {
  4. plugins: Plugin[];
  5. show: boolean;
  6. }
  7. interface Emits {
  8. (e: 'toggle', pluginId: string): void;
  9. }
  10. const props = defineProps<Props>();
  11. defineEmits<Emits>();
  12. </script>
  13. <template>
  14. <div v-if="show" class="plugin-panel">
  15. <div class="plugin-list">
  16. <div v-for="plugin in plugins" :key="plugin.id" class="plugin-item">
  17. <div class="plugin-info">
  18. <span class="plugin-icon">{{ plugin.icon }}</span>
  19. <div class="plugin-details">
  20. <div class="plugin-name">{{ plugin.name }}</div>
  21. <div class="plugin-description">{{ plugin.description }}</div>
  22. </div>
  23. </div>
  24. <div class="plugin-actions">
  25. <span class="plugin-version">v{{ plugin.version }}</span>
  26. <button class="plugin-toggle" :class="{ enabled: plugin.enabled }" @click="$emit('toggle', plugin.id)">
  27. <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
  28. <path
  29. d="M3 7H11M3 7V5M3 7V9M11 7H13M11 7V5M11 7V9"
  30. stroke="currentColor"
  31. stroke-width="1.5"
  32. stroke-linecap="round"
  33. stroke-linejoin="round"
  34. />
  35. </svg>
  36. </button>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </template>
  42. <style scoped lang="less">
  43. .plugin-panel {
  44. padding: 8px;
  45. border-bottom: 1px solid @cb-vscode-panel-border;
  46. background-color: @cb-vscode-input-background;
  47. max-height: 300px;
  48. overflow-y: auto;
  49. }
  50. .plugin-list {
  51. display: flex;
  52. flex-direction: column;
  53. gap: 4px;
  54. }
  55. .plugin-item {
  56. display: flex;
  57. align-items: center;
  58. justify-content: space-between;
  59. padding: 10px 12px;
  60. background-color: @cb-vscode-sideBar-background;
  61. border-radius: 6px;
  62. transition: background-color 0.2s;
  63. }
  64. .plugin-item:hover {
  65. background-color: @cb-vscode-list-hoverBackground;
  66. }
  67. .plugin-info {
  68. display: flex;
  69. align-items: center;
  70. gap: 10px;
  71. flex: 1;
  72. }
  73. .plugin-icon {
  74. font-size: 18px;
  75. flex-shrink: 0;
  76. }
  77. .plugin-details {
  78. display: flex;
  79. flex-direction: column;
  80. gap: 2px;
  81. }
  82. .plugin-name {
  83. font-size: 13px;
  84. font-weight: 500;
  85. color: @cb-text-primary;
  86. }
  87. .plugin-description {
  88. font-size: 11px;
  89. color: @cb-text-secondary;
  90. }
  91. .plugin-actions {
  92. display: flex;
  93. align-items: center;
  94. gap: 8px;
  95. flex-shrink: 0;
  96. }
  97. .plugin-version {
  98. font-size: 11px;
  99. color: @cb-text-secondary;
  100. font-family: monospace;
  101. }
  102. .plugin-toggle {
  103. width: 28px;
  104. height: 20px;
  105. background-color: @cb-vscode-panel-border;
  106. border: none;
  107. border-radius: 10px;
  108. cursor: pointer;
  109. display: flex;
  110. align-items: center;
  111. justify-content: flex-start;
  112. padding: 2px;
  113. transition: background-color 0.2s;
  114. }
  115. .plugin-toggle.enabled {
  116. background-color: @cb-success;
  117. justify-content: flex-end;
  118. }
  119. .plugin-toggle svg {
  120. color: white;
  121. transition: transform 0.2s;
  122. }
  123. </style>