kaze 0.4.0 → 0.6.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.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kaze/commands/install_command.rb +25 -13
  3. data/lib/kaze/commands/installs_hotwire_stack.rb +11 -8
  4. data/lib/kaze/commands/installs_inertia_stacks.rb +34 -24
  5. data/lib/kaze/commands/version_command.rb +6 -0
  6. data/lib/kaze/version.rb +1 -1
  7. data/lib/kaze.rb +1 -3
  8. data/stubs/default/app/forms/auth/login_form.rb +2 -8
  9. data/stubs/default/app/forms/auth/new_password_form.rb +1 -1
  10. data/stubs/default/app/forms/update_profile_information_form.rb +1 -1
  11. data/stubs/default/app/mailers/application_mailer.rb +4 -4
  12. data/stubs/default/app/mailers/user_mailer.rb +1 -1
  13. data/stubs/default/app/models/auth.rb +57 -0
  14. data/stubs/default/app/models/current.rb +1 -1
  15. data/stubs/default/app/validators/current_password_validator.rb +1 -1
  16. data/stubs/default/app/validators/email_validator.rb +1 -1
  17. data/stubs/default/app/validators/lowercase_validator.rb +2 -2
  18. data/stubs/default/app/views/layouts/mailer.html.erb +367 -372
  19. data/stubs/default/app/views/layouts/mailer.text.erb +1 -4
  20. data/stubs/default/app/views/user_mailer/reset_password.html.erb +21 -26
  21. data/stubs/default/config/routes.rb +16 -16
  22. data/stubs/default/db/migrate/20240101000001_create_delayed_jobs.rb +1 -1
  23. data/stubs/default/test/factories/users.rb +7 -0
  24. data/stubs/default/test/integration/auth/authentication_test.rb +43 -0
  25. data/stubs/default/test/integration/auth/password_reset_test.rb +41 -0
  26. data/stubs/default/test/integration/auth/registration_test.rb +21 -0
  27. data/stubs/default/test/integration/password_update_test.rb +28 -0
  28. data/stubs/default/test/integration/profile_test.rb +51 -0
  29. data/stubs/default/test/test_helper.rb +38 -0
  30. data/stubs/hotwire/app/components/danger_button_component.rb +1 -1
  31. data/stubs/hotwire/app/components/dropdown_component.html.erb +17 -18
  32. data/stubs/hotwire/app/components/dropdown_component.rb +7 -7
  33. data/stubs/hotwire/app/components/modal_component.html.erb +55 -59
  34. data/stubs/hotwire/app/components/modal_component.rb +6 -6
  35. data/stubs/hotwire/app/components/primary_button_component.rb +1 -1
  36. data/stubs/hotwire/app/components/secondary_button_component.rb +1 -1
  37. data/stubs/hotwire/app/controllers/application_controller.rb +1 -0
  38. data/stubs/hotwire/app/controllers/auth/authenticated_session_controller.rb +12 -9
  39. data/stubs/hotwire/app/controllers/auth/new_password_controller.rb +7 -5
  40. data/stubs/hotwire/app/controllers/auth/password_reset_link_controller.rb +7 -5
  41. data/stubs/hotwire/app/controllers/auth/registered_user_controller.rb +7 -5
  42. data/stubs/hotwire/app/controllers/concerns/authenticate.rb +5 -20
  43. data/stubs/hotwire/app/controllers/concerns/redirect_if_authenticated.rb +19 -0
  44. data/stubs/hotwire/app/controllers/concerns/set_current_auth.rb +9 -0
  45. data/stubs/hotwire/app/controllers/password_controller.rb +3 -3
  46. data/stubs/hotwire/app/controllers/profile_controller.rb +11 -9
  47. data/stubs/hotwire/app/controllers/welcome_controller.rb +1 -1
  48. data/stubs/hotwire/app/javascript/application.js +3 -3
  49. data/stubs/hotwire/app/views/auth/forgot_password.html.erb +12 -17
  50. data/stubs/hotwire/app/views/auth/login.html.erb +0 -9
  51. data/stubs/hotwire/app/views/auth/register.html.erb +0 -13
  52. data/stubs/hotwire/app/views/auth/reset_password.html.erb +0 -7
  53. data/stubs/hotwire/app/views/dashboard/index.html.erb +9 -10
  54. data/stubs/hotwire/app/views/layouts/_navigation.html.erb +77 -87
  55. data/stubs/hotwire/app/views/layouts/application.html.erb +0 -9
  56. data/stubs/hotwire/app/views/layouts/guest.html.erb +0 -6
  57. data/stubs/hotwire/app/views/profile/edit.html.erb +19 -22
  58. data/stubs/hotwire/app/views/profile/partials/_delete_user_form.html.erb +32 -42
  59. data/stubs/hotwire/app/views/profile/partials/_update_password_form.html.erb +42 -55
  60. data/stubs/hotwire/app/views/profile/partials/_update_profile_information_form.html.erb +36 -46
  61. data/stubs/hotwire/app/views/welcome/index.html.erb +34 -46
  62. data/stubs/hotwire/config/importmap.rb +3 -3
  63. data/stubs/hotwire/config/tailwind.config.js +2 -2
  64. data/stubs/inertia-common/app/controllers/application_controller.rb +1 -0
  65. data/stubs/inertia-common/app/controllers/auth/authenticated_session_controller.rb +11 -8
  66. data/stubs/inertia-common/app/controllers/auth/new_password_controller.rb +5 -3
  67. data/stubs/inertia-common/app/controllers/auth/password_reset_link_controller.rb +5 -3
  68. data/stubs/inertia-common/app/controllers/auth/registered_user_controller.rb +5 -3
  69. data/stubs/inertia-common/app/controllers/concerns/authenticate.rb +5 -20
  70. data/stubs/inertia-common/app/controllers/concerns/handle_inertia_requests.rb +1 -1
  71. data/stubs/inertia-common/app/controllers/concerns/redirect_if_authenticated.rb +19 -0
  72. data/stubs/inertia-common/app/controllers/concerns/set_current_auth.rb +9 -0
  73. data/stubs/inertia-common/app/controllers/concerns/verify_csrf_token.rb +4 -4
  74. data/stubs/inertia-common/app/controllers/dashboard_controller.rb +1 -1
  75. data/stubs/inertia-common/app/controllers/password_controller.rb +1 -1
  76. data/stubs/inertia-common/app/controllers/profile_controller.rb +7 -5
  77. data/stubs/inertia-common/app/controllers/welcome_controller.rb +2 -2
  78. data/stubs/inertia-common/bin/vite +6 -6
  79. data/stubs/inertia-common/test/integration/password_update_test.rb +28 -0
  80. data/stubs/inertia-common/test/integration/profile_test.rb +51 -0
  81. data/stubs/inertia-react-ts/app/javascript/Components/ApplicationLogo.tsx +13 -9
  82. data/stubs/inertia-react-ts/app/javascript/Components/Checkbox.tsx +15 -12
  83. data/stubs/inertia-react-ts/app/javascript/Components/DangerButton.tsx +20 -15
  84. data/stubs/inertia-react-ts/app/javascript/Components/Dropdown.tsx +119 -87
  85. data/stubs/inertia-react-ts/app/javascript/Components/InputError.tsx +14 -7
  86. data/stubs/inertia-react-ts/app/javascript/Components/InputLabel.tsx +18 -7
  87. data/stubs/inertia-react-ts/app/javascript/Components/Modal.tsx +60 -60
  88. data/stubs/inertia-react-ts/app/javascript/Components/NavLink.tsx +21 -16
  89. data/stubs/inertia-react-ts/app/javascript/Components/PrimaryButton.tsx +20 -15
  90. data/stubs/inertia-react-ts/app/javascript/Components/ResponsiveNavLink.tsx +19 -14
  91. data/stubs/inertia-react-ts/app/javascript/Components/SecondaryButton.tsx +22 -16
  92. data/stubs/inertia-react-ts/app/javascript/Components/TextInput.tsx +35 -24
  93. data/stubs/inertia-react-ts/app/javascript/Layouts/AuthenticatedLayout.tsx +157 -117
  94. data/stubs/inertia-react-ts/app/javascript/Layouts/GuestLayout.tsx +15 -15
  95. data/stubs/inertia-react-ts/app/javascript/Pages/Auth/ForgotPassword.tsx +52 -49
  96. data/stubs/inertia-react-ts/app/javascript/Pages/Auth/Login.tsx +90 -82
  97. data/stubs/inertia-react-ts/app/javascript/Pages/Auth/Register.tsx +118 -115
  98. data/stubs/inertia-react-ts/app/javascript/Pages/Auth/ResetPassword.tsx +63 -60
  99. data/stubs/inertia-react-ts/app/javascript/Pages/Dashboard.tsx +23 -17
  100. data/stubs/inertia-react-ts/app/javascript/Pages/Profile/Edit.tsx +31 -27
  101. data/stubs/inertia-react-ts/app/javascript/Pages/Profile/Partials/DeleteUserForm.tsx +109 -99
  102. data/stubs/inertia-react-ts/app/javascript/Pages/Profile/Partials/UpdatePasswordForm.tsx +121 -113
  103. data/stubs/inertia-react-ts/app/javascript/Pages/Profile/Partials/UpdateProfileInformationForm.tsx +76 -69
  104. data/stubs/inertia-react-ts/app/javascript/Pages/Welcome.tsx +87 -63
  105. data/stubs/inertia-react-ts/app/javascript/entrypoints/application.tsx +32 -25
  106. data/stubs/inertia-react-ts/app/views/layouts/application.html.erb +0 -4
  107. data/stubs/inertia-react-ts/config/tailwind.config.js +2 -2
  108. data/stubs/inertia-react-ts/vite.config.ts +2 -5
  109. data/stubs/inertia-vue-ts/app/javascript/Components/ApplicationLogo.vue +10 -6
  110. data/stubs/inertia-vue-ts/app/javascript/Components/Checkbox.vue +18 -18
  111. data/stubs/inertia-vue-ts/app/javascript/Components/DangerButton.vue +5 -5
  112. data/stubs/inertia-vue-ts/app/javascript/Components/Dropdown.vue +60 -57
  113. data/stubs/inertia-vue-ts/app/javascript/Components/DropdownLink.vue +9 -9
  114. data/stubs/inertia-vue-ts/app/javascript/Components/InputError.vue +7 -7
  115. data/stubs/inertia-vue-ts/app/javascript/Components/InputLabel.vue +6 -6
  116. data/stubs/inertia-vue-ts/app/javascript/Components/Modal.vue +84 -74
  117. data/stubs/inertia-vue-ts/app/javascript/Components/NavLink.vue +12 -12
  118. data/stubs/inertia-vue-ts/app/javascript/Components/PrimaryButton.vue +5 -5
  119. data/stubs/inertia-vue-ts/app/javascript/Components/ResponsiveNavLink.vue +12 -12
  120. data/stubs/inertia-vue-ts/app/javascript/Components/SecondaryButton.vue +13 -13
  121. data/stubs/inertia-vue-ts/app/javascript/Components/TextInput.vue +13 -13
  122. data/stubs/inertia-vue-ts/app/javascript/Layouts/AuthenticatedLayout.vue +168 -136
  123. data/stubs/inertia-vue-ts/app/javascript/Layouts/GuestLayout.vue +15 -13
  124. data/stubs/inertia-vue-ts/app/javascript/Pages/Auth/ForgotPassword.vue +56 -49
  125. data/stubs/inertia-vue-ts/app/javascript/Pages/Auth/Login.vue +78 -72
  126. data/stubs/inertia-vue-ts/app/javascript/Pages/Auth/Register.vue +101 -97
  127. data/stubs/inertia-vue-ts/app/javascript/Pages/Auth/ResetPassword.vue +71 -68
  128. data/stubs/inertia-vue-ts/app/javascript/Pages/Dashboard.vue +22 -14
  129. data/stubs/inertia-vue-ts/app/javascript/Pages/Profile/Edit.vue +34 -30
  130. data/stubs/inertia-vue-ts/app/javascript/Pages/Profile/Partials/DeleteUserForm.vue +87 -83
  131. data/stubs/inertia-vue-ts/app/javascript/Pages/Profile/Partials/UpdatePasswordForm.vue +105 -98
  132. data/stubs/inertia-vue-ts/app/javascript/Pages/Profile/Partials/UpdateProfileInformationForm.vue +69 -59
  133. data/stubs/inertia-vue-ts/app/javascript/Pages/Welcome.vue +74 -47
  134. data/stubs/inertia-vue-ts/app/views/layouts/application.html.erb +0 -4
  135. data/stubs/inertia-vue-ts/config/tailwind.config.js +2 -2
  136. data/stubs/inertia-vue-ts/vite.config.ts +2 -5
  137. metadata +19 -6
  138. data/stubs/hotwire/bin/vite +0 -27
  139. data/stubs/inertia-common/Procfile.dev +0 -3
  140. /data/stubs/{hotwire → default}/Procfile.dev +0 -0
  141. /data/stubs/hotwire/app/javascript/{alpinejs.js → alpinejs.stub} +0 -0
@@ -1,131 +1,171 @@
1
- import { useState, PropsWithChildren, ReactNode } from 'react';
2
- import ApplicationLogo from '@/Components/ApplicationLogo';
3
- import Dropdown from '@/Components/Dropdown';
4
- import NavLink from '@/Components/NavLink';
5
- import ResponsiveNavLink from '@/Components/ResponsiveNavLink';
6
- import { Link } from '@inertiajs/react';
7
- import { User } from '@/types';
8
- import { dashboard_path, logout_path, profile_edit_path } from '@/routes';
1
+ import { useState, PropsWithChildren, ReactNode } from 'react'
2
+ import ApplicationLogo from '@/Components/ApplicationLogo'
3
+ import Dropdown from '@/Components/Dropdown'
4
+ import NavLink from '@/Components/NavLink'
5
+ import ResponsiveNavLink from '@/Components/ResponsiveNavLink'
6
+ import { Link } from '@inertiajs/react'
7
+ import { User } from '@/types'
8
+ import { dashboard_path, logout_path, profile_edit_path } from '@/routes'
9
9
 
10
- export default function Authenticated({ user, header, children }: PropsWithChildren<{ user: User, header?: ReactNode }>) {
11
- const [showingNavigationDropdown, setShowingNavigationDropdown] = useState(false);
10
+ export default function Authenticated({
11
+ user,
12
+ header,
13
+ children,
14
+ }: PropsWithChildren<{ user: User; header?: ReactNode }>) {
15
+ const [showingNavigationDropdown, setShowingNavigationDropdown] =
16
+ useState(false)
12
17
 
13
- const { pathname = '' } = typeof window !== 'undefined' ? window.location : {};
18
+ const { pathname = '' } = typeof window !== 'undefined' ? window.location : {}
14
19
 
15
- return (
16
- <div className="min-h-screen bg-gray-100">
17
- <nav className="bg-white border-b border-gray-100">
18
- <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
19
- <div className="flex justify-between h-16">
20
- <div className="flex">
21
- <div className="shrink-0 flex items-center">
22
- <Link href="/">
23
- <ApplicationLogo className="block h-9 w-auto fill-current text-gray-800" />
24
- </Link>
25
- </div>
20
+ return (
21
+ <div className="min-h-screen bg-gray-100">
22
+ <nav className="bg-white border-b border-gray-100">
23
+ <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
24
+ <div className="flex justify-between h-16">
25
+ <div className="flex">
26
+ <div className="shrink-0 flex items-center">
27
+ <Link href="/">
28
+ <ApplicationLogo className="block h-9 w-auto fill-current text-gray-800" />
29
+ </Link>
30
+ </div>
26
31
 
27
- <div className="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
28
- <NavLink href={dashboard_path()} active={pathname.match(/dashboard/) != null}>
29
- Dashboard
30
- </NavLink>
31
- </div>
32
- </div>
32
+ <div className="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
33
+ <NavLink
34
+ href={dashboard_path()}
35
+ active={pathname.match(/dashboard/) != null}
36
+ >
37
+ Dashboard
38
+ </NavLink>
39
+ </div>
40
+ </div>
33
41
 
34
- <div className="hidden sm:flex sm:items-center sm:ms-6">
35
- <div className="ms-3 relative">
36
- <Dropdown>
37
- <Dropdown.Trigger>
38
- <span className="inline-flex rounded-md">
39
- <button
40
- type="button"
41
- className="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none transition ease-in-out duration-150"
42
- >
43
- {user.name}
42
+ <div className="hidden sm:flex sm:items-center sm:ms-6">
43
+ <div className="ms-3 relative">
44
+ <Dropdown>
45
+ <Dropdown.Trigger>
46
+ <span className="inline-flex rounded-md">
47
+ <button
48
+ type="button"
49
+ className="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none transition ease-in-out duration-150"
50
+ >
51
+ {user.name}
44
52
 
45
- <svg
46
- className="ms-2 -me-0.5 h-4 w-4"
47
- xmlns="http://www.w3.org/2000/svg"
48
- viewBox="0 0 20 20"
49
- fill="currentColor"
50
- >
51
- <path
52
- fillRule="evenodd"
53
- d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
54
- clipRule="evenodd"
55
- />
56
- </svg>
57
- </button>
58
- </span>
59
- </Dropdown.Trigger>
53
+ <svg
54
+ className="ms-2 -me-0.5 h-4 w-4"
55
+ xmlns="http://www.w3.org/2000/svg"
56
+ viewBox="0 0 20 20"
57
+ fill="currentColor"
58
+ >
59
+ <path
60
+ fillRule="evenodd"
61
+ d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
62
+ clipRule="evenodd"
63
+ />
64
+ </svg>
65
+ </button>
66
+ </span>
67
+ </Dropdown.Trigger>
60
68
 
61
- <Dropdown.Content>
62
- <Dropdown.Link href={profile_edit_path()}>Profile</Dropdown.Link>
63
- <Dropdown.Link href={logout_path()} method="post" as="button">
64
- Log Out
65
- </Dropdown.Link>
66
- </Dropdown.Content>
67
- </Dropdown>
68
- </div>
69
- </div>
69
+ <Dropdown.Content>
70
+ <Dropdown.Link href={profile_edit_path()}>
71
+ Profile
72
+ </Dropdown.Link>
73
+ <Dropdown.Link
74
+ href={logout_path()}
75
+ method="post"
76
+ as="button"
77
+ >
78
+ Log Out
79
+ </Dropdown.Link>
80
+ </Dropdown.Content>
81
+ </Dropdown>
82
+ </div>
83
+ </div>
70
84
 
71
- <div className="-me-2 flex items-center sm:hidden">
72
- <button
73
- onClick={() => setShowingNavigationDropdown((previousState) => !previousState)}
74
- className="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out"
75
- >
76
- <svg className="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
77
- <path
78
- className={!showingNavigationDropdown ? 'inline-flex' : 'hidden'}
79
- strokeLinecap="round"
80
- strokeLinejoin="round"
81
- strokeWidth="2"
82
- d="M4 6h16M4 12h16M4 18h16"
83
- />
84
- <path
85
- className={showingNavigationDropdown ? 'inline-flex' : 'hidden'}
86
- strokeLinecap="round"
87
- strokeLinejoin="round"
88
- strokeWidth="2"
89
- d="M6 18L18 6M6 6l12 12"
90
- />
91
- </svg>
92
- </button>
93
- </div>
94
- </div>
95
- </div>
85
+ <div className="-me-2 flex items-center sm:hidden">
86
+ <button
87
+ onClick={() =>
88
+ setShowingNavigationDropdown(
89
+ (previousState) => !previousState,
90
+ )
91
+ }
92
+ className="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out"
93
+ >
94
+ <svg
95
+ className="h-6 w-6"
96
+ stroke="currentColor"
97
+ fill="none"
98
+ viewBox="0 0 24 24"
99
+ >
100
+ <path
101
+ className={
102
+ !showingNavigationDropdown ? 'inline-flex' : 'hidden'
103
+ }
104
+ strokeLinecap="round"
105
+ strokeLinejoin="round"
106
+ strokeWidth="2"
107
+ d="M4 6h16M4 12h16M4 18h16"
108
+ />
109
+ <path
110
+ className={
111
+ showingNavigationDropdown ? 'inline-flex' : 'hidden'
112
+ }
113
+ strokeLinecap="round"
114
+ strokeLinejoin="round"
115
+ strokeWidth="2"
116
+ d="M6 18L18 6M6 6l12 12"
117
+ />
118
+ </svg>
119
+ </button>
120
+ </div>
121
+ </div>
122
+ </div>
96
123
 
97
- <div className={(showingNavigationDropdown ? 'block' : 'hidden') + ' sm:hidden'}>
98
- <div className="pt-2 pb-3 space-y-1">
99
- <ResponsiveNavLink href={dashboard_path()} active={pathname.match(/dashboard/) != null}>
100
- Dashboard
101
- </ResponsiveNavLink>
102
- </div>
124
+ <div
125
+ className={
126
+ (showingNavigationDropdown ? 'block' : 'hidden') + ' sm:hidden'
127
+ }
128
+ >
129
+ <div className="pt-2 pb-3 space-y-1">
130
+ <ResponsiveNavLink
131
+ href={dashboard_path()}
132
+ active={pathname.match(/dashboard/) != null}
133
+ >
134
+ Dashboard
135
+ </ResponsiveNavLink>
136
+ </div>
103
137
 
104
- <div className="pt-4 pb-1 border-t border-gray-200">
105
- <div className="px-4">
106
- <div className="font-medium text-base text-gray-800">
107
- {user.name}
108
- </div>
109
- <div className="font-medium text-sm text-gray-500">{user.email}</div>
110
- </div>
138
+ <div className="pt-4 pb-1 border-t border-gray-200">
139
+ <div className="px-4">
140
+ <div className="font-medium text-base text-gray-800">
141
+ {user.name}
142
+ </div>
143
+ <div className="font-medium text-sm text-gray-500">
144
+ {user.email}
145
+ </div>
146
+ </div>
111
147
 
112
- <div className="mt-3 space-y-1">
113
- <ResponsiveNavLink href={profile_edit_path()}>Profile</ResponsiveNavLink>
114
- <ResponsiveNavLink method="post" href={logout_path()} as="button">
115
- Log Out
116
- </ResponsiveNavLink>
117
- </div>
118
- </div>
119
- </div>
120
- </nav>
148
+ <div className="mt-3 space-y-1">
149
+ <ResponsiveNavLink href={profile_edit_path()}>
150
+ Profile
151
+ </ResponsiveNavLink>
152
+ <ResponsiveNavLink method="post" href={logout_path()} as="button">
153
+ Log Out
154
+ </ResponsiveNavLink>
155
+ </div>
156
+ </div>
157
+ </div>
158
+ </nav>
121
159
 
122
- {header && (
123
- <header className="bg-white shadow">
124
- <div className="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">{header}</div>
125
- </header>
126
- )}
160
+ {header && (
161
+ <header className="bg-white shadow">
162
+ <div className="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
163
+ {header}
164
+ </div>
165
+ </header>
166
+ )}
127
167
 
128
- <main>{children}</main>
129
- </div>
130
- );
168
+ <main>{children}</main>
169
+ </div>
170
+ )
131
171
  }
@@ -1,19 +1,19 @@
1
- import ApplicationLogo from '@/Components/ApplicationLogo';
2
- import { Link } from '@inertiajs/react';
3
- import { PropsWithChildren } from 'react';
1
+ import ApplicationLogo from '@/Components/ApplicationLogo'
2
+ import { Link } from '@inertiajs/react'
3
+ import { PropsWithChildren } from 'react'
4
4
 
5
5
  export default function Guest({ children }: PropsWithChildren) {
6
- return (
7
- <div className="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100">
8
- <div>
9
- <Link href="/">
10
- <ApplicationLogo className="w-20 h-20 fill-current text-gray-500" />
11
- </Link>
12
- </div>
6
+ return (
7
+ <div className="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100">
8
+ <div>
9
+ <Link href="/">
10
+ <ApplicationLogo className="w-20 h-20 fill-current text-gray-500" />
11
+ </Link>
12
+ </div>
13
13
 
14
- <div className="w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg">
15
- {children}
16
- </div>
17
- </div>
18
- );
14
+ <div className="w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg">
15
+ {children}
16
+ </div>
17
+ </div>
18
+ )
19
19
  }
@@ -1,52 +1,55 @@
1
- import GuestLayout from '@/Layouts/GuestLayout';
2
- import InputError from '@/Components/InputError';
3
- import PrimaryButton from '@/Components/PrimaryButton';
4
- import TextInput from '@/Components/TextInput';
5
- import { Head, useForm } from '@inertiajs/react';
6
- import { FormEventHandler } from 'react';
7
- import { password_email_path } from '@/routes';
1
+ import GuestLayout from '@/Layouts/GuestLayout'
2
+ import InputError from '@/Components/InputError'
3
+ import PrimaryButton from '@/Components/PrimaryButton'
4
+ import TextInput from '@/Components/TextInput'
5
+ import { Head, useForm } from '@inertiajs/react'
6
+ import { FormEventHandler } from 'react'
7
+ import { password_email_path } from '@/routes'
8
8
 
9
9
  export default function ForgotPassword({ status }: { status?: string }) {
10
- const { data, setData, post, processing, errors } = useForm({
11
- email: '',
12
- });
13
-
14
- const submit: FormEventHandler = (e) => {
15
- e.preventDefault();
16
-
17
- post(password_email_path());
18
- };
19
-
20
- return (
21
- <GuestLayout>
22
- <Head title="Forgot Password" />
23
-
24
- <div className="mb-4 text-sm text-gray-600">
25
- Forgot your password? No problem. Just let us know your email address and we will email you a password
26
- reset link that will allow you to choose a new one.
27
- </div>
28
-
29
- {status && <div className="mb-4 font-medium text-sm text-green-600">{status}</div>}
30
-
31
- <form onSubmit={submit}>
32
- <TextInput
33
- id="email"
34
- type="email"
35
- name="email"
36
- value={data.email}
37
- className="mt-1 block w-full"
38
- isFocused={true}
39
- onChange={(e) => setData('email', e.target.value)}
40
- />
41
-
42
- <InputError message={errors.email} className="mt-2" />
43
-
44
- <div className="flex items-center justify-end mt-4">
45
- <PrimaryButton className="ms-4" disabled={processing}>
46
- Email Password Reset Link
47
- </PrimaryButton>
48
- </div>
49
- </form>
50
- </GuestLayout>
51
- );
10
+ const { data, setData, post, processing, errors } = useForm({
11
+ email: '',
12
+ })
13
+
14
+ const submit: FormEventHandler = (e) => {
15
+ e.preventDefault()
16
+
17
+ post(password_email_path())
18
+ }
19
+
20
+ return (
21
+ <GuestLayout>
22
+ <Head title="Forgot Password" />
23
+
24
+ <div className="mb-4 text-sm text-gray-600">
25
+ Forgot your password? No problem. Just let us know your email address
26
+ and we will email you a password reset link that will allow you to
27
+ choose a new one.
28
+ </div>
29
+
30
+ {status && (
31
+ <div className="mb-4 font-medium text-sm text-green-600">{status}</div>
32
+ )}
33
+
34
+ <form onSubmit={submit}>
35
+ <TextInput
36
+ id="email"
37
+ type="email"
38
+ name="email"
39
+ value={data.email}
40
+ className="mt-1 block w-full"
41
+ isFocused={true}
42
+ onChange={(e) => setData('email', e.target.value)}
43
+ />
44
+
45
+ <InputError message={errors.email} className="mt-2" />
46
+
47
+ <div className="flex items-center justify-end mt-4">
48
+ <PrimaryButton className="ms-4" disabled={processing}>
49
+ Email Password Reset Link
50
+ </PrimaryButton>
51
+ </div>
52
+ </form>
53
+ </GuestLayout>
54
+ )
52
55
  }
@@ -1,98 +1,106 @@
1
- import { useEffect, FormEventHandler } from 'react';
2
- import Checkbox from '@/Components/Checkbox';
3
- import GuestLayout from '@/Layouts/GuestLayout';
4
- import InputError from '@/Components/InputError';
5
- import InputLabel from '@/Components/InputLabel';
6
- import PrimaryButton from '@/Components/PrimaryButton';
7
- import TextInput from '@/Components/TextInput';
8
- import { Head, Link, useForm } from '@inertiajs/react';
9
- import { login_path, password_request_path } from '@/routes';
1
+ import { useEffect, FormEventHandler } from 'react'
2
+ import Checkbox from '@/Components/Checkbox'
3
+ import GuestLayout from '@/Layouts/GuestLayout'
4
+ import InputError from '@/Components/InputError'
5
+ import InputLabel from '@/Components/InputLabel'
6
+ import PrimaryButton from '@/Components/PrimaryButton'
7
+ import TextInput from '@/Components/TextInput'
8
+ import { Head, Link, useForm } from '@inertiajs/react'
9
+ import { login_path, password_request_path } from '@/routes'
10
10
 
11
- export default function Login({ status, canResetPassword }: { status?: string, canResetPassword: boolean }) {
12
- const { data, setData, post, processing, errors, reset } = useForm({
13
- email: '',
14
- password: '',
15
- remember: false,
16
- });
11
+ export default function Login({
12
+ status,
13
+ canResetPassword,
14
+ }: {
15
+ status?: string
16
+ canResetPassword: boolean
17
+ }) {
18
+ const { data, setData, post, processing, errors, reset } = useForm({
19
+ email: '',
20
+ password: '',
21
+ remember: false,
22
+ })
17
23
 
18
- useEffect(() => {
19
- return () => {
20
- reset('password');
21
- };
22
- }, []);
24
+ useEffect(() => {
25
+ return () => {
26
+ reset('password')
27
+ }
28
+ }, [])
23
29
 
24
- const submit: FormEventHandler = (e) => {
25
- e.preventDefault();
30
+ const submit: FormEventHandler = (e) => {
31
+ e.preventDefault()
26
32
 
27
- post(login_path());
28
- };
33
+ post(login_path())
34
+ }
29
35
 
30
- return (
31
- <GuestLayout>
32
- <Head title="Log in" />
36
+ return (
37
+ <GuestLayout>
38
+ <Head title="Log in" />
33
39
 
34
- {status && <div className="mb-4 font-medium text-sm text-green-600">{status}</div>}
40
+ {status && (
41
+ <div className="mb-4 font-medium text-sm text-green-600">{status}</div>
42
+ )}
35
43
 
36
- <form onSubmit={submit}>
37
- <div>
38
- <InputLabel htmlFor="email" value="Email" />
44
+ <form onSubmit={submit}>
45
+ <div>
46
+ <InputLabel htmlFor="email" value="Email" />
39
47
 
40
- <TextInput
41
- id="email"
42
- type="email"
43
- name="email"
44
- value={data.email}
45
- className="mt-1 block w-full"
46
- autoComplete="username"
47
- isFocused={true}
48
- onChange={(e) => setData('email', e.target.value)}
49
- />
48
+ <TextInput
49
+ id="email"
50
+ type="email"
51
+ name="email"
52
+ value={data.email}
53
+ className="mt-1 block w-full"
54
+ autoComplete="username"
55
+ isFocused={true}
56
+ onChange={(e) => setData('email', e.target.value)}
57
+ />
50
58
 
51
- <InputError message={errors.email} className="mt-2" />
52
- </div>
59
+ <InputError message={errors.email} className="mt-2" />
60
+ </div>
53
61
 
54
- <div className="mt-4">
55
- <InputLabel htmlFor="password" value="Password" />
62
+ <div className="mt-4">
63
+ <InputLabel htmlFor="password" value="Password" />
56
64
 
57
- <TextInput
58
- id="password"
59
- type="password"
60
- name="password"
61
- value={data.password}
62
- className="mt-1 block w-full"
63
- autoComplete="current-password"
64
- onChange={(e) => setData('password', e.target.value)}
65
- />
65
+ <TextInput
66
+ id="password"
67
+ type="password"
68
+ name="password"
69
+ value={data.password}
70
+ className="mt-1 block w-full"
71
+ autoComplete="current-password"
72
+ onChange={(e) => setData('password', e.target.value)}
73
+ />
66
74
 
67
- <InputError message={errors.password} className="mt-2" />
68
- </div>
75
+ <InputError message={errors.password} className="mt-2" />
76
+ </div>
69
77
 
70
- <div className="block mt-4">
71
- <label className="flex items-center">
72
- <Checkbox
73
- name="remember"
74
- checked={data.remember}
75
- onChange={(e) => setData('remember', e.target.checked)}
76
- />
77
- <span className="ms-2 text-sm text-gray-600">Remember me</span>
78
- </label>
79
- </div>
78
+ <div className="block mt-4">
79
+ <label className="flex items-center">
80
+ <Checkbox
81
+ name="remember"
82
+ checked={data.remember}
83
+ onChange={(e) => setData('remember', e.target.checked)}
84
+ />
85
+ <span className="ms-2 text-sm text-gray-600">Remember me</span>
86
+ </label>
87
+ </div>
80
88
 
81
- <div className="flex items-center justify-end mt-4">
82
- {canResetPassword && (
83
- <Link
84
- href={password_request_path()}
85
- className="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
86
- >
87
- Forgot your password?
88
- </Link>
89
- )}
89
+ <div className="flex items-center justify-end mt-4">
90
+ {canResetPassword && (
91
+ <Link
92
+ href={password_request_path()}
93
+ className="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
94
+ >
95
+ Forgot your password?
96
+ </Link>
97
+ )}
90
98
 
91
- <PrimaryButton className="ms-4" disabled={processing}>
92
- Log in
93
- </PrimaryButton>
94
- </div>
95
- </form>
96
- </GuestLayout>
97
- );
99
+ <PrimaryButton className="ms-4" disabled={processing}>
100
+ Log in
101
+ </PrimaryButton>
102
+ </div>
103
+ </form>
104
+ </GuestLayout>
105
+ )
98
106
  }