- {canUpload &&
}
-
-
-
- | Action |
- Filename |
- Status |
-
-
-
- {Object.values(files).map((file, i) => {
- return ;
- })}
-
-
+
+ {isDragActive || Object.keys(files).length === 0 ? (
+
+ Drop Skins Here
+
+
+ ) : (
+ <>
+ {canUpload && (
+
+ )}
+
+
+
+ | Action |
+ Filename |
+ Status |
+
+
+
+ {Object.values(files).map((file, i) => {
+ return ;
+ })}
+
+
+ >
+ )}
);
}
diff --git a/src/constants.js b/src/constants.js
index 0ee6c46d..28ecf4cf 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -2,6 +2,7 @@ export const SCREENSHOT_WIDTH = 275;
export const SCREENSHOT_HEIGHT = 348;
export const SKIN_RATIO = SCREENSHOT_HEIGHT / SCREENSHOT_WIDTH;
export const ABOUT_PAGE = "ABOUT_PAGE";
+export const UPLOAD_PAGE = "UPLOAD_PAGE";
// export const CDN = "https://s3.amazonaws.com/webamp-uploaded-skins";
// export const CDN = "https://s3.amazonaws.com/cdn.webampskins.org";
export const SCREENSHOT_CDN = "https://cdn.webampskins.org";
diff --git a/src/redux/actionCreators.js b/src/redux/actionCreators.js
index 3fd6c3ba..0ea38f2d 100644
--- a/src/redux/actionCreators.js
+++ b/src/redux/actionCreators.js
@@ -1,3 +1,4 @@
+import { ABOUT_PAGE, UPLOAD_PAGE } from "../constants";
export function closeModal() {
return { type: "CLOSE_MODAL" };
}
@@ -109,7 +110,11 @@ export function gotFocusedSkinFile(content) {
}
export function requestedAboutPage() {
- return { type: "REQUESTED_ABOUT_PAGE" };
+ return { type: "REQUESTED_PAGE", page: ABOUT_PAGE };
+}
+
+export function requestedUploadPage() {
+ return { type: "REQUESTED_PAGE", page: UPLOAD_PAGE };
}
export function selectRelativeSkin(offset) {
diff --git a/src/redux/epics.js b/src/redux/epics.js
index eddc0e35..7f92bfb7 100644
--- a/src/redux/epics.js
+++ b/src/redux/epics.js
@@ -27,6 +27,9 @@ const urlChangedEpic = (actions) =>
if (action.location.pathname === "/about/") {
return of(Actions.requestedAboutPage());
}
+ if (action.location.pathname === "/upload/") {
+ return of(Actions.requestedUploadPage());
+ }
const params = new URLSearchParams(action.location.search);
const query = params != null && params.get("query");
diff --git a/src/redux/reducer.js b/src/redux/reducer.js
index 3be4ae0b..1ee5f2d2 100644
--- a/src/redux/reducer.js
+++ b/src/redux/reducer.js
@@ -1,4 +1,4 @@
-import { ABOUT_PAGE, CHUNK_SIZE } from "../constants";
+import { CHUNK_SIZE, UPLOAD_PAGE } from "../constants";
const defaultState = {
searchQuery: null,
@@ -26,6 +26,9 @@ export default function reducer(state = defaultState, action) {
case "SET_SCALE": {
return { ...state, scale: action.scale };
}
+ case "GOT_FILES": {
+ return { ...state, activeContentPage: UPLOAD_PAGE };
+ }
case "GOT_FILE": {
return {
...state,
@@ -141,6 +144,7 @@ export default function reducer(state = defaultState, action) {
case "CLOSE_UPLOAD_FILES": {
return {
...state,
+ activeContentPage: null,
fileUploads: {},
};
}
@@ -248,10 +252,11 @@ export default function reducer(state = defaultState, action) {
content: action.content,
},
};
- case "REQUESTED_ABOUT_PAGE":
+ case "REQUESTED_PAGE":
+ console.log(action);
return {
...state,
- activeContentPage: ABOUT_PAGE,
+ activeContentPage: action.page,
};
case "OPEN_FILE_EXPLORER":
return {
diff --git a/src/redux/selectors.js b/src/redux/selectors.js
index 941aa06a..dee75eb5 100644
--- a/src/redux/selectors.js
+++ b/src/redux/selectors.js
@@ -1,6 +1,6 @@
import { createSelector } from "reselect";
import * as Utils from "../utils";
-import { ABOUT_PAGE } from "../constants";
+import { ABOUT_PAGE, UPLOAD_PAGE } from "../constants";
export function getSelectedSkinHash(state) {
return state.selectedSkinHash;
@@ -47,8 +47,9 @@ export const getFileToUpload = (state) => {
);
};
-export const getHaveUploadFiles = (state) =>
- Object.keys(state.fileUploads).length > 0;
+export const getUploadViewOpen = (state) => {
+ return state.activeContentPage === UPLOAD_PAGE;
+};
export const getAreDragging = (state) => state.areDragging;
@@ -145,6 +146,9 @@ export const getUrl = createSelector(
if (activeContentPage === ABOUT_PAGE) {
return "/about/";
}
+ if (activeContentPage === UPLOAD_PAGE) {
+ return "/upload/";
+ }
if (hash) {
const skinUrl = getPermalinkUrlFromHash(hash);
if (fileExplorerOpen && focusedSkinFile) {