diff --git a/resources/js/layouts/auth/auth-split-layout.tsx b/resources/js/layouts/auth/auth-split-layout.tsx
index be8ee87ef..4bac15d80 100644
--- a/resources/js/layouts/auth/auth-split-layout.tsx
+++ b/resources/js/layouts/auth/auth-split-layout.tsx
@@ -1,20 +1,13 @@
-import { Link, usePage } from '@inertiajs/react';
-import { type PropsWithChildren } from 'react';
-
import AppLogoIcon from '@/components/app-logo-icon';
import { home } from '@/routes';
-import { type SharedData } from '@/types';
-
-interface AuthLayoutProps {
- title?: string;
- description?: string;
-}
+import type { AuthLayoutProps, SharedData } from '@/types';
+import { Link, usePage } from '@inertiajs/react';
export default function AuthSplitLayout({
children,
title,
description,
-}: PropsWithChildren
) {
+}: AuthLayoutProps) {
const { name } = usePage().props;
return (
diff --git a/resources/js/layouts/settings/layout.tsx b/resources/js/layouts/settings/layout.tsx
index fab634fe3..715831f8b 100644
--- a/resources/js/layouts/settings/layout.tsx
+++ b/resources/js/layouts/settings/layout.tsx
@@ -1,6 +1,3 @@
-import { Link } from '@inertiajs/react';
-import { type PropsWithChildren } from 'react';
-
import Heading from '@/components/heading';
import { Button } from '@/components/ui/button';
import { Separator } from '@/components/ui/separator';
@@ -10,7 +7,9 @@ import { edit as editAppearance } from '@/routes/appearance';
import { edit } from '@/routes/profile';
import { show } from '@/routes/two-factor';
import { edit as editPassword } from '@/routes/user-password';
-import { type NavItem } from '@/types';
+import type { NavItem } from '@/types';
+import { Link } from '@inertiajs/react';
+import type { PropsWithChildren } from 'react';
const sidebarNavItems: NavItem[] = [
{
diff --git a/resources/js/lib/utils.ts b/resources/js/lib/utils.ts
index 70f56f154..d6fae85d7 100644
--- a/resources/js/lib/utils.ts
+++ b/resources/js/lib/utils.ts
@@ -1,4 +1,4 @@
-import { InertiaLinkProps } from '@inertiajs/react';
+import type { InertiaLinkProps } from '@inertiajs/react';
import { type ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
diff --git a/resources/js/pages/auth/confirm-password.tsx b/resources/js/pages/auth/confirm-password.tsx
index f4461e6c9..b9ae2690d 100644
--- a/resources/js/pages/auth/confirm-password.tsx
+++ b/resources/js/pages/auth/confirm-password.tsx
@@ -1,5 +1,3 @@
-import { Form, Head } from '@inertiajs/react';
-
import InputError from '@/components/input-error';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -7,6 +5,7 @@ import { Label } from '@/components/ui/label';
import { Spinner } from '@/components/ui/spinner';
import AuthLayout from '@/layouts/auth-layout';
import { store } from '@/routes/password/confirm';
+import { Form, Head } from '@inertiajs/react';
export default function ConfirmPassword() {
return (
diff --git a/resources/js/pages/auth/forgot-password.tsx b/resources/js/pages/auth/forgot-password.tsx
index 190aeb768..811624058 100644
--- a/resources/js/pages/auth/forgot-password.tsx
+++ b/resources/js/pages/auth/forgot-password.tsx
@@ -1,7 +1,4 @@
// Components
-import { Form, Head } from '@inertiajs/react';
-import { LoaderCircle } from 'lucide-react';
-
import InputError from '@/components/input-error';
import TextLink from '@/components/text-link';
import { Button } from '@/components/ui/button';
@@ -10,6 +7,8 @@ import { Label } from '@/components/ui/label';
import AuthLayout from '@/layouts/auth-layout';
import { login } from '@/routes';
import { email } from '@/routes/password';
+import { Form, Head } from '@inertiajs/react';
+import { LoaderCircle } from 'lucide-react';
export default function ForgotPassword({ status }: { status?: string }) {
return (
diff --git a/resources/js/pages/auth/login.tsx b/resources/js/pages/auth/login.tsx
index 6d924c2ec..186ee770e 100644
--- a/resources/js/pages/auth/login.tsx
+++ b/resources/js/pages/auth/login.tsx
@@ -1,5 +1,3 @@
-import { Form, Head } from '@inertiajs/react';
-
import InputError from '@/components/input-error';
import TextLink from '@/components/text-link';
import { Button } from '@/components/ui/button';
@@ -11,18 +9,19 @@ import AuthLayout from '@/layouts/auth-layout';
import { register } from '@/routes';
import { store } from '@/routes/login';
import { request } from '@/routes/password';
+import { Form, Head } from '@inertiajs/react';
-interface LoginProps {
+type Props = {
status?: string;
canResetPassword: boolean;
canRegister: boolean;
-}
+};
export default function Login({
status,
canResetPassword,
canRegister,
-}: LoginProps) {
+}: Props) {
return (
(false);
diff --git a/resources/js/pages/auth/verify-email.tsx b/resources/js/pages/auth/verify-email.tsx
index fbc315e16..03ac55793 100644
--- a/resources/js/pages/auth/verify-email.tsx
+++ b/resources/js/pages/auth/verify-email.tsx
@@ -1,12 +1,11 @@
// Components
-import { Form, Head } from '@inertiajs/react';
-
import TextLink from '@/components/text-link';
import { Button } from '@/components/ui/button';
import { Spinner } from '@/components/ui/spinner';
import AuthLayout from '@/layouts/auth-layout';
import { logout } from '@/routes';
import { send } from '@/routes/verification';
+import { Form, Head } from '@inertiajs/react';
export default function VerifyEmail({ status }: { status?: string }) {
return (
diff --git a/resources/js/pages/dashboard.tsx b/resources/js/pages/dashboard.tsx
index 2ed65b5c6..95e8a9636 100644
--- a/resources/js/pages/dashboard.tsx
+++ b/resources/js/pages/dashboard.tsx
@@ -1,9 +1,8 @@
-import { Head } from '@inertiajs/react';
-
import { PlaceholderPattern } from '@/components/ui/placeholder-pattern';
import AppLayout from '@/layouts/app-layout';
import { dashboard } from '@/routes';
-import { type BreadcrumbItem } from '@/types';
+import type { BreadcrumbItem } from '@/types';
+import { Head } from '@inertiajs/react';
const breadcrumbs: BreadcrumbItem[] = [
{
diff --git a/resources/js/pages/settings/appearance.tsx b/resources/js/pages/settings/appearance.tsx
index 25c79ee21..acc852524 100644
--- a/resources/js/pages/settings/appearance.tsx
+++ b/resources/js/pages/settings/appearance.tsx
@@ -1,11 +1,10 @@
-import { Head } from '@inertiajs/react';
-
import AppearanceTabs from '@/components/appearance-tabs';
import Heading from '@/components/heading';
import AppLayout from '@/layouts/app-layout';
import SettingsLayout from '@/layouts/settings/layout';
import { edit as editAppearance } from '@/routes/appearance';
-import { type BreadcrumbItem } from '@/types';
+import type { BreadcrumbItem } from '@/types';
+import { Head } from '@inertiajs/react';
const breadcrumbs: BreadcrumbItem[] = [
{
diff --git a/resources/js/pages/settings/password.tsx b/resources/js/pages/settings/password.tsx
index 87669b73c..18f46b082 100644
--- a/resources/js/pages/settings/password.tsx
+++ b/resources/js/pages/settings/password.tsx
@@ -1,7 +1,3 @@
-import { Transition } from '@headlessui/react';
-import { Form, Head } from '@inertiajs/react';
-import { useRef } from 'react';
-
import PasswordController from '@/actions/App/Http/Controllers/Settings/PasswordController';
import Heading from '@/components/heading';
import InputError from '@/components/input-error';
@@ -11,7 +7,10 @@ import { Label } from '@/components/ui/label';
import AppLayout from '@/layouts/app-layout';
import SettingsLayout from '@/layouts/settings/layout';
import { edit } from '@/routes/user-password';
-import { type BreadcrumbItem } from '@/types';
+import type { BreadcrumbItem } from '@/types';
+import { Transition } from '@headlessui/react';
+import { Form, Head } from '@inertiajs/react';
+import { useRef } from 'react';
const breadcrumbs: BreadcrumbItem[] = [
{
diff --git a/resources/js/pages/settings/profile.tsx b/resources/js/pages/settings/profile.tsx
index 69ef4fa48..834c613c4 100644
--- a/resources/js/pages/settings/profile.tsx
+++ b/resources/js/pages/settings/profile.tsx
@@ -1,6 +1,3 @@
-import { Transition } from '@headlessui/react';
-import { Form, Head, Link, usePage } from '@inertiajs/react';
-
import ProfileController from '@/actions/App/Http/Controllers/Settings/ProfileController';
import DeleteUser from '@/components/delete-user';
import Heading from '@/components/heading';
@@ -12,7 +9,9 @@ import AppLayout from '@/layouts/app-layout';
import SettingsLayout from '@/layouts/settings/layout';
import { edit } from '@/routes/profile';
import { send } from '@/routes/verification';
-import { type BreadcrumbItem, type SharedData } from '@/types';
+import type { BreadcrumbItem, SharedData } from '@/types';
+import { Transition } from '@headlessui/react';
+import { Form, Head, Link, usePage } from '@inertiajs/react';
const breadcrumbs: BreadcrumbItem[] = [
{
diff --git a/resources/js/pages/settings/two-factor.tsx b/resources/js/pages/settings/two-factor.tsx
index 0a741086d..31922e791 100644
--- a/resources/js/pages/settings/two-factor.tsx
+++ b/resources/js/pages/settings/two-factor.tsx
@@ -1,7 +1,3 @@
-import { Form, Head } from '@inertiajs/react';
-import { ShieldBan, ShieldCheck } from 'lucide-react';
-import { useState } from 'react';
-
import Heading from '@/components/heading';
import TwoFactorRecoveryCodes from '@/components/two-factor-recovery-codes';
import TwoFactorSetupModal from '@/components/two-factor-setup-modal';
@@ -11,12 +7,15 @@ import { useTwoFactorAuth } from '@/hooks/use-two-factor-auth';
import AppLayout from '@/layouts/app-layout';
import SettingsLayout from '@/layouts/settings/layout';
import { disable, enable, show } from '@/routes/two-factor';
-import { type BreadcrumbItem } from '@/types';
+import type { BreadcrumbItem } from '@/types';
+import { Form, Head } from '@inertiajs/react';
+import { ShieldBan, ShieldCheck } from 'lucide-react';
+import { useState } from 'react';
-interface TwoFactorProps {
+type Props = {
requiresConfirmation?: boolean;
twoFactorEnabled?: boolean;
-}
+};
const breadcrumbs: BreadcrumbItem[] = [
{
@@ -28,7 +27,7 @@ const breadcrumbs: BreadcrumbItem[] = [
export default function TwoFactor({
requiresConfirmation = false,
twoFactorEnabled = false,
-}: TwoFactorProps) {
+}: Props) {
const {
qrCodeSvg,
hasSetupData,
diff --git a/resources/js/pages/welcome.tsx b/resources/js/pages/welcome.tsx
index 7af074a6e..dd58e2c26 100644
--- a/resources/js/pages/welcome.tsx
+++ b/resources/js/pages/welcome.tsx
@@ -1,7 +1,6 @@
-import { Head, Link, usePage } from '@inertiajs/react';
-
import { dashboard, login, register } from '@/routes';
-import { type SharedData } from '@/types';
+import type { SharedData } from '@/types';
+import { Head, Link, usePage } from '@inertiajs/react';
export default function Welcome({
canRegister = true,
diff --git a/resources/js/types/auth.ts b/resources/js/types/auth.ts
new file mode 100644
index 000000000..5ffc370b0
--- /dev/null
+++ b/resources/js/types/auth.ts
@@ -0,0 +1,24 @@
+export type User = {
+ id: number;
+ name: string;
+ email: string;
+ avatar?: string;
+ email_verified_at: string | null;
+ two_factor_enabled?: boolean;
+ created_at: string;
+ updated_at: string;
+ [key: string]: unknown;
+};
+
+export type Auth = {
+ user: User;
+};
+
+export type TwoFactorSetupData = {
+ svg: string;
+ url: string;
+};
+
+export type TwoFactorSecretKey = {
+ secretKey: string;
+};
diff --git a/resources/js/types/index.d.ts b/resources/js/types/index.d.ts
deleted file mode 100644
index 5c7bc2e1b..000000000
--- a/resources/js/types/index.d.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { InertiaLinkProps } from '@inertiajs/react';
-import { LucideIcon } from 'lucide-react';
-
-export interface Auth {
- user: User;
-}
-
-export interface BreadcrumbItem {
- title: string;
- href: string;
-}
-
-export interface NavGroup {
- title: string;
- items: NavItem[];
-}
-
-export interface NavItem {
- title: string;
- href: NonNullable;
- icon?: LucideIcon | null;
- isActive?: boolean;
-}
-
-export interface SharedData {
- name: string;
- auth: Auth;
- sidebarOpen: boolean;
- [key: string]: unknown;
-}
-
-export interface User {
- id: number;
- name: string;
- email: string;
- avatar?: string;
- email_verified_at: string | null;
- two_factor_enabled?: boolean;
- created_at: string;
- updated_at: string;
- [key: string]: unknown; // This allows for additional properties...
-}
diff --git a/resources/js/types/index.ts b/resources/js/types/index.ts
new file mode 100644
index 000000000..93cefe73b
--- /dev/null
+++ b/resources/js/types/index.ts
@@ -0,0 +1,12 @@
+export type * from './auth';
+export type * from './navigation';
+export type * from './ui';
+
+import type { Auth } from './auth';
+
+export type SharedData = {
+ name: string;
+ auth: Auth;
+ sidebarOpen: boolean;
+ [key: string]: unknown;
+};
diff --git a/resources/js/types/navigation.ts b/resources/js/types/navigation.ts
new file mode 100644
index 000000000..49954d7bd
--- /dev/null
+++ b/resources/js/types/navigation.ts
@@ -0,0 +1,14 @@
+import type { InertiaLinkProps } from '@inertiajs/react';
+import type { LucideIcon } from 'lucide-react';
+
+export type BreadcrumbItem = {
+ title: string;
+ href: string;
+};
+
+export type NavItem = {
+ title: string;
+ href: NonNullable;
+ icon?: LucideIcon | null;
+ isActive?: boolean;
+};
diff --git a/resources/js/types/ui.ts b/resources/js/types/ui.ts
new file mode 100644
index 000000000..53dcf56b1
--- /dev/null
+++ b/resources/js/types/ui.ts
@@ -0,0 +1,14 @@
+import type { ReactNode } from 'react';
+import type { BreadcrumbItem } from './navigation';
+
+export type AppLayoutProps = {
+ children: ReactNode;
+ breadcrumbs?: BreadcrumbItem[];
+};
+
+export type AuthLayoutProps = {
+ children?: ReactNode;
+ name?: string;
+ title?: string;
+ description?: string;
+};