Skip to content

Commit 1ce225d

Browse files
committed
connect: remove Expiry field from the TC UI
1 parent 9ff3b84 commit 1ce225d

File tree

6 files changed

+19
-31
lines changed

6 files changed

+19
-31
lines changed

app/src/components/connect/AddSession.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import React, { useCallback, useState } from 'react';
22
import { observer } from 'mobx-react-lite';
33
import styled from '@emotion/styled';
44
import { usePrefixedTranslation } from 'hooks';
5+
import { MAX_DATE } from 'util/constants';
56
import { useStore } from 'store';
67
import { Button, Column, Row } from 'components/base';
78
import FormField from 'components/common/FormField';
89
import FormInput from 'components/common/FormInput';
9-
import FormInputNumber from 'components/common/FormInputNumber';
1010

1111
const Styled = {
1212
Wrapper: styled.div``,
@@ -23,19 +23,16 @@ const AddSession: React.FC = () => {
2323
const { sessionStore } = useStore();
2424

2525
const [label, setLabel] = useState('');
26-
const [expiry, setExpiry] = useState(30);
2726
const [editing, setEditing] = useState(false);
2827

2928
const toggleEditing = useCallback(() => setEditing(e => !e), []);
3029
const handleSubmit = useCallback(async () => {
31-
const expDate = new Date(Date.now() + expiry * 24 * 60 * 60 * 1000);
32-
const session = await sessionStore.addSession(label, expDate);
30+
const session = await sessionStore.addSession(label, MAX_DATE);
3331
if (session) {
3432
setLabel('');
35-
setExpiry(30);
3633
setEditing(false);
3734
}
38-
}, [label, expiry]);
35+
}, [label]);
3936

4037
const { Wrapper, AddSection, ActionColumn } = Styled;
4138
if (!editing) {
@@ -49,20 +46,11 @@ const AddSession: React.FC = () => {
4946
return (
5047
<Wrapper>
5148
<Row>
52-
<Column cols={4} className="offset-1">
49+
<Column cols={6} className="offset-1">
5350
<FormField label={l('label')}>
5451
<FormInput value={label} onChange={setLabel} placeholder={l('labelHint')} />
5552
</FormField>
5653
</Column>
57-
<Column cols={2}>
58-
<FormField label={l('expiration')}>
59-
<FormInputNumber
60-
value={expiry}
61-
onChange={setExpiry}
62-
extra={l('common.days_plural')}
63-
/>
64-
</FormField>
65-
</Column>
6654
<ActionColumn className="">
6755
<Button primary onClick={handleSubmit}>
6856
{l('common.submit')}

app/src/components/connect/ConnectPage.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,25 @@ const Styled = {
1313
Description: styled.div`
1414
margin: 60px;
1515
`,
16+
Info: styled.div`
17+
margin: 100px 60px;
18+
color: ${props => props.theme.colors.gray};
19+
text-align: center;
20+
font-size: ${props => props.theme.sizes.s};
21+
`,
1622
};
1723

1824
const ConnectPage: React.FC = () => {
1925
const { l } = usePrefixedTranslation('cmps.connect.ConnectPage');
2026

21-
const { Wrapper, Description } = Styled;
27+
const { Wrapper, Description, Info } = Styled;
2228
return (
2329
<Wrapper>
2430
<PageHeader title={l('pageTitle')} />
2531
<Description>{l('description')}</Description>
2632
<AddSession />
2733
<SessionList />
34+
<Info>{l('info')}</Info>
2835
</Wrapper>
2936
);
3037
};

app/src/components/connect/SessionRow.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,6 @@ const RowHeader: React.FC = () => {
8686
{l('state')}
8787
</SortableHeader>
8888
</HeaderColumn>
89-
<HeaderColumn right>
90-
<SortableHeader<Session>
91-
field="expiry"
92-
sort={settingsStore.sessionSort}
93-
onSort={settingsStore.setSessionSort}
94-
>
95-
{l('expiry')}
96-
</SortableHeader>
97-
</HeaderColumn>
9889
<ActionColumn />
9990
</HeaderRow>
10091
);
@@ -130,7 +121,6 @@ const SessionRow: React.FC<Props> = ({ session, style }) => {
130121
<Column cols={3}>{session.label}</Column>
131122
<Column>{session.typeLabel}</Column>
132123
<Column right>{session.stateLabel}</Column>
133-
<Column right>{session.expiryLabel}</Column>
134124
<ActionColumn>
135125
<Tip overlay={l('revoke')}>
136126
<CloseIcon onClick={handleRevoke} />

app/src/i18n/locales/en-US.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
"cmps.connect.AddSession.expiration": "Expiration",
3737
"cmps.connect.AddSession.expirationSuffix": "",
3838
"cmps.connect.ConnectPage.pageTitle": "Terminal Connect",
39-
"cmps.connect.ConnectPage.description": "The list below contains the Terminal Connect sessions which allow you to connect to this Lightning Terminal node remotely from other applications.",
39+
"cmps.connect.ConnectPage.description": "Through the Terminal Connect page, you can create sessions which allow for you to connect to this Lightning Terminal node remotely from other applications, like Terminal Web. Copy the pairing phrase and paste it into the app in order to make the connection.",
40+
"cmps.connect.ConnectPage.info": "You will need a unique session for each app you wish to connect.",
4041
"cmps.connect.SessionRowHeader.label": "Label",
4142
"cmps.connect.SessionRowHeader.type": "Type",
4243
"cmps.connect.SessionRowHeader.state": "State",
43-
"cmps.connect.SessionRowHeader.expiry": "Expiry",
4444
"cmps.connect.SessionRow.copy": "Copy Pairing Phrase",
4545
"cmps.connect.SessionRow.revoke": "Revoke Session",
4646
"cmps.history.HistoryPage.backText": "Lightning Loop",

app/src/store/stores/settingsStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ export default class SettingsStore {
9292

9393
/** specifies the sorting field and direction for the Lit session list */
9494
sessionSort: SortParams<Session> = {
95-
field: 'expiry',
96-
descending: true,
95+
field: 'label',
96+
descending: false,
9797
};
9898

9999
/** the chosen language */

app/src/util/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/** estimated number of blocks mined per day */
22
export const BLOCKS_PER_DAY = 144;
33

4+
/** A Date very far into the future */
5+
export const MAX_DATE = new Date(9999, 0, 1);
6+
47
/** the enumeration of unit supported in the app */
58
export enum Unit {
69
sats = 'sats',

0 commit comments

Comments
 (0)