tangled
alpha
login
or
join now
bad-example.com
/
spacedust-utils
6
fork
atom
demos for spacedust
6
fork
atom
overview
issues
pulls
pipelines
less annoying early page after first visit
bad-example.com
8 months ago
e5d77875
9c19a1fc
+7
-4
2 changed files
expand all
collapse all
unified
split
atproto-notifications
src
components
SecretPassword.jsx
pages
Early.tsx
+1
-1
atproto-notifications/src/components/SecretPassword.jsx
···
41
41
<p style={{ color: "#9f0" }}>Secret password accepted.</p>
42
42
<p>
43
43
{/* an <a> tag, not a <Link>, on purpose so we relaod for our role */}
44
44
-
<a className="button" href="/early">
44
44
+
<a className="button" href="/early?hello">
45
45
Continue
46
46
</a>
47
47
</p>
+6
-3
atproto-notifications/src/pages/Early.tsx
···
1
1
import { useCallback, useState } from 'react';
2
2
-
import { Link } from 'react-router';
2
2
+
import { Link, useSearchParams } from 'react-router';
3
3
import { postJson } from '../components/Fetch';
4
4
import './Early.css';
5
5
6
6
export function Early({ }) {
7
7
+
const [searchParams, _] = useSearchParams();
7
8
const [notified, setNotified] = useState(false);
8
9
const [pushStatus, setPushStatus] = useState(null);
9
10
const [pushed, setPushed] = useState(false);
11
11
+
12
12
+
const returning = !searchParams.has('hello');
10
13
11
14
const localTest = useCallback(() => {
12
15
try {
···
49
52
<p>
50
53
To see a test notification, <button onClick={localTest}>click on this</button>. This is a local-only test.
51
54
</p>
52
52
-
{notified && (
55
55
+
{(returning || notified) && (
53
56
<>
54
57
<p>
55
58
Then
···
66
69
{pushStatus === 'failed' && <p>uh oh, something went wrong requesting a web push</p>}
67
70
</>
68
71
)}
69
69
-
{(pushed && pushStatus !== 'failed') && (
72
72
+
{(returning || (pushed && pushStatus !== 'failed')) && (
70
73
<>
71
74
<h3>Great!</h3>
72
75
<p>