@jsb188/auth-web 1.1.10 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,47 +4,53 @@ import { Button } from '@jsb188/react-web/ui/Button';
4
4
  import { memo } from 'react';
5
5
 
6
6
  export type ManagedSessionListItem = AccountSessionData & {
7
- displayExpiresAt: string;
8
- displayLastActivityAt: string;
9
- displayName: string;
7
+ displayExpiresAt: string;
8
+ displayLastActivityAt: string;
9
+ displayName: string;
10
10
  };
11
11
 
12
12
  /*
13
13
  * Render one managed login session without owning data or interaction state.
14
14
  */
15
15
  const ManagedSessionRowUI = memo(
16
- (p: {
17
- item: ManagedSessionListItem;
18
- revokeText: string;
19
- currentText: string;
20
- expiresText: string;
21
- lastActiveText: string;
22
- saving: boolean;
23
- onRevoke: (sessionId: string) => void;
24
- }) => {
25
- const { item } = p;
16
+ (p: {
17
+ item: ManagedSessionListItem;
18
+ revokeText: string;
19
+ currentText: string;
20
+ expiresText: string;
21
+ lastActiveText: string;
22
+ saving: boolean;
23
+ onRevoke: (sessionId: string) => void;
24
+ }) => {
25
+ const { item } = p;
26
26
 
27
- return (
28
- <div className='h_spread gap_df py_12 bd_b_1 bd_lt'>
29
- <div className='min_w_0'>
30
- <div className='h_item gap_8'>
31
- <strong className='ft_medium ellipsis'>{item.displayName}</strong>
32
- {!item.current ? null : <span className='ft_xs cl_active'>{p.currentText}</span>}
33
- </div>
34
- <p className='ft_sm cl_lt ellipsis'>{p.lastActiveText.replace('%{date}', item.displayLastActivityAt)}</p>
35
- <p className='ft_xs cl_lt ellipsis'>{p.expiresText.replace('%{date}', item.displayExpiresAt)}</p>
36
- </div>
37
- <Button
38
- size='sm'
39
- preset={item.current ? 'cl_err' : 'outline'}
40
- className={cn('shrink_0', p.saving && 'disabled')}
41
- disabled={p.saving}
42
- text={p.revokeText}
43
- onClick={() => p.onRevoke(item.id)}
44
- />
45
- </div>
46
- );
47
- },
27
+ return (
28
+ <div className="h_spread gap_df py_12 bd_b_1 bd_lt">
29
+ <div className="min_w_0">
30
+ <div className="h_item gap_8">
31
+ <strong className="ft_medium ellipsis">{item.displayName}</strong>
32
+ {!item.current ? null : (
33
+ <span className="ft_xs cl_active">{p.currentText}</span>
34
+ )}
35
+ </div>
36
+ <p className="ft_sm cl_lt ellipsis">
37
+ {p.lastActiveText.replace('%{date}', item.displayLastActivityAt)}
38
+ </p>
39
+ <p className="ft_xs cl_lt ellipsis">
40
+ {p.expiresText.replace('%{date}', item.displayExpiresAt)}
41
+ </p>
42
+ </div>
43
+ <Button
44
+ size="sm"
45
+ preset={item.current ? 'cl_err' : 'outline'}
46
+ className={cn('shrink_0', p.saving && 'disabled')}
47
+ disabled={p.saving}
48
+ text={p.revokeText}
49
+ onClick={() => p.onRevoke(item.id)}
50
+ />
51
+ </div>
52
+ );
53
+ },
48
54
  );
49
55
 
50
56
  ManagedSessionRowUI.displayName = 'ManagedSessionRowUI';
@@ -53,37 +59,37 @@ ManagedSessionRowUI.displayName = 'ManagedSessionRowUI';
53
59
  * Render a presentation-only list of managed login sessions.
54
60
  */
55
61
  export const ManagedSessionListUI = memo(
56
- (p: {
57
- items: ManagedSessionListItem[];
58
- emptyText: string;
59
- revokeText: string;
60
- currentText: string;
61
- expiresText: string;
62
- lastActiveText: string;
63
- savingSessionId?: string | null;
64
- onRevoke: (sessionId: string) => void;
65
- }) => {
66
- if (!p.items.length) {
67
- return <p className='cl_lt py_md'>{p.emptyText}</p>;
68
- }
62
+ (p: {
63
+ items: ManagedSessionListItem[];
64
+ emptyText: string;
65
+ revokeText: string;
66
+ currentText: string;
67
+ expiresText: string;
68
+ lastActiveText: string;
69
+ savingSessionId?: string | null;
70
+ onRevoke: (sessionId: string) => void;
71
+ }) => {
72
+ if (!p.items.length) {
73
+ return <p className="cl_lt py_md">{p.emptyText}</p>;
74
+ }
69
75
 
70
- return (
71
- <div>
72
- {p.items.map((item) => (
73
- <ManagedSessionRowUI
74
- key={item.id}
75
- item={item}
76
- revokeText={p.revokeText}
77
- currentText={p.currentText}
78
- expiresText={p.expiresText}
79
- lastActiveText={p.lastActiveText}
80
- saving={p.savingSessionId === item.id}
81
- onRevoke={p.onRevoke}
82
- />
83
- ))}
84
- </div>
85
- );
86
- },
76
+ return (
77
+ <div>
78
+ {p.items.map((item) => (
79
+ <ManagedSessionRowUI
80
+ key={item.id}
81
+ item={item}
82
+ revokeText={p.revokeText}
83
+ currentText={p.currentText}
84
+ expiresText={p.expiresText}
85
+ lastActiveText={p.lastActiveText}
86
+ saving={p.savingSessionId === item.id}
87
+ onRevoke={p.onRevoke}
88
+ />
89
+ ))}
90
+ </div>
91
+ );
92
+ },
87
93
  );
88
94
 
89
95
  ManagedSessionListUI.displayName = 'ManagedSessionListUI';