@stevederico/skateboard-ui 5.7.0 → 5.9.0
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.
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,8 @@ import React from 'react';
|
|
|
4
4
|
*
|
|
5
5
|
* Rendered at the app root and controlled via context state.
|
|
6
6
|
* Opens when SHOW_AUTH_OVERLAY is dispatched (typically via useAuthGate).
|
|
7
|
-
* On successful auth, runs the pending callback and closes.
|
|
7
|
+
* On successful auth, runs the pending callback and closes. Opens on Sign Up,
|
|
8
|
+
* or on Sign In when this device has been signed in before.
|
|
8
9
|
*
|
|
9
10
|
* @returns {JSX.Element} Auth dialog overlay
|
|
10
11
|
*
|
|
@@ -5,12 +5,22 @@ import ConstantsIcon from './core/constantsIcon.js';
|
|
|
5
5
|
import { getState } from './core/Context.js';
|
|
6
6
|
import SignInView from './views/SignInView.js';
|
|
7
7
|
import SignUpView from './views/SignUpView.js';
|
|
8
|
+
const HAD_ACCOUNT_KEY = 'skateboard_had_account';
|
|
9
|
+
function hadAccount() {
|
|
10
|
+
try {
|
|
11
|
+
return localStorage.getItem(HAD_ACCOUNT_KEY) === '1';
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
8
17
|
/**
|
|
9
18
|
* Modal authentication overlay with sign-in and sign-up forms.
|
|
10
19
|
*
|
|
11
20
|
* Rendered at the app root and controlled via context state.
|
|
12
21
|
* Opens when SHOW_AUTH_OVERLAY is dispatched (typically via useAuthGate).
|
|
13
|
-
* On successful auth, runs the pending callback and closes.
|
|
22
|
+
* On successful auth, runs the pending callback and closes. Opens on Sign Up,
|
|
23
|
+
* or on Sign In when this device has been signed in before.
|
|
14
24
|
*
|
|
15
25
|
* @returns {JSX.Element} Auth dialog overlay
|
|
16
26
|
*
|
|
@@ -24,11 +34,20 @@ export default function AuthOverlay() {
|
|
|
24
34
|
const { state, dispatch } = getState();
|
|
25
35
|
const constants = state.constants;
|
|
26
36
|
const { visible } = state.authOverlay;
|
|
27
|
-
const [mode, setMode] = useState('
|
|
28
|
-
//
|
|
37
|
+
const [mode, setMode] = useState('signup');
|
|
38
|
+
// Remember that this device has had an account
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (state.user) {
|
|
41
|
+
try {
|
|
42
|
+
localStorage.setItem(HAD_ACCOUNT_KEY, '1');
|
|
43
|
+
}
|
|
44
|
+
catch { /* storage blocked */ }
|
|
45
|
+
}
|
|
46
|
+
}, [state.user]);
|
|
47
|
+
// Most visitors are new: open on Sign Up, or Sign In if this device has signed in before
|
|
29
48
|
useEffect(() => {
|
|
30
49
|
if (visible) {
|
|
31
|
-
setMode('signin');
|
|
50
|
+
setMode(hadAccount() ? 'signin' : 'signup');
|
|
32
51
|
}
|
|
33
52
|
}, [visible]);
|
|
34
53
|
// Invoke parked 401 retries (apiRequest, Utilities.js) here in event handlers —
|
package/dist/components/Sheet.js
CHANGED
|
@@ -44,6 +44,6 @@ const MySheet = forwardRef(function MySheet(props, ref) {
|
|
|
44
44
|
setIsOpen(open);
|
|
45
45
|
if (!open)
|
|
46
46
|
onUserClose?.();
|
|
47
|
-
}, children: _jsxs(DrawerContent, { style: { minHeight }, children: [_jsx(DrawerHeader, { children: _jsx(DrawerTitle, { children: title }) }), _jsx("div", { className: "px-4 pb-4", children: children })] }) }));
|
|
47
|
+
}, children: _jsxs(DrawerContent, { style: { minHeight }, children: [_jsx(DrawerHeader, { children: _jsx(DrawerTitle, { children: title }) }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pb-4", children: children })] }) }));
|
|
48
48
|
});
|
|
49
49
|
export default MySheet;
|