feat: optiminize modal UE on mobile dev

This commit is contained in:
butterfly 2024-04-30 11:03:37 +08:00
parent 5ea6206319
commit 996537d262
3 changed files with 26 additions and 17 deletions

View File

@ -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">&nbsp;</div> <div
className="flex-1"
onClick={() => {
if (maskCloseble) {
handleClose();
}
}}
>
&nbsp;
</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

View File

@ -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,
)}`} )}`}

View File

@ -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) => (