Repository navigation
[Customer Portal][FE][Web] Implement Outstanding Cases component on Support page #101
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 11 commits into
wso2-open-operations:customer-portal-milestone-1
from
dileepapeiris:feat/add-support-outstanding-cases-chat-history-v1
Feb 9, 2026
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
50f65fb
Add theme color and relative time utilities
dileepapeiris a989eae
Swap status colors for open/awaiting
dileepapeiris 8ce64d6
Add OutstandingCasesList component
dileepapeiris 93b3010
Add tests for OutstandingCasesList component
dileepapeiris 2713855
Add SupportOverviewCard unit tests
dileepapeiris a80ad07
Add SupportOverviewCard component
dileepapeiris 49dac5a
Add OutstandingCasesSkeleton component
dileepapeiris 1239951
Add SUPPORT_OVERVIEW_CASES_LIMIT constant
dileepapeiris 720fbe8
Add outstanding cases overview to SupportPage
dileepapeiris f7aacd1
Support: tweak outstanding cases UI & tests
dileepapeiris c6e3874
Merge branch 'customer-portal-milestone-1' into feat/add-support-outs…
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
There are no files selected for viewing
153 changes: 153 additions & 0 deletions
153
...omer-portal/webapp/src/components/support/support-overview-cards/OutstandingCasesList.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,153 @@ | ||
| // 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, | ||
| Chip, | ||
| Form, | ||
| Stack, | ||
| Tooltip, | ||
| Typography, | ||
| alpha, | ||
| useTheme, | ||
| } from "@wso2/oxygen-ui"; | ||
| import { Clock } from "@wso2/oxygen-ui-icons-react"; | ||
| import type { JSX } from "react"; | ||
| import type { CaseListItem } from "@models/responses"; | ||
| import OutstandingCasesSkeleton from "./OutstandingCasesSkeleton"; | ||
| import { getPriorityColor, getStatusColor } from "@utils/casesTable"; | ||
| import { formatRelativeTime, resolveColorFromTheme } from "@utils/support"; | ||
|
|
||
| export interface OutstandingCasesListProps { | ||
| cases: CaseListItem[]; | ||
| isLoading?: boolean; | ||
| } | ||
|
|
||
| /** | ||
| * Renders a list of outstanding case rows for the support overview card. | ||
| * | ||
| * @param {OutstandingCasesListProps} props - Cases array and loading state. | ||
| * @returns {JSX.Element} The list of case rows. | ||
| */ | ||
| export default function OutstandingCasesList({ | ||
| cases, | ||
| isLoading, | ||
| }: OutstandingCasesListProps): JSX.Element { | ||
| const theme = useTheme(); | ||
|
|
||
| if (isLoading) { | ||
| return <OutstandingCasesSkeleton />; | ||
| } | ||
|
|
||
| if (cases.length === 0) { | ||
| return ( | ||
| <Typography variant="body2" color="text.secondary"> | ||
| No outstanding cases. | ||
| </Typography> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <Box sx={{ display: "flex", flexDirection: "column", gap: 1.5 }}> | ||
| {cases.map((c) => { | ||
| const colorPath = getStatusColor(c.status?.label); | ||
| const resolvedColor = resolveColorFromTheme(colorPath, theme); | ||
|
|
||
| return ( | ||
| <Form.CardButton | ||
| key={c.id} | ||
| sx={{ | ||
| p: 2, | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| alignItems: "stretch", | ||
| gap: 1, | ||
| }} | ||
| > | ||
| <Form.CardHeader | ||
| sx={{ p: 0 }} | ||
| title={ | ||
| <Stack direction="row" spacing={1} alignItems="center"> | ||
| <Typography | ||
| variant="body2" | ||
| fontWeight={500} | ||
| color="text.primary" | ||
| > | ||
| {c.number} | ||
| </Typography> | ||
| <Box | ||
| sx={{ | ||
| width: 8, | ||
| height: 8, | ||
| borderRadius: "50%", | ||
| flexShrink: 0, | ||
| bgcolor: `${getPriorityColor(c.severity?.label)}.main`, | ||
| }} | ||
| /> | ||
|
dileepapeiris marked this conversation as resolved.
Resolved
|
||
| <Typography variant="caption" color="text.secondary"> | ||
| {c.severity?.label ?? "—"} | ||
| </Typography> | ||
| </Stack> | ||
| } | ||
| /> | ||
|
|
||
| <Form.CardContent sx={{ p: 0 }}> | ||
| <Typography | ||
| variant="body2" | ||
| color="text.primary" | ||
| sx={{ | ||
| overflow: "hidden", | ||
| }} | ||
| > | ||
| {c.title} | ||
| </Typography> | ||
| </Form.CardContent> | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| <Form.CardActions sx={{ p: 0, justifyContent: "space-between" }}> | ||
| <Chip | ||
| size="small" | ||
| variant="outlined" | ||
| label={c.status?.label ?? "—"} | ||
| icon={<Clock size={12} />} | ||
| sx={{ | ||
| px: 0.5, | ||
| bgcolor: alpha(resolvedColor, 0.1), | ||
| color: resolvedColor, | ||
| borderColor: "transparent", | ||
| "& .MuiChip-icon": { | ||
| color: "inherit", | ||
| }, | ||
| }} | ||
| /> | ||
| <Box sx={{ display: "flex", alignItems: "center", gap: 1.5 }}> | ||
| {c.assignedEngineer && ( | ||
| <Tooltip title={`Assigned to ${c.assignedEngineer}`}> | ||
| <Typography variant="caption" color="text.secondary"> | ||
| Assigned to {c.assignedEngineer} | ||
| </Typography> | ||
| </Tooltip> | ||
| )} | ||
| <Typography variant="caption" color="text.secondary"> | ||
| {formatRelativeTime(c.createdOn)} | ||
| </Typography> | ||
| </Box> | ||
| </Form.CardActions> | ||
| </Form.CardButton> | ||
| ); | ||
| })} | ||
| </Box> | ||
| ); | ||
| } | ||
60 changes: 60 additions & 0 deletions
60
...-portal/webapp/src/components/support/support-overview-cards/OutstandingCasesSkeleton.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,60 @@ | ||
| // 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 { SUPPORT_OVERVIEW_CASES_LIMIT } from "@/constants/supportConstants"; | ||
| import { Box, Form, Skeleton } from "@wso2/oxygen-ui"; | ||
| import { type JSX } from "react"; | ||
|
|
||
| /** | ||
| * Renders a list of loading skeletons for the outstanding cases list. | ||
| * | ||
| * @returns {JSX.Element} The skeleton list. | ||
| */ | ||
| export default function OutstandingCasesSkeleton(): JSX.Element { | ||
| return ( | ||
| <Box sx={{ display: "flex", flexDirection: "column", gap: 1.5 }}> | ||
| {Array.from({ length: SUPPORT_OVERVIEW_CASES_LIMIT }).map((_, index) => ( | ||
| <Form.CardButton | ||
| key={`skeleton-${index}`} | ||
| sx={{ | ||
| p: 2, | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| alignItems: "stretch", | ||
| gap: 1.5, | ||
| }} | ||
| > | ||
| <Box sx={{ display: "flex", alignItems: "center", gap: 1 }}> | ||
| <Skeleton variant="text" width={60} height={20} /> | ||
| <Skeleton variant="circular" width={8} height={8} /> | ||
| <Skeleton variant="text" width={40} height={16} /> | ||
| </Box> | ||
| <Skeleton variant="text" width="90%" height={24} /> | ||
| <Box | ||
| sx={{ | ||
| display: "flex", | ||
| justifyContent: "space-between", | ||
| alignItems: "center", | ||
| }} | ||
| > | ||
| <Skeleton variant="rounded" width={80} height={20} /> | ||
| <Skeleton variant="text" width={100} height={16} /> | ||
| </Box> | ||
| </Form.CardButton> | ||
| ))} | ||
| </Box> | ||
| ); | ||
| } |
122 changes: 122 additions & 0 deletions
122
...tomer-portal/webapp/src/components/support/support-overview-cards/SupportOverviewCard.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,122 @@ | ||
| // 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, | ||
| Paper, | ||
| Typography, | ||
| alpha, | ||
| colors, | ||
| useTheme, | ||
| } from "@wso2/oxygen-ui"; | ||
| import { ArrowRight } from "@wso2/oxygen-ui-icons-react"; | ||
| import type { ComponentType } from "react"; | ||
| import type { JSX } from "react"; | ||
|
|
||
| export interface SupportOverviewCardProps { | ||
| title: string; | ||
| subtitle: string; | ||
| icon: ComponentType<{ size?: number; color?: string }>; | ||
| iconVariant?: "orange" | "blue"; | ||
| children: React.ReactNode; | ||
| footerButtonLabel: string; | ||
| onFooterClick: () => void; | ||
| } | ||
|
|
||
| /** | ||
| * Generic card for support overview sections (Outstanding Cases, Chat History). | ||
| * | ||
| * @param {SupportOverviewCardProps} props - Title, subtitle, icon, children, footer CTA. | ||
| * @returns {JSX.Element} The rendered card. | ||
| */ | ||
| export default function SupportOverviewCard({ | ||
| title, | ||
| subtitle, | ||
| icon: Icon, | ||
| iconVariant = "orange", | ||
| children, | ||
| footerButtonLabel, | ||
| onFooterClick, | ||
| }: SupportOverviewCardProps): JSX.Element { | ||
| const theme = useTheme(); | ||
| const paletteKey = iconVariant === "blue" ? "info" : "warning"; | ||
| const iconColor = | ||
| iconVariant === "blue" ? colors.blue[600] : colors.orange[600]; | ||
|
|
||
| return ( | ||
| <Paper | ||
| sx={{ | ||
| p: 2.5, | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| gap: 2, | ||
| }} | ||
| > | ||
| <Box sx={{ display: "flex", alignItems: "center", gap: 2, mb: 1 }}> | ||
| <Paper | ||
| sx={{ | ||
| width: 40, | ||
| height: 40, | ||
| bgcolor: alpha(theme.palette[paletteKey].light, 0.1), | ||
| color: theme.palette[paletteKey].light, | ||
| display: "flex", | ||
| alignItems: "center", | ||
| justifyContent: "center", | ||
| flexShrink: 0, | ||
| }} | ||
| > | ||
| <Icon size={20} color={iconColor} /> | ||
| </Paper> | ||
| <Box> | ||
| <Typography variant="h6" color="text.primary"> | ||
| {title} | ||
| </Typography> | ||
| <Typography variant="body2" color="text.secondary"> | ||
| {subtitle} | ||
| </Typography> | ||
| </Box> | ||
| </Box> | ||
|
|
||
| <Box sx={{ display: "flex", flexDirection: "column", gap: 1.5 }}> | ||
| {children} | ||
| </Box> | ||
|
|
||
| <Box | ||
| sx={{ | ||
| borderTop: 1, | ||
| borderColor: "divider", | ||
| pt: 2, | ||
| mt: 1, | ||
| }} | ||
| /> | ||
| <Button | ||
| fullWidth | ||
| variant="text" | ||
| color="warning" | ||
| onClick={onFooterClick} | ||
| endIcon={<ArrowRight size={16} />} | ||
| sx={{ | ||
| justifyContent: "space-between", | ||
| textTransform: "none", | ||
| fontWeight: 500, | ||
| }} | ||
| > | ||
| {footerButtonLabel} | ||
| </Button> | ||
| </Paper> | ||
| ); | ||
| } |
54 changes: 54 additions & 0 deletions
54
...app/src/components/support/support-overview-cards/__tests__/OutstandingCasesList.test.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,54 @@ | ||
| // 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 { render, screen } from "@testing-library/react"; | ||
| import { describe, expect, it } from "vitest"; | ||
| import OutstandingCasesList from "@components/support/support-overview-cards/OutstandingCasesList"; | ||
| import type { CaseListItem } from "@models/responses"; | ||
|
|
||
| const mockCases: CaseListItem[] = [ | ||
| { | ||
| id: "1", | ||
| internalId: "int-1", | ||
| number: "CASE-2845", | ||
| createdOn: new Date(Date.now() - 2 * 60 * 60 * 1000).toISOString(), | ||
| title: "API Gateway timeout issues", | ||
| description: "", | ||
| assignedEngineer: "Sarah Chen", | ||
| project: { id: "p1", label: "Project 1" }, | ||
| type: null, | ||
| deployment: null, | ||
| severity: { id: "1", label: "High" }, | ||
| status: { id: "1", label: "Work In Progress" }, | ||
| }, | ||
| ]; | ||
|
|
||
| describe("OutstandingCasesList", () => { | ||
| it("should render empty state when no cases", () => { | ||
| render(<OutstandingCasesList cases={[]} />); | ||
| expect(screen.getByText("No outstanding cases.")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("should render case number, title, severity and status", () => { | ||
| render(<OutstandingCasesList cases={mockCases} />); | ||
| expect(screen.getByText("CASE-2845")).toBeInTheDocument(); | ||
| expect(screen.getByText("API Gateway timeout issues")).toBeInTheDocument(); | ||
| expect(screen.getByText("High")).toBeInTheDocument(); | ||
| expect(screen.getByText("Work In Progress")).toBeInTheDocument(); | ||
| expect(screen.getByText(/Assigned to Sarah Chen/)).toBeInTheDocument(); | ||
|
dileepapeiris marked this conversation as resolved.
Resolved
|
||
| expect(screen.getByText("2 hours ago")).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
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.