diff --git a/src/common/Home.tsx b/src/common/Home.tsx index 4258ac65..9c48fdd0 100644 --- a/src/common/Home.tsx +++ b/src/common/Home.tsx @@ -45,26 +45,24 @@ export const Home = ({ servers }: HomeProps) => { > Welcome! - - {!hasServers && ( -
-

This application will help you manage your Shlink servers.

-

- -

-

- - - Learn more about Shlink - - - -

-
- )} -
+ {hasServers ? : ( +
+

This application will help you manage your Shlink servers.

+

+ +

+

+ + + Learn more about Shlink + + + +

+
+ )} diff --git a/src/servers/ManageServers.tsx b/src/servers/ManageServers.tsx index d9ba7b17..04966585 100644 --- a/src/servers/ManageServers.tsx +++ b/src/servers/ManageServers.tsx @@ -63,13 +63,17 @@ const ManageServers: FCWithDeps = ({ serv - {hasAutoConnect && Auto-connect} + {hasAutoConnect && ( + Auto-connect + )} NameBase URLOptions )}> - {!filteredServers.length && No servers found.} + {!filteredServers.length && ( + No servers found. + )} {filteredServers.map((server) => ( ))} diff --git a/src/servers/ManageServersRow.tsx b/src/servers/ManageServersRow.tsx index 91fd5067..b90a777c 100644 --- a/src/servers/ManageServersRow.tsx +++ b/src/servers/ManageServersRow.tsx @@ -27,7 +27,7 @@ const ManageServersRow: FCWithDeps {server.autoConnect && ( <> - + Auto-connect to this server diff --git a/src/servers/ServersDropdown.tsx b/src/servers/ServersDropdown.tsx index fbfe08c9..948cf1dd 100644 --- a/src/servers/ServersDropdown.tsx +++ b/src/servers/ServersDropdown.tsx @@ -17,7 +17,7 @@ export const ServersDropdown = ({ servers, selectedServer }: ServersDropdownProp if (serversList.length === 0) { return ( - Add a server + Add a server ); } @@ -31,7 +31,7 @@ export const ServersDropdown = ({ servers, selectedServer }: ServersDropdownProp ))} - Manage servers + Manage servers ); @@ -40,9 +40,9 @@ export const ServersDropdown = ({ servers, selectedServer }: ServersDropdownProp return ( - Servers + Servers - {renderServers()} + {renderServers()} ); }; diff --git a/src/servers/ServersListGroup.tsx b/src/servers/ServersListGroup.tsx index 0d8d1af8..eed7824f 100644 --- a/src/servers/ServersListGroup.tsx +++ b/src/servers/ServersListGroup.tsx @@ -1,14 +1,14 @@ import { faChevronRight as chevronIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { clsx } from 'clsx'; -import type { FC, PropsWithChildren } from 'react'; +import type { FC } from 'react'; import { Link } from 'react-router'; import type { ServerWithId } from './data'; -type ServersListGroupProps = PropsWithChildren<{ +type ServersListGroupProps = { servers: ServerWithId[]; borderless?: boolean; -}>; +}; const ServerListItem = ({ id, name }: { id: string; name: string }) => ( ( ); -export const ServersListGroup: FC = ({ servers, children, borderless }) => ( +export const ServersListGroup: FC = ({ servers, borderless }) => ( <> - {children &&
{children}
} {servers.length > 0 && (
= ({ onSubmit, initialValues, child const handleSubmit = handleEventPreventingDefault(() => onSubmit({ name, url, apiKey })); return ( -
+ setName(e.target.value)} required /> setUrl(e.target.value)} required /> diff --git a/test/servers/ServersListGroup.test.tsx b/test/servers/ServersListGroup.test.tsx index cc2479c6..274d6f90 100644 --- a/test/servers/ServersListGroup.test.tsx +++ b/test/servers/ServersListGroup.test.tsx @@ -10,30 +10,18 @@ describe('', () => { fromPartial({ name: 'foo', id: '123' }), fromPartial({ name: 'bar', id: '456' }), ]; - const setUp = (params: { servers?: ServerWithId[]; withChildren?: boolean; borderless?: boolean } = {}) => { - const { servers = [], withChildren = true, borderless } = params; + const setUp = (params: { servers?: ServerWithId[]; borderless?: boolean } = {}) => { + const { servers = [], borderless } = params; return render( - - {withChildren ? 'The list of servers' : undefined} - + , ); }; it('passes a11y checks', () => checkAccessibility(setUp())); - it('renders title', () => { - setUp({}); - expect(screen.getByTestId('title')).toHaveTextContent('The list of servers'); - }); - - it('does not render title when children is not provided', () => { - setUp({ withChildren: false }); - expect(screen.queryByTestId('title')).not.toBeInTheDocument(); - }); - it.each([ [servers], [[]], diff --git a/test/servers/__snapshots__/ManageServersRow.test.tsx.snap b/test/servers/__snapshots__/ManageServersRow.test.tsx.snap index 0ecf0a1a..855d1bb5 100644 --- a/test/servers/__snapshots__/ManageServersRow.test.tsx.snap +++ b/test/servers/__snapshots__/ManageServersRow.test.tsx.snap @@ -24,7 +24,7 @@ exports[` > renders auto-connect icon only if server is auto >