diff --git a/.gitignore b/.gitignore index 0bd7603..19a9ac3 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,10 @@ # testing /coverage +# development +bundle.js +bundle.js.map + # production /build diff --git a/package.json b/package.json index bd24b98..ee32f92 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,10 @@ "lint-staged": { "src/**/*.{js,jsx,ts,tsx}": [ "eslint --fix", - "prettier --write --tab-width 4 --single-quote", - "git add" + "prettier --write --tab-width 4 --single-quote" ], "src/**/*.{json,css,scss,md}": [ - "prettier --write --tab-width 4 --single-quote", - "git add" + "prettier --write --tab-width 4 --single-quote" ] }, "husky": { diff --git a/src/clients/Element.io.ts b/src/clients/Element.ts similarity index 95% rename from src/clients/Element.io.ts rename to src/clients/Element.ts index 2550840..0693ede 100644 --- a/src/clients/Element.io.ts +++ b/src/clients/Element.ts @@ -24,7 +24,7 @@ import { import { LinkKind } from '../parser/types'; import logo from '../imgs/element.svg'; -const Element: LinkedClient = { +export const Element: LinkedClient = { kind: ClientKind.LINKED_CLIENT, name: 'Element', author: 'Element', @@ -32,7 +32,7 @@ const Element: LinkedClient = { homepage: 'https://element.io', maturity: Maturity.STABLE, description: 'Fully-featured Matrix client for the Web', - platform: Platform.Desktop, + platforms: [Platform.Desktop, Platform.Android, Platform.iOS], experimental: false, clientId: ClientId.Element, toUrl: (link) => { @@ -69,7 +69,7 @@ export const ElementDevelop: LinkedClient = { homepage: 'https://element.io', maturity: Maturity.STABLE, description: 'Fully-featured Matrix client for the Web', - platform: Platform.Desktop, + platforms: [Platform.Desktop], experimental: true, clientId: ClientId.ElementDevelop, toUrl: (link) => { @@ -95,4 +95,3 @@ export const ElementDevelop: LinkedClient = { }, linkSupport: () => true, }; -export default Element; diff --git a/src/clients/Fractal.tsx b/src/clients/Fractal.tsx index 058b4d6..bd0f068 100644 --- a/src/clients/Fractal.tsx +++ b/src/clients/Fractal.tsx @@ -30,7 +30,7 @@ const Fractal: TextClient = { homepage: 'https://github.com/poljar/weechat-matrix', maturity: Maturity.BETA, experimental: false, - platform: Platform.Desktop, + platforms: [Platform.Desktop], clientId: ClientId.Fractal, toInviteString: (link) => { switch (link.kind) { diff --git a/src/clients/Nheko.tsx b/src/clients/Nheko.tsx index a0954d1..1195716 100644 --- a/src/clients/Nheko.tsx +++ b/src/clients/Nheko.tsx @@ -30,7 +30,7 @@ const Nheko: TextClient = { homepage: 'https://github.com/Nheko-Reborn/nheko', maturity: Maturity.BETA, experimental: false, - platform: Platform.Desktop, + platforms: [Platform.Desktop], clientId: ClientId.Nheko, toInviteString: (link) => { switch (link.kind) { @@ -40,7 +40,10 @@ const Nheko: TextClient = { Type{' '} - /join {link.identifier} + /join{' '} + + {link.identifier} + ); @@ -49,7 +52,10 @@ const Nheko: TextClient = { Type{' '} - /invite {link.identifier} + /invite{' '} + + {link.identifier} + ); diff --git a/src/clients/Weechat.tsx b/src/clients/Weechat.tsx index cd15769..105a979 100644 --- a/src/clients/Weechat.tsx +++ b/src/clients/Weechat.tsx @@ -30,7 +30,7 @@ const Weechat: TextClient = { homepage: 'https://github.com/poljar/weechat-matrix', maturity: Maturity.LATE_BETA, experimental: false, - platform: Platform.Desktop, + platforms: [Platform.Desktop], clientId: ClientId.WeeChat, toInviteString: (link) => { switch (link.kind) { @@ -40,7 +40,10 @@ const Weechat: TextClient = { Type{' '} - /join {link.identifier} + /join{' '} + + {link.identifier} + ); @@ -49,7 +52,10 @@ const Weechat: TextClient = { Type{' '} - /invite {link.identifier} + /invite{' '} + + {link.identifier} + ); diff --git a/src/clients/index.ts b/src/clients/index.ts index c3686bb..a00cd71 100644 --- a/src/clients/index.ts +++ b/src/clients/index.ts @@ -16,7 +16,7 @@ limitations under the License. import { Client } from './types'; -import Element, { ElementDevelop } from './Element.io'; +import { Element, ElementDevelop } from './Element'; import Weechat from './Weechat'; import Nheko from './Nheko'; import Fractal from './Fractal'; diff --git a/src/clients/types.ts b/src/clients/types.ts index 5a93f15..3278f96 100644 --- a/src/clients/types.ts +++ b/src/clients/types.ts @@ -62,7 +62,7 @@ export interface ClientDescription { homepage: string; logo: string; description: string; - platform: Platform; + platforms: Platform[]; maturity: Maturity; clientId: ClientId; experimental: boolean; diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx index 4dcffc9..adf99ac 100644 --- a/src/components/Avatar.tsx +++ b/src/components/Avatar.tsx @@ -35,7 +35,7 @@ interface IProps { const Avatar: React.FC = ({ className, avatarUrl, label }: IProps) => { const [src, setSrc] = useState(avatarUrl); useEffect(() => { - setSrc(avatarUrl); + setSrc(avatarUrl ? avatarUrl : logo); }, [avatarUrl]); const _className = classNames('avatar', className, { diff --git a/src/components/ClientList.tsx b/src/components/ClientList.tsx index 4d23d37..64dbebc 100644 --- a/src/components/ClientList.tsx +++ b/src/components/ClientList.tsx @@ -47,16 +47,18 @@ const ClientList: React.FC = ({ link, rememberSelection }: IProps) => { showClient = true; } - switch (client.platform) { - case Platform.Desktop: - showClient = showClient || !(uaResults as any).mobile; - break; - case Platform.iOS: - showClient = showClient || (uaResults as any).ios; - break; - case Platform.Android: - showClient = showClient || (uaResults as any).android; - break; + for (const platform of client.platforms) { + switch (platform) { + case Platform.Desktop: + showClient = showClient || !(uaResults as any).mobile; + break; + case Platform.iOS: + showClient = showClient || (uaResults as any).ios; + break; + case Platform.Android: + showClient = showClient || (uaResults as any).android; + break; + } } if (!showExperimentalClients && client.experimental) { diff --git a/src/components/ClientSelection.tsx b/src/components/ClientSelection.tsx index 9989b29..6e5ed8d 100644 --- a/src/components/ClientSelection.tsx +++ b/src/components/ClientSelection.tsx @@ -38,7 +38,7 @@ const ClientSelection: React.FC = ({ link }: IProps) => { }} checked={rememberSelection} > - Remember choice for future invites in this browser + Remember for future invites in this browser { diff --git a/src/components/ClientTile.tsx b/src/components/ClientTile.tsx index c238a8b..e8eddde 100644 --- a/src/components/ClientTile.tsx +++ b/src/components/ClientTile.tsx @@ -47,7 +47,7 @@ const ClientTile: React.FC = ({ client, link }: IProps) => { if (copyString !== '') { inviteButton = ( -

{props.link}

+

{props.link}