666ghj commited on
Commit
597ea6f
·
1 Parent(s): 36774e4

Enhance Step5Interaction component with updated UI elements and improved functionality

Browse files

- Added an action bar icon and adjusted layout for better visual appeal and usability.
- Updated button labels to Chinese for improved localization.
- Introduced a new method for selecting the survey tab, enhancing user interaction.
- Adjusted CSS styles for better responsiveness and alignment of elements within the action bar and dropdowns.

frontend/src/components/Step5Interaction.vue CHANGED
@@ -79,10 +79,15 @@
79
  <div class="right-panel" ref="rightPanel">
80
  <!-- Unified Action Bar - Professional Design -->
81
  <div class="action-bar">
82
- <div class="action-bar-header">
 
 
 
 
83
  <span class="action-bar-title">Interactive Tools</span>
84
  <span class="action-bar-subtitle mono">{{ profiles.length }} agents available</span>
85
  </div>
 
86
  <div class="action-bar-tabs">
87
  <button
88
  class="tab-pill"
@@ -92,7 +97,7 @@
92
  <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2">
93
  <path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path>
94
  </svg>
95
- <span>Report Agent</span>
96
  </button>
97
  <div class="agent-dropdown" v-if="profiles.length > 0">
98
  <button
@@ -104,7 +109,7 @@
104
  <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
105
  <circle cx="12" cy="7" r="4"></circle>
106
  </svg>
107
- <span>{{ selectedAgent ? selectedAgent.username : 'Select Agent' }}</span>
108
  <svg class="dropdown-arrow" :class="{ open: showAgentDropdown }" viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2">
109
  <polyline points="6 9 12 15 18 9"></polyline>
110
  </svg>
@@ -129,13 +134,13 @@
129
  <button
130
  class="tab-pill survey-pill"
131
  :class="{ active: activeTab === 'survey' }"
132
- @click="activeTab = 'survey'"
133
  >
134
  <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2">
135
  <path d="M9 11l3 3L22 4"></path>
136
  <path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path>
137
  </svg>
138
- <span>Survey</span>
139
  </button>
140
  </div>
141
  </div>
@@ -418,9 +423,17 @@ const selectReportAgentChat = () => {
418
  chatHistory.value = []
419
  }
420
 
 
 
 
 
 
 
 
421
  const toggleAgentDropdown = () => {
422
  showAgentDropdown.value = !showAgentDropdown.value
423
  if (showAgentDropdown.value) {
 
424
  chatTarget.value = 'agent'
425
  }
426
  }
@@ -1110,10 +1123,21 @@ watch(() => props.simulationId, (newId) => {
1110
  }
1111
 
1112
  .action-bar-header {
 
 
 
 
 
 
 
 
 
 
 
 
1113
  display: flex;
1114
  flex-direction: column;
1115
  gap: 2px;
1116
- min-width: 140px;
1117
  }
1118
 
1119
  .action-bar-title {
@@ -1184,10 +1208,18 @@ watch(() => props.simulationId, (newId) => {
1184
  }
1185
 
1186
  .agent-pill {
1187
- min-width: 120px;
1188
  justify-content: space-between;
1189
  }
1190
 
 
 
 
 
 
 
 
 
1191
  .survey-pill {
1192
  background: #ECFDF5;
1193
  color: #047857;
@@ -1730,14 +1762,26 @@ watch(() => props.simulationId, (newId) => {
1730
  }
1731
 
1732
  .survey-setup {
 
 
 
1733
  padding: 24px;
1734
  border-bottom: 1px solid #E5E7EB;
 
1735
  }
1736
 
1737
  .setup-section {
1738
  margin-bottom: 24px;
1739
  }
1740
 
 
 
 
 
 
 
 
 
1741
  .setup-section:last-child {
1742
  margin-bottom: 0;
1743
  }
@@ -1765,9 +1809,10 @@ watch(() => props.simulationId, (newId) => {
1765
  display: grid;
1766
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
1767
  gap: 10px;
1768
- max-height: 200px;
1769
  overflow-y: auto;
1770
  padding: 4px;
 
1771
  }
1772
 
1773
  .agent-checkbox {
 
79
  <div class="right-panel" ref="rightPanel">
80
  <!-- Unified Action Bar - Professional Design -->
81
  <div class="action-bar">
82
+ <div class="action-bar-header">
83
+ <svg class="action-bar-icon" viewBox="0 0 24 24" width="28" height="28" fill="none" stroke="currentColor" stroke-width="1.5">
84
+ <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
85
+ </svg>
86
+ <div class="action-bar-text">
87
  <span class="action-bar-title">Interactive Tools</span>
88
  <span class="action-bar-subtitle mono">{{ profiles.length }} agents available</span>
89
  </div>
90
+ </div>
91
  <div class="action-bar-tabs">
92
  <button
93
  class="tab-pill"
 
97
  <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2">
98
  <path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path>
99
  </svg>
100
+ <span>Report Agent对话</span>
101
  </button>
102
  <div class="agent-dropdown" v-if="profiles.length > 0">
103
  <button
 
109
  <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
110
  <circle cx="12" cy="7" r="4"></circle>
111
  </svg>
112
+ <span>{{ selectedAgent ? selectedAgent.username : '与世界中任意个体对话' }}</span>
113
  <svg class="dropdown-arrow" :class="{ open: showAgentDropdown }" viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2">
114
  <polyline points="6 9 12 15 18 9"></polyline>
115
  </svg>
 
134
  <button
135
  class="tab-pill survey-pill"
136
  :class="{ active: activeTab === 'survey' }"
137
+ @click="selectSurveyTab"
138
  >
139
  <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2">
140
  <path d="M9 11l3 3L22 4"></path>
141
  <path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path>
142
  </svg>
143
+ <span>发送问卷调查到世界中</span>
144
  </button>
145
  </div>
146
  </div>
 
423
  chatHistory.value = []
424
  }
425
 
426
+ const selectSurveyTab = () => {
427
+ activeTab.value = 'survey'
428
+ selectedAgent.value = null
429
+ selectedAgentIndex.value = null
430
+ showAgentDropdown.value = false
431
+ }
432
+
433
  const toggleAgentDropdown = () => {
434
  showAgentDropdown.value = !showAgentDropdown.value
435
  if (showAgentDropdown.value) {
436
+ activeTab.value = 'chat'
437
  chatTarget.value = 'agent'
438
  }
439
  }
 
1123
  }
1124
 
1125
  .action-bar-header {
1126
+ display: flex;
1127
+ align-items: center;
1128
+ gap: 12px;
1129
+ min-width: 160px;
1130
+ }
1131
+
1132
+ .action-bar-icon {
1133
+ color: #1F2937;
1134
+ flex-shrink: 0;
1135
+ }
1136
+
1137
+ .action-bar-text {
1138
  display: flex;
1139
  flex-direction: column;
1140
  gap: 2px;
 
1141
  }
1142
 
1143
  .action-bar-title {
 
1208
  }
1209
 
1210
  .agent-pill {
1211
+ width: 200px;
1212
  justify-content: space-between;
1213
  }
1214
 
1215
+ .agent-pill span {
1216
+ flex: 1;
1217
+ overflow: hidden;
1218
+ text-overflow: ellipsis;
1219
+ white-space: nowrap;
1220
+ text-align: left;
1221
+ }
1222
+
1223
  .survey-pill {
1224
  background: #ECFDF5;
1225
  color: #047857;
 
1762
  }
1763
 
1764
  .survey-setup {
1765
+ flex: 1;
1766
+ display: flex;
1767
+ flex-direction: column;
1768
  padding: 24px;
1769
  border-bottom: 1px solid #E5E7EB;
1770
+ overflow: hidden;
1771
  }
1772
 
1773
  .setup-section {
1774
  margin-bottom: 24px;
1775
  }
1776
 
1777
+ .setup-section:first-child {
1778
+ flex: 1;
1779
+ display: flex;
1780
+ flex-direction: column;
1781
+ overflow: hidden;
1782
+ min-height: 0;
1783
+ }
1784
+
1785
  .setup-section:last-child {
1786
  margin-bottom: 0;
1787
  }
 
1809
  display: grid;
1810
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
1811
  gap: 10px;
1812
+ flex: 1;
1813
  overflow-y: auto;
1814
  padding: 4px;
1815
+ align-content: start;
1816
  }
1817
 
1818
  .agent-checkbox {