Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export default [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
Expand All @@ -55,9 +54,18 @@ export default [
{
...importPlugin.flatConfigs.typescript,
files: ['**/*.{ts,tsx}'],
rules: {
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'separate-type-imports',
},
],
},
},
{
ignores: ['vendor', 'node_modules', 'public', 'bootstrap/ssr', 'tailwind.config.js'],
ignores: ['vendor', 'node_modules', 'public', 'bootstrap/ssr', 'tailwind.config.js', 'vite.config.ts'],
},
prettier, // Turn off all rules that might conflict with Prettier
];
4 changes: 1 addition & 3 deletions resources/js/app.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import '../css/app.css';

import { createInertiaApp } from '@inertiajs/react';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';

import '../css/app.css';
import { initializeTheme } from './hooks/use-appearance';

const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
Expand Down
3 changes: 1 addition & 2 deletions resources/js/components/alert-error.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AlertCircleIcon } from 'lucide-react';

import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { AlertCircleIcon } from 'lucide-react';

export default function AlertError({
errors,
Expand Down
13 changes: 4 additions & 9 deletions resources/js/components/app-content.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import * as React from 'react';

import { SidebarInset } from '@/components/ui/sidebar';
import * as React from 'react';

interface AppContentProps extends React.ComponentProps<'main'> {
type Props = React.ComponentProps<'main'> & {
variant?: 'header' | 'sidebar';
}
};

export function AppContent({
variant = 'header',
children,
...props
}: AppContentProps) {
export function AppContent({ variant = 'header', children, ...props }: Props) {
if (variant === 'sidebar') {
return <SidebarInset {...props}>{children}</SidebarInset>;
}
Expand Down
18 changes: 8 additions & 10 deletions resources/js/components/app-header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { Link, usePage } from '@inertiajs/react';
import { BookOpen, Folder, LayoutGrid, Menu, Search } from 'lucide-react';

import { Breadcrumbs } from '@/components/breadcrumbs';
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import { Button } from '@/components/ui/button';
Expand Down Expand Up @@ -33,11 +30,16 @@ import { useCurrentUrl } from '@/hooks/use-current-url';
import { useInitials } from '@/hooks/use-initials';
import { cn, toUrl } from '@/lib/utils';
import { dashboard } from '@/routes';
import { type BreadcrumbItem, type NavItem, type SharedData } from '@/types';

import type { BreadcrumbItem, NavItem, SharedData } from '@/types';
import { Link, usePage } from '@inertiajs/react';
import { BookOpen, Folder, LayoutGrid, Menu, Search } from 'lucide-react';
import AppLogo from './app-logo';
import AppLogoIcon from './app-logo-icon';

type Props = {
breadcrumbs?: BreadcrumbItem[];
};

const mainNavItems: NavItem[] = [
{
title: 'Dashboard',
Expand All @@ -62,11 +64,7 @@ const rightNavItems: NavItem[] = [
const activeItemStyles =
'text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100';

interface AppHeaderProps {
breadcrumbs?: BreadcrumbItem[];
}

export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
export function AppHeader({ breadcrumbs = [] }: Props) {
const page = usePage<SharedData>();
const { auth } = page.props;
const getInitials = useInitials();
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/app-logo-icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGAttributes } from 'react';
import type { SVGAttributes } from 'react';

export default function AppLogoIcon(props: SVGAttributes<SVGElement>) {
return (
Expand Down
14 changes: 7 additions & 7 deletions resources/js/components/app-shell.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { usePage } from '@inertiajs/react';

import { SidebarProvider } from '@/components/ui/sidebar';
import { SharedData } from '@/types';
import type { SharedData } from '@/types';
import { usePage } from '@inertiajs/react';
import type { ReactNode } from 'react';

interface AppShellProps {
children: React.ReactNode;
type Props = {
children: ReactNode;
variant?: 'header' | 'sidebar';
}
};

export function AppShell({ children, variant = 'header' }: AppShellProps) {
export function AppShell({ children, variant = 'header' }: Props) {
const isOpen = usePage<SharedData>().props.sidebarOpen;

if (variant === 'header') {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/app-sidebar-header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Breadcrumbs } from '@/components/breadcrumbs';
import { SidebarTrigger } from '@/components/ui/sidebar';
import { type BreadcrumbItem as BreadcrumbItemType } from '@/types';
import type { BreadcrumbItem as BreadcrumbItemType } from '@/types';

export function AppSidebarHeader({
breadcrumbs = [],
Expand Down
8 changes: 3 additions & 5 deletions resources/js/components/app-sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { Link } from '@inertiajs/react';
import { BookOpen, Folder, LayoutGrid } from 'lucide-react';

import { NavFooter } from '@/components/nav-footer';
import { NavMain } from '@/components/nav-main';
import { NavUser } from '@/components/nav-user';
Expand All @@ -14,8 +11,9 @@ import {
SidebarMenuItem,
} from '@/components/ui/sidebar';
import { dashboard } from '@/routes';
import { type NavItem } from '@/types';

import type { NavItem } from '@/types';
import { Link } from '@inertiajs/react';
import { BookOpen, Folder, LayoutGrid } from 'lucide-react';
import AppLogo from './app-logo';

const mainNavItems: NavItem[] = [
Expand Down
9 changes: 5 additions & 4 deletions resources/js/components/appearance-tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { LucideIcon, Monitor, Moon, Sun } from 'lucide-react';
import { HTMLAttributes } from 'react';

import { Appearance, useAppearance } from '@/hooks/use-appearance';
import type { Appearance } from '@/hooks/use-appearance';
import { useAppearance } from '@/hooks/use-appearance';
import { cn } from '@/lib/utils';
import type { LucideIcon } from 'lucide-react';
import { Monitor, Moon, Sun } from 'lucide-react';
import type { HTMLAttributes } from 'react';

export default function AppearanceToggleTab({
className = '',
Expand Down
7 changes: 3 additions & 4 deletions resources/js/components/breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { Link } from '@inertiajs/react';
import { Fragment } from 'react';

import {
Breadcrumb,
BreadcrumbItem,
Expand All @@ -9,7 +6,9 @@ import {
BreadcrumbPage,
BreadcrumbSeparator,
} from '@/components/ui/breadcrumb';
import { type BreadcrumbItem as BreadcrumbItemType } from '@/types';
import type { BreadcrumbItem as BreadcrumbItemType } from '@/types';
import { Link } from '@inertiajs/react';
import { Fragment } from 'react';

export function Breadcrumbs({
breadcrumbs,
Expand Down
5 changes: 2 additions & 3 deletions resources/js/components/delete-user.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { Form } from '@inertiajs/react';
import { useRef } from 'react';

import ProfileController from '@/actions/App/Http/Controllers/Settings/ProfileController';
import Heading from '@/components/heading';
import InputError from '@/components/input-error';
Expand All @@ -16,6 +13,8 @@ import {
} from '@/components/ui/dialog';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Form } from '@inertiajs/react';
import { useRef } from 'react';

export default function DeleteUser() {
const passwordInput = useRef<HTMLInputElement>(null);
Expand Down
3 changes: 1 addition & 2 deletions resources/js/components/input-error.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { type HTMLAttributes } from 'react';

import { cn } from '@/lib/utils';
import type { HTMLAttributes } from 'react';

export default function InputError({
message,
Expand Down
5 changes: 2 additions & 3 deletions resources/js/components/nav-footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { type ComponentPropsWithoutRef } from 'react';

import {
SidebarGroup,
SidebarGroupContent,
Expand All @@ -8,7 +6,8 @@ import {
SidebarMenuItem,
} from '@/components/ui/sidebar';
import { toUrl } from '@/lib/utils';
import { type NavItem } from '@/types';
import type { NavItem } from '@/types';
import type { ComponentPropsWithoutRef } from 'react';

export function NavFooter({
items,
Expand Down
5 changes: 2 additions & 3 deletions resources/js/components/nav-main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Link } from '@inertiajs/react';

import {
SidebarGroup,
SidebarGroupLabel,
Expand All @@ -8,7 +6,8 @@ import {
SidebarMenuItem,
} from '@/components/ui/sidebar';
import { useCurrentUrl } from '@/hooks/use-current-url';
import { type NavItem } from '@/types';
import type { NavItem } from '@/types';
import { Link } from '@inertiajs/react';

export function NavMain({ items = [] }: { items: NavItem[] }) {
const { isCurrentUrl } = useCurrentUrl();
Expand Down
7 changes: 3 additions & 4 deletions resources/js/components/nav-user.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { usePage } from '@inertiajs/react';
import { ChevronsUpDown } from 'lucide-react';

import {
DropdownMenu,
DropdownMenuContent,
Expand All @@ -15,7 +12,9 @@ import {
import { UserInfo } from '@/components/user-info';
import { UserMenuContent } from '@/components/user-menu-content';
import { useIsMobile } from '@/hooks/use-mobile';
import { type SharedData } from '@/types';
import type { SharedData } from '@/types';
import { usePage } from '@inertiajs/react';
import { ChevronsUpDown } from 'lucide-react';

export function NavUser() {
const { auth } = usePage<SharedData>().props;
Expand Down
9 changes: 4 additions & 5 deletions resources/js/components/text-link.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Link } from '@inertiajs/react';
import { ComponentProps } from 'react';

import { cn } from '@/lib/utils';
import { Link } from '@inertiajs/react';
import type { ComponentProps } from 'react';

type LinkProps = ComponentProps<typeof Link>;
type Props = ComponentProps<typeof Link>;

export default function TextLink({
className = '',
children,
...props
}: LinkProps) {
}: Props) {
return (
<Link
className={cn(
Expand Down
14 changes: 6 additions & 8 deletions resources/js/components/two-factor-recovery-codes.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { Form } from '@inertiajs/react';
import { Eye, EyeOff, LockKeyhole, RefreshCw } from 'lucide-react';
import { useCallback, useEffect, useRef, useState } from 'react';

import { Button } from '@/components/ui/button';
import {
Card,
Expand All @@ -11,20 +7,22 @@ import {
CardTitle,
} from '@/components/ui/card';
import { regenerateRecoveryCodes } from '@/routes/two-factor';

import { Form } from '@inertiajs/react';
import { Eye, EyeOff, LockKeyhole, RefreshCw } from 'lucide-react';
import { useCallback, useEffect, useRef, useState } from 'react';
import AlertError from './alert-error';

interface TwoFactorRecoveryCodesProps {
type Props = {
recoveryCodesList: string[];
fetchRecoveryCodes: () => Promise<void>;
errors: string[];
}
};

export default function TwoFactorRecoveryCodes({
recoveryCodesList,
fetchRecoveryCodes,
errors,
}: TwoFactorRecoveryCodesProps) {
}: Props) {
const [codesAreVisible, setCodesAreVisible] = useState<boolean>(false);
const codesSectionRef = useRef<HTMLDivElement | null>(null);
const canRegenerateCodes = recoveryCodesList.length > 0 && codesAreVisible;
Expand Down
16 changes: 7 additions & 9 deletions resources/js/components/two-factor-setup-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { Form } from '@inertiajs/react';
import { REGEXP_ONLY_DIGITS } from 'input-otp';
import { Check, Copy, ScanLine } from 'lucide-react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';

import InputError from '@/components/input-error';
import { Button } from '@/components/ui/button';
import {
Expand All @@ -21,7 +16,10 @@ import { useAppearance } from '@/hooks/use-appearance';
import { useClipboard } from '@/hooks/use-clipboard';
import { OTP_MAX_LENGTH } from '@/hooks/use-two-factor-auth';
import { confirm } from '@/routes/two-factor';

import { Form } from '@inertiajs/react';
import { REGEXP_ONLY_DIGITS } from 'input-otp';
import { Check, Copy, ScanLine } from 'lucide-react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import AlertError from './alert-error';
import { Spinner } from './ui/spinner';

Expand Down Expand Up @@ -230,7 +228,7 @@ function TwoFactorVerificationStep({
);
}

interface TwoFactorSetupModalProps {
type Props = {
isOpen: boolean;
onClose: () => void;
requiresConfirmation: boolean;
Expand All @@ -240,7 +238,7 @@ interface TwoFactorSetupModalProps {
clearSetupData: () => void;
fetchSetupData: () => Promise<void>;
errors: string[];
}
};

export default function TwoFactorSetupModal({
isOpen,
Expand All @@ -252,7 +250,7 @@ export default function TwoFactorSetupModal({
clearSetupData,
fetchSetupData,
errors,
}: TwoFactorSetupModalProps) {
}: Props) {
const [showVerificationStep, setShowVerificationStep] =
useState<boolean>(false);

Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/ui/icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LucideIcon } from 'lucide-react';
import type { LucideIcon } from 'lucide-react';

interface IconProps {
iconNode?: LucideIcon | null;
Expand Down
3 changes: 2 additions & 1 deletion resources/js/components/ui/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Slot } from "@radix-ui/react-slot"
import { VariantProps, cva } from "class-variance-authority"
import type { VariantProps} from "class-variance-authority";
import { cva } from "class-variance-authority"
import { PanelLeftCloseIcon, PanelLeftOpenIcon } from "lucide-react"
import * as React from "react"

Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/user-info.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import { useInitials } from '@/hooks/use-initials';
import { type User } from '@/types';
import type { User } from '@/types';

export function UserInfo({
user,
Expand Down
Loading
Loading