Skip to content
TheChatArchiveThe Chat Archive
gpt-4-0314· OpenAIAi2 WildChat-4.8M (AI2)

const ScreenerPage: NextPage = () => { const {diaryToken} = useAuthContext(); const…

  1. User

    const ScreenerPage: NextPage = () => { const {diaryToken} = useAuthContext(); const {selectedSingleApiKey} = useApiKeyProvider(); const [pages, setPages] = useState<"positions" | "orders" | "history">("orders"); const [accountInfo, setAccountInfo] = useState<Account | undefined>(undefined);

    return <> Скринер

    <CabinetAlgoTradingHead />
    

    <Grid sx={{backgroundColor: "#ECECEC"}} container spacing={1} height={999} p={1}> <Box sx={{width: "100%", height: "100%"}}> <Box className="scroll-block" sx={{overflowY: "scroll", overflowX: "hidden", height: "100%", width: "100%", bgcolor: "#fff", borderRadius: "8px"}}> <Grid container sx={{width: "100%", height: 256, mt: "4px", bgcolor: "#fff", borderRadius: "8px", display: "flex", alignContent: "flex-start"}}> </>; };

      • нужно обернуть в import RGL, {WidthProvider, Layout} from "react-grid-layout"; import "react-grid-layout/css/styles.css"; import "react-resizable/css/styles.css";

      <ReactGridLayout cols={30} layout={layout} onDragStop={} onResizeStop={} isDraggable={draggable} rowHeight={40} width={1200}

      • 5 блоков нужно, чтобы было, которым можно изменять размер и перетаскивать, ИЗМЕНЯТЬ РАЗМЕР ТОЖЕ НУЖНО, КАК И ПЕРЕТАСКИВАТЬ первый блок - второй блок - третий блок - <Box className="scroll-block" sx={{overflowY: "scroll", overflowX: "hidden", height: "100%", width: "100%", bgcolor: "#fff", borderRadius: "8px"}}> четвертый блок - пятый блок - <Grid container sx={{width: "100%", height: 256, mt: "4px", bgcolor: "#fff", borderRadius: "8px", display: "flex", alignContent: "flex-start"}}>
      • размеры по умолчанию должны остаться такими, какие сейчас в примере react typescript
  2. Assistant

    First, make sure you have installed the react-grid-layout package:

    npm install react-grid-layout
    

    Now, you can modify your ScreenerPage component to include the draggable and resizable grid from react-grid-layout. Here's an example implementation:

    import { NextPage } from "next";
    import Head from "next/head";
    import Grid from "@mui/material/Grid";
    import Box from "@mui/material/Box";
    import RGL, { WidthProvider } from "react-grid-layout";
    import "react-grid-layout/css/styles.css";
    import "react-resizable/css/styles.css";
    
    // import your custom components here
    // import ScreenerSymbols from "./ScreenerSymbols";
    // import AssetsBuySell from "./AssetsBuySell";
    // import TradingCup from "./TradingCup";
    // import ScreenerCharts from "./ScreenerCharts";
    
    const ReactGridLayout = WidthProvider(RGL);
    
    const ScreenerPage: NextPage = () => {
      const layout = [
        { i: "a", x: 0, y: 0, w: 4, h: 10 },
        { i: "b", x: 4, y: 0, w: 4, h: 10 },
        { i: "c", x: 8, y: 0, w: 8, h: 10 },
        { i: "d", x: 16, y: 0, w: 10, h: 10 },
        { i: "e", x: 0, y: 10, w: 26, h: 10 }
      ];
    
      // Add your custom components inside the grid items below
      return (
        <>
          <Head>
            <title>Скринер</title>
          </Head>
          <Box maxWidth="100%">
            <ReactGridLayout
              className="layout"
              cols={30}
              layout={layout}
              rowHeight={40}
              width={1200}
            >
              <div key="a" className="grid-item">
                {/*<ScreenerSymbols />*/}
                ScreenerSymbols
              </div>
              <div key="b" className="grid-item">
                {/*<AssetsBuySell />*/}
                AssetsBuySell
              </div>
              <div key="c" className="grid-item">
                {/* 
               <Box className="scroll-block" sx={{overflowY: "scroll", overflowX: "hidden", height: "100%", width: "100%", bgcolor: "#fff", borderRadius: "8px"}}>
                  <TradingCup />
                </Box>
                */}
                TradingCup
              </div>
              <div key="d" className="grid-item">
                {/*<ScreenerCharts />*/}
                ScreenerCharts
              </div>
              <div key="e" className="grid-item">
                {/* 
                <Grid container sx={{width: "100%", height: 256, mt: "4px", bgcolor: "#fff", borderRadius: "8px", display: "flex", alignContent: "flex-start"}}></Grid>
                */}
                Grid Container
              </div>
            </ReactGridLayout>
          </Box>
        </>
      );
    };
    
    export default ScreenerPage;
    

    This example uses a static layout for the grid items. You can store the layout variable inside a state if you want to make it dynamic and handle changes coming from the onDragStop and onResizeStop events.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.