Repository navigation
[Customer Portal][FE][Web] Implement Case Details Content Orchestrator and Modular Tabbed UI #148
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 2 commits into
wso2-open-operations:customer-portal-milestone-1
from
dileepapeiris:feat/fix-case-create-id-issue
Feb 13, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
189 changes: 189 additions & 0 deletions
189
...omer-portal/webapp/src/components/support/case-details/details-tab/CaseDetailsContent.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,189 @@ | ||
| // 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, Paper, alpha, useTheme } from "@wso2/oxygen-ui"; | ||
| import { useMemo, useState, type JSX } from "react"; | ||
| import type { CaseDetails } from "@models/responses"; | ||
| import useGetCaseAttachments from "@api/useGetCaseAttachments"; | ||
| import { getStatusColor } from "@utils/casesTable"; | ||
| import { resolveColorFromTheme, getStatusIconElement } from "@utils/support"; | ||
| import CaseDetailsBackButton from "@case-details/CaseDetailsBackButton"; | ||
| import CaseDetailsHeader from "@case-details/CaseDetailsHeader"; | ||
| import CaseDetailsActionRow from "@case-details/CaseDetailsActionRow"; | ||
| import CaseDetailsTabs from "@case-details/CaseDetailsTabs"; | ||
| import CaseDetailsTabPanels from "@case-details/CaseDetailsTabPanels"; | ||
| import CaseDetailsSkeleton from "@case-details-details/CaseDetailsSkeleton"; | ||
|
|
||
| export interface CaseDetailsContentProps { | ||
| data: CaseDetails | undefined; | ||
| isLoading: boolean; | ||
| isError: boolean; | ||
| caseId: string; | ||
| onBack: () => void; | ||
| } | ||
|
|
||
| /** | ||
| * CaseDetailsContent displays case header and details in a layout similar to the template. | ||
| * | ||
| * @param {CaseDetailsContentProps} props - Data, loading/error state, and callbacks. | ||
| * @returns {JSX.Element} The rendered case details content. | ||
| */ | ||
| export default function CaseDetailsContent({ | ||
| data, | ||
| isLoading, | ||
| isError, | ||
| caseId, | ||
| onBack, | ||
| }: CaseDetailsContentProps): JSX.Element { | ||
| const theme = useTheme(); | ||
| const [activeTab, setActiveTab] = useState(0); | ||
| const [focusMode, setFocusMode] = useState(false); | ||
|
|
||
| const statusLabel = data?.state?.label; | ||
| const severityLabel = data?.severity?.label; | ||
| const statusColorPath = getStatusColor(statusLabel ?? undefined); | ||
| const resolvedStatusColor = resolveColorFromTheme(statusColorPath, theme); | ||
| const statusChipIcon = getStatusIconElement(statusLabel, 12); | ||
| const statusChipSx = useMemo( | ||
| () => ({ | ||
| bgcolor: alpha(resolvedStatusColor, 0.1), | ||
| color: resolvedStatusColor, | ||
| height: 20, | ||
| fontSize: "0.75rem", | ||
| px: 0, | ||
| "& .MuiChip-icon": { | ||
| color: "inherit", | ||
| ml: "6px", | ||
| mr: "6px", | ||
| }, | ||
| "& .MuiChip-label": { | ||
| pl: 0, | ||
| pr: "6px", | ||
| }, | ||
| }), | ||
| [resolvedStatusColor], | ||
| ); | ||
|
|
||
| const attachmentsQuery = useGetCaseAttachments(caseId, { | ||
| limit: 1, | ||
| offset: 0, | ||
| }); | ||
| const attachmentCount = attachmentsQuery.data?.totalRecords; | ||
|
|
||
|
dileepapeiris marked this conversation as resolved.
|
||
| const assignedEngineer = data?.assignedEngineer; | ||
| const engineerInitials = | ||
| assignedEngineer && typeof assignedEngineer === "string" | ||
| ? assignedEngineer | ||
| .trim() | ||
|
dileepapeiris marked this conversation as resolved.
|
||
| .split(/\s+/) | ||
| .filter(Boolean) | ||
| .map((n) => n[0]) | ||
| .join("") | ||
| .toUpperCase() | ||
| .slice(0, 2) | ||
| : "--"; | ||
|
|
||
| if (isLoading) { | ||
| return ( | ||
| <Box> | ||
| <Paper variant="outlined" sx={{ p: 2 }}> | ||
| <CaseDetailsBackButton | ||
| onClick={onBack} | ||
| sx={{ mb: 2, ml: -0.5, alignSelf: "flex-start" }} | ||
| /> | ||
| <CaseDetailsSkeleton /> | ||
| </Paper> | ||
| </Box> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <Box | ||
| sx={{ | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| flex: 1, | ||
| minHeight: 0, | ||
| overflow: "hidden", | ||
| }} | ||
| > | ||
| {/* Page header: static, not scrollable (case-details header) */} | ||
| <Paper | ||
| variant="outlined" | ||
| sx={{ | ||
| p: 2, | ||
| flexShrink: 0, | ||
| zIndex: 10, | ||
| borderRadius: 0, | ||
| }} | ||
| > | ||
| <CaseDetailsBackButton onClick={onBack} /> | ||
|
|
||
| {!focusMode && ( | ||
| <> | ||
| <CaseDetailsHeader | ||
| caseNumber={data?.number} | ||
| title={data?.title} | ||
| severityLabel={severityLabel} | ||
| statusLabel={statusLabel} | ||
| statusChipIcon={statusChipIcon} | ||
| statusChipSx={statusChipSx} | ||
| isError={isError} | ||
| isLoading={isLoading} | ||
| /> | ||
|
|
||
| <CaseDetailsActionRow | ||
| assignedEngineer={assignedEngineer} | ||
| engineerInitials={engineerInitials} | ||
| isError={isError} | ||
| isLoading={isLoading} | ||
| /> | ||
| </> | ||
| )} | ||
|
|
||
| <CaseDetailsTabs | ||
| focusMode={focusMode} | ||
| value={activeTab} | ||
| onChange={(_e, newValue) => setActiveTab(newValue)} | ||
| onFocusModeToggle={() => setFocusMode((prev) => !prev)} | ||
| attachmentCount={attachmentCount} | ||
| /> | ||
| </Paper> | ||
|
|
||
| {/* Content: Activity tab has fixed input bar (no scroll); other tabs scroll */} | ||
| <Box | ||
| sx={{ | ||
| flex: 1, | ||
| minHeight: 0, | ||
| mt: 2, | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| overflow: activeTab === 0 ? "hidden" : "auto", | ||
| p: activeTab === 0 ? 0 : 3, | ||
| pt: 0, | ||
| WebkitOverflowScrolling: "touch", | ||
| }} | ||
| > | ||
| <CaseDetailsTabPanels | ||
| activeTab={activeTab} | ||
| caseId={caseId} | ||
| data={data} | ||
| isError={isError} | ||
| /> | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| } | ||
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.