mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 16:23:41 +08:00 
			
		
		
		
	feat: optiminize modal UE on mobile dev
This commit is contained in:
		@@ -26,6 +26,7 @@ export interface ModalProps {
 | 
				
			|||||||
  headerBordered?: boolean;
 | 
					  headerBordered?: boolean;
 | 
				
			||||||
  modelClassName?: string;
 | 
					  modelClassName?: string;
 | 
				
			||||||
  onOpen?: (v: boolean) => void;
 | 
					  onOpen?: (v: boolean) => void;
 | 
				
			||||||
 | 
					  maskCloseble?: boolean;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface WarnProps
 | 
					export interface WarnProps
 | 
				
			||||||
@@ -70,6 +71,7 @@ const Modal = (props: ModalProps) => {
 | 
				
			|||||||
    headerBordered,
 | 
					    headerBordered,
 | 
				
			||||||
    modelClassName,
 | 
					    modelClassName,
 | 
				
			||||||
    onOpen,
 | 
					    onOpen,
 | 
				
			||||||
 | 
					    maskCloseble = true,
 | 
				
			||||||
  } = props;
 | 
					  } = props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const [open, setOpen] = useState(!!visible);
 | 
					  const [open, setOpen] = useState(!!visible);
 | 
				
			||||||
@@ -121,6 +123,11 @@ const Modal = (props: ModalProps) => {
 | 
				
			|||||||
        <AlertDialog.Overlay
 | 
					        <AlertDialog.Overlay
 | 
				
			||||||
          className="bg-modal-mask fixed inset-0 animate-mask "
 | 
					          className="bg-modal-mask fixed inset-0 animate-mask "
 | 
				
			||||||
          style={{ zIndex: baseZIndex - 1 }}
 | 
					          style={{ zIndex: baseZIndex - 1 }}
 | 
				
			||||||
 | 
					          onClick={() => {
 | 
				
			||||||
 | 
					            if (maskCloseble) {
 | 
				
			||||||
 | 
					              handleClose();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          }}
 | 
				
			||||||
        />
 | 
					        />
 | 
				
			||||||
        <AlertDialog.Content
 | 
					        <AlertDialog.Content
 | 
				
			||||||
          className={`
 | 
					          className={`
 | 
				
			||||||
@@ -128,7 +135,16 @@ const Modal = (props: ModalProps) => {
 | 
				
			|||||||
          `}
 | 
					          `}
 | 
				
			||||||
          style={{ zIndex: baseZIndex - 1 }}
 | 
					          style={{ zIndex: baseZIndex - 1 }}
 | 
				
			||||||
        >
 | 
					        >
 | 
				
			||||||
          <div className="flex-1"> </div>
 | 
					          <div
 | 
				
			||||||
 | 
					            className="flex-1"
 | 
				
			||||||
 | 
					            onClick={() => {
 | 
				
			||||||
 | 
					              if (maskCloseble) {
 | 
				
			||||||
 | 
					                handleClose();
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            }}
 | 
				
			||||||
 | 
					          >
 | 
				
			||||||
 | 
					             
 | 
				
			||||||
 | 
					          </div>
 | 
				
			||||||
          <div
 | 
					          <div
 | 
				
			||||||
            className={`flex flex-col flex-0      
 | 
					            className={`flex flex-col flex-0      
 | 
				
			||||||
              bg-moda-panel text-modal-mask    
 | 
					              bg-moda-panel text-modal-mask    
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,12 +54,12 @@ export default function SessionItem(props: {
 | 
				
			|||||||
              }
 | 
					              }
 | 
				
			||||||
            `}
 | 
					            `}
 | 
				
			||||||
          onClick={props.onClick}
 | 
					          onClick={props.onClick}
 | 
				
			||||||
          // ref={(ele) => {
 | 
					          ref={(ele) => {
 | 
				
			||||||
          //   draggableRef.current = ele;
 | 
					            draggableRef.current = ele;
 | 
				
			||||||
          //   provided.innerRef(ele);
 | 
					            provided.innerRef(ele);
 | 
				
			||||||
          // }}
 | 
					          }}
 | 
				
			||||||
          // {...provided.draggableProps}
 | 
					          {...provided.draggableProps}
 | 
				
			||||||
          // {...provided.dragHandleProps}
 | 
					          {...provided.dragHandleProps}
 | 
				
			||||||
          title={`${props.title}\n${Locale.ChatItem.ChatItemCount(
 | 
					          title={`${props.title}\n${Locale.ChatItem.ChatItemCount(
 | 
				
			||||||
            props.count,
 | 
					            props.count,
 | 
				
			||||||
          )}`}
 | 
					          )}`}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -97,20 +97,13 @@ export default MenuLayout(function SessionList(props) {
 | 
				
			|||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      <div
 | 
					      <div className={`flex-1 overflow-y-auto max-md:pb-chat-panel-mobile `}>
 | 
				
			||||||
        className={`flex-1 overflow-y-auto max-md:pb-chat-panel-mobile `}
 | 
					 | 
				
			||||||
        // onClick={(e) => {
 | 
					 | 
				
			||||||
        //   if (e.target === e.currentTarget) {
 | 
					 | 
				
			||||||
        //     navigate(Path.Home);
 | 
					 | 
				
			||||||
        //   }
 | 
					 | 
				
			||||||
        // }}
 | 
					 | 
				
			||||||
      >
 | 
					 | 
				
			||||||
        <DragDropContext onDragEnd={onDragEnd}>
 | 
					        <DragDropContext onDragEnd={onDragEnd}>
 | 
				
			||||||
          <Droppable droppableId="chat-list">
 | 
					          <Droppable droppableId="chat-list">
 | 
				
			||||||
            {(provided) => (
 | 
					            {(provided) => (
 | 
				
			||||||
              <div
 | 
					              <div
 | 
				
			||||||
                // ref={provided.innerRef}
 | 
					                ref={provided.innerRef}
 | 
				
			||||||
                // {...provided.droppableProps}
 | 
					                {...provided.droppableProps}
 | 
				
			||||||
                className={`w-[100%]`}
 | 
					                className={`w-[100%]`}
 | 
				
			||||||
              >
 | 
					              >
 | 
				
			||||||
                {sessions.map((item, i) => (
 | 
					                {sessions.map((item, i) => (
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user