Add new consent prompt to homeserver options as first step
This adds the new style consent text defaulting to matrix.org alongside the older style. More work is still needed here to polish this and then remove the older one.
This commit is contained in:
parent
0e5a08a870
commit
0a3b8c2123
4 changed files with 52 additions and 36 deletions
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
|
|
||||||
|
import GlobalContext from './contexts/GlobalContext';
|
||||||
import SingleColumn from './layouts/SingleColumn';
|
import SingleColumn from './layouts/SingleColumn';
|
||||||
import CreateLinkTile from './components/CreateLinkTile';
|
import CreateLinkTile from './components/CreateLinkTile';
|
||||||
import MatrixTile from './components/MatrixTile';
|
import MatrixTile from './components/MatrixTile';
|
||||||
|
@ -24,8 +25,6 @@ import LinkRouter from './pages/LinkRouter';
|
||||||
|
|
||||||
import './App.scss';
|
import './App.scss';
|
||||||
|
|
||||||
import GlobalContext from './contexts/GlobalContext';
|
|
||||||
|
|
||||||
/* eslint-disable no-restricted-globals */
|
/* eslint-disable no-restricted-globals */
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
|
|
|
@ -17,6 +17,16 @@ limitations under the License.
|
||||||
@import '../color-scheme';
|
@import '../color-scheme';
|
||||||
|
|
||||||
.homeserverOptions {
|
.homeserverOptions {
|
||||||
|
.actions {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 2em;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
row-gap: 20px;
|
row-gap: 20px;
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,14 @@ const HomeserverOptions: React.FC<IProps> = ({ link }: IProps) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tile className="homeserverOptions">
|
<Tile className="homeserverOptions">
|
||||||
|
<div>
|
||||||
|
View this link using matrix.org to preview content, or you can
|
||||||
|
use another server or continue without a preview.
|
||||||
|
</div>
|
||||||
|
<div className="actions">
|
||||||
|
<StyledCheckbox>Ask every time</StyledCheckbox>
|
||||||
|
<Button>Continue</Button>
|
||||||
|
</div>
|
||||||
<div className="homeserverOptionsDescription">
|
<div className="homeserverOptionsDescription">
|
||||||
<div>
|
<div>
|
||||||
<h3>
|
<h3>
|
||||||
|
|
|
@ -14,13 +14,15 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React, { useContext } from 'react';
|
||||||
|
|
||||||
|
import HSContext, { HSOptions } from '../contexts/HSContext';
|
||||||
import Tile from '../components/Tile';
|
import Tile from '../components/Tile';
|
||||||
import LinkPreview from '../components/LinkPreview';
|
import LinkPreview from '../components/LinkPreview';
|
||||||
import InvitingClientTile from '../components/InvitingClientTile';
|
import InvitingClientTile from '../components/InvitingClientTile';
|
||||||
import { parseHash } from '../parser/parser';
|
import { parseHash } from '../parser/parser';
|
||||||
import { LinkKind } from '../parser/types';
|
import { LinkKind } from '../parser/types';
|
||||||
|
import HomeserverOptions from '../components/HomeserverOptions';
|
||||||
|
|
||||||
/* eslint-disable no-restricted-globals */
|
/* eslint-disable no-restricted-globals */
|
||||||
|
|
||||||
|
@ -31,16 +33,13 @@ interface IProps {
|
||||||
const LinkRouter: React.FC<IProps> = ({ link }: IProps) => {
|
const LinkRouter: React.FC<IProps> = ({ link }: IProps) => {
|
||||||
// our room id's will be stored in the hash
|
// our room id's will be stored in the hash
|
||||||
const parsedLink = parseHash(link);
|
const parsedLink = parseHash(link);
|
||||||
|
const [hsState] = useContext(HSContext);
|
||||||
|
|
||||||
let feedback: JSX.Element;
|
if (parsedLink.kind === LinkKind.ParseFailed) {
|
||||||
let client: JSX.Element = <></>;
|
return (
|
||||||
switch (parsedLink.kind) {
|
|
||||||
case LinkKind.ParseFailed:
|
|
||||||
feedback = (
|
|
||||||
<Tile>
|
<Tile>
|
||||||
<p>
|
<p>
|
||||||
That URL doesn't seem right. Links should be in the
|
That URL doesn't seem right. Links should be in the format:
|
||||||
format:
|
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<p>
|
||||||
|
@ -48,25 +47,25 @@ const LinkRouter: React.FC<IProps> = ({ link }: IProps) => {
|
||||||
</p>
|
</p>
|
||||||
</Tile>
|
</Tile>
|
||||||
);
|
);
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
|
if (hsState.option === HSOptions.Unset) {
|
||||||
|
return <HomeserverOptions link={parsedLink} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
let client: JSX.Element = <></>;
|
||||||
if (parsedLink.arguments.client) {
|
if (parsedLink.arguments.client) {
|
||||||
client = (
|
client = (
|
||||||
<InvitingClientTile
|
<InvitingClientTile clientName={parsedLink.arguments.client} />
|
||||||
clientName={parsedLink.arguments.client}
|
|
||||||
/>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
feedback = (
|
return (
|
||||||
<>
|
<>
|
||||||
<LinkPreview link={parsedLink} />
|
<LinkPreview link={parsedLink} />
|
||||||
{client}
|
{client}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
return feedback;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default LinkRouter;
|
export default LinkRouter;
|
||||||
|
|
Loading…
Reference in a new issue