File tree Expand file tree Collapse file tree 19 files changed +200
-79
lines changed
Expand file tree Collapse file tree 19 files changed +200
-79
lines changed Original file line number Diff line number Diff line change 8080 "concurrently" : " ^5.0.2" ,
8181 "electron" : " ^7.1.9" ,
8282 "electron-builder" : " ^22.2.0" ,
83- "wait-on" : " ^3.3 .0"
83+ "wait-on" : " ^4.0 .0"
8484 }
8585}
Original file line number Diff line number Diff line change @@ -11,10 +11,12 @@ import File from "../../routes/File";
1111import Text from "../../routes/Text" ;
1212import Drawerbar from "../Drawerbar" ;
1313import { CssBaseline } from "@material-ui/core" ;
14+ import DropZone from "../DropZone" ;
1415
1516function App ( ) {
1617
1718 let themeIndex = useSelector ( state => state . MainReducer . themeIndex ) ;
19+
1820 let themeType = "light" ;
1921 if ( themeIndex === 8 ) {
2022 themeType = "dark" ;
@@ -32,7 +34,7 @@ function App() {
3234 return (
3335 < ThemeProvider theme = { theme } >
3436 < BrowserRouter >
35- < div className = "App" >
37+ < DropZone >
3638 < Topbar />
3739 < Drawerbar />
3840 < CssBaseline />
@@ -53,7 +55,7 @@ function App() {
5355 < Home />
5456 </ Route >
5557 </ Switch >
56- </ div >
58+ </ DropZone >
5759 </ BrowserRouter >
5860 </ ThemeProvider >
5961 ) ;
Original file line number Diff line number Diff line change 1+ import React from "react" ;
2+ import { useHistory } from "react-router-dom" ;
3+ import { useDispatch , useSelector } from "react-redux" ;
4+
5+ const DropZone = ( { children} ) => {
6+
7+ const history = useHistory ( ) ;
8+ const enabled = useSelector ( state => state . MainReducer . canDragDrop ) ;
9+ const dispatch = useDispatch ( ) ;
10+
11+ /**
12+ * Event that is fired when one or more files are dropped
13+ * @param event The event that contains the drop details
14+ */
15+ const onDrop = ( event ) => {
16+ event . preventDefault ( ) ;
17+ if ( ! enabled ) return ;
18+
19+ dispatch ( { type : 'SET_CURRENT_FILE' , payload : event . dataTransfer . files [ 0 ] } ) ;
20+ history . push ( "/file" ) ;
21+ } ;
22+
23+ /**
24+ * Event that is fired when a drag over event is detected
25+ * @param event The event that contains the drag over details
26+ */
27+ const onDragOver = ( event ) => {
28+ event . preventDefault ( ) ;
29+ } ;
30+
31+ return (
32+ < div
33+ onDragOver = { onDragOver }
34+ onDrop = { onDrop } >
35+ { children }
36+ </ div >
37+ ) ;
38+
39+ } ;
40+
41+ export default DropZone ;
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const de_DE = () => {
1212 theme : "Thema" ,
1313 general : "Allgemeines" ,
1414 autoUpdate : "Automatisch nach Aktualisierungen suchen" ,
15+ dragAndDrop : "Aktivieren Sie Drag & Drop" ,
1516 select : "Wählen" ,
1617 default : "Standard" ,
1718 defaultThemeDescription : "Das Standarddesign." ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const en_US = () => {
1212 theme : "Theme" ,
1313 general : "General" ,
1414 autoUpdate : "Automatically check for updates" ,
15+ dragAndDrop : "Enable drag-and-drop" ,
1516 select : "Select" ,
1617 default : "Default" ,
1718 defaultThemeDescription : "The default theme." ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const es_ES = () => {
1212 theme : "Tema" ,
1313 general : "General" ,
1414 autoUpdate : "Buscar actualizaciones automáticamente" ,
15+ dragAndDrop : "Habilitar arrastrar y soltar" ,
1516 select : "Seleccione" ,
1617 default : "Defecto" ,
1718 defaultThemeDescription : "El tema por defecto." ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const fr_FR = () => {
1212 theme : "Thème" ,
1313 general : "Général" ,
1414 autoUpdate : "Vérifier automatiquement les mises à jour" ,
15+ dragAndDrop : "Activer le glisser-déposer" ,
1516 select : "Sélectionner" ,
1617 default : "Défaut" ,
1718 defaultThemeDescription : "Le thème par défaut." ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const it_IT = () => {
1212 theme : "Tema" ,
1313 general : "Generale" ,
1414 autoUpdate : "Controlla automaticamente gli aggiornamenti" ,
15+ dragAndDrop : "Abilita il trascinamento della selezione" ,
1516 select : "Selezionare" ,
1617 default : "Predefinito" ,
1718 defaultThemeDescription : "Il tema predefinito" ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const jp_JP = () => {
1212 theme : "テーマ" ,
1313 general : "全般" ,
1414 autoUpdate : "更新を自動的に確認する" ,
15+ dragAndDrop : "ドラッグアンドドロップを有効にする" ,
1516 select : "選択してください" ,
1617 default : "デフォルト" ,
1718 defaultThemeDescription : "デフォルトのテーマ。" ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const nl_NL = () => {
1212 theme : "Thema" ,
1313 general : "Algemeen" ,
1414 autoUpdate : "Zoek automatisch naar updates" ,
15+ dragAndDrop : "Slepen en neerzetten inschakelen" ,
1516 select : "Selecteren" ,
1617 default : "Standaard" ,
1718 defaultThemeDescription : "Het standaard thema." ,
You can’t perform that action at this time.
0 commit comments