ConfigRightPanel.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <script setup lang="ts">
  2. import type { Config } from '@/api/config'
  3. import { useElementSize } from '@vueuse/core'
  4. import Basic from './Basic.vue'
  5. import Chat from './Chat.vue'
  6. interface ConfigRightPanelProps {
  7. addMode: boolean
  8. newPath: string
  9. modifiedAt: string
  10. origName: string
  11. }
  12. defineProps<ConfigRightPanelProps>()
  13. const data = defineModel<Config>('data', { required: true })
  14. const activeKey = ref('basic')
  15. // Get container height for Chat component
  16. const containerRef = ref<HTMLElement>()
  17. const { height: containerHeight } = useElementSize(containerRef)
  18. // Calculate chat height (container height - tabs nav height - padding)
  19. const chatHeight = computed(() => {
  20. const tabsNavHeight = 55
  21. const padding = 48 // top and bottom padding
  22. return `${containerHeight.value - tabsNavHeight - padding}px`
  23. })
  24. </script>
  25. <template>
  26. <div ref="containerRef" class="right-settings-container">
  27. <ACard
  28. class="right-settings"
  29. :bordered="false"
  30. >
  31. <ATabs
  32. v-model:active-key="activeKey"
  33. size="small"
  34. >
  35. <ATabPane key="basic" :tab="$gettext('Basic')">
  36. <Basic
  37. v-model:data="data"
  38. :add-mode
  39. :new-path
  40. :modified-at
  41. :orig-name
  42. />
  43. </ATabPane>
  44. <ATabPane key="chat" :tab="$gettext('Chat')">
  45. <Chat v-model:data="data" :chat-height />
  46. </ATabPane>
  47. </ATabs>
  48. </ACard>
  49. </div>
  50. </template>
  51. <style scoped lang="less">
  52. .right-settings-container {
  53. position: relative;
  54. .right-settings {
  55. position: relative;
  56. }
  57. :deep(.ant-tabs-nav) {
  58. margin: 0;
  59. height: 55px;
  60. padding: 0 24px;
  61. }
  62. }
  63. :deep(.ant-tabs-content) {
  64. padding-top: 24px;
  65. overflow-y: auto;
  66. }
  67. :deep(.ant-card) {
  68. box-shadow: unset;
  69. .ant-tabs-content {
  70. max-height: calc(100vh - 260px);
  71. }
  72. }
  73. </style>