diff --git a/index.html b/index.html index 5723adf..14bfcf0 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,40 @@ - + + diff --git a/src/features/admin/AdminBooksPage.tsx b/src/features/admin/AdminBooksPage.tsx index 022bf87..ee35537 100644 --- a/src/features/admin/AdminBooksPage.tsx +++ b/src/features/admin/AdminBooksPage.tsx @@ -18,7 +18,6 @@ import { AlertDialogTitle, } from "@/components/ui/alert-dialog" import { useAdminBooks, useAdminSearchBooks, useAddBook, useUpdateBook, useUpdateStock, useDeleteBook, useAdminBorrowBook } from "./hooks" -import { usePlatform } from "@/hooks/usePlatform" import { useIsMobile } from "@/hooks/useIsMobile" import type { Book } from "@/types/api" import { getErrorMessage } from "@/lib/errors" @@ -33,9 +32,8 @@ interface BorrowDialog { open: boolean; book: Book } const addInitial: AddDialog = { open: false } export default function AdminBooksPage() { - const platform = usePlatform() const isMobile = useIsMobile() - const sel = platform === "web" ? ({ "data-selectable": true } as const) : ({} as const) + const sel = { "data-selectable": true } as const const [searchText, setSearchText] = useState("") const [submitted, setSubmitted] = useState("") diff --git a/src/features/admin/AdminBorrowsPage.tsx b/src/features/admin/AdminBorrowsPage.tsx index 0b1fc5c..68812fd 100644 --- a/src/features/admin/AdminBorrowsPage.tsx +++ b/src/features/admin/AdminBorrowsPage.tsx @@ -17,16 +17,14 @@ import { AlertDialogTitle, } from "@/components/ui/alert-dialog" import { useAdminBorrows, useSearchBorrows, useAdminReturnBook } from "./hooks" -import { usePlatform } from "@/hooks/usePlatform" import { useIsMobile } from "@/hooks/useIsMobile" import { formatDateTime } from "@/lib/formatters" import { getErrorMessage } from "@/lib/errors" import type { BorrowInfoVo } from "@/types/api" export default function AdminBorrowsPage() { - const platform = usePlatform() const isMobile = useIsMobile() - const sel = platform === "web" ? ({ "data-selectable": true } as const) : ({} as const) + const sel = { "data-selectable": true } as const const [searchText, setSearchText] = useState("") const [submitted, setSubmitted] = useState("") diff --git a/src/features/books/BooksPage.tsx b/src/features/books/BooksPage.tsx index e193cd3..3d87997 100644 --- a/src/features/books/BooksPage.tsx +++ b/src/features/books/BooksPage.tsx @@ -7,16 +7,14 @@ import { Input } from "@/components/ui/input" import { Skeleton } from "@/components/ui/skeleton" import { useBooks, useSearchBooks, useBorrowBook } from "./hooks" import { useAuthStore } from "@/store/authStore" -import { usePlatform } from "@/hooks/usePlatform" import { useIsMobile } from "@/hooks/useIsMobile" import { getErrorMessage } from "@/lib/errors" export default function BooksPage() { const borrow = useBorrowBook() const token = useAuthStore((s) => s.token) - const platform = usePlatform() const isMobile = useIsMobile() - const sel = platform === "web" ? ({ "data-selectable": true } as const) : ({} as const) + const sel = { "data-selectable": true } as const const [searchText, setSearchText] = useState("") const [submitted, setSubmitted] = useState("") diff --git a/src/features/borrows/MyBorrowsPage.tsx b/src/features/borrows/MyBorrowsPage.tsx index a5b7be2..a9da23d 100644 --- a/src/features/borrows/MyBorrowsPage.tsx +++ b/src/features/borrows/MyBorrowsPage.tsx @@ -8,15 +8,13 @@ import { Input } from "@/components/ui/input" import { Skeleton } from "@/components/ui/skeleton" import { useMyBorrows, useSearchMyBorrows, useReturnBook } from "./hooks" import { formatDateTime } from "@/lib/formatters" -import { usePlatform } from "@/hooks/usePlatform" import { useIsMobile } from "@/hooks/useIsMobile" import { getErrorMessage } from "@/lib/errors" export default function MyBorrowsPage() { const returnBook = useReturnBook() - const platform = usePlatform() const isMobile = useIsMobile() - const sel = platform === "web" ? ({ "data-selectable": true } as const) : ({} as const) + const sel = { "data-selectable": true } as const const [searchText, setSearchText] = useState("") const [submitted, setSubmitted] = useState("") diff --git a/src/hooks/usePlatform.tsx b/src/hooks/usePlatform.tsx index cb898b6..67e630c 100644 --- a/src/hooks/usePlatform.tsx +++ b/src/hooks/usePlatform.tsx @@ -8,12 +8,6 @@ function isTauri(): boolean { return !!(window as unknown as Record).__TAURI_INTERNALS__ } -// Default to safe: add no-select immediately, remove only if definitely web -document.documentElement.classList.add("no-select") -if (!isTauri()) { - document.documentElement.classList.remove("no-select") -} - export function PlatformProvider({ children }: { children: ReactNode }) { const [platform, setPlatform] = useState(isTauri() ? "desktop" : "web") diff --git a/src/index.css b/src/index.css index 0ad9218..23df6d7 100644 --- a/src/index.css +++ b/src/index.css @@ -140,11 +140,14 @@ html.mobile body { } html.no-select * { + -webkit-user-select: none !important; user-select: none !important; } html.no-select input, html.no-select textarea, html.no-select [data-selectable] { + -webkit-user-select: text !important; user-select: text !important; -} \ No newline at end of file +} +