fix: replaced isMobile with mantine hook
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
import React, { FC } from "react";
|
||||
import { IconDotsVertical, IconEdit, IconTrash } from "@tabler/icons-react";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import { Box, Group, Menu, Text } from "@mantine/core";
|
||||
import { useBoardsContext } from "@/app/deals/contexts/BoardsContext";
|
||||
import useIsMobile from "@/hooks/useIsMobile";
|
||||
import { BoardSchema } from "@/lib/client";
|
||||
|
||||
type Props = {
|
||||
@ -12,8 +12,14 @@ type Props = {
|
||||
menuIconSize?: number;
|
||||
};
|
||||
|
||||
const BoardMenu: FC<Props> = ({ board, startEditing, isHovered = true, menuIconSize = 16 }) => {
|
||||
const BoardMenu: FC<Props> = ({
|
||||
board,
|
||||
startEditing,
|
||||
isHovered = true,
|
||||
menuIconSize = 16,
|
||||
}) => {
|
||||
const { selectedBoard, onDeleteBoard } = useBoardsContext();
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
return (
|
||||
<Menu>
|
||||
|
||||
@ -6,11 +6,12 @@ import Board from "@/app/deals/components/Board/Board";
|
||||
import CreateBoardButton from "@/app/deals/components/CreateBoardButton/CreateBoardButton";
|
||||
import { useBoardsContext } from "@/app/deals/contexts/BoardsContext";
|
||||
import SortableDnd from "@/components/dnd/SortableDnd";
|
||||
import useIsMobile from "@/hooks/useIsMobile";
|
||||
import { BoardSchema } from "@/lib/client";
|
||||
import { isMobile } from "react-device-detect";
|
||||
|
||||
const Boards = () => {
|
||||
const { boards, setSelectedBoard, onUpdateBoard } = useBoardsContext();
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
const renderBoard = (board: BoardSchema) => {
|
||||
return <Board board={board} />;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import React, { FC, ReactNode } from "react";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import { Group, ScrollArea } from "@mantine/core";
|
||||
import CreateStatusButton from "@/app/deals/components/CreateStatusButton/CreateStatusButton";
|
||||
import DealCard from "@/app/deals/components/DealCard/DealCard";
|
||||
@ -10,11 +9,13 @@ import StatusColumnWrapper from "@/app/deals/components/StatusColumnWrapper/Stat
|
||||
import { useDealsContext } from "@/app/deals/contexts/DealsContext";
|
||||
import useDealsAndStatusesDnd from "@/app/deals/hooks/useDealsAndStatusesDnd";
|
||||
import FunnelDnd from "@/components/dnd/FunnelDnd/FunnelDnd";
|
||||
import useIsMobile from "@/hooks/useIsMobile";
|
||||
import { DealSchema, StatusSchema } from "@/lib/client";
|
||||
import { sortByLexorank } from "@/utils/lexorank";
|
||||
|
||||
const Funnel: FC = () => {
|
||||
const { deals } = useDealsContext();
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
const {
|
||||
sortedStatuses,
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
"use client";
|
||||
|
||||
import { IconChevronLeft, IconSettings } from "@tabler/icons-react";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import { Box, Group, Text } from "@mantine/core";
|
||||
import { useBoardsContext } from "@/app/deals/contexts/BoardsContext";
|
||||
import { useProjectsContext } from "@/app/deals/contexts/ProjectsContext";
|
||||
import ProjectSelect from "@/components/selects/ProjectSelect/ProjectSelect";
|
||||
import { ColorSchemeToggle } from "@/components/ui/ColorSchemeToggle/ColorSchemeToggle";
|
||||
import useIsMobile from "@/hooks/useIsMobile";
|
||||
|
||||
const Header = () => {
|
||||
const { projects, setSelectedProject, selectedProject } =
|
||||
useProjectsContext();
|
||||
const { setIsEditorDrawerOpened } = useBoardsContext();
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
const getDesktopHeader = () => {
|
||||
return (
|
||||
|
||||
@ -12,7 +12,6 @@ import {
|
||||
horizontalListSortingStrategy,
|
||||
SortableContext,
|
||||
} from "@dnd-kit/sortable";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import Slider from "react-slick";
|
||||
import { Group } from "@mantine/core";
|
||||
import CreateStatusButton from "@/app/deals/components/CreateStatusButton/CreateStatusButton";
|
||||
@ -20,6 +19,7 @@ import useDndSensors from "@/app/deals/hooks/useSensors";
|
||||
import FunnelColumn from "@/components/dnd/FunnelDnd/FunnelColumn";
|
||||
import FunnelOverlay from "@/components/dnd/FunnelDnd/FunnelOverlay";
|
||||
import { BaseDraggable } from "@/components/dnd/types/types";
|
||||
import useIsMobile from "@/hooks/useIsMobile";
|
||||
import SortableItem from "../SortableItem";
|
||||
|
||||
type Props<TContainer, TItem> = {
|
||||
@ -62,6 +62,7 @@ const FunnelDnd = <
|
||||
disabledColumns = false,
|
||||
}: Props<TContainer, TItem>) => {
|
||||
const sensors = useDndSensors();
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
const settings = {
|
||||
dots: true,
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import React, { FC, ReactNode, useEffect, useRef, useState } from "react";
|
||||
import { TextInput } from "@mantine/core";
|
||||
import { Styles } from "@mantine/core/lib/core/styles-api/styles-api.types";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import { modals } from "@mantine/modals";
|
||||
import useIsMobile from "@/hooks/useIsMobile";
|
||||
|
||||
type Props = {
|
||||
defaultValue?: string;
|
||||
@ -24,6 +24,7 @@ const InPlaceInput: FC<Props> = ({
|
||||
const [isWriting, setIsWriting] = useState<boolean>(false);
|
||||
const [value, setValue] = useState<string>(defaultValue);
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
useEffect(() => {
|
||||
if (isWriting && inputRef.current) {
|
||||
|
||||
8
src/hooks/useIsMobile.ts
Normal file
8
src/hooks/useIsMobile.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { em } from "@mantine/core";
|
||||
import { useMediaQuery } from "@mantine/hooks";
|
||||
|
||||
const useIsMobile = () => {
|
||||
return useMediaQuery(`(max-width: ${em(750)})`);
|
||||
};
|
||||
|
||||
export default useIsMobile;
|
||||
Reference in New Issue
Block a user