ChatHeader.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <script setup lang="ts">
  2. import { type Theme } from '../../api/dto';
  3. interface Props {
  4. title: string;
  5. status: string;
  6. theme: Theme;
  7. }
  8. interface Emits {
  9. (e: 'toggle-theme'): void;
  10. }
  11. const props = defineProps<Props>();
  12. defineEmits<Emits>();
  13. </script>
  14. <template>
  15. <header class="chat-header">
  16. <div class="chat-title">
  17. <h2>{{ title }}</h2>
  18. <span class="chat-status">{{ status === 'active' ? '进行中' : '已完成' }}</span>
  19. </div>
  20. <!-- <button
  21. class="theme-toggle-btn"
  22. :title="theme === 'dark' ? '切换到亮色模式' : '切换到暗色模式'"
  23. @click="$emit('toggle-theme')"
  24. >
  25. <svg v-if="theme === 'dark'" width="20" height="20" viewBox="0 0 20 20" fill="none">
  26. <circle cx="10" cy="10" r="4" stroke="currentColor" stroke-width="2"/>
  27. <path d="M10 2V4M10 16V18M18 10H16M4 10H2M15.66 15.66L14.24 14.24M5.76 5.76L4.34 4.34M15.66 4.34L14.24 5.76M5.76 14.24L4.34 15.66" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
  28. </svg>
  29. <svg v-else width="20" height="20" viewBox="0 0 20 20" fill="none">
  30. <path d="M10 18C13.866 18 17 14.866 17 11C17 7.13401 13.866 4 10 4C10 4 10 4 10 4C6.13401 4 3 7.13401 3 11C3 14.866 6.13401 18 10 18Z" stroke="currentColor" stroke-width="2"/>
  31. <path d="M10 4V2" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
  32. <path d="M10 18V16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
  33. <path d="M15.66 6.34L14.24 4.92" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
  34. <path d="M4.34 15.66L5.76 14.24" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
  35. <path d="M18 11H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
  36. <path d="M4 11H2" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
  37. <path d="M15.66 15.66L14.24 14.24" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
  38. <path d="M4.34 6.34L5.76 4.92" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
  39. </svg>
  40. </button> -->
  41. </header>
  42. </template>
  43. <style scoped lang="less">
  44. .chat-header {
  45. padding: 6px 24px;
  46. border-bottom: 1px solid @cb-vscode-panel-border;
  47. background-color: @cb-vscode-editor-background;
  48. display: flex;
  49. justify-content: space-between;
  50. align-items: center;
  51. transition: background-color 0.3s, border-color 0.3s;
  52. }
  53. .chat-title h2 {
  54. font-size: 18px;
  55. font-weight: 600;
  56. margin-bottom: 4px;
  57. color: @cb-text-primary;
  58. }
  59. .chat-status {
  60. font-size: 12px;
  61. color: @cb-text-secondary;
  62. background-color: @cb-vscode-input-background;
  63. padding: 2px 8px;
  64. border-radius: 4px;
  65. }
  66. .theme-toggle-btn {
  67. width: 36px;
  68. height: 36px;
  69. background-color: @cb-vscode-input-background;
  70. color: @cb-text-primary;
  71. border: 1px solid @cb-vscode-widget-border;
  72. border-radius: 6px;
  73. display: flex;
  74. align-items: center;
  75. justify-content: center;
  76. cursor: pointer;
  77. transition: all 0.2s;
  78. flex-shrink: 0;
  79. }
  80. .theme-toggle-btn:hover {
  81. background-color: @cb-vscode-list-hoverBackground;
  82. border-color: @cb-accent;
  83. }
  84. .theme-toggle-btn svg {
  85. color: @cb-text-primary;
  86. transition: transform 0.3s;
  87. }
  88. .theme-toggle-btn:hover svg {
  89. transform: rotate(180deg);
  90. }
  91. </style>