From 2d203d3c70a2c3f57a926a34a0aa2741d01ef2c2 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Mon, 28 Jul 2025 18:01:51 +0530 Subject: [PATCH] (fix:chunks)responsive --- frontend/src/components/DocumentChunks.tsx | 47 +++++------ frontend/src/components/FileTreeComponent.tsx | 78 ++++++++++--------- 2 files changed, 60 insertions(+), 65 deletions(-) diff --git a/frontend/src/components/DocumentChunks.tsx b/frontend/src/components/DocumentChunks.tsx index c7ed739f..b56e1514 100644 --- a/frontend/src/components/DocumentChunks.tsx +++ b/frontend/src/components/DocumentChunks.tsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import { useSelector } from 'react-redux'; import { useTranslation } from 'react-i18next'; import { selectToken } from '../preferences/preferenceSlice'; -import { useDarkTheme, useLoaderState } from '../hooks'; +import { useDarkTheme, useLoaderState, useMediaQuery } from '../hooks'; import userService from '../api/services/userService'; import ArrowLeft from '../assets/arrow-left.svg'; import NoFilesIcon from '../assets/no-files.svg'; @@ -33,19 +33,23 @@ const LineNumberedTextarea: React.FC = ({ className = '', editable = true }) => { + const { isMobile } = useMediaQuery(); + const handleChange = (e: React.ChangeEvent) => { onChange(e.target.value); }; const lineHeight = 19.93; const contentLines = value.split('\n').length; - const minLinesForDisplay = Math.ceil((typeof window !== 'undefined' ? window.innerHeight - 300 : 600) / lineHeight); + + const heightOffset = isMobile ? 200 : 300; + const minLinesForDisplay = Math.ceil((typeof window !== 'undefined' ? window.innerHeight - heightOffset : 600) / lineHeight); const totalLines = Math.max(contentLines, minLinesForDisplay); return (
= ({ {Array.from({ length: totalLines }, (_, i) => (
{i + 1}
@@ -65,20 +65,19 @@ const LineNumberedTextarea: React.FC = ({
{editable ? (