File tree Expand file tree Collapse file tree 5 files changed +45
-9
lines changed Expand file tree Collapse file tree 5 files changed +45
-9
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import { ReactComponent as UserPlusIcon } from 'assets/icons/user-plus.svg';
3434interface IconProps {
3535 size ?: 'x-small' | 'small' | 'medium' | 'large' ;
3636 onClick ?: ( ) => void ;
37+ disabled ?: boolean ;
3738}
3839
3940const Icon = styled . span < IconProps > `
@@ -52,6 +53,12 @@ const Icon = styled.span<IconProps>`
5253 }
5354 ` }
5455
56+ ${ props =>
57+ props . disabled &&
58+ `
59+ color: ${ props . theme . colors . lightBlue } ;
60+ ` }
61+
5562 ${ props =>
5663 props . size === 'x-small' &&
5764 `
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ const RowHeader: React.FC = () => {
7777 { l ( 'type' ) }
7878 </ SortableHeader >
7979 </ HeaderColumn >
80- < HeaderColumn right >
80+ < HeaderColumn >
8181 < SortableHeader < Session >
8282 field = "state"
8383 sort = { settingsStore . sessionSort }
@@ -86,6 +86,15 @@ const RowHeader: React.FC = () => {
8686 { l ( 'state' ) }
8787 </ SortableHeader >
8888 </ HeaderColumn >
89+ < HeaderColumn >
90+ < SortableHeader < Session >
91+ field = "expiry"
92+ sort = { settingsStore . sessionSort }
93+ onSort = { settingsStore . setSessionSort }
94+ >
95+ { l ( 'expiry' ) }
96+ </ SortableHeader >
97+ </ HeaderColumn >
8998 < ActionColumn />
9099 </ HeaderRow >
91100 ) ;
@@ -114,16 +123,23 @@ const SessionRow: React.FC<Props> = ({ session, style }) => {
114123 return (
115124 < Row style = { style } >
116125 < ActionColumn >
117- < Tip overlay = { l ( 'copy' ) } >
118- < Copy onClick = { handleCopy } />
119- </ Tip >
126+ { session . isPaired ? (
127+ < Tip overlay = { l ( 'paired' ) } >
128+ < Copy disabled />
129+ </ Tip >
130+ ) : (
131+ < Tip overlay = { l ( 'copy' ) } >
132+ < Copy onClick = { handleCopy } />
133+ </ Tip >
134+ ) }
120135 </ ActionColumn >
121136 < Column cols = { 3 } > { session . label } </ Column >
122137 < Column > { session . typeLabel } </ Column >
123- < Column right > { session . stateLabel } </ Column >
138+ < Column > { session . pairedLabel } </ Column >
139+ < Column > { session . expiryLabel } </ Column >
124140 < ActionColumn >
125141 < Tip overlay = { l ( 'revoke' ) } >
126- < CloseIcon onClick = { handleRevoke } />
142+ < CloseIcon size = "large" onClick = { handleRevoke } />
127143 </ Tip >
128144 </ ActionColumn >
129145 </ Row >
Original file line number Diff line number Diff line change 4646 "cmps.connect.SessionRowHeader.label" : " Label" ,
4747 "cmps.connect.SessionRowHeader.type" : " Type" ,
4848 "cmps.connect.SessionRowHeader.state" : " State" ,
49+ "cmps.connect.SessionRowHeader.expiry" : " Expiry" ,
4950 "cmps.connect.SessionRow.copy" : " Copy Pairing Phrase" ,
51+ "cmps.connect.SessionRow.paired" : " This Pairing Phrase has already been used by a client" ,
5052 "cmps.connect.SessionRow.revoke" : " Revoke Session" ,
5153 "cmps.history.HistoryPage.backText" : " Lightning Loop" ,
5254 "cmps.history.HistoryPage.pageTitle" : " History" ,
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { makeAutoObservable } from 'mobx';
22import * as LIT from 'types/generated/lit-sessions_pb' ;
33import { SortParams } from 'types/state' ;
44import formatDate from 'date-fns/format' ;
5+ import { MAX_DATE } from 'util/constants' ;
56import { hex } from 'util/strings' ;
67import { Store } from 'store/store' ;
78
@@ -65,7 +66,9 @@ export default class Session {
6566
6667 /** The date this session will expire as formatted string */
6768 get expiryLabel ( ) {
68- return formatDate ( this . expiry , 'MMM d, h:mm a' ) ;
69+ return this . expiry . getTime ( ) === MAX_DATE . getTime ( )
70+ ? 'Never'
71+ : formatDate ( this . expiry , 'MMM d, yyyy h:mm a' ) ;
6972 }
7073
7174 /** True if the session is not revoked or expired */
@@ -76,6 +79,16 @@ export default class Session {
7679 ) ;
7780 }
7881
82+ /** True if the session has had a client connect to it */
83+ get isPaired ( ) {
84+ return this . remotePublicKey !== '' ;
85+ }
86+
87+ /** The paired status as a string */
88+ get pairedLabel ( ) {
89+ return this . isPaired ? 'In Use' : 'Created' ;
90+ }
91+
7992 /**
8093 * Updates this session model using data provided from the LIT GRPC api
8194 */
Original file line number Diff line number Diff line change @@ -99,8 +99,6 @@ export default class SessionStore {
9999 * @param label the user defined label for this session
100100 * @param type the type of session being created (admin, read-only, etc)
101101 * @param expiry how long the session should be valid for
102- * @param mailboxServerAddr the address where the mailbox server is reachable
103- * @param devServer whether the mailbox server is a dev server that has no valid TLS cert
104102 */
105103 async addSession (
106104 label : string ,
You can’t perform that action at this time.
0 commit comments