From ea40aa76d042a0920ee687bc761768083f42f016 Mon Sep 17 00:00:00 2001 From: nite Date: Tue, 10 Feb 2026 22:44:18 +0800 Subject: [PATCH] feat: peercard accept drag event --- frontend/bindings/mesh-drop/index.ts | 1 + frontend/bindings/mesh-drop/models.ts | 32 +++++- frontend/src/components/MainLayout.vue | 24 +++-- frontend/src/components/PeerCard.vue | 101 +++++++++++++++++- .../src/components/modals/FileSendModal.vue | 77 +++++++------ frontend/src/locales/en.json | 3 +- frontend/src/locales/zh-Hans.json | 3 +- main.go | 18 +++- 8 files changed, 211 insertions(+), 48 deletions(-) diff --git a/frontend/bindings/mesh-drop/index.ts b/frontend/bindings/mesh-drop/index.ts index 787d33d..c8a2f19 100644 --- a/frontend/bindings/mesh-drop/index.ts +++ b/frontend/bindings/mesh-drop/index.ts @@ -2,5 +2,6 @@ // This file is automatically generated. DO NOT EDIT export { + File, FilesDroppedEvent } from "./models.js"; diff --git a/frontend/bindings/mesh-drop/models.ts b/frontend/bindings/mesh-drop/models.ts index 0be8b8c..da69a5f 100644 --- a/frontend/bindings/mesh-drop/models.ts +++ b/frontend/bindings/mesh-drop/models.ts @@ -5,8 +5,33 @@ // @ts-ignore: Unused imports import { Create as $Create } from "@wailsio/runtime"; +export class File { + "name": string; + "path": string; + + /** Creates a new File instance. */ + constructor($$source: Partial = {}) { + if (!("name" in $$source)) { + this["name"] = ""; + } + if (!("path" in $$source)) { + this["path"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new File instance from a string or object. + */ + static createFrom($$source: any = {}): File { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new File($$parsedSource as Partial); + } +} + export class FilesDroppedEvent { - "files": string[]; + "files": File[]; "target": string; /** Creates a new FilesDroppedEvent instance. */ @@ -25,7 +50,7 @@ export class FilesDroppedEvent { * Creates a new FilesDroppedEvent instance from a string or object. */ static createFrom($$source: any = {}): FilesDroppedEvent { - const $$createField0_0 = $$createType0; + const $$createField0_0 = $$createType1; let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; if ("files" in $$parsedSource) { $$parsedSource["files"] = $$createField0_0($$parsedSource["files"]); @@ -35,4 +60,5 @@ export class FilesDroppedEvent { } // Private type creation functions -const $$createType0 = $Create.Array($Create.Any); +const $$createType0 = File.createFrom; +const $$createType1 = $Create.Array($$createType0); diff --git a/frontend/src/components/MainLayout.vue b/frontend/src/components/MainLayout.vue index fd0c5d6..e8083e3 100644 --- a/frontend/src/components/MainLayout.vue +++ b/frontend/src/components/MainLayout.vue @@ -150,12 +150,24 @@ const handleCleanFinished = async () => {
-
-
- +
+ + {{ t("discover.dragDropHint") }} + +
+
+ +
diff --git a/frontend/src/components/PeerCard.vue b/frontend/src/components/PeerCard.vue index 6bdb36c..19ad740 100644 --- a/frontend/src/components/PeerCard.vue +++ b/frontend/src/components/PeerCard.vue @@ -1,6 +1,6 @@ + + diff --git a/frontend/src/components/modals/FileSendModal.vue b/frontend/src/components/modals/FileSendModal.vue index 32c1bb0..0e361df 100644 --- a/frontend/src/components/modals/FileSendModal.vue +++ b/frontend/src/components/modals/FileSendModal.vue @@ -1,18 +1,22 @@