diff --git a/packages/web/src/components/AddAppConnection/index.tsx b/packages/web/src/components/AddAppConnection/index.tsx new file mode 100644 index 00000000..d76580a4 --- /dev/null +++ b/packages/web/src/components/AddAppConnection/index.tsx @@ -0,0 +1,24 @@ +import DialogTitle from '@mui/material/DialogTitle'; +import DialogContent from '@mui/material/DialogContent'; +import DialogContentText from '@mui/material/DialogContentText'; +import Dialog from '@mui/material/Dialog'; + +type AddAppConnectionProps = { + onClose: (value: string) => void; +}; + +export default function AddAppConnection(props: AddAppConnectionProps){ + const { onClose } = props; + + return ( + + Add connection + + + + Here comes the "add connection" dialog + + + + ); +}; diff --git a/packages/web/src/components/AppIcon/index.tsx b/packages/web/src/components/AppIcon/index.tsx new file mode 100644 index 00000000..46e5c7a3 --- /dev/null +++ b/packages/web/src/components/AppIcon/index.tsx @@ -0,0 +1,15 @@ +import Avatar from '@mui/material/Avatar'; + +type AppIconProps = { + name: string; + url: string; + color?: string; +}; + +export default function AppIcon(props: AppIconProps) { + const { color = '#00adef', name, url } = props; + + return ( + + ); +}; diff --git a/packages/web/src/components/AppRow/index.tsx b/packages/web/src/components/AppRow/index.tsx index 26f15681..09727638 100644 --- a/packages/web/src/components/AppRow/index.tsx +++ b/packages/web/src/components/AppRow/index.tsx @@ -41,13 +41,13 @@ function AppRow(props: AppRowProps) { - {formatMessage('app.connections', { count: countTranslation(Math.round(Math.random() * 100)) })} + {formatMessage('app.connectionCount', { count: countTranslation(Math.round(Math.random() * 100)) })} - {formatMessage('app.flows', { count: countTranslation(Math.round(Math.random() * 100)) })} + {formatMessage('app.flowCount', { count: countTranslation(Math.round(Math.random() * 100)) })} diff --git a/packages/web/src/components/TabPanel/index.tsx b/packages/web/src/components/TabPanel/index.tsx new file mode 100644 index 00000000..966210c8 --- /dev/null +++ b/packages/web/src/components/TabPanel/index.tsx @@ -0,0 +1,19 @@ +interface TabPanelProps { + children?: React.ReactNode; + index: number; + value: number; +} + +export default function TabPanel(props: TabPanelProps) { + const { children, value, index, ...other } = props; + + return ( + + ); +}; diff --git a/packages/web/src/config/urls.ts b/packages/web/src/config/urls.ts index 3c13122e..ad1c585f 100644 --- a/packages/web/src/config/urls.ts +++ b/packages/web/src/config/urls.ts @@ -2,5 +2,11 @@ export const DASHBOARD = '/dashboard'; export const APPS = '/apps'; export const FLOWS = '/flows'; export const EXPLORE = '/explore'; -export const APP_PATH = (appSlug: string) => `/app/${appSlug}`; -export const APP_PATH_PATTERN = '/app/:slug'; +export const APP = (appSlug: string) => `/app/${appSlug}`; +export const APP_PATTERN = '/app/:slug'; +export const APP_CONNECTIONS = (appSlug: string) => `/app/${appSlug}/connections`; +export const APP_CONNECTIONS_PATTERN = '/app/:slug/connections'; +export const APP_ADD_CONNECTION = (appSlug: string) => `/app/${appSlug}/connections/add`; +export const APP_ADD_CONNECTION_PATTERN = '/app/:slug/connections/add'; +export const APP_FLOWS = (appSlug: string) => `/app/${appSlug}/flows`; +export const APP_FLOWS_PATTERN = '/app/:slug/flows'; diff --git a/packages/web/src/graphql/queries/get-app.ts b/packages/web/src/graphql/queries/get-app.ts new file mode 100644 index 00000000..eb7f24a9 --- /dev/null +++ b/packages/web/src/graphql/queries/get-app.ts @@ -0,0 +1,22 @@ +import { gql } from '@apollo/client'; + +export const GET_APP = gql` + query GetApp($name: String!) { + getApp (name: $name) { + name + iconUrl + docUrl + fields { + key + label + type + required + readOnly + placeholder + description + docUrl + clickToCopy + } + } + } +`; diff --git a/packages/web/src/locales/en.json b/packages/web/src/locales/en.json index e90c12d3..cb830a71 100644 --- a/packages/web/src/locales/en.json +++ b/packages/web/src/locales/en.json @@ -6,6 +6,10 @@ "drawer.flows": "Flows", "drawer.apps": "My Apps", "drawer.explore": "Explore", - "app.connections": "{count} connections", - "app.flows": "{count} flows" + "app.connectionCount": "{count} connections", + "app.flowCount": "{count} flows", + "app.addConnection": "Add connection", + "app.settings": "Settings", + "app.connections": "Connections", + "app.flows": "Flows" } \ No newline at end of file diff --git a/packages/web/src/pages/Application/index.tsx b/packages/web/src/pages/Application/index.tsx index 1c60f62f..55d88ded 100644 --- a/packages/web/src/pages/Application/index.tsx +++ b/packages/web/src/pages/Application/index.tsx @@ -1,26 +1,102 @@ -import { useCallback, useState } from 'react'; +import { useQuery } from '@apollo/client'; +import { Link, Route, Redirect, Switch, useParams, useRouteMatch, useHistory } from 'react-router-dom'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Grid'; +import Button from '@mui/material/Button'; +import IconButton from '@mui/material/IconButton'; +import Tabs from '@mui/material/Tabs'; +import Tab from '@mui/material/Tab'; +import SettingsIcon from '@mui/icons-material/Settings'; +import useFormatMessage from 'hooks/useFormatMessage'; +import { GET_APP } from 'graphql/queries/get-app'; +import * as URLS from 'config/urls'; + +import AddAppConnection from 'components/AddAppConnection'; +import AppIcon from 'components/AppIcon'; import Container from 'components/Container'; import PageTitle from 'components/PageTitle'; -import SearchInput from 'components/SearchInput'; +type ApplicationParams = { + slug: string; +}; -export default function Applications() { +export default function Application() { + const formatMessage = useFormatMessage(); + const routeMatch = useRouteMatch([URLS.APP_CONNECTIONS_PATTERN, URLS.APP_FLOWS_PATTERN, URLS.APP_PATTERN]); + const { slug } = useParams(); + const history = useHistory(); + const { data } = useQuery(GET_APP, { variables: { name: slug } }); + + const app = data?.getApp || {}; + + const goToApplicationPage = () => history.push(URLS.APP(slug)); return ( - - - - - Application! + <> + + + + + + + + + {app.name} + + + + + + + + + - + + + + + + + + + + + + + Flows come here. + + + + Connections come here. + + + + + + + - - - + + + + + + + ); }; diff --git a/packages/web/src/pages/Applications/index.tsx b/packages/web/src/pages/Applications/index.tsx index e267f55d..492732d3 100644 --- a/packages/web/src/pages/Applications/index.tsx +++ b/packages/web/src/pages/Applications/index.tsx @@ -33,7 +33,7 @@ export default function Applications() { {data?.getApps?.map((name: string) => ( - + ))} diff --git a/packages/web/src/routes.tsx b/packages/web/src/routes.tsx index 061ec64c..0f9d0022 100644 --- a/packages/web/src/routes.tsx +++ b/packages/web/src/routes.tsx @@ -24,7 +24,7 @@ export default ( - +