2018-09-26 02:12:07 +02:00
|
|
|
// @flow
|
2017-12-21 22:08:54 +01:00
|
|
|
import React from 'react';
|
2019-12-18 06:27:08 +01:00
|
|
|
import { withRouter } from 'react-router';
|
2018-10-29 18:23:53 +01:00
|
|
|
import * as MODALS from 'constants/modal_types';
|
2017-12-21 22:08:54 +01:00
|
|
|
import ModalError from 'modal/modalError';
|
|
|
|
import ModalDownloading from 'modal/modalDownloading';
|
2019-05-21 23:18:11 +02:00
|
|
|
import ModalAutoGenerateThumbnail from 'modal/modalAutoGenerateThumbnail';
|
2018-01-23 08:44:15 +01:00
|
|
|
import ModalAutoUpdateDownloaded from 'modal/modalAutoUpdateDownloaded';
|
2017-12-21 22:08:54 +01:00
|
|
|
import ModalUpgrade from 'modal/modalUpgrade';
|
|
|
|
import ModalFirstReward from 'modal/modalFirstReward';
|
|
|
|
import ModalRemoveFile from 'modal/modalRemoveFile';
|
|
|
|
import ModalTransactionFailed from 'modal/modalTransactionFailed';
|
|
|
|
import ModalFileTimeout from 'modal/modalFileTimeout';
|
|
|
|
import ModalAffirmPurchase from 'modal/modalAffirmPurchase';
|
|
|
|
import ModalRevokeClaim from 'modal/modalRevokeClaim';
|
2018-03-16 19:22:19 +01:00
|
|
|
import ModalPhoneCollection from 'modal/modalPhoneCollection';
|
|
|
|
import ModalFirstSubscription from 'modal/modalFirstSubscription';
|
2018-05-28 21:53:15 +02:00
|
|
|
import ModalConfirmTransaction from 'modal/modalConfirmTransaction';
|
2018-09-12 18:42:15 +02:00
|
|
|
import ModalSocialShare from 'modal/modalSocialShare';
|
|
|
|
import ModalSendTip from 'modal/modalSendTip';
|
|
|
|
import ModalPublish from 'modal/modalPublish';
|
2020-08-13 21:06:43 +02:00
|
|
|
import ModalPublishPreview from 'modal/modalPublishPreview';
|
2019-05-12 16:46:14 +02:00
|
|
|
import ModalOpenExternalResource from 'modal/modalOpenExternalResource';
|
2018-04-02 18:03:12 +02:00
|
|
|
import ModalConfirmThumbnailUpload from 'modal/modalConfirmThumbnailUpload';
|
2018-07-18 21:48:30 +02:00
|
|
|
import ModalWalletEncrypt from 'modal/modalWalletEncrypt';
|
|
|
|
import ModalWalletDecrypt from 'modal/modalWalletDecrypt';
|
|
|
|
import ModalWalletUnlock from 'modal/modalWalletUnlock';
|
2018-09-26 02:12:07 +02:00
|
|
|
import ModalRewardCode from 'modal/modalRewardCode';
|
2019-08-20 14:29:59 +02:00
|
|
|
import ModalPasswordUnsave from 'modal/modalPasswordUnsave';
|
2019-11-14 21:02:15 +01:00
|
|
|
import ModalCommentAcknowledgement from 'modal/modalCommentAcknowledgement';
|
2019-12-05 06:24:54 +01:00
|
|
|
import ModalYoutubeWelcome from 'modal/modalYoutubeWelcome';
|
2020-01-14 21:44:07 +01:00
|
|
|
import ModalSetReferrer from 'modal/modalSetReferrer';
|
2020-03-14 00:00:22 +01:00
|
|
|
import ModalSignOut from 'modal/modalSignOut';
|
2020-06-01 19:03:19 +02:00
|
|
|
import ModalSupportsLiquidate from 'modal/modalSupportsLiquidate';
|
2020-05-22 17:47:48 +02:00
|
|
|
import ModalConfirmAge from 'modal/modalConfirmAge';
|
2020-05-25 16:27:36 +02:00
|
|
|
import ModalFileSelection from 'modal/modalFileSelection';
|
2020-09-11 20:35:50 +02:00
|
|
|
import ModalSyncEnable from 'modal/modalSyncEnable';
|
2020-06-29 21:54:07 +02:00
|
|
|
import ModalImageUpload from 'modal/modalImageUpload';
|
2020-12-11 19:33:27 +01:00
|
|
|
import ModalMobileSearch from 'modal/modalMobileSearch';
|
2021-01-27 04:24:14 +01:00
|
|
|
import ModalViewImage from 'modal/modalViewImage';
|
2021-01-27 17:00:31 +01:00
|
|
|
import ModalMassTipsUnlock from 'modal/modalMassTipUnlock';
|
2021-03-25 12:24:49 +01:00
|
|
|
import ModalRemoveBtcSwapAddress from 'modal/modalRemoveBtcSwapAddress';
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
import ModalClaimCollectionAdd from 'modal/modalClaimCollectionAdd';
|
|
|
|
import ModalDeleteCollection from 'modal/modalRemoveCollection';
|
2017-08-18 19:09:40 +02:00
|
|
|
|
2018-04-02 18:03:12 +02:00
|
|
|
type Props = {
|
2019-01-08 03:46:33 +01:00
|
|
|
modal: { id: string, modalProps: {} },
|
2019-01-10 02:38:26 +01:00
|
|
|
error: { message: string },
|
2019-12-18 06:27:08 +01:00
|
|
|
location: { pathname: string },
|
|
|
|
hideModal: () => void,
|
2018-04-02 18:03:12 +02:00
|
|
|
};
|
|
|
|
|
2019-04-03 06:17:00 +02:00
|
|
|
function ModalRouter(props: Props) {
|
2019-12-18 06:27:08 +01:00
|
|
|
const { modal, error, location, hideModal } = props;
|
|
|
|
const { pathname } = location;
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
hideModal();
|
|
|
|
}, [pathname, hideModal]);
|
2017-08-18 19:09:40 +02:00
|
|
|
|
2019-04-03 06:17:00 +02:00
|
|
|
if (error) {
|
|
|
|
return <ModalError {...error} />;
|
2017-08-18 19:09:40 +02:00
|
|
|
}
|
|
|
|
|
2019-04-03 06:17:00 +02:00
|
|
|
if (!modal) {
|
|
|
|
return null;
|
2017-08-21 05:06:26 +02:00
|
|
|
}
|
|
|
|
|
2019-04-03 06:17:00 +02:00
|
|
|
const { id, modalProps } = modal;
|
|
|
|
|
|
|
|
switch (id) {
|
|
|
|
case MODALS.UPGRADE:
|
|
|
|
return <ModalUpgrade {...modalProps} />;
|
|
|
|
case MODALS.DOWNLOADING:
|
|
|
|
return <ModalDownloading {...modalProps} />;
|
2019-05-21 23:18:11 +02:00
|
|
|
case MODALS.AUTO_GENERATE_THUMBNAIL:
|
|
|
|
return <ModalAutoGenerateThumbnail {...modalProps} />;
|
2019-04-03 06:17:00 +02:00
|
|
|
case MODALS.AUTO_UPDATE_DOWNLOADED:
|
|
|
|
return <ModalAutoUpdateDownloaded {...modalProps} />;
|
|
|
|
case MODALS.ERROR:
|
|
|
|
return <ModalError {...modalProps} />;
|
|
|
|
case MODALS.FILE_TIMEOUT:
|
|
|
|
return <ModalFileTimeout {...modalProps} />;
|
|
|
|
case MODALS.FIRST_REWARD:
|
|
|
|
return <ModalFirstReward {...modalProps} />;
|
|
|
|
case MODALS.TRANSACTION_FAILED:
|
|
|
|
return <ModalTransactionFailed {...modalProps} />;
|
|
|
|
case MODALS.CONFIRM_FILE_REMOVE:
|
|
|
|
return <ModalRemoveFile {...modalProps} />;
|
|
|
|
case MODALS.AFFIRM_PURCHASE:
|
|
|
|
return <ModalAffirmPurchase {...modalProps} />;
|
|
|
|
case MODALS.CONFIRM_CLAIM_REVOKE:
|
|
|
|
return <ModalRevokeClaim {...modalProps} />;
|
|
|
|
case MODALS.PHONE_COLLECTION:
|
|
|
|
return <ModalPhoneCollection {...modalProps} />;
|
|
|
|
case MODALS.FIRST_SUBSCRIPTION:
|
|
|
|
return <ModalFirstSubscription {...modalProps} />;
|
|
|
|
case MODALS.SEND_TIP:
|
|
|
|
return <ModalSendTip {...modalProps} />;
|
|
|
|
case MODALS.SOCIAL_SHARE:
|
|
|
|
return <ModalSocialShare {...modalProps} />;
|
|
|
|
case MODALS.PUBLISH:
|
|
|
|
return <ModalPublish {...modalProps} />;
|
2020-08-13 21:06:43 +02:00
|
|
|
case MODALS.PUBLISH_PREVIEW:
|
|
|
|
return <ModalPublishPreview {...modalProps} />;
|
2019-05-12 16:46:14 +02:00
|
|
|
case MODALS.CONFIRM_EXTERNAL_RESOURCE:
|
|
|
|
return <ModalOpenExternalResource {...modalProps} />;
|
2019-04-03 06:17:00 +02:00
|
|
|
case MODALS.CONFIRM_TRANSACTION:
|
|
|
|
return <ModalConfirmTransaction {...modalProps} />;
|
|
|
|
case MODALS.CONFIRM_THUMBNAIL_UPLOAD:
|
|
|
|
return <ModalConfirmThumbnailUpload {...modalProps} />;
|
|
|
|
case MODALS.WALLET_ENCRYPT:
|
|
|
|
return <ModalWalletEncrypt {...modalProps} />;
|
|
|
|
case MODALS.WALLET_DECRYPT:
|
|
|
|
return <ModalWalletDecrypt {...modalProps} />;
|
|
|
|
case MODALS.WALLET_UNLOCK:
|
|
|
|
return <ModalWalletUnlock {...modalProps} />;
|
2019-08-20 14:29:59 +02:00
|
|
|
case MODALS.WALLET_PASSWORD_UNSAVE:
|
|
|
|
return <ModalPasswordUnsave {...modalProps} />;
|
2019-04-03 06:17:00 +02:00
|
|
|
case MODALS.REWARD_GENERATED_CODE:
|
|
|
|
return <ModalRewardCode {...modalProps} />;
|
2019-11-14 21:02:15 +01:00
|
|
|
case MODALS.COMMENT_ACKNOWEDGEMENT:
|
|
|
|
return <ModalCommentAcknowledgement {...modalProps} />;
|
2019-12-05 06:24:54 +01:00
|
|
|
case MODALS.YOUTUBE_WELCOME:
|
|
|
|
return <ModalYoutubeWelcome />;
|
2020-01-14 21:44:07 +01:00
|
|
|
case MODALS.SET_REFERRER:
|
|
|
|
return <ModalSetReferrer {...modalProps} />;
|
2020-03-14 00:00:22 +01:00
|
|
|
case MODALS.SIGN_OUT:
|
|
|
|
return <ModalSignOut {...modalProps} />;
|
2020-05-22 17:47:48 +02:00
|
|
|
case MODALS.CONFIRM_AGE:
|
|
|
|
return <ModalConfirmAge {...modalProps} />;
|
2020-05-25 16:27:36 +02:00
|
|
|
case MODALS.FILE_SELECTION:
|
|
|
|
return <ModalFileSelection {...modalProps} />;
|
2020-06-01 19:03:19 +02:00
|
|
|
case MODALS.LIQUIDATE_SUPPORTS:
|
|
|
|
return <ModalSupportsLiquidate {...modalProps} />;
|
2020-06-29 21:54:07 +02:00
|
|
|
case MODALS.IMAGE_UPLOAD:
|
|
|
|
return <ModalImageUpload {...modalProps} />;
|
2020-09-11 20:35:50 +02:00
|
|
|
case MODALS.SYNC_ENABLE:
|
|
|
|
return <ModalSyncEnable {...modalProps} />;
|
2020-12-11 19:33:27 +01:00
|
|
|
case MODALS.MOBILE_SEARCH:
|
|
|
|
return <ModalMobileSearch {...modalProps} />;
|
2021-01-27 04:24:14 +01:00
|
|
|
case MODALS.VIEW_IMAGE:
|
|
|
|
return <ModalViewImage {...modalProps} />;
|
2021-01-27 17:00:31 +01:00
|
|
|
case MODALS.MASS_TIP_UNLOCK:
|
|
|
|
return <ModalMassTipsUnlock {...modalProps} />;
|
2021-03-25 12:24:49 +01:00
|
|
|
case MODALS.CONFIRM_REMOVE_BTC_SWAP_ADDRESS:
|
|
|
|
return <ModalRemoveBtcSwapAddress {...modalProps} />;
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
case MODALS.COLLECTION_ADD:
|
|
|
|
return <ModalClaimCollectionAdd {...modalProps} />;
|
|
|
|
case MODALS.COLLECTION_DELETE:
|
|
|
|
return <ModalDeleteCollection {...modalProps} />;
|
2019-04-03 06:17:00 +02:00
|
|
|
default:
|
2018-10-29 18:23:53 +01:00
|
|
|
return null;
|
2017-08-18 19:09:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-18 06:27:08 +01:00
|
|
|
export default withRouter(ModalRouter);
|