diff --git a/pages/_app.js b/pages/_app.js index 2f926006..9adf8cb4 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -1,9 +1,17 @@ import 'normalize.css'; import 'xterm/css/xterm.css'; import '../imports/style.css'; +import { appWithTranslation } from 'next-i18next'; +import { Provider } from '../src/provider.tsx'; function App({ Component, pageProps }) { - return + return ( + <> + + + + + ); } -export default App; +export default appWithTranslation(App); diff --git a/pages/new.tsx b/pages/new.tsx new file mode 100644 index 00000000..9a7e812c --- /dev/null +++ b/pages/new.tsx @@ -0,0 +1,253 @@ +import { + Box, + Button, + CircularProgress, + Flex, + Grid, + GridItem, + Text, +} from '@chakra-ui/react'; +import { AutoGuest } from '@deep-foundation/deepcase/imports/auto-guest'; +import { parseUrl } from '@deep-foundation/deepcase/imports/connector/connector'; +import { useContainer, useSpaceId } from '@deep-foundation/deepcase/imports/hooks'; +import { Provider as ProviderDeepcase } from '@deep-foundation/deepcase/imports/provider'; +import { DeepNamespaceProvider, DeepProvider, useDeep } from '@deep-foundation/deeplinks/imports/client'; +import { MinilinksProvider } from '@deep-foundation/deeplinks/imports/minilinks'; +import { useQueryStore } from '@deep-foundation/store/query'; +import { useTranslation } from 'next-i18next'; +import getConfig from 'next/config'; +import { useRouter } from 'next/router'; +import { useEffect, useState } from 'react'; +import { IoMdExit } from "react-icons/io"; +import pckg from '../package.json'; +import { i18nGetStaticProps } from '../src/i18n.tsx'; +import { useDeepPath } from '../src/provider.tsx'; + +const { publicRuntimeConfig } = getConfig(); + +export const Tab = ({ + id, name, type, icon, isActive, onClick, + side = 'right' +}: { + id: number; + name: string; + type: string; + icon: string; + isActive: boolean; + onClick: (id: number) => void; + side?: 'left' | 'right'; +}) => { + return + + + + + + +}; + +export const LayoutButton = ({ + id, name, isActive, onClick +}: { + id: string; + name: string; + isActive: boolean; + onClick: (id: string) => void; +}) => { + return + + + + + +}; + +export function Status() { + const deep = useDeep(); + // const status = deep.client.useApolloNetworkStatus(); + const status = {} + console.log('status', status); + return <> + + ; +} + +export function Content() { + const deep = useDeep(); + const { t } = useTranslation(); + const router = useRouter(); + + // @ts-ignore + if (typeof(window) === 'object') window.deep = deep; + console.log('deep', deep); + + const [layout, setLayout] = useQueryStore('layout', 'c'); + + const [spaceId, setSpaceId] = useSpaceId(); + const [containerId, setContainerId] = useContainer(); + + return ( + + + + + setSpaceId(id)} isActive={spaceId === 123} + /> + setSpaceId(id)} isActive={spaceId === 4324} + /> + setSpaceId(id)} isActive={spaceId === 1273} + /> + setSpaceId(id)} isActive={spaceId === 2473} + /> + setSpaceId(id)} isActive={spaceId === 4273} + /> + setSpaceId(id)} isActive={spaceId === 5173} + /> + + + setSpaceId(id)} isActive={spaceId === 452} + side='left' + /> + + + + + setLayout(id)}/> + setLayout(id)}/> + setLayout(id)}/> + setLayout(id)}/> + + + + + + {layout === 'c' && + } + {layout === 'g' && } + {layout === 'f' && + } + {layout === 'o' && + + } + + + ); + // return ( + // + // + // + // + // ); +}; + +export default function Page({ + defaultPath, defaultSsl, disableConnector +}: { + defaultPath: string; + defaultSsl: boolean; + disableConnector: boolean; +}) { + const [path, setPath] = useDeepPath(defaultPath); + const [ssl, setSsl] = useState(defaultSsl); + + useEffect(() => { + if (!disableConnector) { + return; + } + if (typeof window !== 'undefined') { + const browserURI = window?.location?.origin; + if (browserURI) { + const [browserPath, browserSsl] = parseUrl(browserURI); + setPath(browserPath + "/api/gql"); + setSsl(browserSsl); + } + } + }, []); + + return ( + + + + {!!path && <> + {/* */} + + + + } + + + + ); +}; + +export async function getStaticProps(arg) { + const result = await i18nGetStaticProps(arg); + result.props = result?.props || {}; + + result.props.defaultPath = publicRuntimeConfig?.NEXT_PUBLIC_GQL_PATH || ''; + result.props.defaultSsl = !!+publicRuntimeConfig?.NEXT_PUBLIC_GQL_SSL || false; + result.props.serverUrl = publicRuntimeConfig?.NEXT_PUBLIC_DEEPLINKS_SERVER || 'http://localhost:3007'; + result.props.deeplinksUrl = publicRuntimeConfig?.NEXT_PUBLIC_DEEPLINKS_URL || 'http://localhost:3006'; + result.props.disableConnector = !!+publicRuntimeConfig?.NEXT_PUBLIC_DISABLE_CONNECTOR || false; + result.props.appVersion = pckg?.version || ''; + + return result; +} \ No newline at end of file