handleDrop changes
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
d3693fe89a
commit
42d68bddf9
1 changed files with 9 additions and 6 deletions
|
@ -4,7 +4,6 @@ import debounce from 'lodash/debounce';
|
||||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
||||||
import { HotKeys } from 'react-hotkeys';
|
import { HotKeys } from 'react-hotkeys';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { useDispatch } from 'react-redux';
|
|
||||||
import { Switch, useHistory, useLocation, Redirect } from 'react-router-dom';
|
import { Switch, useHistory, useLocation, Redirect } from 'react-router-dom';
|
||||||
|
|
||||||
import { fetchFollowRequests } from 'soapbox/actions/accounts';
|
import { fetchFollowRequests } from 'soapbox/actions/accounts';
|
||||||
|
@ -26,7 +25,7 @@ import Icon from 'soapbox/components/icon';
|
||||||
import SidebarNavigation from 'soapbox/components/sidebar-navigation';
|
import SidebarNavigation from 'soapbox/components/sidebar-navigation';
|
||||||
import ThumbNavigation from 'soapbox/components/thumb_navigation';
|
import ThumbNavigation from 'soapbox/components/thumb_navigation';
|
||||||
import { Layout } from 'soapbox/components/ui';
|
import { Layout } from 'soapbox/components/ui';
|
||||||
import { useAppSelector, useOwnAccount, useSoapboxConfig, useFeatures } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector, useOwnAccount, useSoapboxConfig, useFeatures } from 'soapbox/hooks';
|
||||||
import AdminPage from 'soapbox/pages/admin_page';
|
import AdminPage from 'soapbox/pages/admin_page';
|
||||||
import DefaultPage from 'soapbox/pages/default_page';
|
import DefaultPage from 'soapbox/pages/default_page';
|
||||||
// import GroupsPage from 'soapbox/pages/groups_page';
|
// import GroupsPage from 'soapbox/pages/groups_page';
|
||||||
|
@ -329,7 +328,7 @@ const SwitchingColumnsArea: React.FC = ({ children }) => {
|
||||||
const UI: React.FC = ({ children }) => {
|
const UI: React.FC = ({ children }) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const [draggingOver, setDraggingOver] = useState<boolean>(false);
|
const [draggingOver, setDraggingOver] = useState<boolean>(false);
|
||||||
const [mobile, setMobile] = useState<boolean>(isMobile(window.innerWidth));
|
const [mobile, setMobile] = useState<boolean>(isMobile(window.innerWidth));
|
||||||
|
@ -386,9 +385,13 @@ const UI: React.FC = ({ children }) => {
|
||||||
setDraggingOver(false);
|
setDraggingOver(false);
|
||||||
dragTargets.current = [];
|
dragTargets.current = [];
|
||||||
|
|
||||||
|
dispatch((_, getState) => {
|
||||||
if (e.dataTransfer && e.dataTransfer.files.length >= 1) {
|
if (e.dataTransfer && e.dataTransfer.files.length >= 1) {
|
||||||
dispatch(uploadCompose('home', e.dataTransfer.files, intl));
|
const modals = getState().modals;
|
||||||
|
const isModalOpen = modals.last()?.modalType === 'COMPOSE';
|
||||||
|
dispatch(uploadCompose(isModalOpen ? 'compose-modal' : 'home', e.dataTransfer.files, intl));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDragLeave = (e: DragEvent) => {
|
const handleDragLeave = (e: DragEvent) => {
|
||||||
|
|
Loading…
Reference in a new issue