From 964a69b5f1ab6a5e39e97441684312de82c46ac2 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 22 Sep 2026 18:04:46 +0800 Subject: [PATCH] feat: improve mobile connection setup --- ui/components/ConnectForm/connectForm.vue | 117 ++++++++++++------ .../ConnectForm/connectMethodPicker.vue | 2 +- ui/components/ConnectForm/fields.vue | 117 ++++++++++++------ ui/components/Modal/connectionFormModal.vue | 61 ++++++++- .../Workspace/connectionSetupPane.vue | 97 +++++++++++++-- .../Workspace/useConnectionSetupDrag.test.ts | 18 ++- .../Workspace/useConnectionSetupDrag.ts | 3 +- ui/composables/useConnectMethods.test.ts | 75 +++++++++-- ui/composables/useConnectMethods.ts | 11 +- ui/utils/runtime.ts | 7 ++ 10 files changed, 397 insertions(+), 111 deletions(-) diff --git a/ui/components/ConnectForm/connectForm.vue b/ui/components/ConnectForm/connectForm.vue index 757de38ed..1076bb9a9 100644 --- a/ui/components/ConnectForm/connectForm.vue +++ b/ui/components/ConnectForm/connectForm.vue @@ -181,7 +181,7 @@ watch( @@ -236,14 +239,20 @@ watch( diff --git a/ui/components/ConnectForm/connectMethodPicker.vue b/ui/components/ConnectForm/connectMethodPicker.vue index 228beef60..e224bdc7d 100644 --- a/ui/components/ConnectForm/connectMethodPicker.vue +++ b/ui/components/ConnectForm/connectMethodPicker.vue @@ -287,7 +287,7 @@ async function openProtocolApplicationSettings() { orientation="horizontal" :ui="{ fieldset: 'flex flex-wrap gap-2', - item: 'rounded-[length:var(--app-radius)] px-2 py-1.5 hover:bg-[var(--app-hover-soft)]' + item: 'items-center rounded-[length:var(--app-radius)] px-2 py-1.5 hover:bg-[var(--app-hover-soft)]' }" />
(), { assetType: "assets", @@ -246,7 +247,19 @@ watchDebounced( + + diff --git a/ui/components/Modal/connectionFormModal.vue b/ui/components/Modal/connectionFormModal.vue index 9d31bbf7f..cbd95164e 100644 --- a/ui/components/Modal/connectionFormModal.vue +++ b/ui/components/Modal/connectionFormModal.vue @@ -23,6 +23,7 @@ const { const currentAsset = ref(null); const loading = ref(false); const downloadingRdp = shallowRef(false); +const headerActionTarget = shallowRef(null); let loadSequence = 0; const modalTitle = computed(() => { @@ -97,17 +98,20 @@ watch( :dismissible="false" :title="modalTitle" :ui="{ - content: 'w-[calc(100vw-3rem)] max-w-2xl', + content: 'connection-form-modal w-[calc(100vw-3rem)] max-w-2xl', header: 'min-h-12 p-3 sm:px-4', - title: 'text-sm leading-5', - close: 'top-2 end-2 size-7 p-1', - body: 'pt-1 sm:pt-1' + title: 'connection-form-modal-title text-sm leading-5', + close: 'connection-form-modal-close top-2 end-2 size-7 p-1', + body: 'connection-form-modal-body pt-1 sm:pt-1' }" @update:open="updateOpen" > + + + diff --git a/ui/components/Workspace/connectionSetupPane.vue b/ui/components/Workspace/connectionSetupPane.vue index f0e0f2c32..7f49f9cb4 100644 --- a/ui/components/Workspace/connectionSetupPane.vue +++ b/ui/components/Workspace/connectionSetupPane.vue @@ -236,10 +236,16 @@ watch( } ); +const compactLayout = useMediaQuery("(max-width: 767px), (max-height: 600px)"); const dragArea = shallowRef(null); const dialogGroup = shallowRef(null); const dragHandle = shallowRef(null); -const { isDragging, style: dialogPosition } = useConnectionSetupDrag(dragArea, dialogGroup, dragHandle); +const headerActionTarget = shallowRef(null); +const { isDragging, style: dialogPosition } = useConnectionSetupDrag( + dragArea, + dialogGroup, + computed(() => (compactLayout.value ? null : dragHandle.value)) +); const closing = ref(false); const dialogVisible = computed(() => !closing.value && Boolean(currentAsset.value || props.tab.setupAsset)); @@ -263,7 +269,7 @@ onMounted(loadAsset);