Skip to content

Commit cd6d1ed

Browse files
authored
Merge pull request #127 from iceljc/features/refine-chat-window
add log tab
2 parents 5de1edb + 7a4330f commit cd6d1ed

File tree

12 files changed

+327
-111
lines changed

12 files changed

+327
-111
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<script>
2+
3+
/** @type {string} */
4+
export let id = "nav-bar";
5+
6+
/** @type {string} */
7+
export let role = "tablist";
8+
9+
/** @type {string} */
10+
export let containerClasses = "";
11+
12+
/** @type {string} */
13+
export let containerStyles = "";
14+
15+
/** @type {boolean} */
16+
export let disableDefaultStyles = false;
17+
</script>
18+
19+
<ul
20+
class="{disableDefaultStyles ? '' : 'nav nav-tabs nav-container'} {containerClasses}"
21+
style={`${containerStyles}`}
22+
id={id}
23+
role={role}
24+
>
25+
<slot />
26+
</ul>
27+
28+
<style>
29+
.nav-container {
30+
height: 100%;
31+
}
32+
</style>
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<script>
2+
3+
/** @type {string} */
4+
export let containerClasses = "";
5+
6+
/** @type {string} */
7+
export let containerStyles = "";
8+
9+
/** @type {boolean} */
10+
export let disableDefaultContainerStyles = false;
11+
12+
/** @type {string} */
13+
export let containerRole = "presentation";
14+
15+
/** @type {string} */
16+
export let containerId = "nav-item";
17+
18+
/** @type {string} */
19+
export let navBtnClasses = "";
20+
21+
/** @type {string} */
22+
export let navBtnStyles = "";
23+
24+
/** @type {boolean} */
25+
export let disableDefaultNavBtnStyles = false;
26+
27+
/** @type {string} */
28+
export let navBtnRole = "tab";
29+
30+
/** @type {string} */
31+
export let navBtnId = "nav-item-id";
32+
33+
/** @type {string} */
34+
export let navBtnText;
35+
36+
/** @type {boolean} */
37+
export let active = false;
38+
39+
/** @type {boolean} */
40+
export let disabled = false;
41+
42+
/** @type {string} */
43+
export let dataBsToggle = "tab";
44+
45+
/** @type {string} */
46+
export let dataBsTarget = "#nav-item-pane";
47+
48+
/** @type {string} */
49+
export let ariaControls = "nav-item-tab-pane";
50+
51+
/** @type {() => void} */
52+
export let onClick = () => {};
53+
54+
/** @param {any} e */
55+
function handleTabClick(e) {
56+
e.preventDefault();
57+
onClick?.();
58+
}
59+
</script>
60+
61+
<li
62+
class="{disableDefaultContainerStyles ? '' : 'nav-item tab-item'} {containerClasses}"
63+
style={`${containerStyles}`}
64+
id={containerId}
65+
role={containerRole}
66+
>
67+
<button
68+
class="{disableDefaultNavBtnStyles ? '' : 'nav-link tab-btn'} {navBtnClasses}"
69+
class:active={active}
70+
style={`${navBtnStyles}`}
71+
id={navBtnId}
72+
type="button"
73+
role={navBtnRole}
74+
data-bs-toggle={dataBsToggle}
75+
data-bs-target={dataBsTarget}
76+
aria-controls={ariaControls}
77+
aria-selected={`${active ? "true" : "false"}`}
78+
disabled={disabled}
79+
on:click={(e) => handleTabClick(e)}
80+
>
81+
{navBtnText}
82+
</button>
83+
</li>
84+
85+
<style>
86+
.tab-item {
87+
flex: 0 1 50%;
88+
}
89+
90+
.tab-btn {
91+
width: 100%;
92+
height: 100%;
93+
border: none !important;
94+
color: white !important;
95+
background-color: var(--bs-secondary);
96+
font-weight: 500;
97+
font-size: 1.2em;
98+
}
99+
100+
.tab-btn.active {
101+
background-color: var(--bs-primary) !important;
102+
}
103+
</style>

src/lib/helpers/types.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ IRichContent.prototype.text;
302302
*/
303303

304304
/**
305-
* @typedef {Object} StateChangeModel
305+
* @typedef {Object} MessageStateLogModel
306306
* @property {string} conversation_id - The conversation id.
307307
* @property {string} message_id - The message id.
308308
* @property {string} before_value - The value before change.
@@ -315,7 +315,7 @@ IRichContent.prototype.text;
315315
*/
316316

317317
/**
318-
* @typedef {Object} AgentQueueChangedModel
318+
* @typedef {Object} AgentQueueLogModel
319319
* @property {string} conversation_id - The conversation id.
320320
* @property {string} log - The log content.
321321
* @property {Date} created_at - The log sent time.
@@ -416,14 +416,14 @@ IRichContent.prototype.text;
416416
* Conversation state change log
417417
*
418418
* @callback OnStateChangeGenerated
419-
* @param {StateChangeModel} log
419+
* @param {MessageStateLogModel} log
420420
*/
421421

422422
/**
423423
* Agent queue changed log
424424
*
425425
* @callback OnAgentQueueChanged
426-
* @param {AgentQueueChangedModel} log
426+
* @param {AgentQueueLogModel} log
427427
*/
428428

429429
/**

src/lib/scss/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ File: Main Css File
9191

9292
// Common
9393
@import "custom/common/animation";
94+
@import "custom/common/display";
9495

9596
//RTL
9697
// @import "custom/rtl/bootstrap-rtl";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.hide {
2+
display: none !important;
3+
}

src/lib/scss/custom/pages/_chat.scss

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,20 @@
343343
.chat-log {
344344
height: 100vh;
345345

346+
.log-flex {
347+
display: flex;
348+
flex-direction: column;
349+
height: 100%;
350+
}
351+
352+
.log-header {
353+
flex: 5%;
354+
}
355+
356+
.log-content {
357+
flex: 90%
358+
}
359+
346360
.padding-side {
347361
padding-left: 20px;
348362
padding-right: 20px;
@@ -361,28 +375,6 @@
361375
position: sticky;
362376
display: flex;
363377
justify-content: space-between;
364-
height: 7vh;
365-
}
366-
367-
.state-log-section {
368-
height: 90vh;
369-
}
370-
371-
.content-log-list {
372-
height: 90vh;
373-
}
374-
375-
.state-change-log-list {
376-
height: 100%;
377-
}
378-
379-
.state-log-list {
380-
height: 100%;
381-
padding-top: 10px;
382-
}
383-
384-
.queue-change-log-list {
385-
width: 100%;
386378
}
387379

388380
.log-list {
@@ -436,6 +428,7 @@
436428
.state-change-container {
437429
margin-top: 0px;
438430
margin-bottom: 5px;
431+
padding-left: 10px;
439432

440433
.state-key {
441434
color: var(--bs-primary);
@@ -463,10 +456,11 @@
463456
.queue-change-container {
464457
margin-top: 0px;
465458
margin-bottom: 0px;
459+
padding: 0px 10px;
466460

467461
.log-content {
468462
text-align: center;
469-
font-size: 14px;
463+
font-size: 18px;
470464
margin-top: 2px;
471465
margin-bottom: 2px;
472466
}

0 commit comments

Comments
 (0)