Skip to content
Snippets Groups Projects
Commit 4d456c27 authored by Jorik Schellekens's avatar Jorik Schellekens
Browse files

Implement design review changes

parent 471c9cd2
No related branches found
No related tags found
No related merge requests found
Showing
with 357 additions and 86 deletions
...@@ -20,6 +20,7 @@ limitations under the License. ...@@ -20,6 +20,7 @@ limitations under the License.
background-color: $app-background; background-color: $app-background;
background-image: url('./imgs/background.svg'); background-image: url('./imgs/background.svg');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: stretch;
background-position: 50% -20%; background-position: 50% -20%;
} }
...@@ -32,7 +33,7 @@ limitations under the License. ...@@ -32,7 +33,7 @@ limitations under the License.
.topSpacer { .topSpacer {
@include spacer; @include spacer;
height: 20vh; height: 10vh;
} }
.bottomSpacer { .bottomSpacer {
......
...@@ -21,6 +21,7 @@ import CreateLinkTile from './components/CreateLinkTile'; ...@@ -21,6 +21,7 @@ import CreateLinkTile from './components/CreateLinkTile';
import MatrixTile from './components/MatrixTile'; import MatrixTile from './components/MatrixTile';
import Tile from './components/Tile'; import Tile from './components/Tile';
import LinkRouter from './pages/LinkRouter'; import LinkRouter from './pages/LinkRouter';
import Footer from './components/Footer';
import './App.scss'; import './App.scss';
...@@ -32,7 +33,6 @@ const App: React.FC = () => { ...@@ -32,7 +33,6 @@ const App: React.FC = () => {
let page = ( let page = (
<> <>
<CreateLinkTile /> <CreateLinkTile />
<hr />
</> </>
); );
...@@ -50,12 +50,18 @@ const App: React.FC = () => { ...@@ -50,12 +50,18 @@ const App: React.FC = () => {
} }
return ( return (
<GlobalContext>
<SingleColumn> <SingleColumn>
<div className="topSpacer" /> <div className="topSpacer" />
<GlobalContext>{page}</GlobalContext> {page}
<MatrixTile /> <div>
<MatrixTile isLink={!!location.hash} />
<br />
<Footer />
</div>
<div className="bottomSpacer" /> <div className="bottomSpacer" />
</SingleColumn> </SingleColumn>
</GlobalContext>
); );
}; };
......
...@@ -19,7 +19,7 @@ import classNames from 'classnames'; ...@@ -19,7 +19,7 @@ import classNames from 'classnames';
import { Room, User } from 'matrix-cypher'; import { Room, User } from 'matrix-cypher';
import { getMediaQueryFromMCX } from '../utils/cypher-wrapper'; import { getMediaQueryFromMCX } from '../utils/cypher-wrapper';
import logo from '../imgs/matrix-logo.svg'; import logo from '../imgs/chat-icon.svg';
import './Avatar.scss'; import './Avatar.scss';
......
...@@ -14,12 +14,13 @@ See the License for the specific language governing permissions and ...@@ -14,12 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
@import "../color-scheme"; @import '../color-scheme';
.button { .button {
width: 100%; width: 100%;
padding: 1rem; height: 48px;
border-radius: 2rem; border-radius: 2rem;
border: 0; border: 0;
...@@ -28,6 +29,31 @@ limitations under the License. ...@@ -28,6 +29,31 @@ limitations under the License.
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
&:hover {
cursor: pointer;
}
position: relative;
.buttonIcon {
position: absolute;
height: 24px;
width: 24px;
left: 18px;
top: 12px;
}
}
.buttonSecondary {
background-color: $background;
color: $foreground;
border: 1px solid $foreground;
}
.errorButton:hover {
cursor: not-allowed;
} }
.buttonHighlight { .buttonHighlight {
......
...@@ -27,3 +27,7 @@ export const WithText: React.FC = () => ( ...@@ -27,3 +27,7 @@ export const WithText: React.FC = () => (
{text('label', 'Hello Story Book')} {text('label', 'Hello Story Book')}
</Button> </Button>
); );
export const Secondary: React.FC = () => (
<Button secondary>Secondary button</Button>
);
...@@ -22,6 +22,9 @@ import './Button.scss'; ...@@ -22,6 +22,9 @@ import './Button.scss';
interface IProps extends React.ButtonHTMLAttributes<Element> { interface IProps extends React.ButtonHTMLAttributes<Element> {
// Briefly display these instead of the children onClick // Briefly display these instead of the children onClick
flashChildren?: React.ReactNode; flashChildren?: React.ReactNode;
secondary?: boolean;
icon?: string;
flashIcon?: string;
} }
/** /**
...@@ -31,7 +34,16 @@ const Button: React.FC< ...@@ -31,7 +34,16 @@ const Button: React.FC<
IProps & React.RefAttributes<HTMLButtonElement> IProps & React.RefAttributes<HTMLButtonElement>
> = React.forwardRef( > = React.forwardRef(
( (
{ onClick, children, flashChildren, className, ...props }: IProps, {
onClick,
children,
flashChildren,
className,
secondary,
icon,
flashIcon,
...props
}: IProps,
ref: React.Ref<HTMLButtonElement> ref: React.Ref<HTMLButtonElement>
) => { ) => {
const [wasClicked, setWasClicked] = React.useState(false); const [wasClicked, setWasClicked] = React.useState(false);
...@@ -51,8 +63,15 @@ const Button: React.FC< ...@@ -51,8 +63,15 @@ const Button: React.FC<
const classNames = classnames('button', className, { const classNames = classnames('button', className, {
buttonHighlight: wasClicked, buttonHighlight: wasClicked,
buttonSecondary: secondary,
}); });
const iconSrc = wasClicked && flashIcon ? flashIcon : icon;
const buttonIcon = icon ? (
<img className="buttonIcon" src={iconSrc} alt="" />
) : null;
return ( return (
<button <button
className={classNames} className={classNames}
...@@ -60,6 +79,7 @@ const Button: React.FC< ...@@ -60,6 +79,7 @@ const Button: React.FC<
ref={ref} ref={ref}
{...props} {...props}
> >
{buttonIcon}
{content} {content}
</button> </button>
); );
......
...@@ -38,7 +38,7 @@ const ClientSelection: React.FC<IProps> = ({ link }: IProps) => { ...@@ -38,7 +38,7 @@ const ClientSelection: React.FC<IProps> = ({ link }: IProps) => {
}} }}
checked={rememberSelection} checked={rememberSelection}
> >
Remember my selection for future invites in this browser Remember choice for future invites in this browser
</StyledCheckbox> </StyledCheckbox>
<StyledCheckbox <StyledCheckbox
onChange={(): void => { onChange={(): void => {
...@@ -79,7 +79,6 @@ const ClientSelection: React.FC<IProps> = ({ link }: IProps) => { ...@@ -79,7 +79,6 @@ const ClientSelection: React.FC<IProps> = ({ link }: IProps) => {
return ( return (
<div className="advanced"> <div className="advanced">
{options} {options}
<h4>Clients you can accept this invite with</h4>
<ClientList link={link} rememberSelection={rememberSelection} /> <ClientList link={link} rememberSelection={rememberSelection} />
{clearSelection} {clearSelection}
</div> </div>
......
...@@ -19,7 +19,7 @@ limitations under the License. ...@@ -19,7 +19,7 @@ limitations under the License.
.clientTile { .clientTile {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: flex-start;
min-height: 150px; min-height: 150px;
width: 100%; width: 100%;
...@@ -28,7 +28,10 @@ limitations under the License. ...@@ -28,7 +28,10 @@ limitations under the License.
> img { > img {
flex-shrink: 0; flex-shrink: 0;
height: 130px; height: 116px;
width: 116px;
margin-right: 14px;
border-radius: 16px;
} }
> div { > div {
...@@ -47,11 +50,10 @@ limitations under the License. ...@@ -47,11 +50,10 @@ limitations under the License.
} }
.button { .button {
margin: 5px; width: 50%;
} }
} }
border: 1px solid $borders;
border-radius: 8px; border-radius: 8px;
padding: 15px; padding: 15px;
...@@ -59,8 +61,8 @@ limitations under the License. ...@@ -59,8 +61,8 @@ limitations under the License.
// For the chevron // For the chevron
position: relative; position: relative;
&::hover { &:hover {
background-color: $grey; background-color: $app-background;
} }
} }
...@@ -68,12 +70,4 @@ limitations under the License. ...@@ -68,12 +70,4 @@ limitations under the License.
position: relative; position: relative;
width: 100%; width: 100%;
&::after {
// TODO: add chevron top right
position: absolute;
right: 10px;
top: 5px;
content: '>';
}
} }
...@@ -29,7 +29,6 @@ limitations under the License. ...@@ -29,7 +29,6 @@ limitations under the License.
display: grid; display: grid;
row-gap: 24px; row-gap: 24px;
align-self: center; align-self: center;
padding: 0 30px;
} }
> a { > a {
...@@ -39,4 +38,56 @@ limitations under the License. ...@@ -39,4 +38,56 @@ limitations under the License.
h1 { h1 {
word-break: break-all; word-break: break-all;
} }
.createLinkReset {
height: 40px;
width: 40px;
border-radius: 100%;
border: 1px solid lighten($grey, 50%);
background: $background;
padding: 6px;
position: relative;
> div {
// This is a terrible case of faking it till
// we make it. It will break. I'm so sorry
position: absolute;
display: none;
width: max-content;
top: -35px;
left: -17px;
border-radius: 30px;
padding: 5px 15px;
background: $background;
word-wrap: none;
}
img {
height: 100%;
width: 100%;
border: 0;
filter: invert(12%);
}
&:hover {
border: 0;
background: $foreground;
cursor: pointer;
> div {
display: block;
}
}
}
} }
...@@ -19,11 +19,13 @@ import { Formik, Form } from 'formik'; ...@@ -19,11 +19,13 @@ import { Formik, Form } from 'formik';
import Tile from './Tile'; import Tile from './Tile';
import Button from './Button'; import Button from './Button';
import TextButton from './TextButton';
import Input from './Input'; import Input from './Input';
import { parseHash } from '../parser/parser'; import { parseHash } from '../parser/parser';
import { LinkKind } from '../parser/types'; import { LinkKind } from '../parser/types';
import linkIcon from '../imgs/link.svg';
import copyIcon from '../imgs/copy.svg';
import tickIcon from '../imgs/tick.svg';
import refreshIcon from '../imgs/refresh.svg';
import './CreateLinkTile.scss'; import './CreateLinkTile.scss';
interface ILinkNotCreatedTileProps { interface ILinkNotCreatedTileProps {
...@@ -38,11 +40,16 @@ interface FormValues { ...@@ -38,11 +40,16 @@ interface FormValues {
function validate(values: FormValues): Partial<FormValues> { function validate(values: FormValues): Partial<FormValues> {
const errors: Partial<FormValues> = {}; const errors: Partial<FormValues> = {};
if (values.identifier === '') {
errors.identifier = '';
return errors;
}
const parse = parseHash(values.identifier); const parse = parseHash(values.identifier);
if (parse.kind === LinkKind.ParseFailed) { if (parse.kind === LinkKind.ParseFailed) {
errors.identifier = errors.identifier =
"That link doesn't look right. Double check the details."; "That identifier doesn't look right. Double check the details.";
} }
return errors; return errors;
...@@ -72,14 +79,26 @@ const LinkNotCreatedTile: React.FC<ILinkNotCreatedTileProps> = ( ...@@ -72,14 +79,26 @@ const LinkNotCreatedTile: React.FC<ILinkNotCreatedTileProps> = (
); );
}} }}
> >
{(formik): JSX.Element => (
<Form> <Form>
<Input <Input
name={'identifier'} name={'identifier'}
type={'text'} type={'text'}
placeholder="#room:example.com, @user:example.com" placeholder="#room:example.com, @user:example.com"
autoFocus
/> />
<Button type="submit">Get Link</Button> <Button
type="submit"
icon={linkIcon}
disabled={!!formik.errors.identifier}
className={
formik.errors.identifier ? 'errorButton' : ''
}
>
Create Link
</Button>
</Form> </Form>
)}
</Formik> </Formik>
</Tile> </Tile>
); );
...@@ -102,14 +121,20 @@ const LinkCreatedTile: React.FC<ILinkCreatedTileProps> = (props) => { ...@@ -102,14 +121,20 @@ const LinkCreatedTile: React.FC<ILinkCreatedTileProps> = (props) => {
return ( return (
<Tile className="createLinkTile"> <Tile className="createLinkTile">
<TextButton onClick={(): void => props.setLink('')}> <button
Create another lnk className="createLinkReset"
</TextButton> onClick={(): void => props.setLink('')}
>
<div>New link</div>
<img src={refreshIcon} />
</button>
<a href={props.link}> <a href={props.link}>
<h1>{props.link}</h1> <h1>{props.link}</h1>
</a> </a>
<Button <Button
flashChildren={'Copied'} flashChildren={'Copied'}
icon={copyIcon}
flashIcon={tickIcon}
onClick={(): void => { onClick={(): void => {
navigator.clipboard.writeText(props.link); navigator.clipboard.writeText(props.link);
}} }}
......
/*
Copyright 2020 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
@import '../color-scheme';
.footer {
display: grid;
grid-auto-flow: column;
justify-content: center;
column-gap: 5px;
* {
color: $font;
}
.textButton {
margin: 0;
padding: 0;
}
}
/*
Copyright 2020 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { useContext } from 'react';
import HSContext, {
HSOptions,
ActionType as HSACtionType,
} from '../contexts/HSContext';
import ClientContext, {
ActionType as ClientActionType,
} from '../contexts/ClientContext';
import TextButton from './TextButton';
import './Footer.scss';
const Footer: React.FC = () => {
const [hsState, hsDispatch] = useContext(HSContext);
const [clientState, clientDispatch] = useContext(ClientContext);
const clear =
hsState.option !== HSOptions.Unset || clientState.clientId !== null ? (
<>
{' · '}
<TextButton
onClick={(): void => {
hsDispatch({
action: HSACtionType.Clear,
});
clientDispatch({
action: ClientActionType.ClearClient,
});
}}
>
Clear preferences
</TextButton>
</>
) : null;
return (
<div className="footer">
<a href="https://github.com/matrix-org/matrix.to">
A github project
</a>
{' · '}
<a href="https://github.com/matrix-org/matrix.to/tree/matrix-two/src/clients">
Add your client
</a>
{clear}
</div>
);
};
export default Footer;
...@@ -46,6 +46,7 @@ limitations under the License. ...@@ -46,6 +46,7 @@ limitations under the License.
width: 62px; width: 62px;
padding: 11px; padding: 11px;
border-radius: 100%; border-radius: 100%;
margin-left: 14px;
} }
} }
......
...@@ -17,6 +17,7 @@ limitations under the License. ...@@ -17,6 +17,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import HomeserverOptions from './HomeserverOptions'; import HomeserverOptions from './HomeserverOptions';
import { LinkKind } from '../parser/types';
export default { export default {
title: 'HomeserverOptions', title: 'HomeserverOptions',
...@@ -29,4 +30,13 @@ export default { ...@@ -29,4 +30,13 @@ export default {
}, },
}; };
export const Default: React.FC = () => <HomeserverOptions />; export const Default: React.FC = () => (
<HomeserverOptions
link={{
identifier: '#banter:matrix.org',
arguments: { vias: [] },
kind: LinkKind.Alias,
originalLink: 'This is all made up',
}}
/>
);
...@@ -23,12 +23,14 @@ import HSContext, { TempHSContext, ActionType } from '../contexts/HSContext'; ...@@ -23,12 +23,14 @@ import HSContext, { TempHSContext, ActionType } from '../contexts/HSContext';
import icon from '../imgs/telecom-mast.svg'; import icon from '../imgs/telecom-mast.svg';
import Button from './Button'; import Button from './Button';
import Input from './Input'; import Input from './Input';
import Toggle from './Toggle';
import StyledCheckbox from './StyledCheckbox'; import StyledCheckbox from './StyledCheckbox';
import { SafeLink } from '../parser/types';
import './HomeserverOptions.scss'; import './HomeserverOptions.scss';
interface IProps {} interface IProps {
link: SafeLink;
}
interface FormValues { interface FormValues {
HSUrl: string; HSUrl: string;
...@@ -44,16 +46,19 @@ function validateURL(values: FormValues): Partial<FormValues> { ...@@ -44,16 +46,19 @@ function validateURL(values: FormValues): Partial<FormValues> {
return errors; return errors;
} }
const HomeserverOptions: React.FC<IProps> = () => { const HomeserverOptions: React.FC<IProps> = ({ link }: IProps) => {
const HSStateDispatcher = useContext(HSContext)[1]; const HSStateDispatcher = useContext(HSContext)[1];
const TempHSStateDispatcher = useContext(TempHSContext)[1]; const TempHSStateDispatcher = useContext(TempHSContext)[1];
const [rememberSelection, setRemeberSelection] = useState(false); const [rememberSelection, setRemeberSelection] = useState(false);
const [usePrefered, setUsePrefered] = useState(false);
// Select which disaptcher to use based on whether we're writing
// the choice to localstorage
const dispatcher = rememberSelection const dispatcher = rememberSelection
? HSStateDispatcher ? HSStateDispatcher
: TempHSStateDispatcher; : TempHSStateDispatcher;
const hsInput = usePrefered ? ( const hsInput = (
<Formik <Formik
initialValues={{ initialValues={{
HSUrl: '', HSUrl: '',
...@@ -63,23 +68,36 @@ const HomeserverOptions: React.FC<IProps> = () => { ...@@ -63,23 +68,36 @@ const HomeserverOptions: React.FC<IProps> = () => {
dispatcher({ action: ActionType.SetHS, HSURL: HSUrl }) dispatcher({ action: ActionType.SetHS, HSURL: HSUrl })
} }
> >
{({ values, errors }): JSX.Element => (
<Form> <Form>
<Input <Input
muted={!values.HSUrl}
type="text" type="text"
name="HSUrl" name="HSUrl"
placeholder="https://example.com" placeholder="https://example.com"
/> />
<Button type="submit">Set HS</Button> {values.HSUrl && !errors.HSUrl ? (
<Button secondary type="submit">
Use {values.HSUrl}
</Button>
) : null}
</Form> </Form>
)}
</Formik> </Formik>
) : null; );
return ( return (
<Tile className="homeserverOptions"> <Tile className="homeserverOptions">
<div className="homeserverOptionsDescription"> <div className="homeserverOptionsDescription">
<div> <div>
<h3>About {link.identifier}</h3>
<p> <p>
Let's locate a homeserver to show you more information. Select a homeserver to learn more about{' '}
{link.identifier}. <br />
The homeserver will provide metadata about the link such
as an avatar or description. Homeservers will be able to
relate your ip to resources you've opened invites for in
matrix.to
</p> </p>
</div> </div>
<img <img
...@@ -94,18 +112,14 @@ const HomeserverOptions: React.FC<IProps> = () => { ...@@ -94,18 +112,14 @@ const HomeserverOptions: React.FC<IProps> = () => {
Remember my choice. Remember my choice.
</StyledCheckbox> </StyledCheckbox>
<Button <Button
secondary
onClick={(): void => { onClick={(): void => {
dispatcher({ action: ActionType.SetAny }); dispatcher({ action: ActionType.SetAny });
}} }}
> >
Use any homeserver Use any homeserver
</Button> </Button>
<Toggle
checked={usePrefered}
onChange={(): void => setUsePrefered(!usePrefered)}
>
Use my prefered homeserver only
</Toggle>
{hsInput} {hsInput}
</Tile> </Tile>
); );
......
...@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and ...@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
@import "../color-scheme"; @import '../color-scheme';
@import "../error"; @import '../error';
.input { .input {
width: 100%; width: 100%;
...@@ -23,7 +23,8 @@ limitations under the License. ...@@ -23,7 +23,8 @@ limitations under the License.
background: $background; background: $background;
border: 1px solid $font; border: 1px solid $foreground;
font: lighten($grey, 60%);
border-radius: 24px; border-radius: 24px;
font-size: 14px; font-size: 14px;
...@@ -32,9 +33,18 @@ limitations under the License. ...@@ -32,9 +33,18 @@ limitations under the License.
&.error { &.error {
@include error; @include error;
} }
&:focus {
border: 1px solid $font;
font: $font;
}
} }
.inputError { .inputError {
@include error; @include error;
text-align: center; text-align: center;
} }
.inputMuted {
border-color: lighten($grey, 60%);
}
...@@ -20,12 +20,13 @@ import { useField } from 'formik'; ...@@ -20,12 +20,13 @@ import { useField } from 'formik';
import './Input.scss'; import './Input.scss';
interface IProps extends React.InputHTMLAttributes<Element> { interface IProps extends React.InputHTMLAttributes<HTMLElement> {
name: string; name: string;
type: string; type: string;
muted?: boolean;
} }
const Input: React.FC<IProps> = ({ className, ...props }) => { const Input: React.FC<IProps> = ({ className, muted, ...props }) => {
const [field, meta] = useField(props); const [field, meta] = useField(props);
const error = const error =
...@@ -35,6 +36,7 @@ const Input: React.FC<IProps> = ({ className, ...props }) => { ...@@ -35,6 +36,7 @@ const Input: React.FC<IProps> = ({ className, ...props }) => {
const classNames = classnames('input', className, { const classNames = classnames('input', className, {
error: meta.error, error: meta.error,
inputMuted: !!muted,
}); });
return ( return (
......
...@@ -25,4 +25,9 @@ limitations under the License. ...@@ -25,4 +25,9 @@ limitations under the License.
justify-content: space-between; justify-content: space-between;
row-gap: 20px; row-gap: 20px;
} }
hr {
width: 100%;
margin: 0;
}
} }
...@@ -25,7 +25,6 @@ import ClientSelection from './ClientSelection'; ...@@ -25,7 +25,6 @@ import ClientSelection from './ClientSelection';
import { Client, ClientKind } from '../clients/types'; import { Client, ClientKind } from '../clients/types';
import { SafeLink } from '../parser/types'; import { SafeLink } from '../parser/types';
import TextButton from './TextButton'; import TextButton from './TextButton';
import FakeProgress from './FakeProgress';
interface IProps { interface IProps {
children?: React.ReactNode; children?: React.ReactNode;
...@@ -39,10 +38,8 @@ const InviteTile: React.FC<IProps> = ({ children, client, link }: IProps) => { ...@@ -39,10 +38,8 @@ const InviteTile: React.FC<IProps> = ({ children, client, link }: IProps) => {
let advanced: React.ReactNode; let advanced: React.ReactNode;
if (client === null) { if (client === null) {
invite = showAdvanced ? ( invite = showAdvanced ? null : (
<FakeProgress /> <Button onClick={(): void => setShowAdvanced(!showAdvanced)}>
) : (
<Button onClick={() => setShowAdvanced(!showAdvanced)}>
Accept invite Accept invite
</Button> </Button>
); );
...@@ -89,7 +86,9 @@ const InviteTile: React.FC<IProps> = ({ children, client, link }: IProps) => { ...@@ -89,7 +86,9 @@ const InviteTile: React.FC<IProps> = ({ children, client, link }: IProps) => {
if (client === null) { if (client === null) {
advanced = ( advanced = (
<> <>
<h4>Pick an app to accept the invite with</h4> <hr />
<h3>Almost done!</h3>
<p>Pick a client to open {link.identifier}</p>
<ClientSelection link={link} /> <ClientSelection link={link} />
</> </>
); );
...@@ -104,12 +103,15 @@ const InviteTile: React.FC<IProps> = ({ children, client, link }: IProps) => { ...@@ -104,12 +103,15 @@ const InviteTile: React.FC<IProps> = ({ children, client, link }: IProps) => {
} }
} }
advanced = advanced ? (
<div className="inviteTileClientSelection">{advanced}</div>
) : null;
return ( return (
<> <>
<Tile className="inviteTile"> <Tile className="inviteTile">
{children} {children}
{invite} {invite}
<div className="inviteTileClientSelection">{advanced}</div> {advanced}
</Tile> </Tile>
</> </>
); );
......
...@@ -47,13 +47,12 @@ const invite = async ({ ...@@ -47,13 +47,12 @@ const invite = async ({
link: SafeLink; link: SafeLink;
}): Promise<JSX.Element> => { }): Promise<JSX.Element> => {
// TODO: replace with client fetch // TODO: replace with client fetch
const defaultClient = await client(clientAddress);
switch (link.kind) { switch (link.kind) {
case LinkKind.Alias: case LinkKind.Alias:
return ( return (
<RoomPreviewWithTopic <RoomPreviewWithTopic
room={ room={
await getRoomFromAlias(defaultClient, link.identifier) await getRoomFromAlias(clientAddress, link.identifier)
} }
/> />
); );
...@@ -61,14 +60,14 @@ const invite = async ({ ...@@ -61,14 +60,14 @@ const invite = async ({
case LinkKind.RoomId: case LinkKind.RoomId:
return ( return (
<RoomPreviewWithTopic <RoomPreviewWithTopic
room={await getRoomFromId(defaultClient, link.identifier)} room={await getRoomFromId(clientAddress, link.identifier)}
/> />
); );
case LinkKind.UserId: case LinkKind.UserId:
return ( return (
<UserPreview <UserPreview
user={await getUser(defaultClient, link.identifier)} user={await getUser(clientAddress, link.identifier)}
userId={link.identifier} userId={link.identifier}
/> />
); );
...@@ -76,10 +75,10 @@ const invite = async ({ ...@@ -76,10 +75,10 @@ const invite = async ({
case LinkKind.Permalink: case LinkKind.Permalink:
return ( return (
<EventPreview <EventPreview
room={await getRoomFromPermalink(defaultClient, link)} room={await getRoomFromPermalink(clientAddress, link)}
event={ event={
await getEvent( await getEvent(
defaultClient, await client(clientAddress),
link.roomLink, link.roomLink,
link.eventId link.eventId
) )
...@@ -128,7 +127,7 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => { ...@@ -128,7 +127,7 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => {
checked={showHSOptions} checked={showHSOptions}
onChange={(): void => setShowHSOPtions(!showHSOptions)} onChange={(): void => setShowHSOPtions(!showHSOptions)}
> >
Show more information About {link.identifier}
</Toggle> </Toggle>
</> </>
); );
...@@ -136,7 +135,7 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => { ...@@ -136,7 +135,7 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => {
content = ( content = (
<> <>
{content} {content}
<HomeserverOptions /> <HomeserverOptions link={link} />
</> </>
); );
} }
...@@ -164,7 +163,9 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => { ...@@ -164,7 +163,9 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => {
originalLink: '', originalLink: '',
}} }}
/> />
) : null; ) : (
<p style={{ margin: '0 0 10px 0' }}>You're invited to join</p>
);
return ( return (
<InviteTile client={client} link={link}> <InviteTile client={client} link={link}>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment