-
Notifications
You must be signed in to change notification settings - Fork 51
[Customer Portal][FE][Web] Implement chat history component on Support page #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Rashmika998
merged 22 commits into
wso2-open-operations:customer-portal-milestone-1
from
dileepapeiris:feat/add-support-novera-chat-history
Feb 10, 2026
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7de31f8
Simplify Grid props in CasesOverviewStatCard
dileepapeiris 15bbc45
Remove bottom margin from NoveraChatBanner
dileepapeiris 3c6b4f5
Add tests for ChatHistoryList component
dileepapeiris d581b00
Add tests for support utils
dileepapeiris 447e96a
Add Chat History overview to Support page
dileepapeiris 25aff2a
tests: mock deps and add SupportPage test
dileepapeiris 3c7e347
Add SUPPORT_OVERVIEW_CHAT_LIMIT constant
dileepapeiris c09a9c9
Expose sx prop and make card full-size
dileepapeiris 807fda0
Make outstanding cases skeleton full width
dileepapeiris acc3ab3
Truncate case titles and set container width
dileepapeiris 5106887
Add ChatHistorySkeleton component
dileepapeiris c2a74b2
Add ChatHistoryList component
dileepapeiris 9fe189e
Add chat status helpers & tweak styles
dileepapeiris b060787
Update tests to use getChatStatusColor
dileepapeiris 975b116
Merge branch 'customer-portal-milestone-1' into feat/add-support-nove…
dileepapeiris fbe4a12
Fix imports and pluralization in customer portal
dileepapeiris 87c5930
Merge branch 'feat/add-support-novera-chat-history' of https://github…
dileepapeiris d4bf1cb
SupportOverviewCard: accept array sx; update tests
dileepapeiris e62a34f
Add ChatActionState type and use in getChatActionColor
dileepapeiris 180241f
Switch to Card components and add Chat types
dileepapeiris 0e23e42
Lowercase ChatStatus checks in getChatStatusColor
dileepapeiris e8ee2b8
Use Form.CardButton instead of Card in chat list
dileepapeiris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
201 changes: 201 additions & 0 deletions
201
.../customer-portal/webapp/src/components/support/support-overview-cards/ChatHistoryList.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,201 @@ | ||
| // Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com). | ||
| // | ||
| // WSO2 LLC. licenses this file to you under the Apache License, | ||
| // Version 2.0 (the "License"); you may not use this file except | ||
| // in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| import { | ||
| Box, | ||
| Button, | ||
| CardActions, | ||
| CardContent, | ||
| Chip, | ||
| Form, | ||
| Stack, | ||
| Typography, | ||
| alpha, | ||
| type Theme, | ||
| } from "@wso2/oxygen-ui"; | ||
| import { | ||
| Bot, | ||
| CircleCheck, | ||
| Clock, | ||
| ExternalLink, | ||
| Play, | ||
| } from "@wso2/oxygen-ui-icons-react"; | ||
| import type { JSX } from "react"; | ||
| import type { ChatHistoryItem } from "@models/responses"; | ||
| import { ChatAction } from "@constants/supportConstants"; | ||
| import { | ||
| getChatActionColor, | ||
| getChatStatusAction, | ||
| getChatStatusColor, | ||
| resolveColorFromTheme, | ||
| } from "@utils/support"; | ||
| import ChatHistorySkeleton from "@/components/support/support-overview-cards/ChatHistorySkeleton"; | ||
| import { CardButton } from "@wso2/oxygen-ui/components/Form/CardButton"; | ||
|
|
||
| export interface ChatHistoryListProps { | ||
| items: ChatHistoryItem[]; | ||
| isLoading?: boolean; | ||
| onItemAction?: (chatId: string, action: ChatAction) => void; | ||
| } | ||
|
|
||
| /** | ||
| * Renders a list of chat history rows for the support overview card. | ||
| * | ||
| * @param {ChatHistoryListProps} props - Items and optional action handler. | ||
| * @returns {JSX.Element} The list of chat rows. | ||
| */ | ||
| export default function ChatHistoryList({ | ||
| items, | ||
| isLoading, | ||
| onItemAction, | ||
| }: ChatHistoryListProps): JSX.Element { | ||
| if (isLoading) { | ||
| return <ChatHistorySkeleton />; | ||
| } | ||
|
|
||
| if (items.length === 0) { | ||
| return ( | ||
| <Typography variant="body2" color="text.secondary"> | ||
| No chat history. | ||
| </Typography> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <Box | ||
| sx={{ display: "flex", flexDirection: "column", gap: 1.5, width: "100%" }} | ||
| > | ||
| {items.map((item) => { | ||
| const action = getChatStatusAction(item.status); | ||
| const StatusIcon = action === ChatAction.VIEW ? CircleCheck : Clock; | ||
| const chipColorPath = getChatStatusColor(item.status); | ||
|
|
||
| return ( | ||
| <Form.CardButton | ||
| key={item.chatId} | ||
| onClick={() => onItemAction?.(item.chatId, action)} | ||
| sx={{ | ||
| p: 2, | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| alignItems: "stretch", | ||
| gap: 1, | ||
| cursor: "pointer", | ||
| "&:hover": { | ||
| bgcolor: "action.hover", | ||
| }, | ||
| }} | ||
| > | ||
| <CardContent | ||
| sx={{ | ||
| p: 0, | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| gap: 0.5, | ||
| }} | ||
| > | ||
| <Box sx={{ display: "flex", gap: 1.5, alignItems: "center" }}> | ||
| <Box sx={{ display: "flex", flexShrink: 0 }}> | ||
| <Bot size={20} /> | ||
| </Box> | ||
| <Box sx={{ minWidth: 0, flexGrow: 1 }}> | ||
| <Typography | ||
| variant="body2" | ||
| fontWeight={500} | ||
| color="text.primary" | ||
| sx={{ | ||
| overflow: "hidden", | ||
| textOverflow: "ellipsis", | ||
| display: "-webkit-box", | ||
| WebkitLineClamp: 1, | ||
| WebkitBoxOrient: "vertical", | ||
| }} | ||
| > | ||
| {item.title} | ||
| </Typography> | ||
| </Box> | ||
| </Box> | ||
| <Box sx={{ pl: 4 }}> | ||
| <Stack direction="row" spacing={1} alignItems="center"> | ||
| <Typography variant="caption" color="text.secondary"> | ||
| {item.startedTime} | ||
| </Typography> | ||
| <Typography variant="caption" color="text.secondary"> | ||
| • | ||
| </Typography> | ||
| <Typography variant="caption" color="text.secondary"> | ||
| {item.messages}{" "} | ||
| {item.messages === 1 ? "message" : "messages"} | ||
| </Typography> | ||
| <Typography variant="caption" color="text.secondary"> | ||
| • | ||
| </Typography> | ||
| <Typography variant="caption" color="text.secondary"> | ||
| {item.kbArticles}{" "} | ||
| {item.kbArticles === 1 ? "KB article" : "KB articles"} | ||
| </Typography> | ||
| </Stack> | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| </Box> | ||
| </CardContent> | ||
|
|
||
| <CardActions sx={{ p: 0, justifyContent: "space-between" }}> | ||
| <Chip | ||
| size="small" | ||
| variant="outlined" | ||
| label={item.status} | ||
| sx={{ | ||
| px: 0.5, | ||
| bgcolor: (theme: Theme) => | ||
| alpha(resolveColorFromTheme(chipColorPath, theme), 0.1), | ||
| color: chipColorPath, | ||
| "& .MuiChip-icon": { | ||
| color: "inherit", | ||
| }, | ||
| }} | ||
| icon={<StatusIcon size={12} />} | ||
| /> | ||
| <Button | ||
| size="small" | ||
| variant="text" | ||
| color={getChatActionColor(action)} | ||
| disableRipple | ||
| onClick={(e) => { | ||
| e.stopPropagation(); | ||
| onItemAction?.(item.chatId, action); | ||
| }} | ||
| startIcon={ | ||
| action === ChatAction.VIEW ? ( | ||
| <ExternalLink size={12} /> | ||
| ) : ( | ||
| <Play size={12} /> | ||
| ) | ||
| } | ||
| sx={{ | ||
| textTransform: "none", | ||
| fontWeight: 500, | ||
| minWidth: 0, | ||
| p: 0, | ||
| }} | ||
| > | ||
| {action === ChatAction.VIEW ? "View" : "Resume"} | ||
| </Button> | ||
| </CardActions> | ||
| </Form.CardButton> | ||
| ); | ||
| })} | ||
| </Box> | ||
| ); | ||
| } | ||
81 changes: 81 additions & 0 deletions
81
...tomer-portal/webapp/src/components/support/support-overview-cards/ChatHistorySkeleton.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // Copyright (c) 2026 WSO2 LLC. (https://www.wso2.com). | ||
| // | ||
| // WSO2 LLC. licenses this file to you under the Apache License, | ||
| // Version 2.0 (the "License"); you may not use this file except | ||
| // in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| import { Box, Form, Skeleton } from "@wso2/oxygen-ui"; | ||
| import { type JSX } from "react"; | ||
| import { SUPPORT_OVERVIEW_CHAT_LIMIT } from "@constants/supportConstants"; | ||
|
|
||
| /** | ||
| * Renders a list of loading skeletons for the chat history list. | ||
| * | ||
| * @returns {JSX.Element} The skeleton list. | ||
| */ | ||
| export default function ChatHistorySkeleton(): JSX.Element { | ||
| return ( | ||
| <Box | ||
| sx={{ display: "flex", flexDirection: "column", gap: 1.5, width: "100%" }} | ||
| > | ||
| {Array.from({ length: SUPPORT_OVERVIEW_CHAT_LIMIT }).map((_, index) => ( | ||
| <Form.CardButton | ||
| key={`skeleton-${index}`} | ||
| sx={{ | ||
| p: 2, | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| alignItems: "stretch", | ||
| gap: 1.5, | ||
| pointerEvents: "none", | ||
| }} | ||
| > | ||
| <Form.CardContent | ||
| sx={{ | ||
| p: 0, | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| gap: 0.5, | ||
| }} | ||
| > | ||
| <Box sx={{ display: "flex", gap: 1.5, alignItems: "center" }}> | ||
| <Box sx={{ display: "flex", flexShrink: 0 }}> | ||
| <Skeleton variant="circular" width={20} height={20} /> | ||
| </Box> | ||
| <Box sx={{ flexGrow: 1 }}> | ||
| <Skeleton variant="text" width="90%" height={24} /> | ||
| </Box> | ||
| </Box> | ||
| <Box sx={{ pl: 4 }}> | ||
| <Box sx={{ display: "flex", gap: 1, alignItems: "center" }}> | ||
| <Skeleton variant="text" width={40} height={16} /> | ||
| <Skeleton variant="text" width={4} height={16} /> | ||
| <Skeleton variant="text" width={60} height={16} /> | ||
| </Box> | ||
| </Box> | ||
| </Form.CardContent> | ||
| <Box | ||
| sx={{ | ||
| display: "flex", | ||
| justifyContent: "space-between", | ||
| alignItems: "center", | ||
| }} | ||
| > | ||
| <Skeleton variant="rounded" width={80} height={20} /> | ||
| <Skeleton variant="text" width={60} height={16} /> | ||
| </Box> | ||
| </Form.CardButton> | ||
| ))} | ||
| </Box> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.