diff --git a/src/app/pages/client/explore/LimitWarning.tsx b/src/app/pages/client/explore/LimitWarning.tsx deleted file mode 100644 index 27bce62f..00000000 --- a/src/app/pages/client/explore/LimitWarning.tsx +++ /dev/null @@ -1,140 +0,0 @@ -import React, { FormEventHandler, useState } from 'react'; -import FocusTrap from 'focus-trap-react'; -import { - Box, - Button, - Dialog, - Header, - Icon, - IconButton, - Icons, - Input, - Overlay, - OverlayBackdrop, - OverlayCenter, - Text, - config, -} from 'folds'; -import { stopPropagation } from '../../../utils/keyboard'; - -type RectCords = { - x: number; - y: number; - width: number; - height: number; -}; - -type LimitButtonProps = { - limit: number; - onLimitChange: (limit: string) => void; - setMenuAnchor: React.Dispatch>; -}; - -export function LimitWarning({ limit, onLimitChange, setMenuAnchor }: LimitButtonProps) { - const [dialog, setDialog] = useState(false); - const [xlimit, setXLimit] = useState(limit); - - const checklimit: FormEventHandler = (evt) => { - evt.preventDefault(); - const limitInput = evt.currentTarget.limitInput as HTMLInputElement; - if (!limitInput) return; - const newLimit = limitInput.value.trim(); - if (!newLimit) return; - if (parseInt(newLimit, 10) > 9999) { - setDialog(true); - setXLimit(Number(newLimit)); - } else { - onLimitChange(newLimit); - setMenuAnchor(undefined); - } - }; - - const handleLimitSubmit: FormEventHandler = (evt) => { - evt.preventDefault(); - onLimitChange(xlimit.toString()); - setDialog(false); - setMenuAnchor(undefined); - }; - - return ( - <> - }> - - setDialog(false), - escapeDeactivates: stopPropagation, - }} - > - -
- - Warning!! - - setDialog(false)} radii="300"> - - -
- - - You are about to change the limit of items. Changing the limit higher than 9,999 - may cause performance issues and may crash the app. It is recommended to keep the - limit below 9,999 for the smooth functioning of the app. Are you sure you want to - continue? - - - - - - -
-
-
-
- - - Custom Limit - - - - - - ); -} diff --git a/src/app/pages/client/explore/Server.tsx b/src/app/pages/client/explore/Server.tsx index b5528367..c757dd79 100644 --- a/src/app/pages/client/explore/Server.tsx +++ b/src/app/pages/client/explore/Server.tsx @@ -45,7 +45,7 @@ import { getMxIdServer } from '../../../utils/matrix'; import { stopPropagation } from '../../../utils/keyboard'; import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize'; import { BackRouteHandler } from '../../../components/BackRouteHandler'; -import { LimitWarning } from './LimitWarning'; +// import { LimitWarning } from './LimitWarning'; const useServerSearchParams = (searchParams: URLSearchParams): ExploreServerPathSearchParams => useMemo( @@ -301,18 +301,27 @@ function LimitButton({ limit, onLimitChange }: LimitButtonProps) { setLimit('96')} radii="Pill"> 96 + setLimit('10000')} radii="Pill"> + Max + - - {/* + Custom Limit ) => { + if (parseInt(e.target.value) > 10000) { + e.target.value = e.target.value.slice(0, 4); + } + }} step={1} outlined type="number" @@ -323,7 +332,7 @@ function LimitButton({ limit, onLimitChange }: LimitButtonProps) { - */} +