nitro-web 0.1.1 → 0.1.3
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/client/app.tsx +1 -1
- package/components/auth/inviteConfirm.tsx +3 -1
- package/components/auth/reset.tsx +5 -1
- package/components/auth/signin.tsx +8 -3
- package/components/auth/signup.tsx +3 -1
- package/components/partials/not-found.tsx +4 -2
- package/package.json +1 -1
- package/types.ts +1 -1
- package/util.js +3 -3
package/client/app.tsx
CHANGED
|
@@ -15,7 +15,7 @@ type LayoutProps = {
|
|
|
15
15
|
|
|
16
16
|
type Settings = {
|
|
17
17
|
afterApp?: () => void
|
|
18
|
-
beforeApp: (config: Config) => Promise<
|
|
18
|
+
beforeApp: (config: Config) => Promise<unknown>
|
|
19
19
|
// beforeStoreUpdate: (prevStore: Store | null, newData: Store) => Store
|
|
20
20
|
isStatic?: boolean
|
|
21
21
|
layouts: React.FC<LayoutProps>[]
|
|
@@ -4,7 +4,7 @@ import { Fragment, useEffect } from 'react'
|
|
|
4
4
|
|
|
5
5
|
type InviteConfirmProps = {
|
|
6
6
|
className?: string,
|
|
7
|
-
elements?: { Button?: typeof Button },
|
|
7
|
+
elements?: { Button?: typeof Button, Header?: React.ReactNode },
|
|
8
8
|
redirectTo?: string,
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -25,6 +25,7 @@ export function InviteConfirm({ className, elements, redirectTo }: InviteConfirm
|
|
|
25
25
|
|
|
26
26
|
const Elements = {
|
|
27
27
|
Button: elements?.Button || Button,
|
|
28
|
+
Header: elements?.Header || null,
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
// Auto-confirm on mount for already signed-in users
|
|
@@ -72,6 +73,7 @@ export function InviteConfirm({ className, elements, redirectTo }: InviteConfirm
|
|
|
72
73
|
|
|
73
74
|
return (
|
|
74
75
|
<div className={className}>
|
|
76
|
+
{!!Elements.Header && Elements.Header}
|
|
75
77
|
<Topbar title={<Fragment>Accept Your Invite</Fragment>} />
|
|
76
78
|
|
|
77
79
|
<form onSubmit={(e) => submit(state, e)} class="mb-0">
|
|
@@ -4,7 +4,7 @@ import { Fragment } from 'react'
|
|
|
4
4
|
|
|
5
5
|
type resetInstructionsProps = {
|
|
6
6
|
className?: string,
|
|
7
|
-
elements?: { Button?: typeof Button },
|
|
7
|
+
elements?: { Button?: typeof Button, Header?: React.ReactNode },
|
|
8
8
|
redirectTo?: string,
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -16,6 +16,7 @@ export function ResetInstructions({ className, elements, redirectTo }: resetInst
|
|
|
16
16
|
|
|
17
17
|
const Elements = {
|
|
18
18
|
Button: elements?.Button || Button,
|
|
19
|
+
Header: elements?.Header || null,
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
async function onSubmit (event: React.FormEvent<HTMLFormElement>) {
|
|
@@ -31,6 +32,7 @@ export function ResetInstructions({ className, elements, redirectTo }: resetInst
|
|
|
31
32
|
|
|
32
33
|
return (
|
|
33
34
|
<div className={className}>
|
|
35
|
+
{!!Elements.Header && Elements.Header}
|
|
34
36
|
<Topbar title={<Fragment>Reset your Password</Fragment>} />
|
|
35
37
|
|
|
36
38
|
<form onSubmit={onSubmit} class="mb-0">
|
|
@@ -64,6 +66,7 @@ export function ResetPassword({ className, elements, redirectTo }: resetInstruct
|
|
|
64
66
|
|
|
65
67
|
const Elements = {
|
|
66
68
|
Button: elements?.Button || Button,
|
|
69
|
+
Header: elements?.Header || null,
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
async function onSubmit (event: React.FormEvent<HTMLFormElement>) {
|
|
@@ -79,6 +82,7 @@ export function ResetPassword({ className, elements, redirectTo }: resetInstruct
|
|
|
79
82
|
|
|
80
83
|
return (
|
|
81
84
|
<div className={className}>
|
|
85
|
+
{!!Elements.Header && Elements.Header}
|
|
82
86
|
<Topbar title={<Fragment>Reset your Password</Fragment>} />
|
|
83
87
|
|
|
84
88
|
<form onSubmit={onSubmit} class="mb-0">
|
|
@@ -4,11 +4,12 @@ import { Fragment } from 'react'
|
|
|
4
4
|
|
|
5
5
|
type signinProps = {
|
|
6
6
|
className?: string,
|
|
7
|
-
elements?: { Button?: typeof Button },
|
|
7
|
+
elements?: { Button?: typeof Button, Header?: React.ReactNode },
|
|
8
8
|
redirectTo?: string,
|
|
9
|
+
hideSignup?: boolean,
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
export function Signin({ className, elements, redirectTo }: signinProps) {
|
|
12
|
+
export function Signin({ className, elements, redirectTo, hideSignup }: signinProps) {
|
|
12
13
|
const navigate = useNavigate()
|
|
13
14
|
const location = useLocation()
|
|
14
15
|
const isSignout = location.pathname == '/signout'
|
|
@@ -22,6 +23,7 @@ export function Signin({ className, elements, redirectTo }: signinProps) {
|
|
|
22
23
|
|
|
23
24
|
const Elements = {
|
|
24
25
|
Button: elements?.Button || Button,
|
|
26
|
+
Header: elements?.Header || null,
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
useEffect(() => {
|
|
@@ -60,6 +62,7 @@ export function Signin({ className, elements, redirectTo }: signinProps) {
|
|
|
60
62
|
|
|
61
63
|
return (
|
|
62
64
|
<div className={className}>
|
|
65
|
+
{!!Elements.Header && Elements.Header}
|
|
63
66
|
<Topbar title={<Fragment>Sign in to your Account</Fragment>} />
|
|
64
67
|
|
|
65
68
|
<form onSubmit={onSubmit} class="mb-0">
|
|
@@ -77,7 +80,9 @@ export function Signin({ className, elements, redirectTo }: signinProps) {
|
|
|
77
80
|
</div>
|
|
78
81
|
|
|
79
82
|
<div class="mb-14">
|
|
80
|
-
|
|
83
|
+
{!hideSignup && (
|
|
84
|
+
<Fragment>Don't have an account? You can <Link to="/signup" class="underline2 is-active">sign up here</Link>.</Fragment>
|
|
85
|
+
)}
|
|
81
86
|
<FormError state={state} className="pt-2" />
|
|
82
87
|
</div>
|
|
83
88
|
|
|
@@ -4,7 +4,7 @@ import { Fragment } from 'react'
|
|
|
4
4
|
|
|
5
5
|
type signupProps = {
|
|
6
6
|
className?: string,
|
|
7
|
-
elements?: { Button?: typeof Button },
|
|
7
|
+
elements?: { Button?: typeof Button, Header?: React.ReactNode },
|
|
8
8
|
redirectTo?: string,
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -22,6 +22,7 @@ export function Signup({ className, elements, redirectTo }: signupProps) {
|
|
|
22
22
|
|
|
23
23
|
const Elements = {
|
|
24
24
|
Button: elements?.Button || Button,
|
|
25
|
+
Header: elements?.Header || null,
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
async function onSubmit (e: React.FormEvent<HTMLFormElement>) {
|
|
@@ -37,6 +38,7 @@ export function Signup({ className, elements, redirectTo }: signupProps) {
|
|
|
37
38
|
|
|
38
39
|
return (
|
|
39
40
|
<div className={className}>
|
|
41
|
+
{!!Elements.Header && Elements.Header}
|
|
40
42
|
<Topbar title={<Fragment>Start your 21 day Free Trial</Fragment>} />
|
|
41
43
|
|
|
42
44
|
<form onSubmit={onSubmit} class="mb-0">
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { twMerge } from 'nitro-web/util'
|
|
2
|
+
|
|
3
|
+
export function NotFound({ className }: { className?: string }) {
|
|
2
4
|
return (
|
|
3
|
-
<div
|
|
5
|
+
<div className={twMerge('min-h-[300px]', className)}>
|
|
4
6
|
<span class="h1">Page Not Found</span><br />
|
|
5
7
|
<br />
|
|
6
8
|
The page you're looking for doesn't exist or has moved.<br />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"repository": "github:boycce/nitro-web",
|
|
5
5
|
"homepage": "https://boycce.github.io/nitro-web/",
|
|
6
6
|
"description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
|
package/types.ts
CHANGED
|
@@ -17,7 +17,7 @@ type InjectedConfig = {
|
|
|
17
17
|
|
|
18
18
|
export type Config = InjectedConfig & {
|
|
19
19
|
// Non-injectable config on the client
|
|
20
|
-
beforeApp?: () => Promise<
|
|
20
|
+
beforeApp?: (config: Config) => Promise<unknown>
|
|
21
21
|
beforeStoreUpdate?: (prevStore: Store | null, newData: Store) => Store
|
|
22
22
|
middleware?: {[key: string]: (route: any, store: any) => undefined | { redirect: string }}
|
|
23
23
|
}
|
package/util.js
CHANGED
|
@@ -756,9 +756,9 @@ export function formData (obj, cfg, existingFormData, keyPrefix) {
|
|
|
756
756
|
cfg.allowEmptyArrays = cfg.allowEmptyArrays === undefined ? false : cfg.allowEmptyArrays
|
|
757
757
|
existingFormData = existingFormData || new FormData()
|
|
758
758
|
|
|
759
|
-
const isBlob = typeof obj === 'object' &&
|
|
760
|
-
'size' in obj && typeof obj.size === 'number' &&
|
|
761
|
-
'type' in obj && typeof obj.type === 'string' &&
|
|
759
|
+
const isBlob = obj != null && typeof obj === 'object' &&
|
|
760
|
+
'size' in obj && typeof obj.size === 'number' &&
|
|
761
|
+
'type' in obj && typeof obj.type === 'string' &&
|
|
762
762
|
'slice' in obj && typeof obj.slice === 'function'
|
|
763
763
|
|
|
764
764
|
const isFile = isBlob &&
|