yt-chat-components 1.5.7 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,18 +5,29 @@ import styles from './index.module.css';
5
5
 
6
6
  const middleImgUrl = 'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/smartSchool/appCreator/school/bcyz/user/ai/guessYourWant.png';
7
7
  const bottomImgUrl = 'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/kai_yuan/byz/xinge.png';
8
+ const mobileCnxwImgUrl = 'https://trans-from-yuntu-resourse.oss-cn-beijing.aliyuncs.com/kai_yuan/common/cnxw.png';
8
9
 
9
- const TabSelector = ({ customUrl, handleRowClick, welcomeWords, isSimple, dataList = [] }) => {
10
+ const TabSelector = ({
11
+ customUrl,
12
+ handleRowClick,
13
+ welcomeWords,
14
+ isSimple,
15
+ dataList = [],
16
+ isMobile = false,
17
+ keyShowSize = 4,
18
+ isShowByPages = true,
19
+ agentName = '杏鸽',
20
+ agentUrl = '',
21
+ }) => {
10
22
  const [activeKey, setActiveKey] = useState();
11
23
  const [valuePage, setValuePage] = useState(0);
12
24
  const [tabLocation, setTabLocation] = useState(0);
13
25
  const valuesPerPage = 5; // Number of values to show per page
14
26
  const [pageLoading, setPageLoading] = useState(false);
15
- const keyShowSize = isSimple ? 2 : 4;
16
27
 
17
28
  const keys = dataList.map(e=>e.category)||[];
18
29
  const values = dataList.filter(e => activeKey === e.category).map(e => e.data)[0] || [];
19
- const visibleValues = isSimple ? values : values.slice(valuePage * valuesPerPage, (valuePage + 1) * valuesPerPage);
30
+ const visibleValues = !isShowByPages ? values : values.slice(valuePage * valuesPerPage, (valuePage + 1) * valuesPerPage);
20
31
 
21
32
  useEffect(() => {
22
33
  setActiveKey(dataList[0]?.category)
@@ -50,6 +61,94 @@ const TabSelector = ({ customUrl, handleRowClick, welcomeWords, isSimple, dataLi
50
61
  }, 500);
51
62
  };
52
63
 
64
+ if (isMobile){
65
+ return (
66
+ <ConfigProvider theme={{
67
+ components: {
68
+ Tabs: {
69
+ horizontalItemGutter:48,
70
+ }
71
+ }
72
+ }}>
73
+ <div className={styles.mainContainer} style={{ marginLeft: '0px' }}>
74
+ {
75
+ welcomeWords && (
76
+ <div className={styles.initHeader}>
77
+ <div className={styles.left}>
78
+ <img src={agentUrl} alt={''}/>
79
+ </div>
80
+ <div className={styles.right}>
81
+ <div className={styles.tips}>Hi~ 我是{agentName}!</div>
82
+ <div className={styles.tipContent}>{welcomeWords}</div>
83
+ </div>
84
+ </div>
85
+ )
86
+ }
87
+ <div
88
+ className={styles.tabSelector}
89
+ style={{ width: "auto", height: '100%', flexDirection: 'column', marginTop: '20px' }}
90
+ >
91
+ {
92
+ <div className={styles.leftPanelMobile}>
93
+ <div className={styles.left}>
94
+ <img src={mobileCnxwImgUrl} alt="Icon"/>
95
+ 猜你想问
96
+ </div>
97
+ <div className={styles.right} onClick={handleValuePageChange}>
98
+ <SyncOutlined spin={pageLoading} className={styles.icon}/>
99
+ <span>换一批</span>
100
+ </div>
101
+ </div>
102
+ }
103
+ <div className={styles.rightPanel}>
104
+ <div className={styles.tabHeaderMobile}
105
+ style={{ paddingLeft: '14px', paddingRight: '14px' }}
106
+ >
107
+ <Tabs
108
+ activeKey={activeKey}
109
+ onChange={handleTabChange}
110
+ className={styles.headerTabs}
111
+ tabBarGutter={20}
112
+ indicator={{size: 15}}
113
+ tabBarStyle={{
114
+ borderBottom: 'transparent !important',
115
+ }}
116
+ renderTabBar={(props, DefaultTabBar) => {
117
+ console.log(" " , activeKey , props.activeKey)
118
+ return (
119
+ <div className={props.activeKey === activeKey ? styles.tabBarActive : styles.tabBar}>
120
+ <DefaultTabBar {...props} style={{ marginBottom: '0px' }}/>
121
+ </div>
122
+ );
123
+ }}
124
+ >
125
+ {keys.map((key) => (
126
+ <Tabs.TabPane tab={key} key={key}/>
127
+ ))}
128
+ </Tabs>
129
+ </div>
130
+ <div className={styles.valueList}>
131
+ {visibleValues.map((item, index) => {
132
+ return (<div className={styles.row} style={{backgroundColor:'#F3F8FF', marginBottom:'10px'}} key={index} onClick={() => handleRowClick(item.q)}>
133
+ <Typography.Paragraph
134
+ className={styles.text}
135
+ ellipsis={{ rows: 1, }}>
136
+ {item.q}
137
+ </Typography.Paragraph>
138
+ <RightOutlined
139
+ className={styles.rightArrow}
140
+ style={{ float: 'right' }}
141
+ />
142
+ </div>)
143
+ })}
144
+ </div>
145
+ </div>
146
+ </div>
147
+ </div>
148
+ </ConfigProvider>
149
+ );
150
+ }
151
+
53
152
  return (
54
153
  <ConfigProvider theme={{
55
154
  components: {
@@ -1,6 +1,40 @@
1
1
  .mainContainer {
2
2
  flex: 1;
3
3
  overflow-y: auto;
4
+ .initHeader{
5
+ width: 100%;
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: flex-start;
9
+ .left{
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ width: 60px;
14
+ min-width: 60px;
15
+ height: 60px;
16
+ background-color: #1473FF;
17
+ border: 3px solid #FFFFFF;
18
+ border-radius: 50%;
19
+ overflow: hidden;
20
+ margin-right: 5px;
21
+ img{
22
+ width: 50px;
23
+ }
24
+ }
25
+ .right{
26
+
27
+ .tips{
28
+ font-weight: bold;
29
+ font-size: 18px;
30
+ }
31
+
32
+ .tipContent{
33
+ font-size: 16px;
34
+ }
35
+
36
+ }
37
+ }
4
38
  .welcome {
5
39
  background: #FFFFFF;
6
40
  border-radius: 8px 8px 8px 0px;
@@ -13,6 +47,47 @@
13
47
  z-index: 2 !important;
14
48
  font-size: 16px;
15
49
  }
50
+ .leftPanelMobile {
51
+ display: flex;
52
+ height: 50px;
53
+ flex-direction: row;
54
+ align-items: center;
55
+ justify-content: space-between;
56
+ padding: 10px 15px;
57
+ font-size: 12px;
58
+ color: #FFFFFF;
59
+ overflow: hidden;
60
+ position: relative;
61
+ background: linear-gradient(-78deg, #DBEFFF 0%, #1573FF 100%);
62
+ border-radius: 12px 12px 0px 0px;
63
+
64
+ .left {
65
+ font-size: 18px;
66
+ display: flex;
67
+ flex-direction: row;
68
+ align-items: center;
69
+ justify-content: center;
70
+ img{
71
+ width: 16px;
72
+ margin-right: 8px;
73
+ }
74
+ }
75
+
76
+ .right {
77
+ display: flex;
78
+ flex-direction: row;
79
+ justify-content: center;
80
+ align-items: center;
81
+ font-size: 14px;
82
+ color: #1572FF;
83
+ .icon{
84
+ padding: 8px;
85
+ background: rgba(255, 255, 255, 0.1);
86
+ border-radius: 32px;
87
+ }
88
+ }
89
+ }
90
+
16
91
  .tabSelector {
17
92
  display: flex;
18
93
  border-radius: 9px;
@@ -58,6 +133,46 @@
58
133
  flex-direction: column;
59
134
  }
60
135
 
136
+ .tabHeaderMobile{
137
+ display: flex;
138
+ align-items: center;
139
+ justify-content: space-between;
140
+ color: #030303;
141
+
142
+ .headerTabs{
143
+ width: 100%;
144
+
145
+ .ant-tabs-nav {
146
+ border-bottom: none !important;
147
+ }
148
+ }
149
+ .ant-tabs-nav {
150
+ border-bottom: none !important;
151
+ }
152
+
153
+ .tabBar{
154
+ font-weight: normal;
155
+ }
156
+ .tabBarActive{
157
+ font-weight: 500;
158
+ }
159
+
160
+ .simpleHeader{
161
+ display: flex;
162
+ justify-content: space-evenly;
163
+ flex: 1;
164
+ .simplyRow{
165
+ padding: 5px 10px;
166
+ font-size: 14px;
167
+ border-radius: 6px;
168
+ cursor: pointer;
169
+ }
170
+ .simplyRow:hover{
171
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
172
+ }
173
+ }
174
+ }
175
+
61
176
  .tabHeader {
62
177
  display: flex;
63
178
  align-items: center;
@@ -36,7 +36,7 @@ export class LogoBtn extends React.Component {
36
36
  isTitleSideIcon,
37
37
  dropManUrl,
38
38
  isShowUploadButton,
39
- isShowReadIcon,
39
+ isShowReadIcon
40
40
  } = this.props;
41
41
  const iconConfig = {
42
42
  width: `${width || 100}px`,
@@ -786,6 +786,7 @@ export class MobileChatPage extends React.Component {
786
786
  tipTitle={tipTitle}
787
787
  tipContent={tipContent}
788
788
  isShowReadIcon={isShowReadIcon}
789
+ voice={currentFlow.call_voice}
789
790
  />
790
791
  </div>
791
792
  {