customer-module-frontend 1.0.1-beta.1 → 1.0.1-beta.2
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.
- package/dist/customer-module.css +1 -0
- package/dist/customer-module.js +29028 -0
- package/dist/customer-module.js.map +1 -0
- package/package.json +21 -2
- package/.cursor/rules/context.md +0 -306
- package/.cursor/rules/guardrails.md +0 -35
- package/.env +0 -1
- package/.github/workflows/publish-to-npm-beta.yml +0 -51
- package/.github/workflows/publish-to-npm.yml +0 -58
- package/eslint.config.js +0 -23
- package/index.html +0 -13
- package/postcss-unwrap-layers.js +0 -31
- package/postcss.config.js +0 -11
- package/src/App.css +0 -40
- package/src/App.tsx +0 -58
- package/src/assets/accounts.svg +0 -3
- package/src/assets/at_the_rate.svg +0 -10
- package/src/assets/buildings.svg +0 -3
- package/src/assets/chat.svg +0 -3
- package/src/assets/close.svg +0 -3
- package/src/assets/contacts.svg +0 -3
- package/src/assets/conversation.svg +0 -10
- package/src/assets/customers.svg +0 -10
- package/src/assets/details.svg +0 -3
- package/src/assets/domain.svg +0 -10
- package/src/assets/edit.svg +0 -15
- package/src/assets/email.svg +0 -3
- package/src/assets/google.svg +0 -8
- package/src/assets/inbox.svg +0 -0
- package/src/assets/message.svg +0 -3
- package/src/assets/no-data.svg +0 -9
- package/src/assets/open_in_a_new_tab.svg +0 -10
- package/src/assets/phone.svg +0 -3
- package/src/assets/react.svg +0 -1
- package/src/assets/search.svg +0 -3
- package/src/assets/search_typing.svg +0 -4
- package/src/assets/sm_contacts.svg +0 -3
- package/src/assets/sm_inbox.svg +0 -3
- package/src/assets/sm_slider.svg +0 -3
- package/src/assets/status-resolved.svg +0 -3
- package/src/assets/status-snoozed.svg +0 -4
- package/src/assets/status_open.svg +0 -1
- package/src/components/AccountContacts/index.tsx +0 -107
- package/src/components/AccountDetails/index.tsx +0 -102
- package/src/components/AccountsConversation/index.tsx +0 -75
- package/src/components/Avatar/constants.tsx +0 -45
- package/src/components/Avatar/index.tsx +0 -42
- package/src/components/BreadcrumbsSection/index.tsx +0 -16
- package/src/components/Card/index.tsx +0 -31
- package/src/components/Card/types.ts +0 -10
- package/src/components/ContactConversation/Converation.tsx +0 -14
- package/src/components/ContactConversation/index.tsx +0 -81
- package/src/components/ContactDetails/index.tsx +0 -111
- package/src/components/Contacts/EditContact.tsx +0 -213
- package/src/components/Contacts/constants/index.tsx +0 -24
- package/src/components/Contacts/index.tsx +0 -171
- package/src/components/ConversationBox/constants.tsx +0 -99
- package/src/components/ConversationBox/index.tsx +0 -147
- package/src/components/ConversationBox/types.ts +0 -20
- package/src/components/CustomersLayout/index.tsx +0 -20
- package/src/components/DetailsCard/index.tsx +0 -31
- package/src/components/DetailsCard/types.ts +0 -10
- package/src/components/EmptyData/NoDataFound.tsx +0 -31
- package/src/components/Header/index.tsx +0 -55
- package/src/components/Icon/index.tsx +0 -93
- package/src/components/Icon/types.ts +0 -13
- package/src/components/Listing/AccountTable.tsx +0 -47
- package/src/components/Listing/ContactTable.tsx +0 -76
- package/src/components/RightPanel/AccountPanel.tsx +0 -123
- package/src/components/RightPanel/ContactPanel.tsx +0 -142
- package/src/components/RightPanel/index.tsx +0 -167
- package/src/components/Search/SearchDialog.tsx +0 -150
- package/src/components/TabsSection/index.tsx +0 -49
- package/src/constants/index.tsx +0 -645
- package/src/hooks/useBreadcrumb.tsx +0 -93
- package/src/index.css +0 -315
- package/src/main.tsx +0 -14
- package/src/pages/AccountDetail.tsx +0 -68
- package/src/pages/Accounts.tsx +0 -12
- package/src/pages/ContactDetail.tsx +0 -55
- package/src/pages/Contacts.tsx +0 -12
- package/src/stores/count.tsx +0 -17
- package/src/types/index.ts +0 -0
- package/tailwind.config.js +0 -179
- package/tsconfig.app.json +0 -36
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -31
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type IconType = 'active' | 'inactive' | 'disabled';
|
|
2
|
-
|
|
3
|
-
export interface IconProps {
|
|
4
|
-
name: string;
|
|
5
|
-
size?: number;
|
|
6
|
-
type?: IconType;
|
|
7
|
-
folder?: string;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
color?: string;
|
|
10
|
-
fill?: string;
|
|
11
|
-
className?: string;
|
|
12
|
-
onClick?: (event: React.MouseEvent<HTMLSpanElement>) => void;
|
|
13
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { DataTable } from "hiver-ui-kit-extended";
|
|
2
|
-
import { accountData } from "../../constants/index";
|
|
3
|
-
import { useNavigate } from 'react-router-dom';
|
|
4
|
-
|
|
5
|
-
// Transform account results to table data
|
|
6
|
-
const tableData = accountData.data.results.map((account) => ({
|
|
7
|
-
id: account.id,
|
|
8
|
-
name: account.name,
|
|
9
|
-
domain: account.domains[0]?.name || account.generated_name,
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
const columns = [
|
|
13
|
-
{
|
|
14
|
-
id: "name",
|
|
15
|
-
field: "name",
|
|
16
|
-
label: "Account name",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
id: "domain",
|
|
20
|
-
field: "domain",
|
|
21
|
-
label: "Domain",
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
export default function AccountTable() {
|
|
26
|
-
|
|
27
|
-
const navigate = useNavigate();
|
|
28
|
-
|
|
29
|
-
const handleAccountClick = (event: any) => {
|
|
30
|
-
const data = event.data;
|
|
31
|
-
navigate(`/accounts/${data.id}`);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<div className="cm:px-12">
|
|
36
|
-
<DataTable
|
|
37
|
-
scrollable={true}
|
|
38
|
-
scrollHeight="32.75rem"
|
|
39
|
-
value={tableData}
|
|
40
|
-
columns={columns}
|
|
41
|
-
|
|
42
|
-
// @ts-ignore
|
|
43
|
-
onRowClick={handleAccountClick}
|
|
44
|
-
/>
|
|
45
|
-
</div>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { DataTable } from "hiver-ui-kit-extended";
|
|
2
|
-
import { useNavigate } from 'react-router-dom';
|
|
3
|
-
import { contactsData } from "../../constants/index";
|
|
4
|
-
import Avatar from "../Avatar/index";
|
|
5
|
-
|
|
6
|
-
// Name cell with avatar
|
|
7
|
-
const NameCell = ({ name }: { name: string }) => (
|
|
8
|
-
<div className="flex items-center gap-2">
|
|
9
|
-
<Avatar name={name} labelName={name} />
|
|
10
|
-
<span className="text-sm text-slate-900">{name}</span>
|
|
11
|
-
</div>
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
// Email cell with link styling
|
|
15
|
-
const EmailCell = ({ email }: { email: string }) => (
|
|
16
|
-
<span className="text-sm !text-primary-text-default" style={{ color: '#0C3E9D' }}>{email}</span>
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
// Phone cell
|
|
20
|
-
const PhoneCell = ({ phone }: { phone: string }) => (
|
|
21
|
-
<span className="text-sm text-slate-900" style={{ color: '#334155' }}>{phone}</span>
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
// Account cell
|
|
25
|
-
const AccountCell = ({ account }: { account: string }) => (
|
|
26
|
-
<span className="text-sm text-slate-900">{account}</span>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
// Transform data with custom renderers
|
|
30
|
-
const tableData = contactsData.data.results.map((result) => ({
|
|
31
|
-
...result,
|
|
32
|
-
nameDisplay: <NameCell name={result.name} />,
|
|
33
|
-
emailDisplay: <EmailCell email={result.email} />,
|
|
34
|
-
phoneDisplay: <PhoneCell phone={result.phone_number || ""} />,
|
|
35
|
-
accountDisplay: <AccountCell account={result.company?.name || ""} />,
|
|
36
|
-
}));
|
|
37
|
-
|
|
38
|
-
const columns = [
|
|
39
|
-
{
|
|
40
|
-
id: "name",
|
|
41
|
-
field: "nameDisplay",
|
|
42
|
-
label: "Name",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: "email",
|
|
46
|
-
field: "emailDisplay",
|
|
47
|
-
label: "Email",
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: "phone",
|
|
51
|
-
field: "phoneDisplay",
|
|
52
|
-
label: "Phone Number",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: "account",
|
|
56
|
-
field: "accountDisplay",
|
|
57
|
-
label: "Account",
|
|
58
|
-
},
|
|
59
|
-
];
|
|
60
|
-
|
|
61
|
-
export default function ContactTable() {
|
|
62
|
-
const navigate = useNavigate();
|
|
63
|
-
|
|
64
|
-
const handleContactClick = (event: any) => {
|
|
65
|
-
const data = event.data;
|
|
66
|
-
navigate(`/contacts/${data.id}`);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<div className="cm:px-12">
|
|
71
|
-
<DataTable scrollable={true} scrollHeight="32.75rem" value={tableData} columns={columns}
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
onRowClick={handleContactClick} />
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ConversationBox from '../ConversationBox';
|
|
3
|
-
import Icon from '../Icon';
|
|
4
|
-
|
|
5
|
-
export interface AccountInfo {
|
|
6
|
-
name: string;
|
|
7
|
-
domain: string;
|
|
8
|
-
contactCount: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface Conversation {
|
|
12
|
-
id: string;
|
|
13
|
-
type: 'chat' | 'email';
|
|
14
|
-
status: 'open' | 'pending' | 'closed';
|
|
15
|
-
senderName: string;
|
|
16
|
-
timestamp: string;
|
|
17
|
-
heading?: string;
|
|
18
|
-
messagePreview: string;
|
|
19
|
-
mailboxName?: string;
|
|
20
|
-
assignedAgent?: {
|
|
21
|
-
name: string;
|
|
22
|
-
avatarColor?: string;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface AccountPanelProps {
|
|
27
|
-
account: AccountInfo;
|
|
28
|
-
conversations: Conversation[];
|
|
29
|
-
onConversationClick?: (conversationId: string) => void;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const AccountPanel: React.FC<AccountPanelProps> = ({
|
|
33
|
-
account,
|
|
34
|
-
conversations,
|
|
35
|
-
onConversationClick,
|
|
36
|
-
}) => {
|
|
37
|
-
return (
|
|
38
|
-
<div className="cm:flex cm:flex-col cm:gap-3 cm:w-full">
|
|
39
|
-
{/* Account Header */}
|
|
40
|
-
<div className="cm:flex cm:flex-col cm:gap-4 cm:px-4 cm:pt-6 cm:pb-4">
|
|
41
|
-
{/* Icon and Account Name */}
|
|
42
|
-
<div className="cm:flex cm:gap-3 cm:items-center">
|
|
43
|
-
<div className="cm:w-7 cm:h-7 cm:rounded-full cm:flex cm:items-center cm:justify-center cm:shrink-0 cm:bg-slate-100">
|
|
44
|
-
<Icon name="buildings" size={14} color="#94A3B8" />
|
|
45
|
-
</div>
|
|
46
|
-
<h3 className="cm:text-base cm:font-medium cm:text-slate-text-title cm:leading-5">
|
|
47
|
-
{account.name}
|
|
48
|
-
</h3>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
{/* Account Details */}
|
|
52
|
-
<div className="cm:flex cm:flex-col cm:gap-1">
|
|
53
|
-
{/* Domain */}
|
|
54
|
-
<AccountDetailRow
|
|
55
|
-
icon="domain"
|
|
56
|
-
label="Domain"
|
|
57
|
-
value={account.domain}
|
|
58
|
-
/>
|
|
59
|
-
|
|
60
|
-
{/* Contact Count */}
|
|
61
|
-
<AccountDetailRow
|
|
62
|
-
icon="contacts"
|
|
63
|
-
label="Contact"
|
|
64
|
-
value={String(account.contactCount)}
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
{/* Divider */}
|
|
70
|
-
<div className="cm:h-px cm:bg-slate-border-light" />
|
|
71
|
-
|
|
72
|
-
{/* Conversations Section */}
|
|
73
|
-
<div className="cm:flex cm:flex-col cm:gap-3">
|
|
74
|
-
<h4 className="cm:px-4 cm:text-sm cm:font-medium cm:text-slate-text-title cm:leading-5 cm:text-left">
|
|
75
|
-
Conversations from {account.name}
|
|
76
|
-
</h4>
|
|
77
|
-
|
|
78
|
-
{/* Conversations List */}
|
|
79
|
-
<div className="cm:flex cm:flex-col cm:gap-2 cm:px-4">
|
|
80
|
-
{conversations.map((conversation) => (
|
|
81
|
-
<ConversationBox
|
|
82
|
-
key={conversation.id}
|
|
83
|
-
type={conversation.type}
|
|
84
|
-
status={conversation.status}
|
|
85
|
-
size="small"
|
|
86
|
-
senderName={conversation.senderName}
|
|
87
|
-
timestamp={conversation.timestamp}
|
|
88
|
-
heading={conversation.heading}
|
|
89
|
-
messagePreview={conversation.messagePreview}
|
|
90
|
-
mailboxName={conversation.mailboxName}
|
|
91
|
-
assignedAgent={conversation.assignedAgent}
|
|
92
|
-
onClick={() => onConversationClick?.(conversation.id)}
|
|
93
|
-
/>
|
|
94
|
-
))}
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
interface AccountDetailRowProps {
|
|
102
|
-
icon: string;
|
|
103
|
-
label: string;
|
|
104
|
-
value: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const AccountDetailRow: React.FC<AccountDetailRowProps> = ({ icon, label, value }) => {
|
|
108
|
-
return (
|
|
109
|
-
<div className="cm:flex cm:gap-3 cm:items-center cm:h-[38px]">
|
|
110
|
-
<div className="cm:flex cm:gap-2 cm:items-center cm:min-w-[90px]">
|
|
111
|
-
<Icon name={icon} size={14} color="#64758b" />
|
|
112
|
-
<span className="cm:text-sm cm:text-slate-text-subtle cm:leading-5">
|
|
113
|
-
{label}
|
|
114
|
-
</span>
|
|
115
|
-
</div>
|
|
116
|
-
<span className="cm:text-sm cm:text-slate-text-body cm:leading-5 cm:truncate">
|
|
117
|
-
{value}
|
|
118
|
-
</span>
|
|
119
|
-
</div>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export default AccountPanel;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ConversationBox from '../ConversationBox';
|
|
3
|
-
import Icon from '../Icon';
|
|
4
|
-
import Avatar from '../Avatar';
|
|
5
|
-
import PrimaryContactsDialog from '../Contacts';
|
|
6
|
-
|
|
7
|
-
export interface ContactInfo {
|
|
8
|
-
name: string;
|
|
9
|
-
email: string;
|
|
10
|
-
phone: string;
|
|
11
|
-
account: string;
|
|
12
|
-
avatarColor?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface Conversation {
|
|
16
|
-
id: string;
|
|
17
|
-
type: 'chat' | 'email';
|
|
18
|
-
status: 'open' | 'pending' | 'closed';
|
|
19
|
-
senderName: string;
|
|
20
|
-
timestamp: string;
|
|
21
|
-
heading?: string;
|
|
22
|
-
messagePreview: string;
|
|
23
|
-
mailboxName?: string;
|
|
24
|
-
assignedAgent?: {
|
|
25
|
-
name: string;
|
|
26
|
-
avatarColor?: string;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ContactPanelProps {
|
|
31
|
-
contact: ContactInfo;
|
|
32
|
-
conversations: Conversation[];
|
|
33
|
-
onConversationClick?: (conversationId: string) => void;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const ContactPanel: React.FC<ContactPanelProps> = ({
|
|
37
|
-
contact,
|
|
38
|
-
conversations,
|
|
39
|
-
onConversationClick,
|
|
40
|
-
}) => {
|
|
41
|
-
return (
|
|
42
|
-
<div className="cm:flex cm:flex-col cm:gap-3 cm:w-full cm:max-w-[330px]">
|
|
43
|
-
{/* Contact Header */}
|
|
44
|
-
<div className="cm:flex cm:flex-col cm:gap-4 cm:px-4 cm:pt-6 cm:pb-5">
|
|
45
|
-
{/* Avatar and Name */}
|
|
46
|
-
|
|
47
|
-
<div className="cm:flex cm:items-center cm:justify-between cm:px-0 cm:rounded-[6px] cm:shrink-0">
|
|
48
|
-
<div className="cm:flex cm:gap-3 cm:items-center">
|
|
49
|
-
<Avatar
|
|
50
|
-
name={contact.name}
|
|
51
|
-
labelName={contact.name}
|
|
52
|
-
size="default"
|
|
53
|
-
/>
|
|
54
|
-
|
|
55
|
-
<h3 className="cm:text-base cm:font-medium cm:text-slate-text-title cm:leading-5">
|
|
56
|
-
{contact.name}
|
|
57
|
-
</h3>
|
|
58
|
-
</div>
|
|
59
|
-
{/* <EditContact /> */}
|
|
60
|
-
<PrimaryContactsDialog />
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
{/* Contact Details */}
|
|
64
|
-
<div className="cm:flex cm:flex-col cm:gap-1">
|
|
65
|
-
{/* Email */}
|
|
66
|
-
<ContactDetailRow
|
|
67
|
-
icon="email"
|
|
68
|
-
label="Email"
|
|
69
|
-
value={contact.email}
|
|
70
|
-
/>
|
|
71
|
-
|
|
72
|
-
{/* Phone */}
|
|
73
|
-
<ContactDetailRow
|
|
74
|
-
icon="phone"
|
|
75
|
-
label="Phone"
|
|
76
|
-
value={contact.phone}
|
|
77
|
-
/>
|
|
78
|
-
|
|
79
|
-
{/* Account */}
|
|
80
|
-
<ContactDetailRow
|
|
81
|
-
icon="buildings"
|
|
82
|
-
label="Account"
|
|
83
|
-
value={contact.account}
|
|
84
|
-
/>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
{/* Divider */}
|
|
89
|
-
<div className="cm:h-px cm:bg-slate-border-light" />
|
|
90
|
-
|
|
91
|
-
{/* Conversations Section */}
|
|
92
|
-
<div className="cm:flex cm:flex-col cm:gap-3 ">
|
|
93
|
-
<h4 className="cm:text-sm cm:font-medium cm:text-slate-text-title cm:leading-5 cm:text-left cm:px-4">
|
|
94
|
-
Conversations with {contact.name}
|
|
95
|
-
</h4>
|
|
96
|
-
|
|
97
|
-
{/* Conversations List */}
|
|
98
|
-
<div className="cm:flex cm:flex-col cm:gap-3 cm:px-4">
|
|
99
|
-
{conversations.map((conversation) => (
|
|
100
|
-
<ConversationBox
|
|
101
|
-
key={conversation.id}
|
|
102
|
-
type={conversation.type}
|
|
103
|
-
status={conversation.status}
|
|
104
|
-
size="small"
|
|
105
|
-
senderName={conversation.senderName}
|
|
106
|
-
timestamp={conversation.timestamp}
|
|
107
|
-
heading={conversation.heading}
|
|
108
|
-
messagePreview={conversation.messagePreview}
|
|
109
|
-
mailboxName={conversation.mailboxName}
|
|
110
|
-
assignedAgent={conversation.assignedAgent}
|
|
111
|
-
onClick={() => onConversationClick?.(conversation.id)}
|
|
112
|
-
/>
|
|
113
|
-
))}
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
interface ContactDetailRowProps {
|
|
121
|
-
icon: string;
|
|
122
|
-
label: string;
|
|
123
|
-
value: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const ContactDetailRow: React.FC<ContactDetailRowProps> = ({ icon, label, value }) => {
|
|
127
|
-
return (
|
|
128
|
-
<div className="cm:flex cm:gap-3 cm:items-center cm:h-[38px]">
|
|
129
|
-
<div className="cm:flex cm:gap-2 cm:items-center cm:w-[90px] cm:shrink-0">
|
|
130
|
-
<Icon name={icon} size={14} color="#64758b" />
|
|
131
|
-
<span className="cm:text-sm cm:text-slate-text-subtle cm:leading-5">
|
|
132
|
-
{label}
|
|
133
|
-
</span>
|
|
134
|
-
</div>
|
|
135
|
-
<span className="cm:text-sm cm:text-slate-text-body cm:leading-5 cm:truncate">
|
|
136
|
-
{value}
|
|
137
|
-
</span>
|
|
138
|
-
</div>
|
|
139
|
-
);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export default ContactPanel;
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import Icon from '../Icon';
|
|
3
|
-
import { Tabs } from 'hiver-ui-kit-extended';
|
|
4
|
-
import ContactPanel from './ContactPanel';
|
|
5
|
-
import AccountPanel from './AccountPanel';
|
|
6
|
-
import type { ContactInfo, Conversation } from './ContactPanel';
|
|
7
|
-
import type { AccountInfo, Conversation as AccountConversation } from './AccountPanel';
|
|
8
|
-
|
|
9
|
-
// Sample data for the Contact Panel
|
|
10
|
-
const sampleContact: ContactInfo = {
|
|
11
|
-
name: 'John Acme',
|
|
12
|
-
email: 'john.acme@company.com',
|
|
13
|
-
phone: '+91 9890876545',
|
|
14
|
-
account: 'Google',
|
|
15
|
-
avatarColor: '#E37144',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const sampleConversations: Conversation[] = [
|
|
19
|
-
{
|
|
20
|
-
id: '1',
|
|
21
|
-
type: 'email',
|
|
22
|
-
status: 'open',
|
|
23
|
-
senderName: 'Carson Daily',
|
|
24
|
-
timestamp: 'Dec 12, 11:22 AM',
|
|
25
|
-
heading: 'Login issues',
|
|
26
|
-
messagePreview: 'I am having trouble with the app. It keeps cras...',
|
|
27
|
-
mailboxName: 'Finance',
|
|
28
|
-
assignedAgent: {
|
|
29
|
-
name: 'Zackary Smith',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: '2',
|
|
34
|
-
type: 'chat',
|
|
35
|
-
status: 'closed',
|
|
36
|
-
senderName: 'Gigi Hadid',
|
|
37
|
-
timestamp: 'Jan 2, 09:56 AM',
|
|
38
|
-
messagePreview: 'I am unable to access key features. The loadin...',
|
|
39
|
-
mailboxName: 'Sales',
|
|
40
|
-
assignedAgent: {
|
|
41
|
-
name: 'Jolie Dale',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
// Sample data for the Account Panel
|
|
47
|
-
const sampleAccount: AccountInfo = {
|
|
48
|
-
name: 'Google',
|
|
49
|
-
domain: 'google.com',
|
|
50
|
-
contactCount: 122,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const sampleAccountConversations: AccountConversation[] = [
|
|
54
|
-
{
|
|
55
|
-
id: '1',
|
|
56
|
-
type: 'email',
|
|
57
|
-
status: 'open',
|
|
58
|
-
senderName: 'Carson Daily',
|
|
59
|
-
timestamp: 'Dec 12, 11:22 AM',
|
|
60
|
-
heading: 'Login issues',
|
|
61
|
-
messagePreview: 'I am having trouble with the app. It keeps cras...',
|
|
62
|
-
mailboxName: 'Finance',
|
|
63
|
-
assignedAgent: {
|
|
64
|
-
name: 'Zackary Smith',
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
id: '2',
|
|
69
|
-
type: 'email',
|
|
70
|
-
status: 'pending',
|
|
71
|
-
senderName: 'Lana Del Rey',
|
|
72
|
-
timestamp: 'Mar 7, 01:33 PM',
|
|
73
|
-
heading: "Can't connect to server",
|
|
74
|
-
messagePreview: 'I am having trouble with the app. It keeps cras...',
|
|
75
|
-
mailboxName: 'Finance',
|
|
76
|
-
assignedAgent: {
|
|
77
|
-
name: 'Zackary Smith',
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: '3',
|
|
82
|
-
type: 'chat',
|
|
83
|
-
status: 'closed',
|
|
84
|
-
senderName: 'Gigi Hadid',
|
|
85
|
-
timestamp: 'Jan 2, 09:56 AM',
|
|
86
|
-
messagePreview: 'I am unable to access key features. The loadin...',
|
|
87
|
-
mailboxName: 'Sales',
|
|
88
|
-
assignedAgent: {
|
|
89
|
-
name: 'Jolie Dale',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
|
|
94
|
-
const RightPanel = () => {
|
|
95
|
-
const [activeTab, setActiveTab] = useState<number>(1);
|
|
96
|
-
|
|
97
|
-
const tabItems = [
|
|
98
|
-
{
|
|
99
|
-
label: <Icon name="sm_slider" size={16} disabled color="#334155"/> as unknown as string,
|
|
100
|
-
content: <div>Slider</div>,
|
|
101
|
-
disabled: true,
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
label: <Icon name="sm_contacts" size={16} color="#334155" /> as unknown as string,
|
|
105
|
-
content: <ContactsTabs />,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
label: <Icon name="sm_inbox" size={16} disabled color="#334155" /> as unknown as string,
|
|
109
|
-
content: <div>Inbox</div>,
|
|
110
|
-
disabled: true,
|
|
111
|
-
},
|
|
112
|
-
];
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<div className="h-[100vh] bg-white [&_.p-tabview-panels]:p-0">
|
|
116
|
-
<Tabs
|
|
117
|
-
value={activeTab}
|
|
118
|
-
onTabChange={(e: { index: number }) => setActiveTab(e.index)}
|
|
119
|
-
items={tabItems}
|
|
120
|
-
/>
|
|
121
|
-
</div>
|
|
122
|
-
);
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export default RightPanel;
|
|
126
|
-
|
|
127
|
-
const ContactsTabs = () => {
|
|
128
|
-
const [activeTab, setActiveTab] = useState<number>(0);
|
|
129
|
-
|
|
130
|
-
const handleConversationClick = (conversationId: string) => {
|
|
131
|
-
console.log('Conversation clicked:', conversationId);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const tabItems = [
|
|
135
|
-
{
|
|
136
|
-
label: 'Contact',
|
|
137
|
-
content: (
|
|
138
|
-
<ContactPanel
|
|
139
|
-
contact={sampleContact}
|
|
140
|
-
conversations={sampleConversations}
|
|
141
|
-
onConversationClick={handleConversationClick}
|
|
142
|
-
/>
|
|
143
|
-
),
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
label: 'Account',
|
|
147
|
-
content: (
|
|
148
|
-
<AccountPanel
|
|
149
|
-
account={sampleAccount}
|
|
150
|
-
conversations={sampleAccountConversations}
|
|
151
|
-
onConversationClick={handleConversationClick}
|
|
152
|
-
/>
|
|
153
|
-
),
|
|
154
|
-
},
|
|
155
|
-
];
|
|
156
|
-
|
|
157
|
-
return (
|
|
158
|
-
<div className="[&_.p-tabview-panels]:p-0">
|
|
159
|
-
<Tabs
|
|
160
|
-
value={activeTab}
|
|
161
|
-
onTabChange={(e: { index: number }) => setActiveTab(e.index)}
|
|
162
|
-
items={tabItems}
|
|
163
|
-
className="!h-[100px]"
|
|
164
|
-
/>
|
|
165
|
-
</div>
|
|
166
|
-
);
|
|
167
|
-
};
|