Skip to content

Commit

Permalink
Wording preference change
Browse files Browse the repository at this point in the history
  • Loading branch information
hujambo-dunia committed Nov 9, 2023
1 parent ed05174 commit bfa5467
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions client/src/components/Upload/DragAndDropModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { computed, ref } from "vue";
import { Toast } from "@/composables/toast";
const modalContentElement = ref(null);
const { isFileOverDocument, isFileOverDropZone } = useFileDrop(modalContentElement, onDrop, onDropFail, true);
const { isFileOverDocument, isFileOverDropZone } = useFileDrop(modalContentElement, onDrop, onDropCancel, true);
const modalClass = computed(() => {
if (isFileOverDropZone.value) {
Expand All @@ -29,9 +29,9 @@ function onDrop(event) {
}
}
function onDropFail(event) {
function onDropCancel(event) {
if (event.dataTransfer?.files?.length > 0) {
Toast.error("Please try again", "File failed");
Toast.error("Please try again", "Upload cancelled");
}
}
</script>
Expand Down
8 changes: 4 additions & 4 deletions client/src/composables/fileDrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ export type FileDropHandler = (event: DragEvent) => void;
* Custom File-Drop composable
* @param dropZone Element which files should be dropped on
* @param onDrop callback function called when drop occurs
* @param onDropFail callback function called when drop fails (missed zone)
* @param onDropCancel callback function called when drop cancelled
* @param solo when true, only reacts if no modal is open
* @param idleTime how long to wait until state resets
*/
export function useFileDrop(
dropZone: MaybeRefOrGetter<EventTarget | null | undefined>,
onDrop: Ref<FileDropHandler> | FileDropHandler,
onDropFail: Ref<FileDropHandler> | FileDropHandler,
onDropCancel: Ref<FileDropHandler> | FileDropHandler,
solo: MaybeRefOrGetter<boolean>,
idleTime = 800
) {
Expand Down Expand Up @@ -75,8 +75,8 @@ export function useFileDrop(
const dropHandler = unref(onDrop);
dropHandler(event as DragEvent);
} else {
const dropFailHandler = unref(onDropFail);
dropFailHandler(event as DragEvent);
const dropCancelHandler = unref(onDropCancel);
dropCancelHandler(event as DragEvent);
}
return "idle";
case "dragend":
Expand Down

0 comments on commit bfa5467

Please sign in to comment.