feat: add no result found UI on apps
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
"apps.addConnection": "Add connection",
|
"apps.addConnection": "Add connection",
|
||||||
"apps.addNewAppConnection": "Add a new app connection",
|
"apps.addNewAppConnection": "Add a new app connection",
|
||||||
"apps.searchApp": "Search for app",
|
"apps.searchApp": "Search for app",
|
||||||
|
"apps.noConnections": "You don't have any connections yet.",
|
||||||
"addAppConnection.submit": "Submit",
|
"addAppConnection.submit": "Submit",
|
||||||
"connection.flowCount": "{count} flows",
|
"connection.flowCount": "{count} flows",
|
||||||
"connection.viewFlows": "View flows",
|
"connection.viewFlows": "View flows",
|
||||||
|
@@ -4,9 +4,12 @@ import type { LinkProps } from 'react-router-dom';
|
|||||||
import { useQuery } from '@apollo/client';
|
import { useQuery } from '@apollo/client';
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import Grid from '@mui/material/Grid';
|
import Grid from '@mui/material/Grid';
|
||||||
|
import Divider from '@mui/material/Divider';
|
||||||
|
import CircularProgress from '@mui/material/CircularProgress';
|
||||||
import AddIcon from '@mui/icons-material/Add';
|
import AddIcon from '@mui/icons-material/Add';
|
||||||
import type { IApp } from '@automatisch/types';
|
import type { IApp } from '@automatisch/types';
|
||||||
|
|
||||||
|
import NoResultFound from 'components/NoResultFound';
|
||||||
import ConditionalIconButton from 'components/ConditionalIconButton';
|
import ConditionalIconButton from 'components/ConditionalIconButton';
|
||||||
import Container from 'components/Container';
|
import Container from 'components/Container';
|
||||||
import AddNewAppConnection from 'components/AddNewAppConnection';
|
import AddNewAppConnection from 'components/AddNewAppConnection';
|
||||||
@@ -21,7 +24,10 @@ export default function Applications(): React.ReactElement {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const [appName, setAppName] = React.useState(null);
|
const [appName, setAppName] = React.useState(null);
|
||||||
const { data } = useQuery(GET_CONNECTED_APPS, { variables: {name: appName } });
|
const { data, loading } = useQuery(GET_CONNECTED_APPS, { variables: {name: appName } });
|
||||||
|
|
||||||
|
const apps: IApp[] = data?.getConnectedApps;
|
||||||
|
const hasApps = apps?.length;
|
||||||
|
|
||||||
const onSearchChange = React.useCallback((event) => {
|
const onSearchChange = React.useCallback((event) => {
|
||||||
setAppName(event.target.value);
|
setAppName(event.target.value);
|
||||||
@@ -45,7 +51,7 @@ export default function Applications(): React.ReactElement {
|
|||||||
return (
|
return (
|
||||||
<Box sx={{ py: 3 }}>
|
<Box sx={{ py: 3 }}>
|
||||||
<Container>
|
<Container>
|
||||||
<Grid container sx={{ mb: [2, 5] }} columnSpacing={1.5} rowSpacing={3}>
|
<Grid container sx={{ mb: [0, 3] }} columnSpacing={1.5} rowSpacing={3}>
|
||||||
<Grid container item xs sm alignItems="center" order={{ xs: 0 }}>
|
<Grid container item xs sm alignItems="center" order={{ xs: 0 }}>
|
||||||
<PageTitle>{formatMessage('apps.title')}</PageTitle>
|
<PageTitle>{formatMessage('apps.title')}</PageTitle>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -69,7 +75,17 @@ export default function Applications(): React.ReactElement {
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
{data?.getConnectedApps?.map((app: IApp) => (
|
<Divider sx={{ mt: [2, 0], mb: 2 }} />
|
||||||
|
|
||||||
|
{loading && <CircularProgress sx={{ display: 'block', margin: '20px auto' }} />}
|
||||||
|
|
||||||
|
{!loading && !hasApps && (<NoResultFound
|
||||||
|
text={formatMessage('apps.noConnections')}
|
||||||
|
to={URLS.NEW_APP_CONNECTION}
|
||||||
|
/>)}
|
||||||
|
|
||||||
|
|
||||||
|
{!loading && apps?.map((app: IApp) => (
|
||||||
<AppRow key={app.name} application={app} />
|
<AppRow key={app.name} application={app} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user