tangled
alpha
login
or
join now
bad-example.com
/
spacedust-utils
demos for spacedust
6
fork
atom
overview
issues
pulls
pipelines
tiny bit simplified
bad-example.com
7 months ago
d0626518
f32459f6
+6
-14
2 changed files
expand all
collapse all
unified
split
atproto-notifications
src
App.tsx
components
WhoAmI.tsx
+1
-1
atproto-notifications/src/App.tsx
···
13
13
14
14
{user === null
15
15
? (
16
16
-
<WhoAmI onSetUser={setUser} />
16
16
+
<WhoAmI onIdentify={setUser} />
17
17
)
18
18
: (
19
19
<>
+5
-13
atproto-notifications/src/components/WhoAmI.tsx
···
1
1
import { useRef, useEffect } from 'react';
2
2
3
3
-
export function WhoAmI({ onSetUser, origin = 'http://127.0.0.1:9997' }) {
3
3
+
export function WhoAmI({ onIdentify, origin = 'http://127.0.0.1:9997' }) {
4
4
const frameRef = useRef(null);
5
5
6
6
useEffect(() => {
···
9
9
ev.source !== frameRef.current?.contentWindow ||
10
10
ev.origin !== origin
11
11
) return;
12
12
-
onSetUser(ev.data);
12
12
+
onIdentify(ev.data);
13
13
}
14
14
-
15
15
-
console.log('ready');
16
14
window.addEventListener('message', handleMessage);
17
17
-
return () => {
18
18
-
console.log('byeeeeeeeeeeeee');
19
19
-
window.removeEventListener('message', handleMessage);
20
20
-
}
15
15
+
return () => window.removeEventListener('message', handleMessage);
21
16
}, []);
22
17
23
18
return (
24
19
<iframe
25
20
src={`${origin}/prompt`}
26
21
ref={frameRef}
27
27
-
id="whoami"
22
22
+
height="160"
23
23
+
width="320"
28
24
style={{
29
25
border: 'none',
30
30
-
boxSizing: 'border-box',
31
26
display: 'block',
32
27
colorScheme: 'none',
33
28
}}
34
34
-
allowtransparency="true"
35
35
-
height="160"
36
36
-
width="320"
37
29
>
38
30
Ooops, failed to load the login helper
39
31
</iframe>