Skip to content
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

(frontend)[AGE-1461]: Window not responding after switching between workspaces while in an app #2360

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions agenta-web/src/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useEffect, useMemo, useState} from "react"
import {Breadcrumb, ConfigProvider, Layout, Modal, Space, Typography, theme} from "antd"
import {Breadcrumb, Button, ConfigProvider, Layout, Modal, Space, Typography, theme} from "antd"
import Sidebar from "../Sidebar/Sidebar"
import {GithubFilled, LinkedinFilled, TwitterOutlined} from "@ant-design/icons"
import Link from "next/link"
Expand Down Expand Up @@ -95,6 +95,21 @@ const useStyles = createUseStyles((theme: JSSTheme) => ({
fontWeight: 600,
},
},
notFoundContainer: {
display: "flex",
flexDirection: "column",
minHeight: "100vh",
alignItems: "center",
justifyContent: "center",
"& .ant-typography:nth-of-type(1)": {
fontSize: 24,
fontWeight: 600,
},
"& .ant-typography:nth-of-type(2)": {
fontSize: 14,
marginTop: 8,
},
},
}))

type LayoutProps = {
Expand Down Expand Up @@ -190,7 +205,19 @@ const App: React.FC<LayoutProps> = ({children}) => {
}, [appTheme])

// wait unitl we have the app id, if its an app route
if (isAppRoute && (!appId || !currentApp)) return null
if (isAppRoute && !appId) return null

if (appId && !currentApp)
return (
<div className={classes.notFoundContainer}>
<Typography.Text>404 - Page Not Found</Typography.Text>
<Typography.Text>This page could not be found.</Typography.Text>

<Button type="primary" onClick={() => router.push("/apps")}>
Back To Apps
</Button>
</div>
)

const isAuthRoute =
router.pathname.includes("/auth") || router.pathname.includes("/post-signup")
Expand Down
Loading