Repository navigation
[CSM Portal Microapp] Support page: case list, case detail, and app shell #1092
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
cloby99
merged 10 commits into
wso2-open-operations:dev-app-csm-portal
from
2003dinijay:support
Jul 8, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
08f047e
Implement microapp structure with initial configuration, theme, and u…
2003dinijay 7608874
Update WSO2 UI dependencies to version 0.6.1 in package.json
2003dinijay 800a7a6
Implement support page: case list, case detail, and app shell
2003dinijay 32fa7e6
Fix case card "updated X ago" showing wrong/stale time
2003dinijay 2384114
Handle the MM/DD/YYYY ServiceNow timestamp format too
2003dinijay 845c84b
Fall back to createdOn when updatedOn is missing
2003dinijay 1644c9c
Address code review findings: hanging bridge callbacks, stale tab sta…
2003dinijay 0adc549
Update apps/csm-portal/microapp/src/index.css
2003dinijay f2298d7
Update apps/csm-portal/microapp/src/index.css
2003dinijay d8dbc74
Add license header to endpoints.ts
2003dinijay 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // 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 { useLayoutEffect } from "react"; | ||
| import { HashRouter as Router, Route, Routes } from "react-router-dom"; | ||
| import MainLayout from "@components/layout/MainLayout"; | ||
| import { requestDeviceSafeAreaInsets } from "@components/microapp-bridge"; | ||
| import SupportPage from "@pages/SupportPage"; | ||
| import CaseDetailPage from "@pages/CaseDetailPage"; | ||
|
|
||
| export default function App() { | ||
| useLayoutEffect(() => { | ||
| requestDeviceSafeAreaInsets((data) => { | ||
| if (!data?.insets) return; | ||
|
|
||
| const { top, right, bottom, left } = data.insets; | ||
| const root = document.documentElement; | ||
| root.style.setProperty("--safe-top", `${top}px`); | ||
| root.style.setProperty("--safe-right", `${right}px`); | ||
| root.style.setProperty("--safe-bottom", `${bottom}px`); | ||
| root.style.setProperty("--safe-left", `${left}px`); | ||
| }); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <Router> | ||
| <Routes> | ||
| <Route element={<MainLayout />}> | ||
| <Route path="/" element={<SupportPage />} /> | ||
| <Route path="/cases/:id" element={<CaseDetailPage />} /> | ||
| </Route> | ||
| </Routes> | ||
| </Router> | ||
| ); | ||
| } |
63 changes: 63 additions & 0 deletions
63
apps/csm-portal/microapp/src/components/common/ErrorBoundary.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,63 @@ | ||
| // 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. | ||
|
|
||
| // refer: https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary | ||
| import * as React from "react"; | ||
|
|
||
| interface ErrorBoundaryProps { | ||
| children: React.ReactNode; | ||
| fallback: React.ReactNode | ((error: unknown, resetErrorBoundary: () => void) => React.ReactNode); | ||
| onError?: (error: unknown) => void; | ||
| } | ||
|
|
||
| interface ErrorBoundaryState { | ||
| hasError: boolean; | ||
| error: unknown; | ||
| } | ||
|
|
||
| export class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> { | ||
| constructor(props: ErrorBoundaryProps) { | ||
| super(props); | ||
| this.state = { hasError: false, error: null }; | ||
| } | ||
|
|
||
| static getDerivedStateFromError(error: unknown): ErrorBoundaryState { | ||
| return { hasError: true, error }; | ||
| } | ||
|
|
||
| componentDidCatch(error: unknown, info: React.ErrorInfo): void { | ||
| console.error(error, info.componentStack); | ||
| this.props.onError?.(error); | ||
| } | ||
|
|
||
| resetErrorBoundary = () => { | ||
| this.setState({ hasError: false, error: null }); | ||
| }; | ||
|
|
||
| render(): React.ReactNode { | ||
| const { hasError, error } = this.state; | ||
| const { fallback, children } = this.props; | ||
|
|
||
| if (hasError && error) { | ||
| if (typeof fallback === "function") { | ||
| return fallback(error, this.resetErrorBoundary); | ||
| } | ||
| return fallback; | ||
| } | ||
|
|
||
| return children; | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
apps/csm-portal/microapp/src/components/layout/MainLayout.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,30 @@ | ||
| // 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 } from "@wso2/oxygen-ui"; | ||
| import { Outlet } from "react-router-dom"; | ||
| import { TabBar } from "./TabBar"; | ||
|
|
||
| export default function MainLayout() { | ||
| return ( | ||
| <> | ||
| <Box component="main" p={2} pb={15}> | ||
| <Outlet /> | ||
| </Box> | ||
| <TabBar /> | ||
| </> | ||
| ); | ||
| } |
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,62 @@ | ||
| // 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 { useLayoutEffect, useRef } from "react"; | ||
| import { Link, useLocation } from "react-router-dom"; | ||
| import { BottomNavigation, BottomNavigationAction, Box } from "@wso2/oxygen-ui"; | ||
| import { Headset } from "@wso2/oxygen-ui-icons-react"; | ||
|
|
||
| export function TabBar() { | ||
| const ref = useRef<HTMLDivElement>(null); | ||
| const location = useLocation(); | ||
| const isSupportActive = location.pathname === "/" || location.pathname.startsWith("/cases/"); | ||
|
|
||
| useLayoutEffect(() => { | ||
| if (!ref.current) return; | ||
|
|
||
| const observer = new ResizeObserver(([entry]) => { | ||
| document.documentElement.style.setProperty("--tab-bar-height", `${entry.contentRect.height}px`); | ||
| }); | ||
|
|
||
| observer.observe(ref.current); | ||
| return () => observer.disconnect(); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <Box | ||
| ref={ref} | ||
| position="fixed" | ||
| bgcolor="background.paper" | ||
| bottom={0} | ||
| left={0} | ||
| right={0} | ||
| pt={1} | ||
| pb={4} | ||
| sx={{ borderTop: "1px solid", borderColor: "divider" }} | ||
| > | ||
| <BottomNavigation value={isSupportActive ? "support" : false} showLabels> | ||
| <BottomNavigationAction | ||
| component={Link} | ||
| to="/" | ||
| value="support" | ||
| label="Support" | ||
| icon={<Headset />} | ||
| disableRipple | ||
| /> | ||
| </BottomNavigation> | ||
| </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.