From a58992d328f4f08541a4d18d6838acb7e36c8960 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Tue, 22 May 2018 19:06:37 -0700 Subject: [PATCH] added spee.ch-components under client --- .eslintignore | 1 + .gitignore | 4 +- .npmignore | 3 + client/build/actions/channel.js | 36 +++ client/build/actions/channelCreate.js | 55 +++++ client/build/actions/index.js | 15 ++ client/build/actions/publish.js | 118 +++++++++ client/build/actions/show.js | 192 +++++++++++++++ client/build/api/assetApi.js | 60 +++++ client/build/api/authApi.js | 27 +++ client/build/api/channelApi.js | 45 ++++ client/build/api/fileApi.js | 21 ++ client/build/app.js | 57 +++++ client/build/channels/publish.js | 72 ++++++ .../build/components/ActiveStatusBar/index.js | 19 ++ client/build/components/AssetPreview/index.js | 23 ++ client/build/components/AssetPreview/view.js | 54 +++++ .../components/ExpandingTextArea/index.js | 94 ++++++++ client/build/components/GAListener/index.js | 79 ++++++ .../components/InactiveStatusBar/index.js | 19 ++ client/build/components/Logo/index.js | 81 +++++++ .../NavBarChannelOptionsDropdown/index.js | 35 +++ client/build/components/ProgressBar/index.js | 145 +++++++++++ .../build/components/PublishPreview/index.js | 123 ++++++++++ .../PublishUrlMiddleDisplay/index.js | 50 ++++ client/build/components/SEO/index.js | 34 +++ client/build/components/SEO/view.js | 95 ++++++++ .../build/constants/asset_display_states.js | 14 ++ .../build/constants/channel_action_types.js | 12 + .../constants/channel_create_action_types.js | 16 ++ .../build/constants/publish_action_types.js | 30 +++ .../publish_channel_select_states.js | 10 + .../build/constants/publish_claim_states.js | 16 ++ client/build/constants/show_action_types.js | 36 +++ client/build/constants/show_request_types.js | 12 + client/build/containers/AssetDisplay/index.js | 43 ++++ client/build/containers/AssetDisplay/view.js | 118 +++++++++ client/build/containers/AssetInfo/index.js | 28 +++ client/build/containers/AssetInfo/view.js | 219 +++++++++++++++++ client/build/containers/AssetTitle/index.js | 29 +++ client/build/containers/AssetTitle/view.js | 20 ++ .../containers/ChannelClaimsDisplay/index.js | 36 +++ .../containers/ChannelClaimsDisplay/view.js | 101 ++++++++ .../containers/ChannelCreateForm/index.js | 39 +++ .../containers/ChannelCreateForm/view.js | 186 ++++++++++++++ .../containers/ChannelLoginForm/index.js | 29 +++ .../build/containers/ChannelLoginForm/view.js | 167 +++++++++++++ .../build/containers/ChannelSelect/index.js | 42 ++++ client/build/containers/ChannelSelect/view.js | 132 ++++++++++ client/build/containers/Dropzone/index.js | 39 +++ client/build/containers/Dropzone/view.js | 226 ++++++++++++++++++ client/build/containers/NavBar/index.js | 34 +++ client/build/containers/NavBar/view.js | 121 ++++++++++ .../build/containers/PublishDetails/index.js | 31 +++ .../build/containers/PublishDetails/view.js | 118 +++++++++ .../PublishDisabledMessage/index.js | 23 ++ .../containers/PublishDisabledMessage/view.js | 59 +++++ .../containers/PublishMetadataInputs/index.js | 39 +++ .../containers/PublishMetadataInputs/view.js | 144 +++++++++++ .../build/containers/PublishStatus/index.js | 30 +++ client/build/containers/PublishStatus/view.js | 96 ++++++++ .../containers/PublishThumbnailInput/index.js | 29 +++ .../containers/PublishThumbnailInput/view.js | 208 ++++++++++++++++ .../containers/PublishTitleInput/index.js | 33 +++ .../containers/PublishTitleInput/view.js | 71 ++++++ client/build/containers/PublishTool/index.js | 25 ++ client/build/containers/PublishTool/view.js | 73 ++++++ .../build/containers/PublishUrlInput/index.js | 38 +++ .../build/containers/PublishUrlInput/view.js | 149 ++++++++++++ .../containers/ShowAssetDetails/index.js | 38 +++ .../build/containers/ShowAssetDetails/view.js | 90 +++++++ .../build/containers/ShowAssetLite/index.js | 38 +++ client/build/containers/ShowAssetLite/view.js | 79 ++++++ client/build/containers/ShowChannel/index.js | 35 +++ client/build/containers/ShowChannel/view.js | 86 +++++++ client/build/index.js | 26 ++ client/build/pages/AboutPage/index.js | 103 ++++++++ client/build/pages/ErrorPage/index.js | 63 +++++ client/build/pages/FourOhFourPage/index.js | 26 ++ client/build/pages/FourOhFourPage/view.js | 65 +++++ client/build/pages/HomePage/index.js | 63 +++++ client/build/pages/LoginPage/index.js | 23 ++ client/build/pages/LoginPage/view.js | 98 ++++++++ client/build/pages/MultisitePage/index.js | 102 ++++++++ client/build/pages/ShowPage/index.js | 30 +++ client/build/pages/ShowPage/view.js | 97 ++++++++ client/build/reducers/channel.js | 33 +++ client/build/reducers/channelCreate.js | 49 ++++ client/build/reducers/index.js | 33 +++ client/build/reducers/publish.js | 121 ++++++++++ client/build/reducers/show.js | 110 +++++++++ client/build/reducers/site.js | 54 +++++ client/build/sagas/checkForLoggedInChannel.js | 82 +++++++ client/build/sagas/createChannel.js | 134 +++++++++++ client/build/sagas/file.js | 133 +++++++++++ client/build/sagas/index.js | 16 ++ client/build/sagas/logoutChannel.js | 67 ++++++ client/build/sagas/publish.js | 213 +++++++++++++++++ client/build/sagas/rootSaga.js | 48 ++++ client/build/sagas/show_asset.js | 168 +++++++++++++ client/build/sagas/show_channel.js | 216 +++++++++++++++++ client/build/sagas/show_uri.js | 206 ++++++++++++++++ .../build/sagas/updateChannelAvailability.js | 88 +++++++ client/build/sagas/updateClaimAvailability.js | 87 +++++++ client/build/selectors/channel.js | 12 + client/build/selectors/channelCreate.js | 12 + client/build/selectors/publish.js | 12 + client/build/selectors/show.js | 20 ++ client/build/selectors/site.js | 18 ++ client/build/utils/canonicalLink.js | 51 ++++ client/build/utils/dynamicImport.js | 54 +++++ client/build/utils/file.js | 42 ++++ client/build/utils/lbryUri.js | 118 +++++++++ client/build/utils/metaTags.js | 203 ++++++++++++++++ client/build/utils/pageTitle.js | 16 ++ client/build/utils/publish.js | 57 +++++ client/build/utils/request.js | 46 ++++ client/build/utils/validate.js | 56 +++++ client/src/actions/channel.js | 26 ++ client/src/actions/channelCreate.js | 43 ++++ client/src/actions/index.js | 7 + client/src/actions/publish.js | 94 ++++++++ client/src/actions/show.js | 118 +++++++++ client/src/api/assetApi.js | 39 +++ client/src/api/authApi.js | 13 + client/src/api/channelApi.js | 30 +++ client/src/api/fileApi.js | 11 + client/src/app.js | 25 ++ client/src/channels/publish.js | 48 ++++ .../src/components/ActiveStatusBar/index.jsx | 7 + client/src/components/AssetPreview/index.js | 10 + client/src/components/AssetPreview/view.jsx | 42 ++++ .../components/ExpandingTextArea/index.jsx | 37 +++ client/src/components/GAListener/index.jsx | 29 +++ .../components/InactiveStatusBar/index.jsx | 7 + client/src/components/Logo/index.jsx | 29 +++ .../NavBarChannelOptionsDropdown/index.jsx | 13 + client/src/components/ProgressBar/index.jsx | 76 ++++++ .../src/components/PublishPreview/index.jsx | 62 +++++ .../PublishUrlMiddleDisplay/index.jsx | 23 ++ client/src/components/SEO/index.js | 16 ++ client/src/components/SEO/view.jsx | 38 +++ client/src/constants/asset_display_states.js | 4 + client/src/constants/channel_action_types.js | 3 + .../constants/channel_create_action_types.js | 5 + client/src/constants/publish_action_types.js | 12 + .../publish_channel_select_states.js | 2 + client/src/constants/publish_claim_states.js | 5 + client/src/constants/show_action_types.js | 21 ++ client/src/constants/show_request_types.js | 3 + client/src/containers/AssetDisplay/index.js | 28 +++ client/src/containers/AssetDisplay/view.jsx | 73 ++++++ client/src/containers/AssetInfo/index.js | 14 ++ client/src/containers/AssetInfo/view.jsx | 123 ++++++++++ client/src/containers/AssetTitle/index.js | 12 + client/src/containers/AssetTitle/view.jsx | 11 + .../containers/ChannelClaimsDisplay/index.js | 22 ++ .../containers/ChannelClaimsDisplay/view.jsx | 51 ++++ .../src/containers/ChannelCreateForm/index.js | 26 ++ .../src/containers/ChannelCreateForm/view.jsx | 100 ++++++++ .../src/containers/ChannelLoginForm/index.js | 15 ++ .../src/containers/ChannelLoginForm/view.jsx | 81 +++++++ client/src/containers/ChannelSelect/index.js | 27 +++ client/src/containers/ChannelSelect/view.jsx | 62 +++++ client/src/containers/Dropzone/index.js | 25 ++ client/src/containers/Dropzone/view.jsx | 137 +++++++++++ client/src/containers/NavBar/index.js | 19 ++ client/src/containers/NavBar/view.jsx | 61 +++++ client/src/containers/PublishDetails/index.js | 16 ++ client/src/containers/PublishDetails/view.jsx | 63 +++++ .../PublishDisabledMessage/index.js | 10 + .../PublishDisabledMessage/view.jsx | 15 ++ .../containers/PublishMetadataInputs/index.js | 25 ++ .../containers/PublishMetadataInputs/view.jsx | 74 ++++++ client/src/containers/PublishStatus/index.js | 16 ++ client/src/containers/PublishStatus/view.jsx | 50 ++++ .../containers/PublishThumbnailInput/index.js | 15 ++ .../containers/PublishThumbnailInput/view.jsx | 140 +++++++++++ .../src/containers/PublishTitleInput/index.js | 19 ++ .../src/containers/PublishTitleInput/view.jsx | 20 ++ client/src/containers/PublishTool/index.js | 12 + client/src/containers/PublishTool/view.jsx | 28 +++ .../src/containers/PublishUrlInput/index.js | 23 ++ .../src/containers/PublishUrlInput/view.jsx | 72 ++++++ .../src/containers/ShowAssetDetails/index.js | 21 ++ .../src/containers/ShowAssetDetails/view.jsx | 41 ++++ client/src/containers/ShowAssetLite/index.js | 21 ++ client/src/containers/ShowAssetLite/view.jsx | 30 +++ client/src/containers/ShowChannel/index.js | 20 ++ client/src/containers/ShowChannel/view.jsx | 38 +++ client/src/index.jsx | 16 ++ client/src/pages/AboutPage/index.jsx | 35 +++ client/src/pages/ErrorPage/index.jsx | 23 ++ client/src/pages/FourOhFourPage/index.jsx | 11 + client/src/pages/FourOhFourPage/view.jsx | 24 ++ client/src/pages/HomePage/index.jsx | 20 ++ client/src/pages/LoginPage/index.jsx | 10 + client/src/pages/LoginPage/view.jsx | 39 +++ client/src/pages/MultisitePage/index.jsx | 59 +++++ client/src/pages/ShowPage/index.jsx | 16 ++ client/src/pages/ShowPage/view.jsx | 38 +++ client/src/reducers/channel.js | 20 ++ client/src/reducers/channelCreate.js | 36 +++ client/src/reducers/index.js | 18 ++ client/src/reducers/publish.js | 96 ++++++++ client/src/reducers/show.js | 95 ++++++++ client/src/reducers/site.js | 48 ++++ client/src/sagas/checkForLoggedInChannel.js | 23 ++ client/src/sagas/createChannel.js | 47 ++++ client/src/sagas/file.js | 35 +++ client/src/sagas/index.js | 7 + client/src/sagas/logoutChannel.js | 17 ++ client/src/sagas/publish.js | 62 +++++ client/src/sagas/rootSaga.js | 27 +++ client/src/sagas/show_asset.js | 55 +++++ client/src/sagas/show_channel.js | 65 +++++ client/src/sagas/show_uri.js | 59 +++++ client/src/sagas/updateChannelAvailability.js | 22 ++ client/src/sagas/updateClaimAvailability.js | 21 ++ client/src/selectors/channel.js | 3 + client/src/selectors/channelCreate.js | 3 + client/src/selectors/publish.js | 3 + client/src/selectors/show.js | 9 + client/src/selectors/site.js | 7 + client/src/utils/canonicalLink.js | 29 +++ client/src/utils/dynamicImport.js | 36 +++ client/src/utils/file.js | 32 +++ client/src/utils/lbryUri.js | 85 +++++++ client/src/utils/metaTags.js | 94 ++++++++ client/src/utils/pageTitle.js | 6 + client/src/utils/publish.js | 35 +++ client/src/utils/request.js | 27 +++ client/src/utils/validate.js | 29 +++ package-lock.json | 24 +- package.json | 7 +- 235 files changed, 12136 insertions(+), 6 deletions(-) create mode 100644 .npmignore create mode 100644 client/build/actions/channel.js create mode 100644 client/build/actions/channelCreate.js create mode 100644 client/build/actions/index.js create mode 100644 client/build/actions/publish.js create mode 100644 client/build/actions/show.js create mode 100644 client/build/api/assetApi.js create mode 100644 client/build/api/authApi.js create mode 100644 client/build/api/channelApi.js create mode 100644 client/build/api/fileApi.js create mode 100644 client/build/app.js create mode 100644 client/build/channels/publish.js create mode 100644 client/build/components/ActiveStatusBar/index.js create mode 100644 client/build/components/AssetPreview/index.js create mode 100644 client/build/components/AssetPreview/view.js create mode 100644 client/build/components/ExpandingTextArea/index.js create mode 100644 client/build/components/GAListener/index.js create mode 100644 client/build/components/InactiveStatusBar/index.js create mode 100644 client/build/components/Logo/index.js create mode 100644 client/build/components/NavBarChannelOptionsDropdown/index.js create mode 100644 client/build/components/ProgressBar/index.js create mode 100644 client/build/components/PublishPreview/index.js create mode 100644 client/build/components/PublishUrlMiddleDisplay/index.js create mode 100644 client/build/components/SEO/index.js create mode 100644 client/build/components/SEO/view.js create mode 100644 client/build/constants/asset_display_states.js create mode 100644 client/build/constants/channel_action_types.js create mode 100644 client/build/constants/channel_create_action_types.js create mode 100644 client/build/constants/publish_action_types.js create mode 100644 client/build/constants/publish_channel_select_states.js create mode 100644 client/build/constants/publish_claim_states.js create mode 100644 client/build/constants/show_action_types.js create mode 100644 client/build/constants/show_request_types.js create mode 100644 client/build/containers/AssetDisplay/index.js create mode 100644 client/build/containers/AssetDisplay/view.js create mode 100644 client/build/containers/AssetInfo/index.js create mode 100644 client/build/containers/AssetInfo/view.js create mode 100644 client/build/containers/AssetTitle/index.js create mode 100644 client/build/containers/AssetTitle/view.js create mode 100644 client/build/containers/ChannelClaimsDisplay/index.js create mode 100644 client/build/containers/ChannelClaimsDisplay/view.js create mode 100644 client/build/containers/ChannelCreateForm/index.js create mode 100644 client/build/containers/ChannelCreateForm/view.js create mode 100644 client/build/containers/ChannelLoginForm/index.js create mode 100644 client/build/containers/ChannelLoginForm/view.js create mode 100644 client/build/containers/ChannelSelect/index.js create mode 100644 client/build/containers/ChannelSelect/view.js create mode 100644 client/build/containers/Dropzone/index.js create mode 100644 client/build/containers/Dropzone/view.js create mode 100644 client/build/containers/NavBar/index.js create mode 100644 client/build/containers/NavBar/view.js create mode 100644 client/build/containers/PublishDetails/index.js create mode 100644 client/build/containers/PublishDetails/view.js create mode 100644 client/build/containers/PublishDisabledMessage/index.js create mode 100644 client/build/containers/PublishDisabledMessage/view.js create mode 100644 client/build/containers/PublishMetadataInputs/index.js create mode 100644 client/build/containers/PublishMetadataInputs/view.js create mode 100644 client/build/containers/PublishStatus/index.js create mode 100644 client/build/containers/PublishStatus/view.js create mode 100644 client/build/containers/PublishThumbnailInput/index.js create mode 100644 client/build/containers/PublishThumbnailInput/view.js create mode 100644 client/build/containers/PublishTitleInput/index.js create mode 100644 client/build/containers/PublishTitleInput/view.js create mode 100644 client/build/containers/PublishTool/index.js create mode 100644 client/build/containers/PublishTool/view.js create mode 100644 client/build/containers/PublishUrlInput/index.js create mode 100644 client/build/containers/PublishUrlInput/view.js create mode 100644 client/build/containers/ShowAssetDetails/index.js create mode 100644 client/build/containers/ShowAssetDetails/view.js create mode 100644 client/build/containers/ShowAssetLite/index.js create mode 100644 client/build/containers/ShowAssetLite/view.js create mode 100644 client/build/containers/ShowChannel/index.js create mode 100644 client/build/containers/ShowChannel/view.js create mode 100644 client/build/index.js create mode 100644 client/build/pages/AboutPage/index.js create mode 100644 client/build/pages/ErrorPage/index.js create mode 100644 client/build/pages/FourOhFourPage/index.js create mode 100644 client/build/pages/FourOhFourPage/view.js create mode 100644 client/build/pages/HomePage/index.js create mode 100644 client/build/pages/LoginPage/index.js create mode 100644 client/build/pages/LoginPage/view.js create mode 100644 client/build/pages/MultisitePage/index.js create mode 100644 client/build/pages/ShowPage/index.js create mode 100644 client/build/pages/ShowPage/view.js create mode 100644 client/build/reducers/channel.js create mode 100644 client/build/reducers/channelCreate.js create mode 100644 client/build/reducers/index.js create mode 100644 client/build/reducers/publish.js create mode 100644 client/build/reducers/show.js create mode 100644 client/build/reducers/site.js create mode 100644 client/build/sagas/checkForLoggedInChannel.js create mode 100644 client/build/sagas/createChannel.js create mode 100644 client/build/sagas/file.js create mode 100644 client/build/sagas/index.js create mode 100644 client/build/sagas/logoutChannel.js create mode 100644 client/build/sagas/publish.js create mode 100644 client/build/sagas/rootSaga.js create mode 100644 client/build/sagas/show_asset.js create mode 100644 client/build/sagas/show_channel.js create mode 100644 client/build/sagas/show_uri.js create mode 100644 client/build/sagas/updateChannelAvailability.js create mode 100644 client/build/sagas/updateClaimAvailability.js create mode 100644 client/build/selectors/channel.js create mode 100644 client/build/selectors/channelCreate.js create mode 100644 client/build/selectors/publish.js create mode 100644 client/build/selectors/show.js create mode 100644 client/build/selectors/site.js create mode 100644 client/build/utils/canonicalLink.js create mode 100644 client/build/utils/dynamicImport.js create mode 100644 client/build/utils/file.js create mode 100644 client/build/utils/lbryUri.js create mode 100644 client/build/utils/metaTags.js create mode 100644 client/build/utils/pageTitle.js create mode 100644 client/build/utils/publish.js create mode 100644 client/build/utils/request.js create mode 100644 client/build/utils/validate.js create mode 100644 client/src/actions/channel.js create mode 100644 client/src/actions/channelCreate.js create mode 100644 client/src/actions/index.js create mode 100644 client/src/actions/publish.js create mode 100644 client/src/actions/show.js create mode 100644 client/src/api/assetApi.js create mode 100644 client/src/api/authApi.js create mode 100644 client/src/api/channelApi.js create mode 100644 client/src/api/fileApi.js create mode 100644 client/src/app.js create mode 100644 client/src/channels/publish.js create mode 100644 client/src/components/ActiveStatusBar/index.jsx create mode 100644 client/src/components/AssetPreview/index.js create mode 100644 client/src/components/AssetPreview/view.jsx create mode 100644 client/src/components/ExpandingTextArea/index.jsx create mode 100644 client/src/components/GAListener/index.jsx create mode 100644 client/src/components/InactiveStatusBar/index.jsx create mode 100644 client/src/components/Logo/index.jsx create mode 100644 client/src/components/NavBarChannelOptionsDropdown/index.jsx create mode 100644 client/src/components/ProgressBar/index.jsx create mode 100644 client/src/components/PublishPreview/index.jsx create mode 100644 client/src/components/PublishUrlMiddleDisplay/index.jsx create mode 100644 client/src/components/SEO/index.js create mode 100644 client/src/components/SEO/view.jsx create mode 100644 client/src/constants/asset_display_states.js create mode 100644 client/src/constants/channel_action_types.js create mode 100644 client/src/constants/channel_create_action_types.js create mode 100644 client/src/constants/publish_action_types.js create mode 100644 client/src/constants/publish_channel_select_states.js create mode 100644 client/src/constants/publish_claim_states.js create mode 100644 client/src/constants/show_action_types.js create mode 100644 client/src/constants/show_request_types.js create mode 100644 client/src/containers/AssetDisplay/index.js create mode 100644 client/src/containers/AssetDisplay/view.jsx create mode 100644 client/src/containers/AssetInfo/index.js create mode 100644 client/src/containers/AssetInfo/view.jsx create mode 100644 client/src/containers/AssetTitle/index.js create mode 100644 client/src/containers/AssetTitle/view.jsx create mode 100644 client/src/containers/ChannelClaimsDisplay/index.js create mode 100644 client/src/containers/ChannelClaimsDisplay/view.jsx create mode 100644 client/src/containers/ChannelCreateForm/index.js create mode 100644 client/src/containers/ChannelCreateForm/view.jsx create mode 100644 client/src/containers/ChannelLoginForm/index.js create mode 100644 client/src/containers/ChannelLoginForm/view.jsx create mode 100644 client/src/containers/ChannelSelect/index.js create mode 100644 client/src/containers/ChannelSelect/view.jsx create mode 100644 client/src/containers/Dropzone/index.js create mode 100644 client/src/containers/Dropzone/view.jsx create mode 100644 client/src/containers/NavBar/index.js create mode 100644 client/src/containers/NavBar/view.jsx create mode 100644 client/src/containers/PublishDetails/index.js create mode 100644 client/src/containers/PublishDetails/view.jsx create mode 100644 client/src/containers/PublishDisabledMessage/index.js create mode 100644 client/src/containers/PublishDisabledMessage/view.jsx create mode 100644 client/src/containers/PublishMetadataInputs/index.js create mode 100644 client/src/containers/PublishMetadataInputs/view.jsx create mode 100644 client/src/containers/PublishStatus/index.js create mode 100644 client/src/containers/PublishStatus/view.jsx create mode 100644 client/src/containers/PublishThumbnailInput/index.js create mode 100644 client/src/containers/PublishThumbnailInput/view.jsx create mode 100644 client/src/containers/PublishTitleInput/index.js create mode 100644 client/src/containers/PublishTitleInput/view.jsx create mode 100644 client/src/containers/PublishTool/index.js create mode 100644 client/src/containers/PublishTool/view.jsx create mode 100644 client/src/containers/PublishUrlInput/index.js create mode 100644 client/src/containers/PublishUrlInput/view.jsx create mode 100644 client/src/containers/ShowAssetDetails/index.js create mode 100644 client/src/containers/ShowAssetDetails/view.jsx create mode 100644 client/src/containers/ShowAssetLite/index.js create mode 100644 client/src/containers/ShowAssetLite/view.jsx create mode 100644 client/src/containers/ShowChannel/index.js create mode 100644 client/src/containers/ShowChannel/view.jsx create mode 100644 client/src/index.jsx create mode 100644 client/src/pages/AboutPage/index.jsx create mode 100644 client/src/pages/ErrorPage/index.jsx create mode 100644 client/src/pages/FourOhFourPage/index.jsx create mode 100644 client/src/pages/FourOhFourPage/view.jsx create mode 100644 client/src/pages/HomePage/index.jsx create mode 100644 client/src/pages/LoginPage/index.jsx create mode 100644 client/src/pages/LoginPage/view.jsx create mode 100644 client/src/pages/MultisitePage/index.jsx create mode 100644 client/src/pages/ShowPage/index.jsx create mode 100644 client/src/pages/ShowPage/view.jsx create mode 100644 client/src/reducers/channel.js create mode 100644 client/src/reducers/channelCreate.js create mode 100644 client/src/reducers/index.js create mode 100644 client/src/reducers/publish.js create mode 100644 client/src/reducers/show.js create mode 100644 client/src/reducers/site.js create mode 100644 client/src/sagas/checkForLoggedInChannel.js create mode 100644 client/src/sagas/createChannel.js create mode 100644 client/src/sagas/file.js create mode 100644 client/src/sagas/index.js create mode 100644 client/src/sagas/logoutChannel.js create mode 100644 client/src/sagas/publish.js create mode 100644 client/src/sagas/rootSaga.js create mode 100644 client/src/sagas/show_asset.js create mode 100644 client/src/sagas/show_channel.js create mode 100644 client/src/sagas/show_uri.js create mode 100644 client/src/sagas/updateChannelAvailability.js create mode 100644 client/src/sagas/updateClaimAvailability.js create mode 100644 client/src/selectors/channel.js create mode 100644 client/src/selectors/channelCreate.js create mode 100644 client/src/selectors/publish.js create mode 100644 client/src/selectors/show.js create mode 100644 client/src/selectors/site.js create mode 100644 client/src/utils/canonicalLink.js create mode 100644 client/src/utils/dynamicImport.js create mode 100644 client/src/utils/file.js create mode 100644 client/src/utils/lbryUri.js create mode 100644 client/src/utils/metaTags.js create mode 100644 client/src/utils/pageTitle.js create mode 100644 client/src/utils/publish.js create mode 100644 client/src/utils/request.js create mode 100644 client/src/utils/validate.js diff --git a/.eslintignore b/.eslintignore index 9791ef95..d8f67946 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,3 +3,4 @@ exports/ index.js test/ server/render/build +client/build diff --git a/.gitignore b/.gitignore index 6f577b24..81ca6ba3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ node_modules -.idea +.DS_Store +*.log +.idea/ /devConfig/sequelizeCliConfig.js /devConfig/testingConfig.js diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..da409f7d --- /dev/null +++ b/.npmignore @@ -0,0 +1,3 @@ +client/src +server/render/src +.babelrc diff --git a/client/build/actions/channel.js b/client/build/actions/channel.js new file mode 100644 index 00000000..66ea97c8 --- /dev/null +++ b/client/build/actions/channel.js @@ -0,0 +1,36 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.updateLoggedInChannel = updateLoggedInChannel; +exports.checkForLoggedInChannel = checkForLoggedInChannel; +exports.logOutChannel = logOutChannel; + +var actions = _interopRequireWildcard(require("../constants/channel_action_types")); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +// export action creators +function updateLoggedInChannel(name, shortId, longId) { + return { + type: actions.CHANNEL_UPDATE, + data: { + name: name, + shortId: shortId, + longId: longId + } + }; +} + +function checkForLoggedInChannel() { + return { + type: actions.CHANNEL_LOGIN_CHECK + }; +} + +function logOutChannel() { + return { + type: actions.CHANNEL_LOGOUT + }; +} \ No newline at end of file diff --git a/client/build/actions/channelCreate.js b/client/build/actions/channelCreate.js new file mode 100644 index 00000000..b81e6469 --- /dev/null +++ b/client/build/actions/channelCreate.js @@ -0,0 +1,55 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.updateChannelCreateName = updateChannelCreateName; +exports.updateChannelCreatePassword = updateChannelCreatePassword; +exports.updateChannelCreateStatus = updateChannelCreateStatus; +exports.updateChannelAvailability = updateChannelAvailability; +exports.createChannel = createChannel; + +var actions = _interopRequireWildcard(require("../constants/channel_create_action_types")); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +// export action creators +function updateChannelCreateName(name, value) { + return { + type: actions.CHANNEL_CREATE_UPDATE_NAME, + data: { + name: name, + value: value + } + }; +} + +function updateChannelCreatePassword(name, value) { + return { + type: actions.CHANNEL_CREATE_UPDATE_PASSWORD, + data: { + name: name, + value: value + } + }; +} + +function updateChannelCreateStatus(status) { + return { + type: actions.CHANNEL_CREATE_UPDATE_STATUS, + data: status + }; +} + +function updateChannelAvailability(channel) { + return { + type: actions.CHANNEL_AVAILABILITY, + data: channel + }; +} + +function createChannel() { + return { + type: actions.CHANNEL_CREATE + }; +} \ No newline at end of file diff --git a/client/build/actions/index.js b/client/build/actions/index.js new file mode 100644 index 00000000..74643914 --- /dev/null +++ b/client/build/actions/index.js @@ -0,0 +1,15 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _show = require("./show"); + +// import { } from './channel'; +// import { } from './publish'; +var _default = { + onHandleShowPageUri: _show.onHandleShowPageUri +}; +exports.default = _default; \ No newline at end of file diff --git a/client/build/actions/publish.js b/client/build/actions/publish.js new file mode 100644 index 00000000..8d698de9 --- /dev/null +++ b/client/build/actions/publish.js @@ -0,0 +1,118 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.selectFile = selectFile; +exports.clearFile = clearFile; +exports.updateMetadata = updateMetadata; +exports.updateClaim = updateClaim; +exports.setPublishInChannel = setPublishInChannel; +exports.updatePublishStatus = updatePublishStatus; +exports.updateError = updateError; +exports.updateSelectedChannel = updateSelectedChannel; +exports.toggleMetadataInputs = toggleMetadataInputs; +exports.onNewThumbnail = onNewThumbnail; +exports.startPublish = startPublish; +exports.validateClaim = validateClaim; + +var actions = _interopRequireWildcard(require("../constants/publish_action_types")); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +// export action creators +function selectFile(file) { + return { + type: actions.FILE_SELECTED, + data: file + }; +} + +function clearFile() { + return { + type: actions.FILE_CLEAR + }; +} + +function updateMetadata(name, value) { + return { + type: actions.METADATA_UPDATE, + data: { + name: name, + value: value + } + }; +} + +function updateClaim(value) { + return { + type: actions.CLAIM_UPDATE, + data: value + }; +} + +; + +function setPublishInChannel(channel) { + return { + type: actions.SET_PUBLISH_IN_CHANNEL, + channel: channel + }; +} + +function updatePublishStatus(status, message) { + return { + type: actions.PUBLISH_STATUS_UPDATE, + data: { + status: status, + message: message + } + }; +} + +function updateError(name, value) { + return { + type: actions.ERROR_UPDATE, + data: { + name: name, + value: value + } + }; +} + +function updateSelectedChannel(channelName) { + return { + type: actions.SELECTED_CHANNEL_UPDATE, + data: channelName + }; +} + +function toggleMetadataInputs(showMetadataInputs) { + return { + type: actions.TOGGLE_METADATA_INPUTS, + data: showMetadataInputs + }; +} + +function onNewThumbnail(file) { + return { + type: actions.THUMBNAIL_NEW, + data: file + }; +} + +function startPublish(history) { + return { + type: actions.PUBLISH_START, + data: { + history: history + } + }; +} + +function validateClaim(claim) { + return { + type: actions.CLAIM_AVAILABILITY, + data: claim + }; +} \ No newline at end of file diff --git a/client/build/actions/show.js b/client/build/actions/show.js new file mode 100644 index 00000000..67dcb7f0 --- /dev/null +++ b/client/build/actions/show.js @@ -0,0 +1,192 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.onHandleShowPageUri = onHandleShowPageUri; +exports.onRequestError = onRequestError; +exports.onNewChannelRequest = onNewChannelRequest; +exports.onNewAssetRequest = onNewAssetRequest; +exports.onRequestUpdate = onRequestUpdate; +exports.addRequestToRequestList = addRequestToRequestList; +exports.addAssetToAssetList = addAssetToAssetList; +exports.addNewChannelToChannelList = addNewChannelToChannelList; +exports.onUpdateChannelClaims = onUpdateChannelClaims; +exports.updateChannelClaims = updateChannelClaims; +exports.fileRequested = fileRequested; +exports.updateFileAvailability = updateFileAvailability; +exports.updateDisplayAssetError = updateDisplayAssetError; + +var actions = _interopRequireWildcard(require("../constants/show_action_types")); + +var _show_request_types = require("../constants/show_request_types"); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +// basic request parsing +function onHandleShowPageUri(params) { + return { + type: actions.HANDLE_SHOW_URI, + data: params + }; +} + +; + +function onRequestError(error) { + return { + type: actions.REQUEST_ERROR, + data: error + }; +} + +; + +function onNewChannelRequest(channelName, channelId) { + var requestType = _show_request_types.CHANNEL; + var requestId = "cr#".concat(channelName, "#").concat(channelId); + return { + type: actions.CHANNEL_REQUEST_NEW, + data: { + requestType: requestType, + requestId: requestId, + channelName: channelName, + channelId: channelId + } + }; +} + +; + +function onNewAssetRequest(name, id, channelName, channelId, extension) { + var requestType = extension ? _show_request_types.ASSET_LITE : _show_request_types.ASSET_DETAILS; + var requestId = "ar#".concat(name, "#").concat(id, "#").concat(channelName, "#").concat(channelId); + return { + type: actions.ASSET_REQUEST_NEW, + data: { + requestType: requestType, + requestId: requestId, + name: name, + modifier: { + id: id, + channel: { + name: channelName, + id: channelId + } + } + } + }; +} + +; + +function onRequestUpdate(requestType, requestId) { + return { + type: actions.REQUEST_UPDATE, + data: { + requestType: requestType, + requestId: requestId + } + }; +} + +; + +function addRequestToRequestList(id, error, key) { + return { + type: actions.REQUEST_LIST_ADD, + data: { + id: id, + error: error, + key: key + } + }; +} + +; // asset actions + +function addAssetToAssetList(id, error, name, claimId, shortId, claimData) { + return { + type: actions.ASSET_ADD, + data: { + id: id, + error: error, + name: name, + claimId: claimId, + shortId: shortId, + claimData: claimData + } + }; +} // channel actions + + +function addNewChannelToChannelList(id, name, shortId, longId, claimsData) { + return { + type: actions.CHANNEL_ADD, + data: { + id: id, + name: name, + shortId: shortId, + longId: longId, + claimsData: claimsData + } + }; +} + +; + +function onUpdateChannelClaims(channelKey, name, longId, page) { + return { + type: actions.CHANNEL_CLAIMS_UPDATE_ASYNC, + data: { + channelKey: channelKey, + name: name, + longId: longId, + page: page + } + }; +} + +; + +function updateChannelClaims(channelListId, claimsData) { + return { + type: actions.CHANNEL_CLAIMS_UPDATE_SUCCESS, + data: { + channelListId: channelListId, + claimsData: claimsData + } + }; +} + +; // display a file + +function fileRequested(name, claimId) { + return { + type: actions.FILE_REQUESTED, + data: { + name: name, + claimId: claimId + } + }; +} + +; + +function updateFileAvailability(status) { + return { + type: actions.FILE_AVAILABILITY_UPDATE, + data: status + }; +} + +; + +function updateDisplayAssetError(error) { + return { + type: actions.DISPLAY_ASSET_ERROR, + data: error + }; +} + +; \ No newline at end of file diff --git a/client/build/api/assetApi.js b/client/build/api/assetApi.js new file mode 100644 index 00000000..ba9432bc --- /dev/null +++ b/client/build/api/assetApi.js @@ -0,0 +1,60 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getLongClaimId = getLongClaimId; +exports.getShortId = getShortId; +exports.getClaimData = getClaimData; +exports.checkClaimAvailability = checkClaimAvailability; + +var _request = _interopRequireDefault(require("../utils/request")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function getLongClaimId(host, name, modifier) { + var body = {}; // create request params + + if (modifier) { + if (modifier.id) { + body['claimId'] = modifier.id; + } else { + body['channelName'] = modifier.channel.name; + body['channelClaimId'] = modifier.channel.id; + } + } + + body['claimName'] = name; + var params = { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(body) + }; // create url + + var url = "".concat(host, "/api/claim/long-id"); // return the request promise + + return (0, _request.default)(url, params); +} + +; + +function getShortId(host, name, claimId) { + var url = "".concat(host, "/api/claim/short-id/").concat(claimId, "/").concat(name); + return (0, _request.default)(url); +} + +; + +function getClaimData(host, name, claimId) { + var url = "".concat(host, "/api/claim/data/").concat(name, "/").concat(claimId); + return (0, _request.default)(url); +} + +; + +function checkClaimAvailability(claim) { + var url = "/api/claim/availability/".concat(claim); + return (0, _request.default)(url); +} \ No newline at end of file diff --git a/client/build/api/authApi.js b/client/build/api/authApi.js new file mode 100644 index 00000000..b792fffa --- /dev/null +++ b/client/build/api/authApi.js @@ -0,0 +1,27 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.checkForLoggedInChannelApi = checkForLoggedInChannelApi; +exports.channelLogoutApi = channelLogoutApi; + +var _request = _interopRequireDefault(require("../utils/request")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function checkForLoggedInChannelApi() { + var url = "/user"; + var params = { + credentials: 'include' + }; + return (0, _request.default)(url, params); +} + +function channelLogoutApi() { + var url = "/logout"; + var params = { + credentials: 'include' + }; + return (0, _request.default)(url, params); +} \ No newline at end of file diff --git a/client/build/api/channelApi.js b/client/build/api/channelApi.js new file mode 100644 index 00000000..0afcf254 --- /dev/null +++ b/client/build/api/channelApi.js @@ -0,0 +1,45 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getChannelData = getChannelData; +exports.getChannelClaims = getChannelClaims; +exports.checkChannelAvailability = checkChannelAvailability; +exports.makeCreateChannelRequest = makeCreateChannelRequest; + +var _request = _interopRequireDefault(require("../utils/request")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function getChannelData(host, name, id) { + if (!id) id = 'none'; + var url = "".concat(host, "/api/channel/data/").concat(name, "/").concat(id); + return (0, _request.default)(url); +} + +function getChannelClaims(host, name, longId, page) { + if (!page) page = 1; + var url = "".concat(host, "/api/channel/claims/").concat(name, "/").concat(longId, "/").concat(page); + return (0, _request.default)(url); +} + +function checkChannelAvailability(channel) { + var url = "/api/channel/availability/".concat(channel); + return (0, _request.default)(url); +} + +function makeCreateChannelRequest(username, password) { + var params = { + method: 'POST', + body: JSON.stringify({ + username: username, + password: password + }), + headers: new Headers({ + 'Content-Type': 'application/json' + }), + credentials: 'include' + }; + return (0, _request.default)('/signup', params); +} \ No newline at end of file diff --git a/client/build/api/fileApi.js b/client/build/api/fileApi.js new file mode 100644 index 00000000..9142bd15 --- /dev/null +++ b/client/build/api/fileApi.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.checkFileAvailability = checkFileAvailability; +exports.triggerClaimGet = triggerClaimGet; + +var _request = _interopRequireDefault(require("../utils/request")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function checkFileAvailability(claimId, host, name) { + var url = "".concat(host, "/api/file/availability/").concat(name, "/").concat(claimId); + return (0, _request.default)(url); +} + +function triggerClaimGet(claimId, host, name) { + var url = "".concat(host, "/api/claim/get/").concat(name, "/").concat(claimId); + return (0, _request.default)(url); +} \ No newline at end of file diff --git a/client/build/app.js b/client/build/app.js new file mode 100644 index 00000000..b77df70b --- /dev/null +++ b/client/build/app.js @@ -0,0 +1,57 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactRouterDom = require("react-router-dom"); + +var _HomePage = _interopRequireDefault(require("@pages/HomePage")); + +var _AboutPage = _interopRequireDefault(require("@pages/AboutPage")); + +var _LoginPage = _interopRequireDefault(require("@pages/LoginPage")); + +var _ShowPage = _interopRequireDefault(require("@pages/ShowPage")); + +var _FourOhFourPage = _interopRequireDefault(require("@pages/FourOhFourPage")); + +var _MultisitePage = _interopRequireDefault(require("@pages/MultisitePage")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var customizedApp = function customizedApp() { + return _react.default.createElement(_reactRouterDom.Switch, null, _react.default.createElement(_reactRouterDom.Route, { + exact: true, + path: "/", + component: _HomePage.default + }), _react.default.createElement(_reactRouterDom.Route, { + exact: true, + path: "/about", + component: _AboutPage.default + }), _react.default.createElement(_reactRouterDom.Route, { + exact: true, + path: "/login", + component: _LoginPage.default + }), _react.default.createElement(_reactRouterDom.Route, { + exact: true, + path: "/multisite", + component: _MultisitePage.default + }), _react.default.createElement(_reactRouterDom.Route, { + exact: true, + path: "/:identifier/:claim", + component: _ShowPage.default + }), _react.default.createElement(_reactRouterDom.Route, { + exact: true, + path: "/:claim", + component: _ShowPage.default + }), _react.default.createElement(_reactRouterDom.Route, { + component: _FourOhFourPage.default + })); +}; + +var _default = customizedApp; +exports.default = _default; \ No newline at end of file diff --git a/client/build/channels/publish.js b/client/build/channels/publish.js new file mode 100644 index 00000000..36259eb7 --- /dev/null +++ b/client/build/channels/publish.js @@ -0,0 +1,72 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.makePublishRequestChannel = void 0; + +var _reduxSaga = require("redux-saga"); + +var makePublishRequestChannel = function makePublishRequestChannel(fd) { + return (0, _reduxSaga.eventChannel)(function (emitter) { + var uri = '/api/claim/publish'; + var xhr = new XMLHttpRequest(); // add event listeners + + var onLoadStart = function onLoadStart() { + emitter({ + loadStart: true + }); + }; + + var onProgress = function onProgress(event) { + if (event.lengthComputable) { + var percentage = Math.round(event.loaded * 100 / event.total); + emitter({ + progress: percentage + }); + } + }; + + var onLoad = function onLoad() { + emitter({ + load: true + }); + }; + + xhr.upload.addEventListener('loadstart', onLoadStart); + xhr.upload.addEventListener('progress', onProgress); + xhr.upload.addEventListener('load', onLoad); // set state change handler + + xhr.onreadystatechange = function () { + if (xhr.readyState === 4) { + var response = JSON.parse(xhr.response); + + if (xhr.status === 200 && response.success) { + emitter({ + success: response + }); + emitter(_reduxSaga.END); + } else { + emitter({ + error: new Error(response.message) + }); + emitter(_reduxSaga.END); + } + } + }; // open and send + + + xhr.open('POST', uri, true); + xhr.send(fd); // clean up + + return function () { + xhr.upload.removeEventListener('loadstart', onLoadStart); + xhr.upload.removeEventListener('progress', onProgress); + xhr.upload.removeEventListener('load', onLoad); + xhr.onreadystatechange = null; + xhr.abort(); + }; + }, _reduxSaga.buffers.sliding(2)); +}; + +exports.makePublishRequestChannel = makePublishRequestChannel; \ No newline at end of file diff --git a/client/build/components/ActiveStatusBar/index.js b/client/build/components/ActiveStatusBar/index.js new file mode 100644 index 00000000..1e0769d9 --- /dev/null +++ b/client/build/components/ActiveStatusBar/index.js @@ -0,0 +1,19 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var ActiveStatusBar = function ActiveStatusBar() { + return _react.default.createElement("span", { + className: "progress-bar progress-bar--active" + }, "| "); +}; + +var _default = ActiveStatusBar; +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/AssetPreview/index.js b/client/build/components/AssetPreview/index.js new file mode 100644 index 00000000..f0afdc19 --- /dev/null +++ b/client/build/components/AssetPreview/index.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var defaultThumbnail = _ref.site.defaultThumbnail; + return { + defaultThumbnail: defaultThumbnail + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, null)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/AssetPreview/view.js b/client/build/components/AssetPreview/view.js new file mode 100644 index 00000000..eec62e71 --- /dev/null +++ b/client/build/components/AssetPreview/view.js @@ -0,0 +1,54 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactRouterDom = require("react-router-dom"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var AssetPreview = function AssetPreview(_ref) { + var defaultThumbnail = _ref.defaultThumbnail, + _ref$claimData = _ref.claimData, + name = _ref$claimData.name, + claimId = _ref$claimData.claimId, + fileExt = _ref$claimData.fileExt, + contentType = _ref$claimData.contentType, + thumbnail = _ref$claimData.thumbnail; + var directSourceLink = "".concat(claimId, "/").concat(name, ".").concat(fileExt); + var showUrlLink = "/".concat(claimId, "/").concat(name); + return _react.default.createElement("div", { + className: "asset-holder" + }, _react.default.createElement(_reactRouterDom.Link, { + to: showUrlLink + }, function () { + switch (contentType) { + case 'image/jpeg': + case 'image/jpg': + case 'image/png': + case 'image/gif': + return _react.default.createElement("img", { + className: 'asset-preview', + src: directSourceLink, + alt: name + }); + + case 'video/mp4': + return _react.default.createElement("img", { + className: 'asset-preview video', + src: thumbnail || defaultThumbnail, + alt: name + }); + + default: + return _react.default.createElement("p", null, "unsupported file type"); + } + }())); +}; + +var _default = AssetPreview; +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/ExpandingTextArea/index.js b/client/build/components/ExpandingTextArea/index.js new file mode 100644 index 00000000..f5a074dc --- /dev/null +++ b/client/build/components/ExpandingTextArea/index.js @@ -0,0 +1,94 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var ExpandingTextarea = +/*#__PURE__*/ +function (_Component) { + function ExpandingTextarea(props) { + var _this; + + _classCallCheck(this, ExpandingTextarea); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(ExpandingTextarea).call(this, props)); + _this._handleChange = _this._handleChange.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(ExpandingTextarea, [{ + key: "componentDidMount", + value: function componentDidMount() { + this.adjustTextarea({}); + } + }, { + key: "_handleChange", + value: function _handleChange(event) { + var onChange = this.props.onChange; + if (onChange) onChange(event); + this.adjustTextarea(event); + } + }, { + key: "adjustTextarea", + value: function adjustTextarea(_ref) { + var _ref$target = _ref.target, + target = _ref$target === void 0 ? this.el : _ref$target; + target.style.height = 0; + target.style.height = "".concat(target.scrollHeight, "px"); + } + }, { + key: "render", + value: function render() { + var _this2 = this; + + var rest = _extends({}, this.props); + + return _react.default.createElement("textarea", _extends({}, rest, { + ref: function ref(x) { + return _this2.el = x; + }, + onChange: this._handleChange + })); + } + }]); + + _inherits(ExpandingTextarea, _Component); + + return ExpandingTextarea; +}(_react.Component); + +ExpandingTextarea.propTypes = { + onChange: _propTypes.default.func +}; +var _default = ExpandingTextarea; +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/GAListener/index.js b/client/build/components/GAListener/index.js new file mode 100644 index 00000000..54a99a0f --- /dev/null +++ b/client/build/components/GAListener/index.js @@ -0,0 +1,79 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactGa = _interopRequireDefault(require("react-ga")); + +var _reactRouterDom = require("react-router-dom"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var customGAListener = function customGAListener(siteConfig) { + var googleId = siteConfig.analytics.googleId; + + _reactGa.default.initialize(googleId); + + var GAListener = + /*#__PURE__*/ + function (_React$Component) { + function GAListener() { + _classCallCheck(this, GAListener); + + return _possibleConstructorReturn(this, _getPrototypeOf(GAListener).apply(this, arguments)); + } + + _createClass(GAListener, [{ + key: "componentDidMount", + value: function componentDidMount() { + this.sendPageView(this.props.history.location); + this.props.history.listen(this.sendPageView); + } + }, { + key: "sendPageView", + value: function sendPageView(location) { + _reactGa.default.set({ + page: location.pathname + }); + + _reactGa.default.pageview(location.pathname); + } + }, { + key: "render", + value: function render() { + return this.props.children; + } + }]); + + _inherits(GAListener, _React$Component); + + return GAListener; + }(_react.default.Component); + + return (0, _reactRouterDom.withRouter)(GAListener); +}; + +var _default = customGAListener; +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/InactiveStatusBar/index.js b/client/build/components/InactiveStatusBar/index.js new file mode 100644 index 00000000..55f3176a --- /dev/null +++ b/client/build/components/InactiveStatusBar/index.js @@ -0,0 +1,19 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var InactiveStatusBar = function InactiveStatusBar() { + return _react.default.createElement("span", { + className: "progress-bar progress-bar--inactive" + }, "| "); +}; + +var _default = InactiveStatusBar; +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/Logo/index.js b/client/build/components/Logo/index.js new file mode 100644 index 00000000..95199487 --- /dev/null +++ b/client/build/components/Logo/index.js @@ -0,0 +1,81 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactRouterDom = require("react-router-dom"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function Logo() { + return _react.default.createElement("svg", { + version: "1.1", + id: "Layer_1", + x: "0px", + y: "0px", + height: "24px", + viewBox: "0 0 80 31", + enableBackground: "new 0 0 80 31", + className: "nav-bar-logo" + }, _react.default.createElement(_reactRouterDom.Link, { + to: "/" + }, _react.default.createElement("title", null, "Logo"), _react.default.createElement("desc", null, "Spee.ch logo"), _react.default.createElement("g", { + id: "About" + }, _react.default.createElement("g", { + id: "Publish-Form-V2-_x28_filled_x29_", + transform: "translate(-42.000000, -23.000000)" + }, _react.default.createElement("g", { + id: "Group-17", + transform: "translate(42.000000, 22.000000)" + }, _react.default.createElement("text", { + transform: "matrix(1 0 0 1 0 20)", + fontSize: "25", + fontFamily: "Roboto" + }, "Spee this.props.size) { + incrementer = incrementer * -1; + index += incrementer; + } // update the indexed bar + + + if (incrementer > 0) { + bars[index].isActive = true; + } else { + bars[index].isActive = false; + } + + ; // increment index + + index += incrementer; // update state + + this.setState({ + bars: bars, + incrementer: incrementer, + index: index + }); + } + }, { + key: "stopProgressBar", + value: function stopProgressBar() { + clearInterval(this.updateInterval); + } + }, { + key: "render", + value: function render() { + return _react.default.createElement("div", null, this.state.bars.map(function (bar, index) { + return bar.isActive ? _react.default.createElement(_ActiveStatusBar.default, { + key: index + }) : _react.default.createElement(_InactiveStatusBar.default, { + key: index + }); + })); + } + }]); + + _inherits(ProgressBar, _React$Component); + + return ProgressBar; +}(_react.default.Component); + +; +ProgressBar.propTypes = { + size: _propTypes.default.number.isRequired +}; +var _default = ProgressBar; +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/PublishPreview/index.js b/client/build/components/PublishPreview/index.js new file mode 100644 index 00000000..45be4308 --- /dev/null +++ b/client/build/components/PublishPreview/index.js @@ -0,0 +1,123 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var PublishPreview = +/*#__PURE__*/ +function (_React$Component) { + function PublishPreview(props) { + var _this; + + _classCallCheck(this, PublishPreview); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(PublishPreview).call(this, props)); + _this.state = { + imgSource: '', + defaultThumbnail: '/assets/img/video_thumb_default.png' + }; + return _this; + } + + _createClass(PublishPreview, [{ + key: "componentDidMount", + value: function componentDidMount() { + this.setPreviewImageSource(this.props.file); + } + }, { + key: "componentWillReceiveProps", + value: function componentWillReceiveProps(newProps) { + if (newProps.file !== this.props.file) { + this.setPreviewImageSource(newProps.file); + } + + if (newProps.thumbnail !== this.props.thumbnail) { + if (newProps.thumbnail) { + this.setPreviewImageSourceFromFile(newProps.thumbnail); + } else { + this.setState({ + imgSource: this.state.defaultThumbnail + }); + } + } + } + }, { + key: "setPreviewImageSourceFromFile", + value: function setPreviewImageSourceFromFile(file) { + var _this2 = this; + + var previewReader = new FileReader(); + previewReader.readAsDataURL(file); + + previewReader.onloadend = function () { + _this2.setState({ + imgSource: previewReader.result + }); + }; + } + }, { + key: "setPreviewImageSource", + value: function setPreviewImageSource(file) { + if (file.type !== 'video/mp4') { + this.setPreviewImageSourceFromFile(file); + } else { + if (this.props.thumbnail) { + this.setPreviewImageSourceFromFile(this.props.thumbnail); + } + + this.setState({ + imgSource: this.state.defaultThumbnail + }); + } + } + }, { + key: "render", + value: function render() { + return _react.default.createElement("img", { + id: "dropzone-preview", + src: this.state.imgSource, + className: this.props.dimPreview ? 'dim' : '', + alt: "publish preview" + }); + } + }]); + + _inherits(PublishPreview, _React$Component); + + return PublishPreview; +}(_react.default.Component); + +; +PublishPreview.propTypes = { + dimPreview: _propTypes.default.bool.isRequired, + file: _propTypes.default.object.isRequired, + thumbnail: _propTypes.default.object +}; +var _default = PublishPreview; +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/PublishUrlMiddleDisplay/index.js b/client/build/components/PublishUrlMiddleDisplay/index.js new file mode 100644 index 00000000..5a739e8b --- /dev/null +++ b/client/build/components/PublishUrlMiddleDisplay/index.js @@ -0,0 +1,50 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function UrlMiddle(_ref) { + var publishInChannel = _ref.publishInChannel, + selectedChannel = _ref.selectedChannel, + loggedInChannelName = _ref.loggedInChannelName, + loggedInChannelShortId = _ref.loggedInChannelShortId; + + if (publishInChannel) { + if (selectedChannel === loggedInChannelName) { + return _react.default.createElement("span", { + id: "url-channel", + className: "url-text--secondary" + }, loggedInChannelName, ":", loggedInChannelShortId, " /"); + } + + return _react.default.createElement("span", { + id: "url-channel-placeholder", + className: "url-text--secondary tooltip" + }, "@channel", _react.default.createElement("span", { + className: "tooltip-text" + }, "Select a channel below"), " /"); + } + + return _react.default.createElement("span", { + id: "url-no-channel-placeholder", + className: "url-text--secondary tooltip" + }, "xyz", _react.default.createElement("span", { + className: "tooltip-text" + }, "This will be a random id"), " /"); +} + +UrlMiddle.propTypes = { + publishInChannel: _propTypes.default.bool.isRequired, + loggedInChannelName: _propTypes.default.string, + loggedInChannelShortId: _propTypes.default.string +}; +var _default = UrlMiddle; +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/SEO/index.js b/client/build/components/SEO/index.js new file mode 100644 index 00000000..68ed79ed --- /dev/null +++ b/client/build/components/SEO/index.js @@ -0,0 +1,34 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var site = _ref.site; + var defaultDescription = site.defaultDescription, + defaultThumbnail = site.defaultThumbnail, + siteDescription = site.description, + siteHost = site.host, + siteTitle = site.title, + siteTwitter = site.twitter; + return { + defaultDescription: defaultDescription, + defaultThumbnail: defaultThumbnail, + siteDescription: siteDescription, + siteHost: siteHost, + siteTitle: siteTitle, + siteTwitter: siteTwitter + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, null)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/SEO/view.js b/client/build/components/SEO/view.js new file mode 100644 index 00000000..bbacc8aa --- /dev/null +++ b/client/build/components/SEO/view.js @@ -0,0 +1,95 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactHelmet = _interopRequireDefault(require("react-helmet")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _pageTitle = require("../../utils/pageTitle"); + +var _metaTags = require("../../utils/metaTags"); + +var _canonicalLink = require("../../utils/canonicalLink"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var SEO = +/*#__PURE__*/ +function (_React$Component) { + function SEO() { + _classCallCheck(this, SEO); + + return _possibleConstructorReturn(this, _getPrototypeOf(SEO).apply(this, arguments)); + } + + _createClass(SEO, [{ + key: "render", + value: function render() { + // props from state + var _this$props = this.props, + defaultDescription = _this$props.defaultDescription, + defaultThumbnail = _this$props.defaultThumbnail, + siteDescription = _this$props.siteDescription, + siteHost = _this$props.siteHost, + siteTitle = _this$props.siteTitle, + siteTwitter = _this$props.siteTwitter; // props from parent + + var _this$props2 = this.props, + asset = _this$props2.asset, + channel = _this$props2.channel, + pageUri = _this$props2.pageUri; + var pageTitle = this.props.pageTitle; // create page title, tags, and canonical link + + pageTitle = (0, _pageTitle.createPageTitle)(siteTitle, pageTitle); + var metaTags = (0, _metaTags.createMetaTags)(siteDescription, siteHost, siteTitle, siteTwitter, asset, channel, defaultDescription, defaultThumbnail); + var canonicalLink = (0, _canonicalLink.createCanonicalLink)(asset, channel, pageUri, siteHost); // render results + + return _react.default.createElement(_reactHelmet.default, { + title: pageTitle, + meta: metaTags, + link: [{ + rel: 'canonical', + href: canonicalLink + }] + }); + } + }]); + + _inherits(SEO, _React$Component); + + return SEO; +}(_react.default.Component); + +; +SEO.propTypes = { + pageTitle: _propTypes.default.string, + pageUri: _propTypes.default.string, + channel: _propTypes.default.object, + asset: _propTypes.default.object +}; +var _default = SEO; +exports.default = _default; \ No newline at end of file diff --git a/client/build/constants/asset_display_states.js b/client/build/constants/asset_display_states.js new file mode 100644 index 00000000..c74d7451 --- /dev/null +++ b/client/build/constants/asset_display_states.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.AVAILABLE = exports.ERROR = exports.UNAVAILABLE = exports.LOCAL_CHECK = void 0; +var LOCAL_CHECK = 'LOCAL_CHECK'; +exports.LOCAL_CHECK = LOCAL_CHECK; +var UNAVAILABLE = 'UNAVAILABLE'; +exports.UNAVAILABLE = UNAVAILABLE; +var ERROR = 'ERROR'; +exports.ERROR = ERROR; +var AVAILABLE = 'AVAILABLE'; +exports.AVAILABLE = AVAILABLE; \ No newline at end of file diff --git a/client/build/constants/channel_action_types.js b/client/build/constants/channel_action_types.js new file mode 100644 index 00000000..f5763d7d --- /dev/null +++ b/client/build/constants/channel_action_types.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.CHANNEL_LOGOUT = exports.CHANNEL_LOGIN_CHECK = exports.CHANNEL_UPDATE = void 0; +var CHANNEL_UPDATE = 'CHANNEL_UPDATE'; +exports.CHANNEL_UPDATE = CHANNEL_UPDATE; +var CHANNEL_LOGIN_CHECK = 'CHANNEL_LOGIN_CHECK'; +exports.CHANNEL_LOGIN_CHECK = CHANNEL_LOGIN_CHECK; +var CHANNEL_LOGOUT = 'CHANNEL_LOGOUT'; +exports.CHANNEL_LOGOUT = CHANNEL_LOGOUT; \ No newline at end of file diff --git a/client/build/constants/channel_create_action_types.js b/client/build/constants/channel_create_action_types.js new file mode 100644 index 00000000..1ced1d4c --- /dev/null +++ b/client/build/constants/channel_create_action_types.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.CHANNEL_CREATE = exports.CHANNEL_AVAILABILITY = exports.CHANNEL_CREATE_UPDATE_STATUS = exports.CHANNEL_CREATE_UPDATE_PASSWORD = exports.CHANNEL_CREATE_UPDATE_NAME = void 0; +var CHANNEL_CREATE_UPDATE_NAME = 'CHANNEL_CREATE_UPDATE_NAME'; +exports.CHANNEL_CREATE_UPDATE_NAME = CHANNEL_CREATE_UPDATE_NAME; +var CHANNEL_CREATE_UPDATE_PASSWORD = 'CHANNEL_CREATE_UPDATE_PASSWORD'; +exports.CHANNEL_CREATE_UPDATE_PASSWORD = CHANNEL_CREATE_UPDATE_PASSWORD; +var CHANNEL_CREATE_UPDATE_STATUS = 'CHANNEL_CREATE_UPDATE_STATUS'; +exports.CHANNEL_CREATE_UPDATE_STATUS = CHANNEL_CREATE_UPDATE_STATUS; +var CHANNEL_AVAILABILITY = 'CHANNEL_AVAILABILITY'; +exports.CHANNEL_AVAILABILITY = CHANNEL_AVAILABILITY; +var CHANNEL_CREATE = 'CHANNEL_CREATE'; +exports.CHANNEL_CREATE = CHANNEL_CREATE; \ No newline at end of file diff --git a/client/build/constants/publish_action_types.js b/client/build/constants/publish_action_types.js new file mode 100644 index 00000000..73a49439 --- /dev/null +++ b/client/build/constants/publish_action_types.js @@ -0,0 +1,30 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.CLAIM_AVAILABILITY = exports.PUBLISH_START = exports.THUMBNAIL_NEW = exports.TOGGLE_METADATA_INPUTS = exports.SELECTED_CHANNEL_UPDATE = exports.ERROR_UPDATE = exports.PUBLISH_STATUS_UPDATE = exports.SET_PUBLISH_IN_CHANNEL = exports.CLAIM_UPDATE = exports.METADATA_UPDATE = exports.FILE_CLEAR = exports.FILE_SELECTED = void 0; +var FILE_SELECTED = 'FILE_SELECTED'; +exports.FILE_SELECTED = FILE_SELECTED; +var FILE_CLEAR = 'FILE_CLEAR'; +exports.FILE_CLEAR = FILE_CLEAR; +var METADATA_UPDATE = 'METADATA_UPDATE'; +exports.METADATA_UPDATE = METADATA_UPDATE; +var CLAIM_UPDATE = 'CLAIM_UPDATE'; +exports.CLAIM_UPDATE = CLAIM_UPDATE; +var SET_PUBLISH_IN_CHANNEL = 'SET_PUBLISH_IN_CHANNEL'; +exports.SET_PUBLISH_IN_CHANNEL = SET_PUBLISH_IN_CHANNEL; +var PUBLISH_STATUS_UPDATE = 'PUBLISH_STATUS_UPDATE'; +exports.PUBLISH_STATUS_UPDATE = PUBLISH_STATUS_UPDATE; +var ERROR_UPDATE = 'ERROR_UPDATE'; +exports.ERROR_UPDATE = ERROR_UPDATE; +var SELECTED_CHANNEL_UPDATE = 'SELECTED_CHANNEL_UPDATE'; +exports.SELECTED_CHANNEL_UPDATE = SELECTED_CHANNEL_UPDATE; +var TOGGLE_METADATA_INPUTS = 'TOGGLE_METADATA_INPUTS'; +exports.TOGGLE_METADATA_INPUTS = TOGGLE_METADATA_INPUTS; +var THUMBNAIL_NEW = 'THUMBNAIL_NEW'; +exports.THUMBNAIL_NEW = THUMBNAIL_NEW; +var PUBLISH_START = 'PUBLISH_START'; +exports.PUBLISH_START = PUBLISH_START; +var CLAIM_AVAILABILITY = 'CLAIM_AVAILABILITY'; +exports.CLAIM_AVAILABILITY = CLAIM_AVAILABILITY; \ No newline at end of file diff --git a/client/build/constants/publish_channel_select_states.js b/client/build/constants/publish_channel_select_states.js new file mode 100644 index 00000000..e4409f41 --- /dev/null +++ b/client/build/constants/publish_channel_select_states.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.CREATE = exports.LOGIN = void 0; +var LOGIN = 'Existing'; +exports.LOGIN = LOGIN; +var CREATE = 'New'; +exports.CREATE = CREATE; \ No newline at end of file diff --git a/client/build/constants/publish_claim_states.js b/client/build/constants/publish_claim_states.js new file mode 100644 index 00000000..09ed9f9d --- /dev/null +++ b/client/build/constants/publish_claim_states.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.FAILED = exports.SUCCESS = exports.PUBLISHING = exports.LOADING = exports.LOAD_START = void 0; +var LOAD_START = 'LOAD_START'; +exports.LOAD_START = LOAD_START; +var LOADING = 'LOADING'; +exports.LOADING = LOADING; +var PUBLISHING = 'PUBLISHING'; +exports.PUBLISHING = PUBLISHING; +var SUCCESS = 'SUCCESS'; +exports.SUCCESS = SUCCESS; +var FAILED = 'FAILED'; +exports.FAILED = FAILED; \ No newline at end of file diff --git a/client/build/constants/show_action_types.js b/client/build/constants/show_action_types.js new file mode 100644 index 00000000..201d6729 --- /dev/null +++ b/client/build/constants/show_action_types.js @@ -0,0 +1,36 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.DISPLAY_ASSET_ERROR = exports.FILE_AVAILABILITY_UPDATE = exports.FILE_REQUESTED = exports.CHANNEL_CLAIMS_UPDATE_SUCCESS = exports.CHANNEL_CLAIMS_UPDATE_ASYNC = exports.CHANNEL_ADD = exports.ASSET_ADD = exports.REQUEST_LIST_ADD = exports.CHANNEL_REQUEST_NEW = exports.ASSET_REQUEST_NEW = exports.REQUEST_UPDATE = exports.REQUEST_ERROR = exports.HANDLE_SHOW_URI = void 0; +// request actions +var HANDLE_SHOW_URI = 'HANDLE_SHOW_URI'; +exports.HANDLE_SHOW_URI = HANDLE_SHOW_URI; +var REQUEST_ERROR = 'REQUEST_ERROR'; +exports.REQUEST_ERROR = REQUEST_ERROR; +var REQUEST_UPDATE = 'REQUEST_UPDATE'; +exports.REQUEST_UPDATE = REQUEST_UPDATE; +var ASSET_REQUEST_NEW = 'ASSET_REQUEST_NEW'; +exports.ASSET_REQUEST_NEW = ASSET_REQUEST_NEW; +var CHANNEL_REQUEST_NEW = 'CHANNEL_REQUEST_NEW'; +exports.CHANNEL_REQUEST_NEW = CHANNEL_REQUEST_NEW; +var REQUEST_LIST_ADD = 'REQUEST_LIST_ADD'; // asset actions + +exports.REQUEST_LIST_ADD = REQUEST_LIST_ADD; +var ASSET_ADD = "ASSET_ADD"; // channel actions + +exports.ASSET_ADD = ASSET_ADD; +var CHANNEL_ADD = 'CHANNEL_ADD'; +exports.CHANNEL_ADD = CHANNEL_ADD; +var CHANNEL_CLAIMS_UPDATE_ASYNC = 'CHANNEL_CLAIMS_UPDATE_ASYNC'; +exports.CHANNEL_CLAIMS_UPDATE_ASYNC = CHANNEL_CLAIMS_UPDATE_ASYNC; +var CHANNEL_CLAIMS_UPDATE_SUCCESS = 'CHANNEL_CLAIMS_UPDATE_SUCCESS'; // asset/file display actions + +exports.CHANNEL_CLAIMS_UPDATE_SUCCESS = CHANNEL_CLAIMS_UPDATE_SUCCESS; +var FILE_REQUESTED = 'FILE_REQUESTED'; +exports.FILE_REQUESTED = FILE_REQUESTED; +var FILE_AVAILABILITY_UPDATE = 'FILE_AVAILABILITY_UPDATE'; +exports.FILE_AVAILABILITY_UPDATE = FILE_AVAILABILITY_UPDATE; +var DISPLAY_ASSET_ERROR = 'DISPLAY_ASSET_ERROR'; +exports.DISPLAY_ASSET_ERROR = DISPLAY_ASSET_ERROR; \ No newline at end of file diff --git a/client/build/constants/show_request_types.js b/client/build/constants/show_request_types.js new file mode 100644 index 00000000..d2e764c4 --- /dev/null +++ b/client/build/constants/show_request_types.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ASSET_DETAILS = exports.ASSET_LITE = exports.CHANNEL = void 0; +var CHANNEL = 'CHANNEL'; +exports.CHANNEL = CHANNEL; +var ASSET_LITE = 'ASSET_LITE'; +exports.ASSET_LITE = ASSET_LITE; +var ASSET_DETAILS = 'ASSET_DETAILS'; +exports.ASSET_DETAILS = ASSET_DETAILS; \ No newline at end of file diff --git a/client/build/containers/AssetDisplay/index.js b/client/build/containers/AssetDisplay/index.js new file mode 100644 index 00000000..fee6361c --- /dev/null +++ b/client/build/containers/AssetDisplay/index.js @@ -0,0 +1,43 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +var _show = require("../../actions/show"); + +var _show2 = require("../../selectors/show"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var show = _ref.show; + // select error and status + var error = show.displayAsset.error; + var status = show.displayAsset.status; // select asset + + var asset = (0, _show2.selectAsset)(show); // return props + + return { + error: error, + status: status, + asset: asset + }; +}; + +var mapDispatchToProps = function mapDispatchToProps(dispatch) { + return { + onFileRequest: function onFileRequest(name, claimId) { + dispatch((0, _show.fileRequested)(name, claimId)); + } + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/AssetDisplay/view.js b/client/build/containers/AssetDisplay/view.js new file mode 100644 index 00000000..32f98941 --- /dev/null +++ b/client/build/containers/AssetDisplay/view.js @@ -0,0 +1,118 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _ProgressBar = _interopRequireDefault(require("@components/ProgressBar")); + +var _asset_display_states = require("../../constants/asset_display_states"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var AssetDisplay = +/*#__PURE__*/ +function (_React$Component) { + function AssetDisplay() { + _classCallCheck(this, AssetDisplay); + + return _possibleConstructorReturn(this, _getPrototypeOf(AssetDisplay).apply(this, arguments)); + } + + _createClass(AssetDisplay, [{ + key: "componentDidMount", + value: function componentDidMount() { + var _this$props$asset$cla = this.props.asset.claimData, + name = _this$props$asset$cla.name, + claimId = _this$props$asset$cla.claimId; + this.props.onFileRequest(name, claimId); + } + }, { + key: "render", + value: function render() { + var _this$props = this.props, + status = _this$props.status, + error = _this$props.error, + _this$props$asset$cla2 = _this$props.asset.claimData, + name = _this$props$asset$cla2.name, + claimId = _this$props$asset$cla2.claimId, + contentType = _this$props$asset$cla2.contentType, + fileExt = _this$props$asset$cla2.fileExt, + thumbnail = _this$props$asset$cla2.thumbnail; + return _react.default.createElement("div", { + id: "asset-display-component" + }, status === _asset_display_states.LOCAL_CHECK && _react.default.createElement("div", null, _react.default.createElement("p", null, "Checking to see if Spee.ch has your asset locally...")), status === _asset_display_states.UNAVAILABLE && _react.default.createElement("div", null, _react.default.createElement("p", null, "Sit tight, we're searching the LBRY blockchain for your asset!"), _react.default.createElement(_ProgressBar.default, { + size: 12 + }), _react.default.createElement("p", null, "Curious what magic is happening here? ", _react.default.createElement("a", { + className: "link--primary", + target: "blank", + href: "https://lbry.io/faq/what-is-lbry" + }, "Learn more."))), status === _asset_display_states.ERROR && _react.default.createElement("div", null, _react.default.createElement("p", null, "Unfortunately, we couldn't download your asset from LBRY. You can help us out by sharing the below error message in the ", _react.default.createElement("a", { + className: "link--primary", + href: "https://chat.lbry.io", + target: "_blank" + }, "LBRY discord"), "."), _react.default.createElement("i", null, _react.default.createElement("p", { + id: "error-message" + }, error))), status === _asset_display_states.AVAILABLE && function () { + switch (contentType) { + case 'image/jpeg': + case 'image/jpg': + case 'image/png': + return _react.default.createElement("img", { + className: "asset", + src: "/".concat(claimId, "/").concat(name, ".").concat(fileExt), + alt: name + }); + + case 'image/gif': + return _react.default.createElement("img", { + className: "asset", + src: "/".concat(claimId, "/").concat(name, ".").concat(fileExt), + alt: name + }); + + case 'video/mp4': + return _react.default.createElement("video", { + className: "asset video", + controls: true, + poster: thumbnail + }, _react.default.createElement("source", { + src: "/".concat(claimId, "/").concat(name, ".").concat(fileExt) + }), _react.default.createElement("p", null, "Your browser does not support the ", _react.default.createElement("code", null, "video"), " element.")); + + default: + return _react.default.createElement("p", null, "Unsupported file type"); + } + }()); + } + }]); + + _inherits(AssetDisplay, _React$Component); + + return AssetDisplay; +}(_react.default.Component); + +; +var _default = AssetDisplay; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/AssetInfo/index.js b/client/build/containers/AssetInfo/index.js new file mode 100644 index 00000000..17345134 --- /dev/null +++ b/client/build/containers/AssetInfo/index.js @@ -0,0 +1,28 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +var _show = require("../../selectors/show"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var show = _ref.show; + // select asset + var asset = (0, _show.selectAsset)(show); // return props + + return { + asset: asset + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, null)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/AssetInfo/view.js b/client/build/containers/AssetInfo/view.js new file mode 100644 index 00000000..239b301b --- /dev/null +++ b/client/build/containers/AssetInfo/view.js @@ -0,0 +1,219 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactRouterDom = require("react-router-dom"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var AssetInfo = +/*#__PURE__*/ +function (_React$Component) { + function AssetInfo(props) { + var _this; + + _classCallCheck(this, AssetInfo); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssetInfo).call(this, props)); + _this.copyToClipboard = _this.copyToClipboard.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(AssetInfo, [{ + key: "copyToClipboard", + value: function copyToClipboard(event) { + var elementToCopy = event.target.dataset.elementtocopy; + var element = document.getElementById(elementToCopy); + element.select(); + + try { + document.execCommand('copy'); + } catch (err) { + this.setState({ + error: 'Oops, unable to copy' + }); + } + } + }, { + key: "render", + value: function render() { + var _this$props$asset = this.props.asset, + shortId = _this$props$asset.shortId, + _this$props$asset$cla = _this$props$asset.claimData, + channelName = _this$props$asset$cla.channelName, + certificateId = _this$props$asset$cla.certificateId, + description = _this$props$asset$cla.description, + name = _this$props$asset$cla.name, + claimId = _this$props$asset$cla.claimId, + fileExt = _this$props$asset$cla.fileExt, + contentType = _this$props$asset$cla.contentType, + thumbnail = _this$props$asset$cla.thumbnail, + host = _this$props$asset$cla.host; + return _react.default.createElement("div", null, channelName && _react.default.createElement("div", { + className: "row row--padded row--wide row--no-top" + }, _react.default.createElement("div", { + className: "column column--2 column--med-10" + }, _react.default.createElement("span", { + className: "text" + }, "Channel:")), _react.default.createElement("div", { + className: "column column--8 column--med-10" + }, _react.default.createElement("span", { + className: "text" + }, _react.default.createElement(_reactRouterDom.Link, { + to: "/".concat(channelName, ":").concat(certificateId) + }, channelName)))), description && _react.default.createElement("div", { + className: "row row--padded row--wide row--no-top" + }, _react.default.createElement("span", { + className: "text" + }, description)), _react.default.createElement("div", { + id: "show-share-buttons" + }, _react.default.createElement("div", { + className: "row row--padded row--wide row--no-top" + }, _react.default.createElement("div", { + className: "column column--2 column--med-10" + }, _react.default.createElement("span", { + className: "text" + }, "Share:")), _react.default.createElement("div", { + className: "column column--8 column--med-10" + }, _react.default.createElement("div", { + className: "row row--short row--wide flex-container--row flex-container--space-between-bottom flex-container--wrap" + }, _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://twitter.com/intent/tweet?text=".concat(host, "/").concat(shortId, "/").concat(name) + }, "twitter"), _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://www.facebook.com/sharer/sharer.php?u=".concat(host, "/").concat(shortId, "/").concat(name) + }, "facebook"), _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "http://tumblr.com/widgets/share/tool?canonicalUrl=".concat(host, "/").concat(shortId, "/").concat(name) + }, "tumblr"), _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://www.reddit.com/submit?url=".concat(host, "/").concat(shortId, "/").concat(name, "&title=").concat(name) + }, "reddit"))))), _react.default.createElement("div", { + className: "row row--padded row--wide row--no-top" + }, _react.default.createElement("div", { + id: "show-short-link" + }, _react.default.createElement("div", { + className: "column column--2 column--med-10" + }, _react.default.createElement("span", { + className: "text" + }, "Link:")), _react.default.createElement("div", { + className: "column column--8 column--med-10" + }, _react.default.createElement("div", { + className: "row row--short row--wide" + }, _react.default.createElement("div", { + className: "column column--7" + }, _react.default.createElement("div", { + className: "input-error", + id: "input-error-copy-short-link", + hidden: "true" + }, "error here"), _react.default.createElement("input", { + type: "text", + id: "short-link", + className: "input-disabled input-text--full-width", + readOnly: true, + spellCheck: "false", + value: "".concat(host, "/").concat(shortId, "/").concat(name, ".").concat(fileExt), + onClick: this.select + })), _react.default.createElement("div", { + className: "column column--1" + }), _react.default.createElement("div", { + className: "column column--2" + }, _react.default.createElement("button", { + className: "button--primary button--wide", + "data-elementtocopy": "short-link", + onClick: this.copyToClipboard + }, "copy"))))), _react.default.createElement("div", { + id: "show-embed-code" + }, _react.default.createElement("div", { + className: "column column--2 column--med-10" + }, _react.default.createElement("span", { + className: "text" + }, "Embed:")), _react.default.createElement("div", { + className: "column column--8 column--med-10" + }, _react.default.createElement("div", { + className: "row row--short row--wide" + }, _react.default.createElement("div", { + className: "column column--7" + }, _react.default.createElement("div", { + className: "input-error", + id: "input-error-copy-embed-text", + hidden: "true" + }, "error here"), contentType === 'video/mp4' ? _react.default.createElement("input", { + type: "text", + id: "embed-text", + className: "input-disabled input-text--full-width", + readOnly: true, + onClick: this.select, + spellCheck: "false", + value: "") + }) : _react.default.createElement("input", { + type: "text", + id: "embed-text", + className: "input-disabled input-text--full-width", + readOnly: true, + onClick: this.select, + spellCheck: "false", + value: "") + })), _react.default.createElement("div", { + className: "column column--1" + }), _react.default.createElement("div", { + className: "column column--2" + }, _react.default.createElement("button", { + className: "button--primary button--wide", + "data-elementtocopy": "embed-text", + onClick: this.copyToClipboard + }, "copy")))))), _react.default.createElement("div", { + className: "flex-container--row flex-container--space-between-bottom" + }, _react.default.createElement(_reactRouterDom.Link, { + className: "link--primary", + to: "/".concat(shortId, "/").concat(name, ".").concat(fileExt) + }, _react.default.createElement("span", { + className: "text" + }, "Direct Link")), _react.default.createElement("a", { + className: "link--primary", + href: "".concat(host, "/").concat(claimId, "/").concat(name, ".").concat(fileExt), + download: name + }, "Download"), _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://lbry.io/dmca" + }, "Report"))); + } + }]); + + _inherits(AssetInfo, _React$Component); + + return AssetInfo; +}(_react.default.Component); + +; +var _default = AssetInfo; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/AssetTitle/index.js b/client/build/containers/AssetTitle/index.js new file mode 100644 index 00000000..39f79def --- /dev/null +++ b/client/build/containers/AssetTitle/index.js @@ -0,0 +1,29 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +var _show = require("../../selectors/show"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var show = _ref.show; + + var _selectAsset = (0, _show.selectAsset)(show), + title = _selectAsset.claimData.title; + + return { + title: title + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, null)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/AssetTitle/view.js b/client/build/containers/AssetTitle/view.js new file mode 100644 index 00000000..55a05ba4 --- /dev/null +++ b/client/build/containers/AssetTitle/view.js @@ -0,0 +1,20 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var AssetTitle = function AssetTitle(_ref) { + var title = _ref.title; + return _react.default.createElement("div", null, _react.default.createElement("span", { + className: "text--large" + }, title)); +}; + +var _default = AssetTitle; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ChannelClaimsDisplay/index.js b/client/build/containers/ChannelClaimsDisplay/index.js new file mode 100644 index 00000000..50b3ffe8 --- /dev/null +++ b/client/build/containers/ChannelClaimsDisplay/index.js @@ -0,0 +1,36 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _show = require("../../actions/show"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var show = _ref.show; + // select channel key + var request = show.requestList[show.request.id]; + var channelKey = request.key; // select channel claims + + var channel = show.channelList[channelKey] || null; // return props + + return { + channelKey: channelKey, + channel: channel + }; +}; + +var mapDispatchToProps = { + onUpdateChannelClaims: _show.onUpdateChannelClaims +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ChannelClaimsDisplay/view.js b/client/build/containers/ChannelClaimsDisplay/view.js new file mode 100644 index 00000000..e520997e --- /dev/null +++ b/client/build/containers/ChannelClaimsDisplay/view.js @@ -0,0 +1,101 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _AssetPreview = _interopRequireDefault(require("@components/AssetPreview")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var ChannelClaimsDisplay = +/*#__PURE__*/ +function (_React$Component) { + function ChannelClaimsDisplay(props) { + var _this; + + _classCallCheck(this, ChannelClaimsDisplay); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(ChannelClaimsDisplay).call(this, props)); + _this.showNextResultsPage = _this.showNextResultsPage.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.showPreviousResultsPage = _this.showPreviousResultsPage.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(ChannelClaimsDisplay, [{ + key: "showPreviousResultsPage", + value: function showPreviousResultsPage() { + var currentPage = this.props.channel.claimsData.currentPage; + var previousPage = parseInt(currentPage) - 1; + this.showNewPage(previousPage); + } + }, { + key: "showNextResultsPage", + value: function showNextResultsPage() { + var currentPage = this.props.channel.claimsData.currentPage; + var nextPage = parseInt(currentPage) + 1; + this.showNewPage(nextPage); + } + }, { + key: "showNewPage", + value: function showNewPage(page) { + var _this$props = this.props, + channelKey = _this$props.channelKey, + _this$props$channel = _this$props.channel, + name = _this$props$channel.name, + longId = _this$props$channel.longId; + this.props.onUpdateChannelClaims(channelKey, name, longId, page); + } + }, { + key: "render", + value: function render() { + var _this$props$channel$c = this.props.channel.claimsData, + claims = _this$props$channel$c.claims, + currentPage = _this$props$channel$c.currentPage, + totalPages = _this$props$channel$c.totalPages; + return _react.default.createElement("div", { + className: "row row--tall" + }, claims.length > 0 ? _react.default.createElement("div", null, claims.map(function (claim, index) { + return _react.default.createElement(_AssetPreview.default, { + claimData: claim, + key: "".concat(claim.name, "-").concat(index) + }); + }), _react.default.createElement("div", null, currentPage > 1 && _react.default.createElement("button", { + className: 'button--secondary', + onClick: this.showPreviousResultsPage + }, "Previous Page"), currentPage < totalPages && _react.default.createElement("button", { + className: 'button--secondary', + onClick: this.showNextResultsPage + }, "Next Page"))) : _react.default.createElement("p", null, "There are no claims in this channel")); + } + }]); + + _inherits(ChannelClaimsDisplay, _React$Component); + + return ChannelClaimsDisplay; +}(_react.default.Component); + +; +var _default = ChannelClaimsDisplay; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ChannelCreateForm/index.js b/client/build/containers/ChannelCreateForm/index.js new file mode 100644 index 00000000..828f5874 --- /dev/null +++ b/client/build/containers/ChannelCreateForm/index.js @@ -0,0 +1,39 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +var _channelCreate = require("../../actions/channelCreate"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var _ref$channelCreate = _ref.channelCreate, + name = _ref$channelCreate.name, + password = _ref$channelCreate.password, + error = _ref$channelCreate.error, + status = _ref$channelCreate.status; + return { + name: name, + password: password, + error: error, + status: status + }; +}; + +var mapDispatchToProps = { + updateChannelAvailability: _channelCreate.updateChannelAvailability, + updateChannelCreateName: _channelCreate.updateChannelCreateName, + updateChannelCreatePassword: _channelCreate.updateChannelCreatePassword, + createChannel: _channelCreate.createChannel +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ChannelCreateForm/view.js b/client/build/containers/ChannelCreateForm/view.js new file mode 100644 index 00000000..b1376829 --- /dev/null +++ b/client/build/containers/ChannelCreateForm/view.js @@ -0,0 +1,186 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _ProgressBar = _interopRequireDefault(require("@components/ProgressBar")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var ChannelCreateForm = +/*#__PURE__*/ +function (_React$Component) { + function ChannelCreateForm(props) { + var _this; + + _classCallCheck(this, ChannelCreateForm); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(ChannelCreateForm).call(this, props)); + _this.handleNameInput = _this.handleNameInput.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handlePasswordInput = _this.handlePasswordInput.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleSubmit = _this.handleSubmit.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(ChannelCreateForm, [{ + key: "cleanseNameInput", + value: function cleanseNameInput(input) { + input = input.replace(/\s+/g, '-'); // replace spaces with dashes + + input = input.replace(/[^A-Za-z0-9-]/g, ''); // remove all characters that are not A-Z, a-z, 0-9, or '-' + + return input; + } + }, { + key: "cleansePasswordInput", + value: function cleansePasswordInput(input) { + input = input.replace(/\s+/g, ''); // replace spaces + + return input; + } + }, { + key: "handleNameInput", + value: function handleNameInput(event) { + var value = this.cleanseNameInput(event.target.value); + + if (!value) { + this.props.updateChannelCreateName('error', 'Please enter a channel name'); + } else { + this.props.updateChannelAvailability(value); + } + + this.props.updateChannelCreateName('value', value); + } + }, { + key: "handlePasswordInput", + value: function handlePasswordInput(event) { + var value = this.cleansePasswordInput(event.target.value); + + if (!value) { + this.props.updateChannelCreatePassword('error', 'Please enter a password'); + } else { + this.props.updateChannelCreatePassword('error', null); + } + + this.props.updateChannelCreatePassword('value', value); + } + }, { + key: "handleSubmit", + value: function handleSubmit(event) { + console.log('handling submit'); + event.preventDefault(); + this.props.createChannel(); + } + }, { + key: "returnErrors", + value: function returnErrors() { + if (this.props.name.error) { + return this.props.name.error; + } + + if (this.props.password.error) { + return this.props.password.error; + } + + return null; + } + }, { + key: "render", + value: function render() { + var _this$props = this.props, + name = _this$props.name, + password = _this$props.password, + status = _this$props.status; + var formError = this.returnErrors(); + return _react.default.createElement("div", null, !status ? _react.default.createElement("form", { + id: "publish-channel-form" + }, _react.default.createElement("div", { + className: "row row--wide row--short" + }, _react.default.createElement("div", { + className: "column column--3 column--sml-10" + }, _react.default.createElement("label", { + className: "label", + htmlFor: "new-channel-name" + }, "Name:")), _react.default.createElement("div", { + className: "column column--6 column--sml-10" + }, _react.default.createElement("div", { + className: "input-text--primary flex-container--row flex-container--left-bottom span--relative" + }, _react.default.createElement("span", null, "@"), _react.default.createElement("input", { + type: "text", + name: "channel", + id: "new-channel-name", + className: "input-text", + placeholder: "exampleChannelName", + value: name.value, + onChange: this.handleNameInput + }), name.value && !name.error && _react.default.createElement("span", { + id: "input-success-channel-name", + className: "info-message--success span--absolute" + }, "\u2713"), name.error && _react.default.createElement("span", { + id: "input-success-channel-name", + className: "info-message--failure span--absolute" + }, "\u2716")))), _react.default.createElement("div", { + className: "row row--wide row--short" + }, _react.default.createElement("div", { + className: "column column--3 column--sml-10" + }, _react.default.createElement("label", { + className: "label", + htmlFor: "new-channel-password" + }, "Password:")), _react.default.createElement("div", { + className: "column column--6 column--sml-10" + }, _react.default.createElement("div", { + className: "input-text--primary" + }, _react.default.createElement("input", { + type: "password", + name: "password", + id: "new-channel-password", + className: "input-text", + placeholder: "", + value: password.value, + onChange: this.handlePasswordInput + })))), formError ? _react.default.createElement("p", { + className: "info-message--failure" + }, formError) : _react.default.createElement("p", { + className: "info-message" + }, "Choose a name and password for your channel"), _react.default.createElement("div", { + className: "row row--wide" + }, _react.default.createElement("button", { + className: "button--primary", + onClick: this.handleSubmit + }, "Create Channel"))) : _react.default.createElement("div", null, _react.default.createElement("p", { + className: "fine-print" + }, status), _react.default.createElement(_ProgressBar.default, { + size: 12 + }))); + } + }]); + + _inherits(ChannelCreateForm, _React$Component); + + return ChannelCreateForm; +}(_react.default.Component); + +var _default = ChannelCreateForm; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ChannelLoginForm/index.js b/client/build/containers/ChannelLoginForm/index.js new file mode 100644 index 00000000..583d84de --- /dev/null +++ b/client/build/containers/ChannelLoginForm/index.js @@ -0,0 +1,29 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _channel = require("../../actions/channel"); + +var _publish = require("../../actions/publish"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapDispatchToProps = function mapDispatchToProps(dispatch) { + return { + onChannelLogin: function onChannelLogin(name, shortId, longId) { + dispatch((0, _channel.updateLoggedInChannel)(name, shortId, longId)); + dispatch((0, _publish.updateSelectedChannel)(name)); + } + }; +}; + +var _default = (0, _reactRedux.connect)(null, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ChannelLoginForm/view.js b/client/build/containers/ChannelLoginForm/view.js new file mode 100644 index 00000000..a2a75a6f --- /dev/null +++ b/client/build/containers/ChannelLoginForm/view.js @@ -0,0 +1,167 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _request = _interopRequireDefault(require("../../utils/request")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var ChannelLoginForm = +/*#__PURE__*/ +function (_React$Component) { + function ChannelLoginForm(props) { + var _this; + + _classCallCheck(this, ChannelLoginForm); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(ChannelLoginForm).call(this, props)); + _this.state = { + error: null, + name: '', + password: '' + }; + _this.handleInput = _this.handleInput.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.loginToChannel = _this.loginToChannel.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(ChannelLoginForm, [{ + key: "handleInput", + value: function handleInput(event) { + var name = event.target.name; + var value = event.target.value; + this.setState(_defineProperty({}, name, value)); + } + }, { + key: "loginToChannel", + value: function loginToChannel(event) { + var _this2 = this; + + event.preventDefault(); + var params = { + method: 'POST', + body: JSON.stringify({ + username: this.state.name, + password: this.state.password + }), + headers: new Headers({ + 'Content-Type': 'application/json' + }), + credentials: 'include' + }; + (0, _request.default)('login', params).then(function (_ref) { + var success = _ref.success, + channelName = _ref.channelName, + shortChannelId = _ref.shortChannelId, + channelClaimId = _ref.channelClaimId, + message = _ref.message; + + if (success) { + _this2.props.onChannelLogin(channelName, shortChannelId, channelClaimId); + } else { + _this2.setState({ + 'error': message + }); + } + + ; + }).catch(function (error) { + if (error.message) { + _this2.setState({ + 'error': error.message + }); + } else { + _this2.setState({ + 'error': error + }); + } + }); + } + }, { + key: "render", + value: function render() { + return _react.default.createElement("form", { + id: "channel-login-form" + }, _react.default.createElement("div", { + className: "row row--wide row--short" + }, _react.default.createElement("div", { + className: "column column--3 column--sml-10" + }, _react.default.createElement("label", { + className: "label", + htmlFor: "channel-login-name-input" + }, "Name:")), _react.default.createElement("div", { + className: "column column--6 column--sml-10" + }, _react.default.createElement("div", { + className: "input-text--primary flex-container--row flex-container--left-bottom" + }, _react.default.createElement("span", null, "@"), _react.default.createElement("input", { + type: "text", + id: "channel-login-name-input", + className: "input-text", + name: "name", + placeholder: "Your Channel Name", + value: this.state.channelName, + onChange: this.handleInput + })))), _react.default.createElement("div", { + className: "row row--wide row--short" + }, _react.default.createElement("div", { + className: "column column--3 column--sml-10" + }, _react.default.createElement("label", { + className: "label", + htmlFor: "channel-login-password-input" + }, "Password:")), _react.default.createElement("div", { + className: "column column--6 column--sml-10" + }, _react.default.createElement("div", { + className: "input-text--primary" + }, _react.default.createElement("input", { + type: "password", + id: "channel-login-password-input", + name: "password", + className: "input-text", + placeholder: "", + value: this.state.channelPassword, + onChange: this.handleInput + })))), this.state.error ? _react.default.createElement("p", { + className: "info-message--failure" + }, this.state.error) : _react.default.createElement("p", { + className: "info-message" + }, "Enter the name and password for your channel"), _react.default.createElement("div", { + className: "row row--wide" + }, _react.default.createElement("button", { + className: "button--primary", + onClick: this.loginToChannel + }, "Authenticate"))); + } + }]); + + _inherits(ChannelLoginForm, _React$Component); + + return ChannelLoginForm; +}(_react.default.Component); + +var _default = ChannelLoginForm; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ChannelSelect/index.js b/client/build/containers/ChannelSelect/index.js new file mode 100644 index 00000000..974482d1 --- /dev/null +++ b/client/build/containers/ChannelSelect/index.js @@ -0,0 +1,42 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _publish = require("../../actions/publish"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var channel = _ref.channel, + publish = _ref.publish; + return { + loggedInChannelName: channel.loggedInChannel.name, + publishInChannel: publish.publishInChannel, + selectedChannel: publish.selectedChannel, + channelError: publish.error.channel + }; +}; + +var mapDispatchToProps = function mapDispatchToProps(dispatch) { + return { + onPublishInChannelChange: function onPublishInChannelChange(value) { + dispatch((0, _publish.updateError)('channel', null)); + dispatch((0, _publish.setPublishInChannel)(value)); + }, + onChannelSelect: function onChannelSelect(value) { + dispatch((0, _publish.updateError)('channel', null)); + dispatch((0, _publish.updateSelectedChannel)(value)); + } + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ChannelSelect/view.js b/client/build/containers/ChannelSelect/view.js new file mode 100644 index 00000000..cf01b7a8 --- /dev/null +++ b/client/build/containers/ChannelSelect/view.js @@ -0,0 +1,132 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _ChannelLoginForm = _interopRequireDefault(require("@containers/ChannelLoginForm")); + +var _ChannelCreateForm = _interopRequireDefault(require("@containers/ChannelCreateForm")); + +var states = _interopRequireWildcard(require("../../constants/publish_channel_select_states")); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var ChannelSelect = +/*#__PURE__*/ +function (_React$Component) { + function ChannelSelect(props) { + var _this; + + _classCallCheck(this, ChannelSelect); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(ChannelSelect).call(this, props)); + _this.toggleAnonymousPublish = _this.toggleAnonymousPublish.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleSelection = _this.handleSelection.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(ChannelSelect, [{ + key: "toggleAnonymousPublish", + value: function toggleAnonymousPublish(event) { + var value = event.target.value; + + if (value === 'anonymous') { + this.props.onPublishInChannelChange(false); + } else { + this.props.onPublishInChannelChange(true); + } + } + }, { + key: "handleSelection", + value: function handleSelection(event) { + var selectedOption = event.target.selectedOptions[0].value; + this.props.onChannelSelect(selectedOption); + } + }, { + key: "render", + value: function render() { + return _react.default.createElement("div", null, _react.default.createElement("form", null, _react.default.createElement("div", { + className: "column column--3 column--med-10" + }, _react.default.createElement("input", { + type: "radio", + name: "anonymous-or-channel", + id: "anonymous-radio", + className: "input-radio", + value: "anonymous", + checked: !this.props.publishInChannel, + onChange: this.toggleAnonymousPublish + }), _react.default.createElement("label", { + className: "label label--pointer", + htmlFor: "anonymous-radio" + }, "Anonymous")), _react.default.createElement("div", { + className: "column column--7 column--med-10" + }, _react.default.createElement("input", { + type: "radio", + name: "anonymous-or-channel", + id: "channel-radio", + className: "input-radio", + value: "in a channel", + checked: this.props.publishInChannel, + onChange: this.toggleAnonymousPublish + }), _react.default.createElement("label", { + className: "label label--pointer", + htmlFor: "channel-radio" + }, "In a channel")), this.props.channelError ? _react.default.createElement("p", { + className: "info-message--failure" + }, this.props.channelError) : _react.default.createElement("p", { + className: "info-message" + }, "Publish anonymously or in a channel")), this.props.publishInChannel && _react.default.createElement("div", null, _react.default.createElement("div", { + className: "column column--3" + }, _react.default.createElement("label", { + className: "label", + htmlFor: "channel-name-select" + }, "Channel:")), _react.default.createElement("div", { + className: "column column--7" + }, _react.default.createElement("select", { + type: "text", + id: "channel-name-select", + className: "select select--arrow", + value: this.props.selectedChannel, + onChange: this.handleSelection + }, this.props.loggedInChannelName && _react.default.createElement("option", { + value: this.props.loggedInChannelName, + id: "publish-channel-select-channel-option" + }, this.props.loggedInChannelName), _react.default.createElement("option", { + value: states.LOGIN + }, "Existing"), _react.default.createElement("option", { + value: states.CREATE + }, "New"))), this.props.selectedChannel === states.LOGIN && _react.default.createElement(_ChannelLoginForm.default, null), this.props.selectedChannel === states.CREATE && _react.default.createElement(_ChannelCreateForm.default, null))); + } + }]); + + _inherits(ChannelSelect, _React$Component); + + return ChannelSelect; +}(_react.default.Component); + +var _default = ChannelSelect; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/Dropzone/index.js b/client/build/containers/Dropzone/index.js new file mode 100644 index 00000000..eda8c65e --- /dev/null +++ b/client/build/containers/Dropzone/index.js @@ -0,0 +1,39 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _publish = require("../../actions/publish"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var publish = _ref.publish; + return { + file: publish.file, + thumbnail: publish.thumbnail, + fileError: publish.error.file + }; +}; + +var mapDispatchToProps = function mapDispatchToProps(dispatch) { + return { + selectFile: function selectFile(file) { + dispatch((0, _publish.selectFile)(file)); + }, + setFileError: function setFileError(value) { + dispatch((0, _publish.clearFile)()); + dispatch((0, _publish.updateError)('file', value)); + } + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/Dropzone/view.js b/client/build/containers/Dropzone/view.js new file mode 100644 index 00000000..6135b2f4 --- /dev/null +++ b/client/build/containers/Dropzone/view.js @@ -0,0 +1,226 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _file = require("../../utils/file"); + +var _PublishPreview = _interopRequireDefault(require("@components/PublishPreview")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var Dropzone = +/*#__PURE__*/ +function (_React$Component) { + function Dropzone(props) { + var _this; + + _classCallCheck(this, Dropzone); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(Dropzone).call(this, props)); + _this.state = { + dragOver: false, + mouseOver: false, + dimPreview: false + }; + _this.handleDrop = _this.handleDrop.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleDragOver = _this.handleDragOver.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleDragEnd = _this.handleDragEnd.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleDragEnter = _this.handleDragEnter.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleDragLeave = _this.handleDragLeave.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleMouseEnter = _this.handleMouseEnter.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleMouseLeave = _this.handleMouseLeave.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleClick = _this.handleClick.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleFileInput = _this.handleFileInput.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.chooseFile = _this.chooseFile.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(Dropzone, [{ + key: "handleDrop", + value: function handleDrop(event) { + event.preventDefault(); + this.setState({ + dragOver: false + }); // if dropped items aren't files, reject them + + var dt = event.dataTransfer; + + if (dt.items) { + if (dt.items[0].kind === 'file') { + var droppedFile = dt.items[0].getAsFile(); + this.chooseFile(droppedFile); + } + } + } + }, { + key: "handleDragOver", + value: function handleDragOver(event) { + event.preventDefault(); + } + }, { + key: "handleDragEnd", + value: function handleDragEnd(event) { + var dt = event.dataTransfer; + + if (dt.items) { + for (var i = 0; i < dt.items.length; i++) { + dt.items.remove(i); + } + } else { + event.dataTransfer.clearData(); + } + } + }, { + key: "handleDragEnter", + value: function handleDragEnter() { + this.setState({ + dragOver: true, + dimPreview: true + }); + } + }, { + key: "handleDragLeave", + value: function handleDragLeave() { + this.setState({ + dragOver: false, + dimPreview: false + }); + } + }, { + key: "handleMouseEnter", + value: function handleMouseEnter() { + this.setState({ + mouseOver: true, + dimPreview: true + }); + } + }, { + key: "handleMouseLeave", + value: function handleMouseLeave() { + this.setState({ + mouseOver: false, + dimPreview: false + }); + } + }, { + key: "handleClick", + value: function handleClick(event) { + event.preventDefault(); + document.getElementById('file_input').click(); + } + }, { + key: "handleFileInput", + value: function handleFileInput(event) { + event.preventDefault(); + var fileList = event.target.files; + this.chooseFile(fileList[0]); + } + }, { + key: "chooseFile", + value: function chooseFile(file) { + if (file) { + try { + (0, _file.validateFile)(file); // validate the file's name, type, and size + } catch (error) { + return this.props.setFileError(error.message); + } // stage it so it will be ready when the publish button is clicked + + + this.props.selectFile(file); + } + } + }, { + key: "render", + value: function render() { + return _react.default.createElement("div", { + className: "row row--tall flex-container--column" + }, _react.default.createElement("form", null, _react.default.createElement("input", { + className: "input-file", + type: "file", + id: "file_input", + name: "file_input", + accept: "video/*,image/*", + onChange: this.handleFileInput, + encType: "multipart/form-data" + })), _react.default.createElement("div", { + id: "preview-dropzone", + className: 'row row--padded row--tall dropzone' + (this.state.dragOver ? ' dropzone--drag-over' : ''), + onDrop: this.handleDrop, + onDragOver: this.handleDragOver, + onDragEnd: this.handleDragEnd, + onDragEnter: this.handleDragEnter, + onDragLeave: this.handleDragLeave, + onMouseEnter: this.handleMouseEnter, + onMouseLeave: this.handleMouseLeave, + onClick: this.handleClick + }, this.props.file ? _react.default.createElement("div", null, _react.default.createElement(_PublishPreview.default, { + dimPreview: this.state.dimPreview, + file: this.props.file, + thumbnail: this.props.thumbnail + }), _react.default.createElement("div", { + id: "dropzone-text-holder", + className: 'flex-container--column flex-container--center-center' + }, this.state.dragOver ? _react.default.createElement("div", { + id: "dropzone-dragover" + }, _react.default.createElement("p", { + className: "blue" + }, "Drop it.")) : null, this.state.mouseOver ? _react.default.createElement("div", { + id: "dropzone-instructions" + }, _react.default.createElement("p", { + className: "info-message-placeholder info-message--failure", + id: "input-error-file-selection" + }, this.props.fileError), _react.default.createElement("p", null, "Drag & drop image or video here to publish"), _react.default.createElement("p", { + className: "fine-print" + }, "OR"), _react.default.createElement("p", { + className: "blue--underlined" + }, "CHOOSE FILE")) : null)) : _react.default.createElement("div", { + id: "dropzone-text-holder", + className: 'flex-container--column flex-container--center-center' + }, this.state.dragOver ? _react.default.createElement("div", { + id: "dropzone-dragover" + }, _react.default.createElement("p", { + className: "blue" + }, "Drop it.")) : _react.default.createElement("div", { + id: "dropzone-instructions" + }, _react.default.createElement("p", { + className: "info-message-placeholder info-message--failure", + id: "input-error-file-selection" + }, this.props.fileError), _react.default.createElement("p", null, "Drag & drop image or video here to publish"), _react.default.createElement("p", { + className: "fine-print" + }, "OR"), _react.default.createElement("p", { + className: "blue--underlined" + }, "CHOOSE FILE"))))); + } + }]); + + _inherits(Dropzone, _React$Component); + + return Dropzone; +}(_react.default.Component); + +; +var _default = Dropzone; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/NavBar/index.js b/client/build/containers/NavBar/index.js new file mode 100644 index 00000000..c44c51b7 --- /dev/null +++ b/client/build/containers/NavBar/index.js @@ -0,0 +1,34 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _channel = require("../../actions/channel"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var channel = _ref.channel, + site = _ref.site; + return { + channelName: channel.loggedInChannel.name, + channelShortId: channel.loggedInChannel.shortId, + channelLongId: channel.loggedInChannel.longId, + siteDescription: site.description + }; +}; + +var mapDispatchToProps = { + checkForLoggedInChannel: _channel.checkForLoggedInChannel, + logOutChannel: _channel.logOutChannel +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/NavBar/view.js b/client/build/containers/NavBar/view.js new file mode 100644 index 00000000..4b5dc852 --- /dev/null +++ b/client/build/containers/NavBar/view.js @@ -0,0 +1,121 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactRouterDom = require("react-router-dom"); + +var _Logo = _interopRequireDefault(require("@components/Logo")); + +var _NavBarChannelOptionsDropdown = _interopRequireDefault(require("@components/NavBarChannelOptionsDropdown")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var VIEW = 'VIEW'; +var LOGOUT = 'LOGOUT'; + +var NavBar = +/*#__PURE__*/ +function (_React$Component) { + function NavBar(props) { + var _this; + + _classCallCheck(this, NavBar); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(NavBar).call(this, props)); + _this.handleSelection = _this.handleSelection.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(NavBar, [{ + key: "componentDidMount", + value: function componentDidMount() { + this.props.checkForLoggedInChannel(); + } + }, { + key: "handleSelection", + value: function handleSelection(event) { + var value = event.target.selectedOptions[0].value; + + switch (value) { + case LOGOUT: + this.props.logOutChannel(); + break; + + case VIEW: + // redirect to channel page + this.props.history.push("/".concat(this.props.channelName, ":").concat(this.props.channelLongId)); + break; + + default: + break; + } + } + }, { + key: "render", + value: function render() { + var siteDescription = this.props.siteDescription; + return _react.default.createElement("div", { + className: "row row--wide nav-bar" + }, _react.default.createElement("div", { + className: "row row--padded row--short flex-container--row flex-container--space-between-center" + }, _react.default.createElement(_Logo.default, null), _react.default.createElement("div", { + className: "nav-bar--center" + }, _react.default.createElement("span", { + className: "nav-bar-tagline" + }, siteDescription)), _react.default.createElement("div", { + className: "nav-bar--right" + }, _react.default.createElement(_reactRouterDom.NavLink, { + className: "nav-bar-link link--nav", + activeClassName: "link--nav-active", + to: "/", + exact: true + }, "Publish"), _react.default.createElement(_reactRouterDom.NavLink, { + className: "nav-bar-link link--nav", + activeClassName: "link--nav-active", + to: "/about" + }, "About"), this.props.channelName ? _react.default.createElement(_NavBarChannelOptionsDropdown.default, { + channelName: this.props.channelName, + handleSelection: this.handleSelection, + defaultSelection: this.props.channelName, + VIEW: VIEW, + LOGOUT: LOGOUT + }) : _react.default.createElement(_reactRouterDom.NavLink, { + id: "nav-bar-login-link", + className: "nav-bar-link link--nav", + activeClassName: "link--nav-active", + to: "/login" + }, "Channel")))); + } + }]); + + _inherits(NavBar, _React$Component); + + return NavBar; +}(_react.default.Component); + +var _default = (0, _reactRouterDom.withRouter)(NavBar); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishDetails/index.js b/client/build/containers/PublishDetails/index.js new file mode 100644 index 00000000..65fd7c12 --- /dev/null +++ b/client/build/containers/PublishDetails/index.js @@ -0,0 +1,31 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _publish = require("../../actions/publish"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var channel = _ref.channel, + publish = _ref.publish; + return { + file: publish.file + }; +}; + +var mapDispatchToProps = { + clearFile: _publish.clearFile, + startPublish: _publish.startPublish +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishDetails/view.js b/client/build/containers/PublishDetails/view.js new file mode 100644 index 00000000..dfbcaf1e --- /dev/null +++ b/client/build/containers/PublishDetails/view.js @@ -0,0 +1,118 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactRouterDom = require("react-router-dom"); + +var _Dropzone = _interopRequireDefault(require("@containers/Dropzone")); + +var _PublishTitleInput = _interopRequireDefault(require("@containers/PublishTitleInput")); + +var _PublishUrlInput = _interopRequireDefault(require("@containers/PublishUrlInput")); + +var _PublishThumbnailInput = _interopRequireDefault(require("@containers/PublishThumbnailInput")); + +var _PublishMetadataInputs = _interopRequireDefault(require("@containers/PublishMetadataInputs")); + +var _ChannelSelect = _interopRequireDefault(require("@containers/ChannelSelect")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var PublishDetails = +/*#__PURE__*/ +function (_React$Component) { + function PublishDetails(props) { + var _this; + + _classCallCheck(this, PublishDetails); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(PublishDetails).call(this, props)); + _this.onPublishSubmit = _this.onPublishSubmit.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(PublishDetails, [{ + key: "onPublishSubmit", + value: function onPublishSubmit() { + this.props.startPublish(this.props.history); + } + }, { + key: "render", + value: function render() { + return _react.default.createElement("div", { + className: "row row--no-bottom" + }, _react.default.createElement("div", { + className: "column column--10" + }, _react.default.createElement(_PublishTitleInput.default, null)), _react.default.createElement("div", { + className: "column column--5 column--sml-10" + }, _react.default.createElement("div", { + className: "row row--padded" + }, _react.default.createElement(_Dropzone.default, null))), _react.default.createElement("div", { + className: "column column--5 column--sml-10 align-content-top" + }, _react.default.createElement("div", { + id: "publish-active-area", + className: "row row--padded" + }, _react.default.createElement("div", { + className: "row row--padded row--no-top row--wide" + }, _react.default.createElement(_PublishUrlInput.default, null)), _react.default.createElement("div", { + className: "row row--padded row--no-top row--wide" + }, _react.default.createElement(_ChannelSelect.default, null)), this.props.file.type === 'video/mp4' && _react.default.createElement("div", { + className: "row row--padded row--no-top row--wide " + }, _react.default.createElement(_PublishThumbnailInput.default, null)), _react.default.createElement("div", { + className: "row row--padded row--no-top row--no-bottom row--wide" + }, _react.default.createElement(_PublishMetadataInputs.default, null)), _react.default.createElement("div", { + className: "row row--wide align-content-center" + }, _react.default.createElement("button", { + id: "publish-submit", + className: "button--primary button--large", + onClick: this.onPublishSubmit + }, "Publish")), _react.default.createElement("div", { + className: "row row--padded row--no-bottom align-content-center" + }, _react.default.createElement("button", { + className: "button--cancel", + onClick: this.props.clearFile + }, "Cancel")), _react.default.createElement("div", { + className: "row row--short align-content-center" + }, _react.default.createElement("p", { + className: "fine-print" + }, "By clicking 'Publish', you affirm that you have the rights to publish this content to the LBRY network, and that you understand the properties of publishing it to a decentralized, user-controlled network. ", _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://lbry.io/learn" + }, "Read more.")))))); + } + }]); + + _inherits(PublishDetails, _React$Component); + + return PublishDetails; +}(_react.default.Component); + +; + +var _default = (0, _reactRouterDom.withRouter)(PublishDetails); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishDisabledMessage/index.js b/client/build/containers/PublishDisabledMessage/index.js new file mode 100644 index 00000000..92fd5c41 --- /dev/null +++ b/client/build/containers/PublishDisabledMessage/index.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var publish = _ref.publish; + return { + message: publish.disabledMessage + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, null)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishDisabledMessage/view.js b/client/build/containers/PublishDisabledMessage/view.js new file mode 100644 index 00000000..6e7ca290 --- /dev/null +++ b/client/build/containers/PublishDisabledMessage/view.js @@ -0,0 +1,59 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var PublishDisabledMessage = +/*#__PURE__*/ +function (_React$Component) { + function PublishDisabledMessage() { + _classCallCheck(this, PublishDisabledMessage); + + return _possibleConstructorReturn(this, _getPrototypeOf(PublishDisabledMessage).apply(this, arguments)); + } + + _createClass(PublishDisabledMessage, [{ + key: "render", + value: function render() { + var message = this.props.message; + return _react.default.createElement("div", { + className: "row dropzone--disabled row--tall flex-container--column flex-container--center-center" + }, _react.default.createElement("p", { + className: "text--disabled" + }, "Publishing is currently disabled."), _react.default.createElement("p", { + className: "text--disabled" + }, message)); + } + }]); + + _inherits(PublishDisabledMessage, _React$Component); + + return PublishDisabledMessage; +}(_react.default.Component); + +var _default = PublishDisabledMessage; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishMetadataInputs/index.js b/client/build/containers/PublishMetadataInputs/index.js new file mode 100644 index 00000000..04ee6f0e --- /dev/null +++ b/client/build/containers/PublishMetadataInputs/index.js @@ -0,0 +1,39 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _publish = require("../../actions/publish"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var publish = _ref.publish; + return { + showMetadataInputs: publish.showMetadataInputs, + description: publish.metadata.description, + license: publish.metadata.license, + nsfw: publish.metadata.nsfw + }; +}; + +var mapDispatchToProps = function mapDispatchToProps(dispatch) { + return { + onMetadataChange: function onMetadataChange(name, value) { + dispatch((0, _publish.updateMetadata)(name, value)); + }, + onToggleMetadataInputs: function onToggleMetadataInputs(value) { + dispatch((0, _publish.toggleMetadataInputs)(value)); + } + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishMetadataInputs/view.js b/client/build/containers/PublishMetadataInputs/view.js new file mode 100644 index 00000000..c3ee9ebe --- /dev/null +++ b/client/build/containers/PublishMetadataInputs/view.js @@ -0,0 +1,144 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _ExpandingTextArea = _interopRequireDefault(require("@components/ExpandingTextArea")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var PublishMetadataInputs = +/*#__PURE__*/ +function (_React$Component) { + function PublishMetadataInputs(props) { + var _this; + + _classCallCheck(this, PublishMetadataInputs); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(PublishMetadataInputs).call(this, props)); + _this.toggleShowInputs = _this.toggleShowInputs.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleInput = _this.handleInput.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleSelect = _this.handleSelect.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(PublishMetadataInputs, [{ + key: "toggleShowInputs", + value: function toggleShowInputs() { + this.props.onToggleMetadataInputs(!this.props.showMetadataInputs); + } + }, { + key: "handleInput", + value: function handleInput(event) { + var target = event.target; + var value = target.type === 'checkbox' ? target.checked : target.value; + var name = target.name; + this.props.onMetadataChange(name, value); + } + }, { + key: "handleSelect", + value: function handleSelect(event) { + var name = event.target.name; + var selectedOption = event.target.selectedOptions[0].value; + this.props.onMetadataChange(name, selectedOption); + } + }, { + key: "render", + value: function render() { + return _react.default.createElement("div", { + id: "publish-details", + className: "row row--padded row--no-top row--wide" + }, this.props.showMetadataInputs && _react.default.createElement("div", null, _react.default.createElement("div", { + className: "row row--no-top" + }, _react.default.createElement("div", { + className: "column column--3 column--med-10 align-content-top" + }, _react.default.createElement("label", { + htmlFor: "publish-license", + className: "label" + }, "Description:")), _react.default.createElement("div", { + className: "column column--7 column--sml-10" + }, _react.default.createElement(_ExpandingTextArea.default, { + id: "publish-description", + className: "textarea textarea--primary textarea--full-width", + rows: 1, + maxLength: 2000, + style: { + maxHeight: 200 + }, + name: "description", + placeholder: "Optional description", + value: this.props.description, + onChange: this.handleInput + }))), _react.default.createElement("div", { + className: "row row--no-top" + }, _react.default.createElement("div", { + className: "column column--3 column--med-10" + }, _react.default.createElement("label", { + htmlFor: "publish-license", + className: "label" + }, "License:")), _react.default.createElement("div", { + className: "column column--7 column--sml-10" + }, _react.default.createElement("select", { + type: "text", + name: "license", + id: "publish-license", + className: "select select--primary", + onChange: this.handleSelect + }, _react.default.createElement("option", { + value: " " + }, "Unspecified"), _react.default.createElement("option", { + value: "Public Domain" + }, "Public Domain"), _react.default.createElement("option", { + value: "Creative Commons" + }, "Creative Commons")))), _react.default.createElement("div", { + className: "row row--no-top" + }, _react.default.createElement("div", { + className: "column column--3" + }, _react.default.createElement("label", { + htmlFor: "publish-nsfw", + className: "label" + }, "Mature:")), _react.default.createElement("div", { + className: "column column--7" + }, _react.default.createElement("input", { + className: "input-checkbox", + type: "checkbox", + id: "publish-nsfw", + name: "nsfw", + value: this.props.nsfw, + onChange: this.handleInput + })))), _react.default.createElement("button", { + className: "button--secondary", + onClick: this.toggleShowInputs + }, this.props.showMetadataInputs ? 'less' : 'more')); + } + }]); + + _inherits(PublishMetadataInputs, _React$Component); + + return PublishMetadataInputs; +}(_react.default.Component); + +var _default = PublishMetadataInputs; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishStatus/index.js b/client/build/containers/PublishStatus/index.js new file mode 100644 index 00000000..c83bbfe1 --- /dev/null +++ b/client/build/containers/PublishStatus/index.js @@ -0,0 +1,30 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _publish = require("../../actions/publish"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var publish = _ref.publish; + return { + status: publish.status.status, + message: publish.status.message + }; +}; + +var mapDispatchToProps = { + clearFile: _publish.clearFile +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishStatus/view.js b/client/build/containers/PublishStatus/view.js new file mode 100644 index 00000000..9df6c73e --- /dev/null +++ b/client/build/containers/PublishStatus/view.js @@ -0,0 +1,96 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _ProgressBar = _interopRequireDefault(require("@components/ProgressBar")); + +var publishStates = _interopRequireWildcard(require("../../constants/publish_claim_states")); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var PublishStatus = +/*#__PURE__*/ +function (_React$Component) { + function PublishStatus() { + _classCallCheck(this, PublishStatus); + + return _possibleConstructorReturn(this, _getPrototypeOf(PublishStatus).apply(this, arguments)); + } + + _createClass(PublishStatus, [{ + key: "render", + value: function render() { + var _this$props = this.props, + status = _this$props.status, + message = _this$props.message, + clearFile = _this$props.clearFile; + return _react.default.createElement("div", { + className: "row row--tall flex-container--column flex-container--center-center" + }, status === publishStates.LOAD_START && _react.default.createElement("div", { + className: "row align-content-center" + }, _react.default.createElement("p", null, "File is loading to server"), _react.default.createElement("p", { + className: "blue" + }, "0%")), status === publishStates.LOADING && _react.default.createElement("div", null, _react.default.createElement("div", { + className: "row align-content-center" + }, _react.default.createElement("p", null, "File is loading to server"), _react.default.createElement("p", { + className: "blue" + }, message))), status === publishStates.PUBLISHING && _react.default.createElement("div", { + className: "row align-content-center" + }, _react.default.createElement("p", null, "Upload complete. Your file is now being published on the blockchain..."), _react.default.createElement(_ProgressBar.default, { + size: 12 + }), _react.default.createElement("p", null, "Curious what magic is happening here? ", _react.default.createElement("a", { + className: "link--primary", + target: "blank", + href: "https://lbry.io/faq/what-is-lbry" + }, "Learn more."))), status === publishStates.SUCCESS && _react.default.createElement("div", { + className: "row align-content-center" + }, _react.default.createElement("p", null, "Your publish is complete! You are being redirected to it now."), _react.default.createElement("p", null, "If you are not automatically redirected, ", _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: message + }, "click here."))), status === publishStates.FAILED && _react.default.createElement("div", { + className: "row align-content-center" + }, _react.default.createElement("p", null, "Something went wrong..."), _react.default.createElement("p", null, _react.default.createElement("strong", null, message)), _react.default.createElement("p", null, "For help, post the above error text in the #speech channel on the ", _react.default.createElement("a", { + className: "link--primary", + href: "https://chat.lbry.io", + target: "_blank" + }, "lbry discord")), _react.default.createElement("button", { + className: "button--secondary", + onClick: clearFile + }, "Reset"))); + } + }]); + + _inherits(PublishStatus, _React$Component); + + return PublishStatus; +}(_react.default.Component); + +; +var _default = PublishStatus; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishThumbnailInput/index.js b/client/build/containers/PublishThumbnailInput/index.js new file mode 100644 index 00000000..0c7381a3 --- /dev/null +++ b/client/build/containers/PublishThumbnailInput/index.js @@ -0,0 +1,29 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _publish = require("../../actions/publish"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var file = _ref.publish.file; + return { + file: file + }; +}; + +var mapDispatchToProps = { + onNewThumbnail: _publish.onNewThumbnail +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishThumbnailInput/view.js b/client/build/containers/PublishThumbnailInput/view.js new file mode 100644 index 00000000..d4767937 --- /dev/null +++ b/client/build/containers/PublishThumbnailInput/view.js @@ -0,0 +1,208 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function dataURItoBlob(dataURI) { + // convert base64/URLEncoded data component to raw binary data held in a string + var byteString = atob(dataURI.split(',')[1]); // separate out the mime component + + var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; // write the bytes of the string to a typed array + + var ia = new Uint8Array(byteString.length); + + for (var i = 0; i < byteString.length; i++) { + ia[i] = byteString.charCodeAt(i); + } + + return new Blob([ia], { + type: mimeString + }); +} + +var PublishThumbnailInput = +/*#__PURE__*/ +function (_React$Component) { + function PublishThumbnailInput(props) { + var _this; + + _classCallCheck(this, PublishThumbnailInput); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(PublishThumbnailInput).call(this, props)); + _this.state = { + videoSource: null, + error: null, + sliderMinRange: 1, + sliderMaxRange: null, + sliderValue: null + }; + _this.handleVideoLoadedData = _this.handleVideoLoadedData.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleSliderChange = _this.handleSliderChange.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.createThumbnail = _this.createThumbnail.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(PublishThumbnailInput, [{ + key: "componentDidMount", + value: function componentDidMount() { + var file = this.props.file; + this.setVideoSource(file); + } + }, { + key: "componentWillReceiveProps", + value: function componentWillReceiveProps(nextProps) { + // if file changes + if (nextProps.file && nextProps.file !== this.props.file) { + var file = nextProps.file; + this.setVideoSource(file); + } + + ; + } + }, { + key: "setVideoSource", + value: function setVideoSource(file) { + var _this2 = this; + + var previewReader = new FileReader(); + previewReader.readAsDataURL(file); + + previewReader.onloadend = function () { + var dataUri = previewReader.result; + var blob = dataURItoBlob(dataUri); + var videoSource = URL.createObjectURL(blob); + + _this2.setState({ + videoSource: videoSource + }); + }; + } + }, { + key: "handleVideoLoadedData", + value: function handleVideoLoadedData(event) { + var duration = event.target.duration; + var totalMinutes = Math.floor(duration / 60); + var totalSeconds = Math.floor(duration % 60); // set the slider + + this.setState({ + sliderMaxRange: duration * 100, + sliderValue: duration * 100 / 2, + totalMinutes: totalMinutes, + totalSeconds: totalSeconds + }); // update the current time of the video + + var video = document.getElementById('video-thumb-player'); + video.currentTime = duration / 2; + } + }, { + key: "handleSliderChange", + value: function handleSliderChange(event) { + var value = parseInt(event.target.value); // update the slider value + + this.setState({ + sliderValue: value + }); // update the current time of the video + + var video = document.getElementById('video-thumb-player'); + video.currentTime = value / 100; + } + }, { + key: "createThumbnail", + value: function createThumbnail() { + // take a snapshot + var video = document.getElementById('video-thumb-player'); + var canvas = document.createElement('canvas'); + canvas.width = video.videoWidth; + canvas.height = video.videoHeight; + canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height); + var dataUrl = canvas.toDataURL(); + var blob = dataURItoBlob(dataUrl); + var snapshot = new File([blob], "thumbnail.png", { + type: 'image/png' + }); // set the thumbnail in redux store + + if (snapshot) { + this.props.onNewThumbnail(snapshot); + } + } + }, { + key: "render", + value: function render() { + var _this$state = this.state, + error = _this$state.error, + videoSource = _this$state.videoSource, + sliderMinRange = _this$state.sliderMinRange, + sliderMaxRange = _this$state.sliderMaxRange, + sliderValue = _this$state.sliderValue, + totalMinutes = _this$state.totalMinutes, + totalSeconds = _this$state.totalSeconds; + return _react.default.createElement("div", null, _react.default.createElement("label", { + className: "label" + }, "Thumbnail:"), _react.default.createElement("video", { + id: "video-thumb-player", + preload: "metadata", + muted: true, + style: { + display: 'none' + }, + playsInline: true, + onLoadedData: this.handleVideoLoadedData, + src: videoSource, + onSeeked: this.createThumbnail + }), sliderValue ? _react.default.createElement("div", null, _react.default.createElement("div", { + className: "flex-container--row flex-container--space-between-center", + style: { + width: '100%' + } + }, _react.default.createElement("span", { + className: "info-message" + }, "0'00\""), _react.default.createElement("span", { + className: "info-message" + }, totalMinutes, "'", totalSeconds, "\"")), _react.default.createElement("div", null, _react.default.createElement("input", { + type: "range", + min: sliderMinRange, + max: sliderMaxRange, + value: sliderValue, + className: "slider", + onChange: this.handleSliderChange + }))) : _react.default.createElement("p", { + className: "info-message" + }, "loading... "), error ? _react.default.createElement("p", { + className: "info-message--failure" + }, error) : _react.default.createElement("p", { + className: "info-message" + }, "Use slider to set thumbnail")); + } + }]); + + _inherits(PublishThumbnailInput, _React$Component); + + return PublishThumbnailInput; +}(_react.default.Component); + +var _default = PublishThumbnailInput; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishTitleInput/index.js b/client/build/containers/PublishTitleInput/index.js new file mode 100644 index 00000000..924551e7 --- /dev/null +++ b/client/build/containers/PublishTitleInput/index.js @@ -0,0 +1,33 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _publish = require("../../actions/publish"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var publish = _ref.publish; + return { + title: publish.metadata.title + }; +}; + +var mapDispatchToProps = function mapDispatchToProps(dispatch) { + return { + onMetadataChange: function onMetadataChange(name, value) { + dispatch((0, _publish.updateMetadata)(name, value)); + } + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishTitleInput/view.js b/client/build/containers/PublishTitleInput/view.js new file mode 100644 index 00000000..6df6f6c1 --- /dev/null +++ b/client/build/containers/PublishTitleInput/view.js @@ -0,0 +1,71 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var PublishTitleInput = +/*#__PURE__*/ +function (_React$Component) { + function PublishTitleInput(props) { + var _this; + + _classCallCheck(this, PublishTitleInput); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(PublishTitleInput).call(this, props)); + _this.handleInput = _this.handleInput.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(PublishTitleInput, [{ + key: "handleInput", + value: function handleInput(e) { + var name = e.target.name; + var value = e.target.value; + this.props.onMetadataChange(name, value); + } + }, { + key: "render", + value: function render() { + return _react.default.createElement("input", { + type: "text", + id: "publish-title", + className: "input-text text--large input-text--full-width", + name: "title", + placeholder: "Give your post a title...", + onChange: this.handleInput, + value: this.props.title + }); + } + }]); + + _inherits(PublishTitleInput, _React$Component); + + return PublishTitleInput; +}(_react.default.Component); + +var _default = PublishTitleInput; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishTool/index.js b/client/build/containers/PublishTool/index.js new file mode 100644 index 00000000..f3fb26b0 --- /dev/null +++ b/client/build/containers/PublishTool/index.js @@ -0,0 +1,25 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var publish = _ref.publish; + return { + disabled: publish.disabled, + file: publish.file, + status: publish.status.status + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, null)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishTool/view.js b/client/build/containers/PublishTool/view.js new file mode 100644 index 00000000..0f678730 --- /dev/null +++ b/client/build/containers/PublishTool/view.js @@ -0,0 +1,73 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _Dropzone = _interopRequireDefault(require("@containers/Dropzone")); + +var _PublishDetails = _interopRequireDefault(require("@containers/PublishDetails")); + +var _PublishStatus = _interopRequireDefault(require("@containers/PublishStatus")); + +var _PublishDisabledMessage = _interopRequireDefault(require("@containers/PublishDisabledMessage")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var PublishTool = +/*#__PURE__*/ +function (_React$Component) { + function PublishTool() { + _classCallCheck(this, PublishTool); + + return _possibleConstructorReturn(this, _getPrototypeOf(PublishTool).apply(this, arguments)); + } + + _createClass(PublishTool, [{ + key: "render", + value: function render() { + if (this.props.disabled) { + return _react.default.createElement(_PublishDisabledMessage.default, null); + } else { + if (this.props.file) { + if (this.props.status) { + return _react.default.createElement(_PublishStatus.default, null); + } else { + return _react.default.createElement(_PublishDetails.default, null); + } + } + + return _react.default.createElement(_Dropzone.default, null); + } + } + }]); + + _inherits(PublishTool, _React$Component); + + return PublishTool; +}(_react.default.Component); + +; +var _default = PublishTool; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishUrlInput/index.js b/client/build/containers/PublishUrlInput/index.js new file mode 100644 index 00000000..37b9bb38 --- /dev/null +++ b/client/build/containers/PublishUrlInput/index.js @@ -0,0 +1,38 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _publish = require("../../actions/publish"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var channel = _ref.channel, + publish = _ref.publish; + return { + loggedInChannelName: channel.loggedInChannel.name, + loggedInChannelShortId: channel.loggedInChannel.shortId, + fileName: publish.file.name, + publishInChannel: publish.publishInChannel, + selectedChannel: publish.selectedChannel, + claim: publish.claim, + urlError: publish.error.url + }; +}; + +var mapDispatchToProps = { + validateClaim: _publish.validateClaim, + updateClaim: _publish.updateClaim, + updateError: _publish.updateError +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/PublishUrlInput/view.js b/client/build/containers/PublishUrlInput/view.js new file mode 100644 index 00000000..61fb19be --- /dev/null +++ b/client/build/containers/PublishUrlInput/view.js @@ -0,0 +1,149 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _PublishUrlMiddleDisplay = _interopRequireDefault(require("@components/PublishUrlMiddleDisplay")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +var PublishUrlInput = +/*#__PURE__*/ +function (_React$Component) { + function PublishUrlInput(props) { + var _this; + + _classCallCheck(this, PublishUrlInput); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(PublishUrlInput).call(this, props)); + _this.handleInput = _this.handleInput.bind(_assertThisInitialized(_assertThisInitialized(_this))); + return _this; + } + + _createClass(PublishUrlInput, [{ + key: "cleanseInput", + value: function cleanseInput(input) { + input = input.replace(/\s+/g, '-'); + input = input.replace(/[^A-Za-z0-9-]/g, ''); + return input; + } + }, { + key: "componentDidMount", + value: function componentDidMount() { + var _this$props = this.props, + claim = _this$props.claim, + fileName = _this$props.fileName; + + if (!claim) { + this.setInitialClaimName(fileName); + } + } + }, { + key: "componentWillReceiveProps", + value: function componentWillReceiveProps(_ref) { + var claim = _ref.claim, + fileName = _ref.fileName; + + // if a new file was chosen, update the claim name + if (fileName !== this.props.fileName) { + return this.setInitialClaimName(fileName); + } + } + }, { + key: "setInitialClaimName", + value: function setInitialClaimName(fileName) { + var fileNameWithoutEnding = fileName.substring(0, fileName.lastIndexOf('.')); + var cleanFileName = this.cleanseInput(fileNameWithoutEnding); + this.updateAndValidateClaimInput(cleanFileName); + } + }, { + key: "handleInput", + value: function handleInput(event) { + var value = event.target.value; + value = this.cleanseInput(value); + this.updateAndValidateClaimInput(value); + } + }, { + key: "updateAndValidateClaimInput", + value: function updateAndValidateClaimInput(value) { + if (value) { + this.props.validateClaim(value); + } else { + this.props.updateError('url', 'Choose a custom url'); + } + + this.props.updateClaim(value); + } + }, { + key: "render", + value: function render() { + var _this$props2 = this.props, + claim = _this$props2.claim, + loggedInChannelName = _this$props2.loggedInChannelName, + loggedInChannelShortId = _this$props2.loggedInChannelShortId, + publishInChannel = _this$props2.publishInChannel, + selectedChannel = _this$props2.selectedChannel, + urlError = _this$props2.urlError; + return _react.default.createElement("div", { + className: "column column--10 column--sml-10" + }, _react.default.createElement("div", { + className: "input-text--primary span--relative" + }, _react.default.createElement("span", { + className: "url-text--secondary" + }, "spee.ch / "), _react.default.createElement(_PublishUrlMiddleDisplay.default, { + publishInChannel: publishInChannel, + selectedChannel: selectedChannel, + loggedInChannelName: loggedInChannelName, + loggedInChannelShortId: loggedInChannelShortId + }), _react.default.createElement("input", { + type: "text", + id: "claim-name-input", + className: "input-text", + name: "claim", + placeholder: "your-url-here", + onChange: this.handleInput, + value: claim + }), claim && !urlError && _react.default.createElement("span", { + id: "input-success-claim-name", + className: "info-message--success span--absolute" + }, "\u2713"), urlError && _react.default.createElement("span", { + id: "input-success-channel-name", + className: "info-message--failure span--absolute" + }, "\u2716")), _react.default.createElement("div", null, urlError ? _react.default.createElement("p", { + id: "input-error-claim-name", + className: "info-message--failure" + }, urlError) : _react.default.createElement("p", { + className: "info-message" + }, "Choose a custom url"))); + } + }]); + + _inherits(PublishUrlInput, _React$Component); + + return PublishUrlInput; +}(_react.default.Component); + +var _default = PublishUrlInput; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ShowAssetDetails/index.js b/client/build/containers/ShowAssetDetails/index.js new file mode 100644 index 00000000..092c5daa --- /dev/null +++ b/client/build/containers/ShowAssetDetails/index.js @@ -0,0 +1,38 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var show = _ref.show; + // select request info + var requestId = show.request.id; // select asset info + + var asset; + var request = show.requestList[requestId] || null; + var assetList = show.assetList; + + if (request && assetList) { + var assetKey = request.key; // note: just store this in the request + + asset = assetList[assetKey] || null; + } + + ; // return props + + return { + asset: asset + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, null)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ShowAssetDetails/view.js b/client/build/containers/ShowAssetDetails/view.js new file mode 100644 index 00000000..9fc8559f --- /dev/null +++ b/client/build/containers/ShowAssetDetails/view.js @@ -0,0 +1,90 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _SEO = _interopRequireDefault(require("@components/SEO")); + +var _NavBar = _interopRequireDefault(require("../NavBar")); + +var _ErrorPage = _interopRequireDefault(require("../../pages/ErrorPage")); + +var _AssetTitle = _interopRequireDefault(require("../AssetTitle")); + +var _AssetDisplay = _interopRequireDefault(require("../AssetDisplay")); + +var _AssetInfo = _interopRequireDefault(require("../AssetInfo")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var ShowAssetDetails = +/*#__PURE__*/ +function (_React$Component) { + function ShowAssetDetails() { + _classCallCheck(this, ShowAssetDetails); + + return _possibleConstructorReturn(this, _getPrototypeOf(ShowAssetDetails).apply(this, arguments)); + } + + _createClass(ShowAssetDetails, [{ + key: "render", + value: function render() { + var asset = this.props.asset; + + if (asset) { + var name = asset.claimData.name; + return _react.default.createElement("div", null, _react.default.createElement(_SEO.default, { + pageTitle: "".concat(name, " - details"), + asset: asset + }), _react.default.createElement(_NavBar.default, null), _react.default.createElement("div", { + className: "row row--tall row--padded" + }, _react.default.createElement("div", { + className: "column column--10" + }, _react.default.createElement(_AssetTitle.default, null)), _react.default.createElement("div", { + className: "column column--5 column--sml-10 align-content-top" + }, _react.default.createElement("div", { + className: "row row--padded show-details-container" + }, _react.default.createElement(_AssetDisplay.default, null))), _react.default.createElement("div", { + className: "column column--5 column--sml-10 align-content-top" + }, _react.default.createElement("div", { + className: "row row--padded" + }, _react.default.createElement(_AssetInfo.default, null))))); + } + + ; + return _react.default.createElement(_ErrorPage.default, { + error: 'loading asset data...' + }); + } + }]); + + _inherits(ShowAssetDetails, _React$Component); + + return ShowAssetDetails; +}(_react.default.Component); + +; +var _default = ShowAssetDetails; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ShowAssetLite/index.js b/client/build/containers/ShowAssetLite/index.js new file mode 100644 index 00000000..092c5daa --- /dev/null +++ b/client/build/containers/ShowAssetLite/index.js @@ -0,0 +1,38 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var show = _ref.show; + // select request info + var requestId = show.request.id; // select asset info + + var asset; + var request = show.requestList[requestId] || null; + var assetList = show.assetList; + + if (request && assetList) { + var assetKey = request.key; // note: just store this in the request + + asset = assetList[assetKey] || null; + } + + ; // return props + + return { + asset: asset + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, null)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ShowAssetLite/view.js b/client/build/containers/ShowAssetLite/view.js new file mode 100644 index 00000000..7221a145 --- /dev/null +++ b/client/build/containers/ShowAssetLite/view.js @@ -0,0 +1,79 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactRouterDom = require("react-router-dom"); + +var _SEO = _interopRequireDefault(require("@components/SEO")); + +var _AssetDisplay = _interopRequireDefault(require("../AssetDisplay")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var ShowLite = +/*#__PURE__*/ +function (_React$Component) { + function ShowLite() { + _classCallCheck(this, ShowLite); + + return _possibleConstructorReturn(this, _getPrototypeOf(ShowLite).apply(this, arguments)); + } + + _createClass(ShowLite, [{ + key: "render", + value: function render() { + var asset = this.props.asset; + + if (asset) { + var _asset$claimData = asset.claimData, + name = _asset$claimData.name, + claimId = _asset$claimData.claimId; + return _react.default.createElement("div", { + className: "row row--tall flex-container--column flex-container--center-center show-lite-container" + }, _react.default.createElement(_SEO.default, { + pageTitle: name, + asset: asset + }), _react.default.createElement(_AssetDisplay.default, null), _react.default.createElement(_reactRouterDom.Link, { + id: "asset-boilerpate", + className: "link--primary fine-print", + to: "/".concat(claimId, "/").concat(name) + }, "hosted via Spee.ch")); + } + + return _react.default.createElement("div", { + className: "row row--tall row--padded flex-container--column flex-container--center-center" + }, _react.default.createElement("p", null, "loading asset data...")); + } + }]); + + _inherits(ShowLite, _React$Component); + + return ShowLite; +}(_react.default.Component); + +; +var _default = ShowLite; +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ShowChannel/index.js b/client/build/containers/ShowChannel/index.js new file mode 100644 index 00000000..9c3d0661 --- /dev/null +++ b/client/build/containers/ShowChannel/index.js @@ -0,0 +1,35 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var show = _ref.show; + // select request info + var requestId = show.request.id; // select request + + var previousRequest = show.requestList[requestId] || null; // select channel + + var channel; + + if (previousRequest) { + var channelKey = previousRequest.key; + channel = show.channelList[channelKey] || null; + } + + return { + channel: channel + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, null)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/ShowChannel/view.js b/client/build/containers/ShowChannel/view.js new file mode 100644 index 00000000..741bcd7f --- /dev/null +++ b/client/build/containers/ShowChannel/view.js @@ -0,0 +1,86 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _SEO = _interopRequireDefault(require("@components/SEO")); + +var _ErrorPage = _interopRequireDefault(require("@pages/ErrorPage")); + +var _NavBar = _interopRequireDefault(require("../NavBar")); + +var _ChannelClaimsDisplay = _interopRequireDefault(require("../ChannelClaimsDisplay")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var ShowChannel = +/*#__PURE__*/ +function (_React$Component) { + function ShowChannel() { + _classCallCheck(this, ShowChannel); + + return _possibleConstructorReturn(this, _getPrototypeOf(ShowChannel).apply(this, arguments)); + } + + _createClass(ShowChannel, [{ + key: "render", + value: function render() { + var channel = this.props.channel; + + if (channel) { + var name = channel.name, + longId = channel.longId, + shortId = channel.shortId; + return _react.default.createElement("div", null, _react.default.createElement(_SEO.default, { + pageTitle: name, + channel: channel + }), _react.default.createElement(_NavBar.default, null), _react.default.createElement("div", { + className: "row row--tall row--padded" + }, _react.default.createElement("div", { + className: "column column--10" + }, _react.default.createElement("h2", null, "channel name: ", name), _react.default.createElement("p", { + className: 'fine-print' + }, "full channel id: ", longId), _react.default.createElement("p", { + className: 'fine-print' + }, "short channel id: ", shortId)), _react.default.createElement("div", { + className: "column column--10" + }, _react.default.createElement(_ChannelClaimsDisplay.default, null)))); + } + + ; + return _react.default.createElement(_ErrorPage.default, { + error: 'loading channel data...' + }); + } + }]); + + _inherits(ShowChannel, _React$Component); + + return ShowChannel; +}(_react.default.Component); + +; +var _default = ShowChannel; +exports.default = _default; \ No newline at end of file diff --git a/client/build/index.js b/client/build/index.js new file mode 100644 index 00000000..60a738d7 --- /dev/null +++ b/client/build/index.js @@ -0,0 +1,26 @@ +"use strict"; + +var _app = _interopRequireDefault(require("./app")); + +var _reducers = _interopRequireDefault(require("./reducers")); + +var _sagas = _interopRequireDefault(require("./sagas")); + +var _actions = _interopRequireDefault(require("./actions")); + +var _GAListener = _interopRequireDefault(require("./components/GAListener")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// app, reducers, sagas, actions +// can it be a function and pass in the config like this?, +// or should all the configs just come from the store (assuming the initial config can be used to config the store)? +module.exports = { + App: _app.default, + Reducers: _reducers.default, + Sagas: _sagas.default, + // includes all the sagas + Actions: _actions.default, + // includes all the actions + GAListener: _GAListener.default +}; \ No newline at end of file diff --git a/client/build/pages/AboutPage/index.js b/client/build/pages/AboutPage/index.js new file mode 100644 index 00000000..0ef791cf --- /dev/null +++ b/client/build/pages/AboutPage/index.js @@ -0,0 +1,103 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _SEO = _interopRequireDefault(require("@components/SEO")); + +var _NavBar = _interopRequireDefault(require("@containers/NavBar")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var AboutPage = +/*#__PURE__*/ +function (_React$Component) { + function AboutPage() { + _classCallCheck(this, AboutPage); + + return _possibleConstructorReturn(this, _getPrototypeOf(AboutPage).apply(this, arguments)); + } + + _createClass(AboutPage, [{ + key: "render", + value: function render() { + return _react.default.createElement("div", null, _react.default.createElement(_SEO.default, { + pageTitle: 'About', + pageUri: 'about' + }), _react.default.createElement(_NavBar.default, null), _react.default.createElement("div", { + className: "row row--padded" + }, _react.default.createElement("div", { + className: "column column--5 column--med-10 align-content-top" + }, _react.default.createElement("div", { + className: "column column--8 column--med-10" + }, _react.default.createElement("p", { + className: "pull-quote" + }, "Spee.ch is an open-source project. Please contribute to the existing site, or fork it and make your own."), _react.default.createElement("p", null, _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://twitter.com/spee_ch" + }, "TWITTER")), _react.default.createElement("p", null, _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://github.com/lbryio/spee.ch" + }, "GITHUB")), _react.default.createElement("p", null, _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://discord.gg/YjYbwhS" + }, "DISCORD CHANNEL")), _react.default.createElement("p", null, _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "https://github.com/lbryio/spee.ch/blob/master/README.md" + }, "DOCUMENTATION")))), _react.default.createElement("div", { + className: "column column--5 column--med-10 align-content-top" + }, _react.default.createElement("div", { + className: "column column--8 column--med-10" + }, _react.default.createElement("p", null, "Spee.ch is a media-hosting site that reads from and publishes content to the ", _react.default.createElement("a", { + className: "link--primary", + href: "https://lbry.io" + }, "LBRY"), " blockchain."), _react.default.createElement("p", null, "Spee.ch is a hosting service, but with the added benefit that it stores your content on a decentralized network of computers -- the ", _react.default.createElement("a", { + className: "link--primary", + href: "https://lbry.io/get" + }, "LBRY"), " network. This means that your images are stored in multiple locations without a single point of failure."), _react.default.createElement("h3", null, "Contribute"), _react.default.createElement("p", null, "If you have an idea for your own spee.ch-like site on top of LBRY, fork our ", _react.default.createElement("a", { + className: "link--primary", + href: "https://github.com/lbryio/spee.ch" + }, "github repo"), " and go to town!"), _react.default.createElement("p", null, "If you want to improve spee.ch, join our ", _react.default.createElement("a", { + className: "link--primary", + href: "https://chat.lbry.io" + }, "discord channel"), " or solve one of our ", _react.default.createElement("a", { + className: "link--primary", + href: "https://github.com/lbryio/spee.ch/issues" + }, "github issues"), "."))))); + } + }]); + + _inherits(AboutPage, _React$Component); + + return AboutPage; +}(_react.default.Component); + +; +var _default = AboutPage; +exports.default = _default; \ No newline at end of file diff --git a/client/build/pages/ErrorPage/index.js b/client/build/pages/ErrorPage/index.js new file mode 100644 index 00000000..16d290df --- /dev/null +++ b/client/build/pages/ErrorPage/index.js @@ -0,0 +1,63 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _NavBar = _interopRequireDefault(require("@containers/NavBar")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var ErrorPage = +/*#__PURE__*/ +function (_React$Component) { + function ErrorPage() { + _classCallCheck(this, ErrorPage); + + return _possibleConstructorReturn(this, _getPrototypeOf(ErrorPage).apply(this, arguments)); + } + + _createClass(ErrorPage, [{ + key: "render", + value: function render() { + var error = this.props.error; + return _react.default.createElement("div", null, _react.default.createElement(_NavBar.default, null), _react.default.createElement("div", { + className: "row row--padded" + }, _react.default.createElement("p", null, error))); + } + }]); + + _inherits(ErrorPage, _React$Component); + + return ErrorPage; +}(_react.default.Component); + +; +ErrorPage.propTypes = { + error: _propTypes.default.string.isRequired +}; +var _default = ErrorPage; +exports.default = _default; \ No newline at end of file diff --git a/client/build/pages/FourOhFourPage/index.js b/client/build/pages/FourOhFourPage/index.js new file mode 100644 index 00000000..0dd8b1cd --- /dev/null +++ b/client/build/pages/FourOhFourPage/index.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var _ref$site = _ref.site, + host = _ref$site.host, + title = _ref$site.title; + return { + host: host, + title: title + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, null)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/pages/FourOhFourPage/view.js b/client/build/pages/FourOhFourPage/view.js new file mode 100644 index 00000000..cc7c9260 --- /dev/null +++ b/client/build/pages/FourOhFourPage/view.js @@ -0,0 +1,65 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactHelmet = _interopRequireDefault(require("react-helmet")); + +var _index = _interopRequireDefault(require("@containers/NavBar/index")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var FourOhForPage = +/*#__PURE__*/ +function (_React$Component) { + function FourOhForPage() { + _classCallCheck(this, FourOhForPage); + + return _possibleConstructorReturn(this, _getPrototypeOf(FourOhForPage).apply(this, arguments)); + } + + _createClass(FourOhForPage, [{ + key: "render", + value: function render() { + var _this$props = this.props, + title = _this$props.title, + host = _this$props.host; + return _react.default.createElement("div", null, _react.default.createElement(_reactHelmet.default, null, _react.default.createElement("title", null, title, " - 404"), _react.default.createElement("link", { + rel: "canonical", + href: "".concat(host, "/404") + })), _react.default.createElement(_index.default, null), _react.default.createElement("div", { + className: "row row--padded" + }, _react.default.createElement("h2", null, "404"), _react.default.createElement("p", null, "That page does not exist"))); + } + }]); + + _inherits(FourOhForPage, _React$Component); + + return FourOhForPage; +}(_react.default.Component); + +; +var _default = FourOhForPage; +exports.default = _default; \ No newline at end of file diff --git a/client/build/pages/HomePage/index.js b/client/build/pages/HomePage/index.js new file mode 100644 index 00000000..d32b3b38 --- /dev/null +++ b/client/build/pages/HomePage/index.js @@ -0,0 +1,63 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _SEO = _interopRequireDefault(require("@components/SEO")); + +var _NavBar = _interopRequireDefault(require("@containers/NavBar")); + +var _PublishTool = _interopRequireDefault(require("@containers/PublishTool")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var HomePage = +/*#__PURE__*/ +function (_React$Component) { + function HomePage() { + _classCallCheck(this, HomePage); + + return _possibleConstructorReturn(this, _getPrototypeOf(HomePage).apply(this, arguments)); + } + + _createClass(HomePage, [{ + key: "render", + value: function render() { + return _react.default.createElement("div", { + className: 'row row--tall flex-container--column' + }, _react.default.createElement(_SEO.default, null), _react.default.createElement(_NavBar.default, null), _react.default.createElement("div", { + className: 'row row--tall row--padded flex-container--column' + }, _react.default.createElement(_PublishTool.default, null))); + } + }]); + + _inherits(HomePage, _React$Component); + + return HomePage; +}(_react.default.Component); + +; +var _default = HomePage; +exports.default = _default; \ No newline at end of file diff --git a/client/build/pages/LoginPage/index.js b/client/build/pages/LoginPage/index.js new file mode 100644 index 00000000..0010f82e --- /dev/null +++ b/client/build/pages/LoginPage/index.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var channel = _ref.channel; + return { + loggedInChannelName: channel.loggedInChannel.name + }; +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, null)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/pages/LoginPage/view.js b/client/build/pages/LoginPage/view.js new file mode 100644 index 00000000..e977686e --- /dev/null +++ b/client/build/pages/LoginPage/view.js @@ -0,0 +1,98 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactRouterDom = require("react-router-dom"); + +var _SEO = _interopRequireDefault(require("@components/SEO")); + +var _NavBar = _interopRequireDefault(require("@containers/NavBar")); + +var _ChannelLoginForm = _interopRequireDefault(require("@containers/ChannelLoginForm")); + +var _ChannelCreateForm = _interopRequireDefault(require("@containers/ChannelCreateForm")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var LoginPage = +/*#__PURE__*/ +function (_React$Component) { + function LoginPage() { + _classCallCheck(this, LoginPage); + + return _possibleConstructorReturn(this, _getPrototypeOf(LoginPage).apply(this, arguments)); + } + + _createClass(LoginPage, [{ + key: "componentWillReceiveProps", + value: function componentWillReceiveProps(newProps) { + // re-route the user to the homepage if the user is logged in + if (newProps.loggedInChannelName !== this.props.loggedInChannelName) { + this.props.history.push("/"); + } + } + }, { + key: "render", + value: function render() { + return _react.default.createElement("div", null, _react.default.createElement(_SEO.default, { + pageTitle: 'Login', + pageUri: 'login' + }), _react.default.createElement(_NavBar.default, null), _react.default.createElement("div", { + className: "row row--padded" + }, _react.default.createElement("div", { + className: "column column--5 column--med-10 align-content-top" + }, _react.default.createElement("div", { + className: "column column--8 column--med-10" + }, _react.default.createElement("p", null, "Channels allow you to publish and group content under an identity. You can create a channel for yourself, or share one with like-minded friends. You can create 1 channel, or 100, so whether you're ", _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "/@catalonia2017:43dcf47163caa21d8404d9fe9b30f78ef3e146a8" + }, "documenting important events"), ", or making a public repository for ", _react.default.createElement("a", { + className: "link--primary", + target: "_blank", + href: "/@catGifs" + }, "cat gifs"), " (password: '1234'), try creating a channel for it!"))), _react.default.createElement("div", { + className: "column column--5 column--med-10 align-content-top" + }, _react.default.createElement("div", { + className: "column column--8 column--med-10" + }, _react.default.createElement("h3", { + className: "h3--no-bottom" + }, "Log in to an existing channel:"), _react.default.createElement(_ChannelLoginForm.default, null), _react.default.createElement("h3", { + className: "h3--no-bottom" + }, "Create a brand new channel:"), _react.default.createElement(_ChannelCreateForm.default, null))))); + } + }]); + + _inherits(LoginPage, _React$Component); + + return LoginPage; +}(_react.default.Component); + +; + +var _default = (0, _reactRouterDom.withRouter)(LoginPage); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/pages/MultisitePage/index.js b/client/build/pages/MultisitePage/index.js new file mode 100644 index 00000000..8af52497 --- /dev/null +++ b/client/build/pages/MultisitePage/index.js @@ -0,0 +1,102 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _SEO = _interopRequireDefault(require("@components/SEO")); + +var _NavBar = _interopRequireDefault(require("@containers/NavBar")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var MultisitePage = +/*#__PURE__*/ +function (_React$Component) { + function MultisitePage() { + _classCallCheck(this, MultisitePage); + + return _possibleConstructorReturn(this, _getPrototypeOf(MultisitePage).apply(this, arguments)); + } + + _createClass(MultisitePage, [{ + key: "render", + value: function render() { + return _react.default.createElement("div", null, _react.default.createElement(_SEO.default, { + pageTitle: 'Multisite', + pageUri: 'multisite' + }), _react.default.createElement(_NavBar.default, null), _react.default.createElement("div", { + className: "row row--padded flex-container--row flex-container--center-center" + }, _react.default.createElement("div", { + className: "column column--8 column--med-10" + }, _react.default.createElement("p", { + className: "pull-quote" + }, "Introducing Spee.ch Multisite"), _react.default.createElement("p", null, "Hi there! My name is ", _react.default.createElement("a", { + href: 'https://github.com/billbitt', + target: '_blank' + }, "Bill"), ", and I\u2019d like to speak with you about Spee.ch. No, not \u2018speech,\u2019 \u2018", _react.default.createElement("i", null, _react.default.createElement("a", { + href: 'https://spee.ch', + target: '_blank' + }, "Spee.ch.")), "\u2019 You know what, just read on..."), _react.default.createElement("h2", null, "A Little Background"), _react.default.createElement("p", null, "Wow, time flies! A little over a year ago Spee.ch was nothing more than a glimmer in the eye of LBRY CEO Jeremy Kaufman. At that time, the ", _react.default.createElement("a", { + href: 'https://lbry.io/faq/what-is-lbry', + target: '_blank' + }, "LBRY protocol"), " was still so early in its development, that there were no web-based applications for interacting with the LBRY blockchain. But then, something beautiful happened. On March 29th, 2017, Jeremy sat down with Jack, and together they ", _react.default.createElement("a", { + href: 'https://www.youtube.com/watch?v=C9LCapt_OYw', + target: '_blank' + }, "live coded a single-page PHP site"), " that could publish images to the LBRY network. And just like that, Spee.ch was born!"), _react.default.createElement("p", null, "Being that LBRY is an open source project, Jeremy ended the session by inviting community members who were interested in the project to take the reigns and see where Spee.ch could go. I was one of the devs that did just that, and it wasn\u2019t long before I was on a weekly call dedicated to this project with contributors from around the world."), _react.default.createElement("p", null, "At this point in time, the vision for Spee.ch was pretty simple: create a web-based hosting service that used the LBRY network as a database for free image and video sharing. In other words, an \u2018imgur on the blockchain.\u2019"), _react.default.createElement("h2", null, "Growth"), _react.default.createElement("p", null, "You might be wondering, \u201CSo, what has the Spee.ch team been doing since then?\u201D. Well, that is a great question. I\u2019m glad you asked."), _react.default.createElement("p", null, "As it turned out, the initial single-serving site was only the beginning. We wanted to add more features, improve user experience, and continue to rapidly innovate on new ideas to explore what web-based image-hosting on the blockchain could look like. And now -- a couple of re-designs, ", _react.default.createElement("a", { + href: 'https://github.com/lbryio/spee.ch', + target: '_blank' + }, "1,428 commits"), ", and ", _react.default.createElement("a", { + href: 'https://github.com/lbryio/spee.ch/graphs/contributors', + target: '_blank' + }, "18 contributors"), " later (as of the time of this writing) -- we\u2019ve been through a lot of changes. We changed the URL scheme, switched out the PHP for Javascript (sorry Jeremy!), added more HTML pages, removed those HTML pages, added Handlebars, removed most of Handlebars, added React, and... you get the picture."), _react.default.createElement("p", null, "It\u2019s been a lot of work, and through all of these changes, we have been guided by our original vision: develop a free web app that allows users to share images and video using a blockchain."), _react.default.createElement("p", null, "However, we ask ourselves constantly: what else can we be doing? What can we be doing differently? What features can we be doing better? And it is those kinds of questions that lead us to this post."), _react.default.createElement("h2", null, "A New Initiative"), _react.default.createElement("p", null, "As Spee.ch developed, we were lucky to find an amazing community spring up around the project that contributed bug reports, bug fixes, feature requests, pull requests, etc., but ultimately we are limited by the hours we have in the day, and while some requests get prioritized, others get shelved. "), _react.default.createElement("p", null, "So we started wondering: What if instead of having the community help us build our platform, we started helping them build theirs? We started mulling this over, and the more we thought about it the more we liked it. And thus, Spee.ch Multisite was born."), _react.default.createElement("h2", null, "Spee.ch Multisite"), _react.default.createElement("p", null, "The vision for Spee.ch Multisite is to maintain a foundational codebase that will support a greater variety of content-sharing web apps built on LBRY, allowing these apps to publish and retrieve content from the network via the blockchain."), _react.default.createElement("h3", null, "Run Your Own Spee.ch!"), _react.default.createElement("p", null, "Ok, here\u2019s the tl:dr: the purpose of the Spee.ch Multisite initiative is to enable you to run your own version of Spee.ch."), _react.default.createElement("p", null, "Spee.ch Multisite will provide a helpful set of basic code to get you going, but we purposefully want to give you control and provide a sandbox in which you can develop the look, content, and features for your site. The shared code base will be developed to support you in that quest. "), _react.default.createElement("p", null, "So if you don\u2019t want your site called or looking anything like Spee.ch, we encourage that! Don\u2019t hesitate to make it your own!"), _react.default.createElement("h3", null, "For the Community by the Community"), _react.default.createElement("p", null, "Initially, sites built on Spee.ch Multisite will look a lot like Spee.ch, but you will be able to add custom pages, update the look of components, and limit the content on your spee.ch site as you see fit."), _react.default.createElement("p", null, "Over time, it is our hope that the project will grow to incorporate many more components and features developed by us and the community to support a wide variety of functionalities beyond what the current spee.ch site is capable of."), _react.default.createElement("h3", null, "A Common Codebase"), _react.default.createElement("p", null, "If you have been following the project, you may have already noticed that the original github repository has grown into three: ", _react.default.createElement("a", { + href: 'https://github.com/lbryio/www.spee.ch', + target: '_blank' + }, "www.spee.ch"), ", ", _react.default.createElement("a", { + href: 'https://github.com/lbryio/spee.ch', + target: '_blank' + }, "spee.ch"), ", and ", _react.default.createElement("a", { + href: 'https://github.com/lbryio/spee.ch-components', + target: '_blank' + }, "spee.ch-components"), ". I will save the specifics for a future tech-focused blog post in the coming weeks, but the reason for these changes is to modularise the code so that is it easier for anyone who wants to run their own version of Spee.ch to do so, and to be able to customize their Spee.ch to their liking."), _react.default.createElement("h3", null, "What About the Flagship Spee.ch Site?"), _react.default.createElement("p", null, "Don\u2019t worry! If you like using ", _react.default.createElement("a", { + href: 'https://spee.ch', + target: '_blank' + }, "Spee.ch"), " and have no intention of running your own site, we will still be here running it for you! We are dedicated to pushing it forward and using it as patient zero for all additions to the Spee.ch Multisite codebase."), _react.default.createElement("h2", null, "Join Us"), _react.default.createElement("p", null, "Friday, May 18, we will be hosting a live demo showcasing the alpha version of Spee.ch Multisite. It\u2019s still quite young, but that\u2019s the point: we want to realize this vision together."), _react.default.createElement("p", null, _react.default.createElement("b", null, _react.default.createElement("a", { + href: 'https://speech.rsvpify.com/', + target: '_blank' + }, "CLICK HERE TO RSVP!"))), _react.default.createElement("p", null, "At this first demonstration, we will walk through preparing a server environment, installing LBRY and Spee.ch, and how to make local changes to your Spee.ch instance. Details below:"), _react.default.createElement("ul", null, _react.default.createElement("li", null, "When: Friday, May 18, 2018"), _react.default.createElement("li", null, "Time: 5:00 p.m. PST"), _react.default.createElement("li", null, "Where: Google Hangouts"), _react.default.createElement("li", null, "Link: ", _react.default.createElement("a", { + href: 'https://meet.google.com/aex-ghqg-kcs', + target: '_blank' + }, "meet.google.com/aex-ghqg-kcs")), _react.default.createElement("li", null, "System Requirements: If you have a server, please make sure you have MySql, Node and NPM installed. If you need help installing the above, or if you need a server to run your own instance on, please join the Hangout 30 minutes ahead of time and we will help get you set up =]"), _react.default.createElement("li", null, "Questions: hello@lbry.io"))))); + } + }]); + + _inherits(MultisitePage, _React$Component); + + return MultisitePage; +}(_react.default.Component); + +; +var _default = MultisitePage; +exports.default = _default; \ No newline at end of file diff --git a/client/build/pages/ShowPage/index.js b/client/build/pages/ShowPage/index.js new file mode 100644 index 00000000..b36a485b --- /dev/null +++ b/client/build/pages/ShowPage/index.js @@ -0,0 +1,30 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _reactRedux = require("react-redux"); + +var _show = require("../../actions/show"); + +var _view = _interopRequireDefault(require("./view")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mapStateToProps = function mapStateToProps(_ref) { + var show = _ref.show; + return { + error: show.request.error, + requestType: show.request.type + }; +}; + +var mapDispatchToProps = { + onHandleShowPageUri: _show.onHandleShowPageUri +}; + +var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_view.default); + +exports.default = _default; \ No newline at end of file diff --git a/client/build/pages/ShowPage/view.js b/client/build/pages/ShowPage/view.js new file mode 100644 index 00000000..9ce3ba95 --- /dev/null +++ b/client/build/pages/ShowPage/view.js @@ -0,0 +1,97 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _ErrorPage = _interopRequireDefault(require("@pages/ErrorPage")); + +var _ShowAssetLite = _interopRequireDefault(require("@containers/ShowAssetLite")); + +var _ShowAssetDetails = _interopRequireDefault(require("@containers/ShowAssetDetails")); + +var _ShowChannel = _interopRequireDefault(require("@containers/ShowChannel")); + +var _show_request_types = require("../../constants/show_request_types"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var ShowPage = +/*#__PURE__*/ +function (_React$Component) { + function ShowPage() { + _classCallCheck(this, ShowPage); + + return _possibleConstructorReturn(this, _getPrototypeOf(ShowPage).apply(this, arguments)); + } + + _createClass(ShowPage, [{ + key: "componentDidMount", + value: function componentDidMount() { + this.props.onHandleShowPageUri(this.props.match.params); + } + }, { + key: "componentWillReceiveProps", + value: function componentWillReceiveProps(nextProps) { + if (nextProps.match.params !== this.props.match.params) { + this.props.onHandleShowPageUri(nextProps.match.params); + } + } + }, { + key: "render", + value: function render() { + var _this$props = this.props, + error = _this$props.error, + requestType = _this$props.requestType; + + if (error) { + return _react.default.createElement(_ErrorPage.default, { + error: error + }); + } + + switch (requestType) { + case _show_request_types.CHANNEL: + return _react.default.createElement(_ShowChannel.default, null); + + case _show_request_types.ASSET_LITE: + return _react.default.createElement(_ShowAssetLite.default, null); + + case _show_request_types.ASSET_DETAILS: + return _react.default.createElement(_ShowAssetDetails.default, null); + + default: + return _react.default.createElement("p", null, "loading..."); + } + } + }]); + + _inherits(ShowPage, _React$Component); + + return ShowPage; +}(_react.default.Component); + +; +var _default = ShowPage; +exports.default = _default; \ No newline at end of file diff --git a/client/build/reducers/channel.js b/client/build/reducers/channel.js new file mode 100644 index 00000000..5d282535 --- /dev/null +++ b/client/build/reducers/channel.js @@ -0,0 +1,33 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _default; + +var actions = _interopRequireWildcard(require("../constants/channel_action_types")); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +var initialState = { + loggedInChannel: { + name: null, + shortId: null, + longId: null + } +}; + +function _default() { + var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; + var action = arguments.length > 1 ? arguments[1] : undefined; + + switch (action.type) { + case actions.CHANNEL_UPDATE: + return Object.assign({}, state, { + loggedInChannel: action.data + }); + + default: + return state; + } +} \ No newline at end of file diff --git a/client/build/reducers/channelCreate.js b/client/build/reducers/channelCreate.js new file mode 100644 index 00000000..0bfe53a6 --- /dev/null +++ b/client/build/reducers/channelCreate.js @@ -0,0 +1,49 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _default; + +var actions = _interopRequireWildcard(require("../constants/channel_create_action_types")); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var initialState = { + name: { + value: '', + error: '' + }, + password: { + value: '', + error: '' + }, + status: null +}; + +function _default() { + var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; + var action = arguments.length > 1 ? arguments[1] : undefined; + + switch (action.type) { + case actions.CHANNEL_CREATE_UPDATE_NAME: + return Object.assign({}, state, { + name: Object.assign({}, state.name, _defineProperty({}, action.data.name, action.data.value)) + }); + + case actions.CHANNEL_CREATE_UPDATE_PASSWORD: + return Object.assign({}, state, { + password: Object.assign({}, state.password, _defineProperty({}, action.data.name, action.data.value)) + }); + + case actions.CHANNEL_CREATE_UPDATE_STATUS: + return Object.assign({}, state, { + status: action.data + }); + + default: + return state; + } +} \ No newline at end of file diff --git a/client/build/reducers/index.js b/client/build/reducers/index.js new file mode 100644 index 00000000..cccf793d --- /dev/null +++ b/client/build/reducers/index.js @@ -0,0 +1,33 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _redux = require("redux"); + +var _publish = _interopRequireDefault(require("./publish")); + +var _channel = _interopRequireDefault(require("./channel")); + +var _show = _interopRequireDefault(require("./show")); + +var _site = _interopRequireDefault(require("./site")); + +var _channelCreate = _interopRequireDefault(require("./channelCreate")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var customizedReducers = function customizedReducers(siteConfig) { + return (0, _redux.combineReducers)({ + channel: _channel.default, + channelCreate: _channelCreate.default, + publish: (0, _publish.default)(siteConfig), + show: _show.default, + site: (0, _site.default)(siteConfig) + }); +}; + +var _default = customizedReducers; +exports.default = _default; \ No newline at end of file diff --git a/client/build/reducers/publish.js b/client/build/reducers/publish.js new file mode 100644 index 00000000..a7ee6054 --- /dev/null +++ b/client/build/reducers/publish.js @@ -0,0 +1,121 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var actions = _interopRequireWildcard(require("../constants/publish_action_types")); + +var _publish_channel_select_states = require("../constants/publish_channel_select_states"); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var customizedPublishReducer = function customizedPublishReducer(siteConfig) { + // parse inputs + var disabledConfig = false; + var disabledMessageConfig = 'none'; + var thumbnailChannel = ''; + var thumbnailChannelId = ''; + + if (siteConfig) { + if (siteConfig.publishing) { + disabledConfig = siteConfig.publishing.disabled; + disabledMessageConfig = siteConfig.publishing.disabledMessage; + thumbnailChannel = siteConfig.publishing.thumbnailChannel; + thumbnailChannelId = siteConfig.publishing.thumbnailChannelId; + } + } // create initial state + + + var initialState = { + disabled: disabledConfig, + disabledMessage: disabledMessageConfig, + publishInChannel: false, + selectedChannel: _publish_channel_select_states.LOGIN, + showMetadataInputs: false, + status: { + status: null, + message: null + }, + error: { + file: null, + url: null, + channel: null + }, + file: null, + claim: '', + metadata: { + title: '', + description: '', + license: '', + nsfw: false + }, + thumbnail: null, + thumbnailChannel: thumbnailChannel, + thumbnailChannelId: thumbnailChannelId + }; + return function () { + var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; + var action = arguments.length > 1 ? arguments[1] : undefined; + + switch (action.type) { + case actions.FILE_SELECTED: + return Object.assign({}, initialState, { + // note: clears to initial state + file: action.data + }); + + case actions.FILE_CLEAR: + return initialState; + + case actions.METADATA_UPDATE: + return Object.assign({}, state, { + metadata: Object.assign({}, state.metadata, _defineProperty({}, action.data.name, action.data.value)) + }); + + case actions.CLAIM_UPDATE: + return Object.assign({}, state, { + claim: action.data + }); + + case actions.SET_PUBLISH_IN_CHANNEL: + return Object.assign({}, state, { + publishInChannel: action.channel + }); + + case actions.PUBLISH_STATUS_UPDATE: + return Object.assign({}, state, { + status: action.data + }); + + case actions.ERROR_UPDATE: + return Object.assign({}, state, { + error: Object.assign({}, state.error, _defineProperty({}, action.data.name, action.data.value)) + }); + + case actions.SELECTED_CHANNEL_UPDATE: + return Object.assign({}, state, { + selectedChannel: action.data + }); + + case actions.TOGGLE_METADATA_INPUTS: + return Object.assign({}, state, { + showMetadataInputs: action.data + }); + + case actions.THUMBNAIL_NEW: + return Object.assign({}, state, { + thumbnail: action.data + }); + + default: + return state; + } + }; +}; + +var _default = customizedPublishReducer; +exports.default = _default; \ No newline at end of file diff --git a/client/build/reducers/show.js b/client/build/reducers/show.js new file mode 100644 index 00000000..c6868f06 --- /dev/null +++ b/client/build/reducers/show.js @@ -0,0 +1,110 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _default; + +var actions = _interopRequireWildcard(require("../constants/show_action_types")); + +var _asset_display_states = require("../constants/asset_display_states"); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var initialState = { + request: { + error: null, + type: null, + id: null + }, + requestList: {}, + channelList: {}, + assetList: {}, + displayAsset: { + error: null, + status: _asset_display_states.LOCAL_CHECK + } +}; + +function _default() { + var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; + var action = arguments.length > 1 ? arguments[1] : undefined; + + switch (action.type) { + // handle request + case actions.REQUEST_ERROR: + return Object.assign({}, state, { + request: Object.assign({}, state.request, { + error: action.data + }) + }); + + case actions.REQUEST_UPDATE: + return Object.assign({}, state, { + request: Object.assign({}, state.request, { + type: action.data.requestType, + id: action.data.requestId + }) + }); + // store requests + + case actions.REQUEST_LIST_ADD: + return Object.assign({}, state, { + requestList: Object.assign({}, state.requestList, _defineProperty({}, action.data.id, { + error: action.data.error, + key: action.data.key + })) + }); + // asset data + + case actions.ASSET_ADD: + return Object.assign({}, state, { + assetList: Object.assign({}, state.assetList, _defineProperty({}, action.data.id, { + error: action.data.error, + name: action.data.name, + claimId: action.data.claimId, + shortId: action.data.shortId, + claimData: action.data.claimData + })) + }); + // channel data + + case actions.CHANNEL_ADD: + return Object.assign({}, state, { + channelList: Object.assign({}, state.channelList, _defineProperty({}, action.data.id, { + name: action.data.name, + longId: action.data.longId, + shortId: action.data.shortId, + claimsData: action.data.claimsData + })) + }); + + case actions.CHANNEL_CLAIMS_UPDATE_SUCCESS: + return Object.assign({}, state, { + channelList: Object.assign({}, state.channelList, _defineProperty({}, action.data.channelListId, Object.assign({}, state.channelList[action.data.channelListId], { + claimsData: action.data.claimsData + }))) + }); + // display an asset + + case actions.FILE_AVAILABILITY_UPDATE: + return Object.assign({}, state, { + displayAsset: Object.assign({}, state.displayAsset, { + status: action.data + }) + }); + + case actions.DISPLAY_ASSET_ERROR: + return Object.assign({}, state, { + displayAsset: Object.assign({}, state.displayAsset, { + error: action.data, + status: _asset_display_states.ERROR + }) + }); + + default: + return state; + } +} \ No newline at end of file diff --git a/client/build/reducers/site.js b/client/build/reducers/site.js new file mode 100644 index 00000000..ea6c37f1 --- /dev/null +++ b/client/build/reducers/site.js @@ -0,0 +1,54 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var customizedSiteReducer = function customizedSiteReducer(siteConfig) { + var initialState = {}; + + if (siteConfig) { + var googleAnalyticsId = siteConfig.analytics.googleId, + _siteConfig$assetDefa = siteConfig.assetDefaults, + defaultThumbnail = _siteConfig$assetDefa.thumbnail, + defaultDescription = _siteConfig$assetDefa.description, + _siteConfig$details = siteConfig.details, + description = _siteConfig$details.description, + host = _siteConfig$details.host, + title = _siteConfig$details.title, + twitter = _siteConfig$details.twitter; + initialState = { + description: description, + googleAnalyticsId: googleAnalyticsId, + host: host, + title: title, + twitter: twitter, + defaultDescription: defaultDescription, + defaultThumbnail: defaultThumbnail + }; + } else { + initialState = { + description: 'default description', + googleAnalyticsId: 'default google id', + host: 'default host', + title: 'default title', + twitter: 'default twitter', + defaultDescription: 'default description', + defaultThumbnail: 'default thumbnail' + }; + } + + return function () { + var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; + var action = arguments.length > 1 ? arguments[1] : undefined; + + switch (action.type) { + default: + return state; + } + }; +}; + +var _default = customizedSiteReducer; +exports.default = _default; \ No newline at end of file diff --git a/client/build/sagas/checkForLoggedInChannel.js b/client/build/sagas/checkForLoggedInChannel.js new file mode 100644 index 00000000..77e68d2a --- /dev/null +++ b/client/build/sagas/checkForLoggedInChannel.js @@ -0,0 +1,82 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.watchChannelLoginCheck = watchChannelLoginCheck; + +var _effects = require("redux-saga/effects"); + +var _channel_action_types = require("../constants/channel_action_types"); + +var _authApi = require("../api/authApi.js"); + +var _publish = require("../actions/publish"); + +var _channel = require("../actions/channel"); + +var _marked = +/*#__PURE__*/ +regeneratorRuntime.mark(checkForLoggedInChannelSaga), + _marked2 = +/*#__PURE__*/ +regeneratorRuntime.mark(watchChannelLoginCheck); + +function checkForLoggedInChannelSaga() { + var response, _response, _response$data, channelName, shortChannelId, channelClaimId; + + return regeneratorRuntime.wrap(function checkForLoggedInChannelSaga$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.prev = 0; + _context.next = 3; + return (0, _effects.call)(_authApi.checkForLoggedInChannelApi); + + case 3: + response = _context.sent; + _context.next = 9; + break; + + case 6: + _context.prev = 6; + _context.t0 = _context["catch"](0); + return _context.abrupt("return", console.log(_context.t0)); + + case 9: + if (!response.data) { + _context.next = 15; + break; + } + + _response = response, _response$data = _response.data, channelName = _response$data.channelName, shortChannelId = _response$data.shortChannelId, channelClaimId = _response$data.channelClaimId; + _context.next = 13; + return (0, _effects.put)((0, _publish.updateSelectedChannel)(channelName)); + + case 13: + _context.next = 15; + return (0, _effects.put)((0, _channel.updateLoggedInChannel)(channelName, shortChannelId, channelClaimId)); + + case 15: + case "end": + return _context.stop(); + } + } + }, _marked, this, [[0, 6]]); +} + +function watchChannelLoginCheck() { + return regeneratorRuntime.wrap(function watchChannelLoginCheck$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return (0, _effects.takeLatest)(_channel_action_types.CHANNEL_LOGIN_CHECK, checkForLoggedInChannelSaga); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _marked2, this); +} \ No newline at end of file diff --git a/client/build/sagas/createChannel.js b/client/build/sagas/createChannel.js new file mode 100644 index 00000000..df8a8c3e --- /dev/null +++ b/client/build/sagas/createChannel.js @@ -0,0 +1,134 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.watchChannelCreate = watchChannelCreate; + +var _effects = require("redux-saga/effects"); + +var _channel_create_action_types = require("../constants/channel_create_action_types"); + +var _channelCreate = require("../selectors/channelCreate"); + +var _validate = require("../utils/validate"); + +var _channelCreate2 = require("../actions/channelCreate"); + +var _channelApi = require("../api/channelApi"); + +var _channel = require("../actions/channel"); + +var _publish = require("../actions/publish"); + +var _marked = +/*#__PURE__*/ +regeneratorRuntime.mark(createChannel), + _marked2 = +/*#__PURE__*/ +regeneratorRuntime.mark(watchChannelCreate); + +function createChannel() { + var _ref, name, password, channelName, shortChannelId, channelClaimId, _ref2; + + return regeneratorRuntime.wrap(function createChannel$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return (0, _effects.select)(_channelCreate.selectChannelCreateState); + + case 2: + _ref = _context.sent; + name = _ref.name; + password = _ref.password; + _context.prev = 5; + (0, _validate.validateCreateChannelNameInput)(name); + _context.next = 14; + break; + + case 9: + _context.prev = 9; + _context.t0 = _context["catch"](5); + _context.next = 13; + return (0, _effects.put)((0, _channelCreate2.updateChannelCreateName)('error', _context.t0.message)); + + case 13: + return _context.abrupt("return", _context.sent); + + case 14: + _context.prev = 14; + (0, _validate.validateCreateChannelPasswordInput)(password); + _context.next = 23; + break; + + case 18: + _context.prev = 18; + _context.t1 = _context["catch"](14); + _context.next = 22; + return (0, _effects.put)((0, _channelCreate2.updateChannelCreatePassword)('error', _context.t1.message)); + + case 22: + return _context.abrupt("return", _context.sent); + + case 23: + _context.next = 25; + return (0, _effects.put)((0, _channelCreate2.updateChannelCreateStatus)('We are publishing your new channel. Sit tight...')); + + case 25: + _context.prev = 25; + _context.next = 28; + return (0, _effects.call)(_channelApi.makeCreateChannelRequest, name.value, password.value); + + case 28: + _ref2 = _context.sent; + channelName = _ref2.channelName; + shortChannelId = _ref2.shortChannelId; + channelClaimId = _ref2.channelClaimId; + _context.next = 39; + break; + + case 34: + _context.prev = 34; + _context.t2 = _context["catch"](25); + _context.next = 38; + return (0, _effects.put)((0, _channelCreate2.updateChannelCreateStatus)(_context.t2.message)); + + case 38: + return _context.abrupt("return", _context.sent); + + case 39: + _context.next = 41; + return (0, _effects.put)((0, _channelCreate2.updateChannelCreateStatus)(null)); + + case 41: + _context.next = 43; + return (0, _effects.put)((0, _channel.updateLoggedInChannel)(channelName, shortChannelId, channelClaimId)); + + case 43: + _context.next = 45; + return (0, _effects.put)((0, _publish.updateSelectedChannel)(channelName)); + + case 45: + case "end": + return _context.stop(); + } + } + }, _marked, this, [[5, 9], [14, 18], [25, 34]]); +} + +function watchChannelCreate() { + return regeneratorRuntime.wrap(function watchChannelCreate$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return (0, _effects.takeLatest)(_channel_create_action_types.CHANNEL_CREATE, createChannel); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _marked2, this); +} \ No newline at end of file diff --git a/client/build/sagas/file.js b/client/build/sagas/file.js new file mode 100644 index 00000000..e7ae2676 --- /dev/null +++ b/client/build/sagas/file.js @@ -0,0 +1,133 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.watchFileIsRequested = watchFileIsRequested; + +var _effects = require("redux-saga/effects"); + +var actions = _interopRequireWildcard(require("../constants/show_action_types")); + +var _show = require("../actions/show"); + +var _asset_display_states = require("../constants/asset_display_states"); + +var _fileApi = require("../api/fileApi"); + +var _site = require("../selectors/site"); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +var _marked = +/*#__PURE__*/ +regeneratorRuntime.mark(retrieveFile), + _marked2 = +/*#__PURE__*/ +regeneratorRuntime.mark(watchFileIsRequested); + +function retrieveFile(action) { + var name, claimId, host, isAvailable, _ref; + + return regeneratorRuntime.wrap(function retrieveFile$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + name = action.data.name; + claimId = action.data.claimId; + _context.next = 4; + return (0, _effects.select)(_site.selectSiteHost); + + case 4: + host = _context.sent; + _context.prev = 5; + _context.next = 8; + return (0, _effects.call)(_fileApi.checkFileAvailability, claimId, host, name); + + case 8: + _ref = _context.sent; + isAvailable = _ref.data; + _context.next = 17; + break; + + case 12: + _context.prev = 12; + _context.t0 = _context["catch"](5); + _context.next = 16; + return (0, _effects.put)((0, _show.updateDisplayAssetError)(_context.t0.message)); + + case 16: + return _context.abrupt("return", _context.sent); + + case 17: + ; + + if (!isAvailable) { + _context.next = 24; + break; + } + + _context.next = 21; + return (0, _effects.put)((0, _show.updateDisplayAssetError)(null)); + + case 21: + _context.next = 23; + return (0, _effects.put)((0, _show.updateFileAvailability)(_asset_display_states.AVAILABLE)); + + case 23: + return _context.abrupt("return", _context.sent); + + case 24: + _context.next = 26; + return (0, _effects.put)((0, _show.updateFileAvailability)(_asset_display_states.UNAVAILABLE)); + + case 26: + _context.prev = 26; + _context.next = 29; + return (0, _effects.call)(_fileApi.triggerClaimGet, claimId, host, name); + + case 29: + _context.next = 36; + break; + + case 31: + _context.prev = 31; + _context.t1 = _context["catch"](26); + _context.next = 35; + return (0, _effects.put)((0, _show.updateDisplayAssetError)(_context.t1.message)); + + case 35: + return _context.abrupt("return", _context.sent); + + case 36: + ; + _context.next = 39; + return (0, _effects.put)((0, _show.updateFileAvailability)(_asset_display_states.AVAILABLE)); + + case 39: + case "end": + return _context.stop(); + } + } + }, _marked, this, [[5, 12], [26, 31]]); +} + +; + +function watchFileIsRequested() { + return regeneratorRuntime.wrap(function watchFileIsRequested$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return (0, _effects.takeLatest)(actions.FILE_REQUESTED, retrieveFile); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _marked2, this); +} + +; \ No newline at end of file diff --git a/client/build/sagas/index.js b/client/build/sagas/index.js new file mode 100644 index 00000000..59ee61cc --- /dev/null +++ b/client/build/sagas/index.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _rootSaga = require("./rootSaga"); + +var _show_uri = require("./show_uri"); + +var _default = { + rootSaga: _rootSaga.rootSaga, + handleShowPageUri: _show_uri.handleShowPageUri +}; +exports.default = _default; \ No newline at end of file diff --git a/client/build/sagas/logoutChannel.js b/client/build/sagas/logoutChannel.js new file mode 100644 index 00000000..9eb101e3 --- /dev/null +++ b/client/build/sagas/logoutChannel.js @@ -0,0 +1,67 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.watchChannelLogout = watchChannelLogout; + +var _effects = require("redux-saga/effects"); + +var _channel_action_types = require("../constants/channel_action_types"); + +var _authApi = require("../api/authApi.js"); + +var _channel = require("../actions/channel"); + +var _marked = +/*#__PURE__*/ +regeneratorRuntime.mark(logoutChannelSaga), + _marked2 = +/*#__PURE__*/ +regeneratorRuntime.mark(watchChannelLogout); + +function logoutChannelSaga() { + return regeneratorRuntime.wrap(function logoutChannelSaga$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.prev = 0; + _context.next = 3; + return (0, _effects.call)(_authApi.channelLogoutApi); + + case 3: + _context.next = 8; + break; + + case 5: + _context.prev = 5; + _context.t0 = _context["catch"](0); + return _context.abrupt("return", console.log(_context.t0)); + + case 8: + _context.next = 10; + return (0, _effects.put)((0, _channel.updateLoggedInChannel)(null, null, null)); + + case 10: + case "end": + return _context.stop(); + } + } + }, _marked, this, [[0, 5]]); +} + +function watchChannelLogout() { + return regeneratorRuntime.wrap(function watchChannelLogout$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return (0, _effects.takeLatest)(_channel_action_types.CHANNEL_LOGOUT, logoutChannelSaga); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _marked2, this); +} \ No newline at end of file diff --git a/client/build/sagas/publish.js b/client/build/sagas/publish.js new file mode 100644 index 00000000..dcb676b5 --- /dev/null +++ b/client/build/sagas/publish.js @@ -0,0 +1,213 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.watchPublishStart = watchPublishStart; + +var _effects = require("redux-saga/effects"); + +var actions = _interopRequireWildcard(require("../constants/publish_action_types")); + +var publishStates = _interopRequireWildcard(require("../constants/publish_claim_states")); + +var _publish = require("../actions/publish"); + +var _publish2 = require("../selectors/publish"); + +var _channel = require("../selectors/channel"); + +var _site = require("../selectors/site"); + +var _validate = require("../utils/validate"); + +var _publish3 = require("../utils/publish"); + +var _publish4 = require("../channels/publish"); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +var _marked = +/*#__PURE__*/ +regeneratorRuntime.mark(publishFile), + _marked2 = +/*#__PURE__*/ +regeneratorRuntime.mark(watchPublishStart); + +function publishFile(action) { + var history, _ref, publishInChannel, selectedChannel, file, claim, metadata, thumbnailChannel, thumbnailChannelId, thumbnail, publishToolErrors, _ref2, loggedInChannel, _ref3, host, publishMetadata, publishFormData, publishChannel, _ref4, loadStart, progress, load, success, publishError; + + return regeneratorRuntime.wrap(function publishFile$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + history = action.data.history; + _context.next = 3; + return (0, _effects.select)(_publish2.selectPublishState); + + case 3: + _ref = _context.sent; + publishInChannel = _ref.publishInChannel; + selectedChannel = _ref.selectedChannel; + file = _ref.file; + claim = _ref.claim; + metadata = _ref.metadata; + thumbnailChannel = _ref.thumbnailChannel; + thumbnailChannelId = _ref.thumbnailChannelId; + thumbnail = _ref.thumbnail; + publishToolErrors = _ref.error; + _context.next = 15; + return (0, _effects.select)(_channel.selectChannelState); + + case 15: + _ref2 = _context.sent; + loggedInChannel = _ref2.loggedInChannel; + _context.next = 19; + return (0, _effects.select)(_site.selectSiteState); + + case 19: + _ref3 = _context.sent; + host = _ref3.host; + _context.prev = 21; + (0, _validate.validateChannelSelection)(publishInChannel, selectedChannel, loggedInChannel); + _context.next = 30; + break; + + case 25: + _context.prev = 25; + _context.t0 = _context["catch"](21); + _context.next = 29; + return (0, _effects.put)((0, _publish.updateError)('channel', _context.t0.message)); + + case 29: + return _context.abrupt("return", _context.sent); + + case 30: + ; // validate publish parameters + + _context.prev = 31; + (0, _validate.validateNoPublishErrors)(publishToolErrors); + _context.next = 38; + break; + + case 35: + _context.prev = 35; + _context.t1 = _context["catch"](31); + return _context.abrupt("return", console.log('publish error:', _context.t1.message)); + + case 38: + // create metadata + publishMetadata = (0, _publish3.createPublishMetadata)(claim, file, metadata, publishInChannel, selectedChannel); + + if (thumbnail) { + // add thumbnail to publish metadata + publishMetadata['thumbnail'] = (0, _publish3.createThumbnailUrl)(thumbnailChannel, thumbnailChannelId, claim, host); + } // create form data for main publish + + + publishFormData = (0, _publish3.createPublishFormData)(file, thumbnail, publishMetadata); // make the publish request + + _context.next = 43; + return (0, _effects.call)(_publish4.makePublishRequestChannel, publishFormData); + + case 43: + publishChannel = _context.sent; + + case 44: + if (!true) { + _context.next = 72; + break; + } + + _context.next = 47; + return (0, _effects.take)(publishChannel); + + case 47: + _ref4 = _context.sent; + loadStart = _ref4.loadStart; + progress = _ref4.progress; + load = _ref4.load; + success = _ref4.success; + publishError = _ref4.error; + + if (!publishError) { + _context.next = 57; + break; + } + + _context.next = 56; + return (0, _effects.put)((0, _publish.updatePublishStatus)(publishStates.FAILED, publishError.message)); + + case 56: + return _context.abrupt("return", _context.sent); + + case 57: + if (!success) { + _context.next = 61; + break; + } + + _context.next = 60; + return (0, _effects.put)((0, _publish.clearFile)()); + + case 60: + return _context.abrupt("return", history.push("/".concat(success.data.claimId, "/").concat(success.data.name))); + + case 61: + if (!loadStart) { + _context.next = 64; + break; + } + + _context.next = 64; + return (0, _effects.put)((0, _publish.updatePublishStatus)(publishStates.LOAD_START, null)); + + case 64: + if (!progress) { + _context.next = 67; + break; + } + + _context.next = 67; + return (0, _effects.put)((0, _publish.updatePublishStatus)(publishStates.LOADING, "".concat(progress, "%"))); + + case 67: + if (!load) { + _context.next = 70; + break; + } + + _context.next = 70; + return (0, _effects.put)((0, _publish.updatePublishStatus)(publishStates.PUBLISHING, null)); + + case 70: + _context.next = 44; + break; + + case 72: + case "end": + return _context.stop(); + } + } + }, _marked, this, [[21, 25], [31, 35]]); +} + +; + +function watchPublishStart() { + return regeneratorRuntime.wrap(function watchPublishStart$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return (0, _effects.takeLatest)(actions.PUBLISH_START, publishFile); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _marked2, this); +} + +; \ No newline at end of file diff --git a/client/build/sagas/rootSaga.js b/client/build/sagas/rootSaga.js new file mode 100644 index 00000000..818ed43a --- /dev/null +++ b/client/build/sagas/rootSaga.js @@ -0,0 +1,48 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.rootSaga = rootSaga; + +var _effects = require("redux-saga/effects"); + +var _show_uri = require("./show_uri"); + +var _show_asset = require("./show_asset"); + +var _show_channel = require("./show_channel"); + +var _file = require("./file"); + +var _publish = require("./publish"); + +var _updateClaimAvailability = require("./updateClaimAvailability"); + +var _updateChannelAvailability = require("./updateChannelAvailability"); + +var _createChannel = require("./createChannel"); + +var _checkForLoggedInChannel = require("./checkForLoggedInChannel"); + +var _logoutChannel = require("./logoutChannel"); + +var _marked = +/*#__PURE__*/ +regeneratorRuntime.mark(rootSaga); + +function rootSaga() { + return regeneratorRuntime.wrap(function rootSaga$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return (0, _effects.all)([(0, _show_uri.watchHandleShowPageUri)(), (0, _show_asset.watchNewAssetRequest)(), (0, _show_channel.watchNewChannelRequest)(), (0, _show_channel.watchUpdateChannelClaims)(), (0, _file.watchFileIsRequested)(), (0, _publish.watchPublishStart)(), (0, _updateClaimAvailability.watchUpdateClaimAvailability)(), (0, _updateChannelAvailability.watchUpdateChannelAvailability)(), (0, _createChannel.watchChannelCreate)(), (0, _checkForLoggedInChannel.watchChannelLoginCheck)(), (0, _logoutChannel.watchChannelLogout)()]); + + case 2: + case "end": + return _context.stop(); + } + } + }, _marked, this); +} \ No newline at end of file diff --git a/client/build/sagas/show_asset.js b/client/build/sagas/show_asset.js new file mode 100644 index 00000000..25bc1a95 --- /dev/null +++ b/client/build/sagas/show_asset.js @@ -0,0 +1,168 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.newAssetRequest = newAssetRequest; +exports.watchNewAssetRequest = watchNewAssetRequest; + +var _effects = require("redux-saga/effects"); + +var actions = _interopRequireWildcard(require("../constants/show_action_types")); + +var _show = require("../actions/show"); + +var _assetApi = require("../api/assetApi"); + +var _show2 = require("../selectors/show"); + +var _site = require("../selectors/site"); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +var _marked = +/*#__PURE__*/ +regeneratorRuntime.mark(newAssetRequest), + _marked2 = +/*#__PURE__*/ +regeneratorRuntime.mark(watchNewAssetRequest); + +function newAssetRequest(action) { + var _action$data, requestType, requestId, name, modifier, state, host, longId, _ref, assetKey, shortId, _ref2, claimData, _ref3; + + return regeneratorRuntime.wrap(function newAssetRequest$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _action$data = action.data, requestType = _action$data.requestType, requestId = _action$data.requestId, name = _action$data.name, modifier = _action$data.modifier; // put an action to update the request in redux + + _context.next = 3; + return (0, _effects.put)((0, _show.onRequestUpdate)(requestType, requestId)); + + case 3: + _context.next = 5; + return (0, _effects.select)(_show2.selectShowState); + + case 5: + state = _context.sent; + _context.next = 8; + return (0, _effects.select)(_site.selectSiteHost); + + case 8: + host = _context.sent; + + if (!state.requestList[requestId]) { + _context.next = 11; + break; + } + + return _context.abrupt("return", null); + + case 11: + _context.prev = 11; + _context.next = 14; + return (0, _effects.call)(_assetApi.getLongClaimId, host, name, modifier); + + case 14: + _ref = _context.sent; + longId = _ref.data; + _context.next = 23; + break; + + case 18: + _context.prev = 18; + _context.t0 = _context["catch"](11); + _context.next = 22; + return (0, _effects.put)((0, _show.onRequestError)(_context.t0.message)); + + case 22: + return _context.abrupt("return", _context.sent); + + case 23: + assetKey = "a#".concat(name, "#").concat(longId); + _context.next = 26; + return (0, _effects.put)((0, _show.addRequestToRequestList)(requestId, null, assetKey)); + + case 26: + if (!state.assetList[assetKey]) { + _context.next = 28; + break; + } + + return _context.abrupt("return", null); + + case 28: + _context.prev = 28; + _context.next = 31; + return (0, _effects.call)(_assetApi.getShortId, host, name, longId); + + case 31: + _ref2 = _context.sent; + shortId = _ref2.data; + _context.next = 40; + break; + + case 35: + _context.prev = 35; + _context.t1 = _context["catch"](28); + _context.next = 39; + return (0, _effects.put)((0, _show.onRequestError)(_context.t1.message)); + + case 39: + return _context.abrupt("return", _context.sent); + + case 40: + _context.prev = 40; + _context.next = 43; + return (0, _effects.call)(_assetApi.getClaimData, host, name, longId); + + case 43: + _ref3 = _context.sent; + claimData = _ref3.data; + _context.next = 52; + break; + + case 47: + _context.prev = 47; + _context.t2 = _context["catch"](40); + _context.next = 51; + return (0, _effects.put)((0, _show.onRequestError)(_context.t2.message)); + + case 51: + return _context.abrupt("return", _context.sent); + + case 52: + _context.next = 54; + return (0, _effects.put)((0, _show.addAssetToAssetList)(assetKey, null, name, longId, shortId, claimData)); + + case 54: + _context.next = 56; + return (0, _effects.put)((0, _show.onRequestError)(null)); + + case 56: + case "end": + return _context.stop(); + } + } + }, _marked, this, [[11, 18], [28, 35], [40, 47]]); +} + +; + +function watchNewAssetRequest() { + return regeneratorRuntime.wrap(function watchNewAssetRequest$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return (0, _effects.takeLatest)(actions.ASSET_REQUEST_NEW, newAssetRequest); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _marked2, this); +} + +; \ No newline at end of file diff --git a/client/build/sagas/show_channel.js b/client/build/sagas/show_channel.js new file mode 100644 index 00000000..4f210715 --- /dev/null +++ b/client/build/sagas/show_channel.js @@ -0,0 +1,216 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.newChannelRequest = newChannelRequest; +exports.watchNewChannelRequest = watchNewChannelRequest; +exports.watchUpdateChannelClaims = watchUpdateChannelClaims; + +var _effects = require("redux-saga/effects"); + +var actions = _interopRequireWildcard(require("../constants/show_action_types")); + +var _show = require("../actions/show"); + +var _channelApi = require("../api/channelApi"); + +var _show2 = require("../selectors/show"); + +var _site = require("../selectors/site"); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +var _marked = +/*#__PURE__*/ +regeneratorRuntime.mark(newChannelRequest), + _marked2 = +/*#__PURE__*/ +regeneratorRuntime.mark(watchNewChannelRequest), + _marked3 = +/*#__PURE__*/ +regeneratorRuntime.mark(getNewClaimsAndUpdateChannel), + _marked4 = +/*#__PURE__*/ +regeneratorRuntime.mark(watchUpdateChannelClaims); + +function newChannelRequest(action) { + var _action$data, requestType, requestId, channelName, channelId, state, host, longId, shortId, _ref, _ref$data, channelKey, claimsData, _ref2; + + return regeneratorRuntime.wrap(function newChannelRequest$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _action$data = action.data, requestType = _action$data.requestType, requestId = _action$data.requestId, channelName = _action$data.channelName, channelId = _action$data.channelId; // put an action to update the request in redux + + _context.next = 3; + return (0, _effects.put)((0, _show.onRequestUpdate)(requestType, requestId)); + + case 3: + _context.next = 5; + return (0, _effects.select)(_show2.selectShowState); + + case 5: + state = _context.sent; + _context.next = 8; + return (0, _effects.select)(_site.selectSiteHost); + + case 8: + host = _context.sent; + + if (!state.requestList[requestId]) { + _context.next = 11; + break; + } + + return _context.abrupt("return", null); + + case 11: + _context.prev = 11; + _context.next = 14; + return (0, _effects.call)(_channelApi.getChannelData, host, channelName, channelId); + + case 14: + _ref = _context.sent; + _ref$data = _ref.data; + longId = _ref$data.longChannelClaimId; + shortId = _ref$data.shortChannelClaimId; + _context.next = 25; + break; + + case 20: + _context.prev = 20; + _context.t0 = _context["catch"](11); + _context.next = 24; + return (0, _effects.put)((0, _show.onRequestError)(_context.t0.message)); + + case 24: + return _context.abrupt("return", _context.sent); + + case 25: + // store the request in the channel requests list + channelKey = "c#".concat(channelName, "#").concat(longId); + _context.next = 28; + return (0, _effects.put)((0, _show.addRequestToRequestList)(requestId, null, channelKey)); + + case 28: + if (!state.channelList[channelKey]) { + _context.next = 30; + break; + } + + return _context.abrupt("return", null); + + case 30: + _context.prev = 30; + _context.next = 33; + return (0, _effects.call)(_channelApi.getChannelClaims, host, channelName, longId, 1); + + case 33: + _ref2 = _context.sent; + claimsData = _ref2.data; + _context.next = 42; + break; + + case 37: + _context.prev = 37; + _context.t1 = _context["catch"](30); + _context.next = 41; + return (0, _effects.put)((0, _show.onRequestError)(_context.t1.message)); + + case 41: + return _context.abrupt("return", _context.sent); + + case 42: + _context.next = 44; + return (0, _effects.put)((0, _show.addNewChannelToChannelList)(channelKey, channelName, shortId, longId, claimsData)); + + case 44: + _context.next = 46; + return (0, _effects.put)((0, _show.onRequestError)(null)); + + case 46: + case "end": + return _context.stop(); + } + } + }, _marked, this, [[11, 20], [30, 37]]); +} + +function watchNewChannelRequest() { + return regeneratorRuntime.wrap(function watchNewChannelRequest$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return (0, _effects.takeLatest)(actions.CHANNEL_REQUEST_NEW, newChannelRequest); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _marked2, this); +} + +; + +function getNewClaimsAndUpdateChannel(action) { + var _action$data2, channelKey, name, longId, page, host, claimsData, _ref3; + + return regeneratorRuntime.wrap(function getNewClaimsAndUpdateChannel$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _action$data2 = action.data, channelKey = _action$data2.channelKey, name = _action$data2.name, longId = _action$data2.longId, page = _action$data2.page; + _context3.next = 3; + return (0, _effects.select)(_site.selectSiteHost); + + case 3: + host = _context3.sent; + _context3.prev = 4; + _context3.next = 7; + return (0, _effects.call)(_channelApi.getChannelClaims, host, name, longId, page); + + case 7: + _ref3 = _context3.sent; + claimsData = _ref3.data; + _context3.next = 16; + break; + + case 11: + _context3.prev = 11; + _context3.t0 = _context3["catch"](4); + _context3.next = 15; + return (0, _effects.put)((0, _show.onRequestError)(_context3.t0.message)); + + case 15: + return _context3.abrupt("return", _context3.sent); + + case 16: + _context3.next = 18; + return (0, _effects.put)((0, _show.updateChannelClaims)(channelKey, claimsData)); + + case 18: + case "end": + return _context3.stop(); + } + } + }, _marked3, this, [[4, 11]]); +} + +function watchUpdateChannelClaims() { + return regeneratorRuntime.wrap(function watchUpdateChannelClaims$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + _context4.next = 2; + return (0, _effects.takeLatest)(actions.CHANNEL_CLAIMS_UPDATE_ASYNC, getNewClaimsAndUpdateChannel); + + case 2: + case "end": + return _context4.stop(); + } + } + }, _marked4, this); +} \ No newline at end of file diff --git a/client/build/sagas/show_uri.js b/client/build/sagas/show_uri.js new file mode 100644 index 00000000..b00c17fb --- /dev/null +++ b/client/build/sagas/show_uri.js @@ -0,0 +1,206 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.handleShowPageUri = handleShowPageUri; +exports.watchHandleShowPageUri = watchHandleShowPageUri; + +var _effects = require("redux-saga/effects"); + +var actions = _interopRequireWildcard(require("../constants/show_action_types")); + +var _show = require("../actions/show"); + +var _show_asset = require("../sagas/show_asset"); + +var _show_channel = require("../sagas/show_channel"); + +var _lbryUri = _interopRequireDefault(require("../utils/lbryUri")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +var _marked = +/*#__PURE__*/ +regeneratorRuntime.mark(parseAndUpdateIdentifierAndClaim), + _marked2 = +/*#__PURE__*/ +regeneratorRuntime.mark(parseAndUpdateClaimOnly), + _marked3 = +/*#__PURE__*/ +regeneratorRuntime.mark(handleShowPageUri), + _marked4 = +/*#__PURE__*/ +regeneratorRuntime.mark(watchHandleShowPageUri); + +function parseAndUpdateIdentifierAndClaim(modifier, claim) { + var isChannel, channelName, channelClaimId, claimId, claimName, extension, _lbryUri$parseIdentif, _lbryUri$parseClaim; + + return regeneratorRuntime.wrap(function parseAndUpdateIdentifierAndClaim$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.prev = 0; + _lbryUri$parseIdentif = _lbryUri.default.parseIdentifier(modifier); + isChannel = _lbryUri$parseIdentif.isChannel; + channelName = _lbryUri$parseIdentif.channelName; + channelClaimId = _lbryUri$parseIdentif.channelClaimId; + claimId = _lbryUri$parseIdentif.claimId; + _lbryUri$parseClaim = _lbryUri.default.parseClaim(claim); + claimName = _lbryUri$parseClaim.claimName; + extension = _lbryUri$parseClaim.extension; + _context.next = 16; + break; + + case 11: + _context.prev = 11; + _context.t0 = _context["catch"](0); + _context.next = 15; + return (0, _effects.put)((0, _show.onRequestError)(_context.t0.message)); + + case 15: + return _context.abrupt("return", _context.sent); + + case 16: + if (!isChannel) { + _context.next = 20; + break; + } + + _context.next = 19; + return (0, _effects.call)(_show_asset.newAssetRequest, (0, _show.onNewAssetRequest)(claimName, null, channelName, channelClaimId, extension)); + + case 19: + return _context.abrupt("return", _context.sent); + + case 20: + ; + _context.next = 23; + return (0, _effects.call)(_show_asset.newAssetRequest, (0, _show.onNewAssetRequest)(claimName, claimId, null, null, extension)); + + case 23: + case "end": + return _context.stop(); + } + } + }, _marked, this, [[0, 11]]); +} + +function parseAndUpdateClaimOnly(claim) { + var isChannel, channelName, channelClaimId, _lbryUri$parseIdentif2, claimName, extension, _lbryUri$parseClaim2; + + return regeneratorRuntime.wrap(function parseAndUpdateClaimOnly$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.prev = 0; + _lbryUri$parseIdentif2 = _lbryUri.default.parseIdentifier(claim); + isChannel = _lbryUri$parseIdentif2.isChannel; + channelName = _lbryUri$parseIdentif2.channelName; + channelClaimId = _lbryUri$parseIdentif2.channelClaimId; + _context2.next = 12; + break; + + case 7: + _context2.prev = 7; + _context2.t0 = _context2["catch"](0); + _context2.next = 11; + return (0, _effects.put)((0, _show.onRequestError)(_context2.t0.message)); + + case 11: + return _context2.abrupt("return", _context2.sent); + + case 12: + if (!isChannel) { + _context2.next = 16; + break; + } + + _context2.next = 15; + return (0, _effects.call)(_show_channel.newChannelRequest, (0, _show.onNewChannelRequest)(channelName, channelClaimId)); + + case 15: + return _context2.abrupt("return", _context2.sent); + + case 16: + _context2.prev = 16; + _lbryUri$parseClaim2 = _lbryUri.default.parseClaim(claim); + claimName = _lbryUri$parseClaim2.claimName; + extension = _lbryUri$parseClaim2.extension; + _context2.next = 27; + break; + + case 22: + _context2.prev = 22; + _context2.t1 = _context2["catch"](16); + _context2.next = 26; + return (0, _effects.put)((0, _show.onRequestError)(_context2.t1.message)); + + case 26: + return _context2.abrupt("return", _context2.sent); + + case 27: + _context2.next = 29; + return (0, _effects.call)(_show_asset.newAssetRequest, (0, _show.onNewAssetRequest)(claimName, null, null, null, extension)); + + case 29: + case "end": + return _context2.stop(); + } + } + }, _marked2, this, [[0, 7], [16, 22]]); +} + +function handleShowPageUri(action) { + var _action$data, identifier, claim; + + return regeneratorRuntime.wrap(function handleShowPageUri$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _action$data = action.data, identifier = _action$data.identifier, claim = _action$data.claim; + + if (!identifier) { + _context3.next = 5; + break; + } + + _context3.next = 4; + return (0, _effects.call)(parseAndUpdateIdentifierAndClaim, identifier, claim); + + case 4: + return _context3.abrupt("return", _context3.sent); + + case 5: + _context3.next = 7; + return (0, _effects.call)(parseAndUpdateClaimOnly, claim); + + case 7: + case "end": + return _context3.stop(); + } + } + }, _marked3, this); +} + +; + +function watchHandleShowPageUri() { + return regeneratorRuntime.wrap(function watchHandleShowPageUri$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + _context4.next = 2; + return (0, _effects.takeLatest)(actions.HANDLE_SHOW_URI, handleShowPageUri); + + case 2: + case "end": + return _context4.stop(); + } + } + }, _marked4, this); +} + +; \ No newline at end of file diff --git a/client/build/sagas/updateChannelAvailability.js b/client/build/sagas/updateChannelAvailability.js new file mode 100644 index 00000000..0123267e --- /dev/null +++ b/client/build/sagas/updateChannelAvailability.js @@ -0,0 +1,88 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.watchUpdateChannelAvailability = watchUpdateChannelAvailability; + +var _effects = require("redux-saga/effects"); + +var actions = _interopRequireWildcard(require("../constants/channel_create_action_types")); + +var _channelApi = require("../api/channelApi"); + +var _channelCreate = require("../actions/channelCreate"); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +var _marked = +/*#__PURE__*/ +regeneratorRuntime.mark(updateChannelAvailability), + _marked2 = +/*#__PURE__*/ +regeneratorRuntime.mark(watchUpdateChannelAvailability); + +function updateChannelAvailability(_ref) { + var data, isAvailable, message, _ref2; + + return regeneratorRuntime.wrap(function updateChannelAvailability$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + data = _ref.data; + _context.prev = 1; + _context.next = 4; + return (0, _effects.call)(_channelApi.checkChannelAvailability, data); + + case 4: + _ref2 = _context.sent; + isAvailable = _ref2.data; + message = _ref2.message; + console.log('isAvailable:', isAvailable, 'message:', message); + _context.next = 13; + break; + + case 10: + _context.prev = 10; + _context.t0 = _context["catch"](1); + console.log('updateClaimAvailability error'); + + case 13: + if (isAvailable) { + _context.next = 17; + break; + } + + _context.next = 16; + return (0, _effects.put)((0, _channelCreate.updateChannelCreateName)('error', message)); + + case 16: + return _context.abrupt("return", _context.sent); + + case 17: + _context.next = 19; + return (0, _effects.put)((0, _channelCreate.updateChannelCreateName)('error', null)); + + case 19: + case "end": + return _context.stop(); + } + } + }, _marked, this, [[1, 10]]); +} + +function watchUpdateChannelAvailability() { + return regeneratorRuntime.wrap(function watchUpdateChannelAvailability$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return (0, _effects.takeLatest)(actions.CHANNEL_AVAILABILITY, updateChannelAvailability); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _marked2, this); +} \ No newline at end of file diff --git a/client/build/sagas/updateClaimAvailability.js b/client/build/sagas/updateClaimAvailability.js new file mode 100644 index 00000000..950f5c4e --- /dev/null +++ b/client/build/sagas/updateClaimAvailability.js @@ -0,0 +1,87 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.watchUpdateClaimAvailability = watchUpdateClaimAvailability; + +var _effects = require("redux-saga/effects"); + +var actions = _interopRequireWildcard(require("../constants/publish_action_types")); + +var _publish = require("../actions/publish"); + +var _assetApi = require("../api/assetApi"); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +var _marked = +/*#__PURE__*/ +regeneratorRuntime.mark(updateClaimAvailability), + _marked2 = +/*#__PURE__*/ +regeneratorRuntime.mark(watchUpdateClaimAvailability); + +function updateClaimAvailability(_ref) { + var data, isAvailable, message, _ref2; + + return regeneratorRuntime.wrap(function updateClaimAvailability$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + data = _ref.data; + _context.prev = 1; + _context.next = 4; + return (0, _effects.call)(_assetApi.checkClaimAvailability, data); + + case 4: + _ref2 = _context.sent; + isAvailable = _ref2.data; + message = _ref2.message; + _context.next = 12; + break; + + case 9: + _context.prev = 9; + _context.t0 = _context["catch"](1); + return _context.abrupt("return", console.log(_context.t0)); + + case 12: + if (isAvailable) { + _context.next = 16; + break; + } + + _context.next = 15; + return (0, _effects.put)((0, _publish.updateError)('url', message)); + + case 15: + return _context.abrupt("return", _context.sent); + + case 16: + _context.next = 18; + return (0, _effects.put)((0, _publish.updateError)('url', null)); + + case 18: + case "end": + return _context.stop(); + } + } + }, _marked, this, [[1, 9]]); +} + +function watchUpdateClaimAvailability() { + return regeneratorRuntime.wrap(function watchUpdateClaimAvailability$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return (0, _effects.takeLatest)(actions.CLAIM_AVAILABILITY, updateClaimAvailability); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _marked2, this); +} \ No newline at end of file diff --git a/client/build/selectors/channel.js b/client/build/selectors/channel.js new file mode 100644 index 00000000..7de26cd8 --- /dev/null +++ b/client/build/selectors/channel.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.selectChannelState = void 0; + +var selectChannelState = function selectChannelState(state) { + return state.channel; +}; + +exports.selectChannelState = selectChannelState; \ No newline at end of file diff --git a/client/build/selectors/channelCreate.js b/client/build/selectors/channelCreate.js new file mode 100644 index 00000000..ce843e7b --- /dev/null +++ b/client/build/selectors/channelCreate.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.selectChannelCreateState = void 0; + +var selectChannelCreateState = function selectChannelCreateState(state) { + return state.channelCreate; +}; + +exports.selectChannelCreateState = selectChannelCreateState; \ No newline at end of file diff --git a/client/build/selectors/publish.js b/client/build/selectors/publish.js new file mode 100644 index 00000000..de4b99d4 --- /dev/null +++ b/client/build/selectors/publish.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.selectPublishState = void 0; + +var selectPublishState = function selectPublishState(state) { + return state.publish; +}; + +exports.selectPublishState = selectPublishState; \ No newline at end of file diff --git a/client/build/selectors/show.js b/client/build/selectors/show.js new file mode 100644 index 00000000..069258cd --- /dev/null +++ b/client/build/selectors/show.js @@ -0,0 +1,20 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.selectShowState = exports.selectAsset = void 0; + +var selectAsset = function selectAsset(show) { + var request = show.requestList[show.request.id]; + var assetKey = request.key; + return show.assetList[assetKey]; +}; + +exports.selectAsset = selectAsset; + +var selectShowState = function selectShowState(state) { + return state.show; +}; + +exports.selectShowState = selectShowState; \ No newline at end of file diff --git a/client/build/selectors/site.js b/client/build/selectors/site.js new file mode 100644 index 00000000..29bfd70a --- /dev/null +++ b/client/build/selectors/site.js @@ -0,0 +1,18 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.selectSiteHost = exports.selectSiteState = void 0; + +var selectSiteState = function selectSiteState(state) { + return state.site; +}; + +exports.selectSiteState = selectSiteState; + +var selectSiteHost = function selectSiteHost(state) { + return state.site.host; +}; + +exports.selectSiteHost = selectSiteHost; \ No newline at end of file diff --git a/client/build/utils/canonicalLink.js b/client/build/utils/canonicalLink.js new file mode 100644 index 00000000..8f42085b --- /dev/null +++ b/client/build/utils/canonicalLink.js @@ -0,0 +1,51 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createCanonicalLink = void 0; + +var createBasicCanonicalLink = function createBasicCanonicalLink(page, siteHost) { + return "".concat(siteHost, "/").concat(page); +}; + +var createAssetCanonicalLink = function createAssetCanonicalLink(asset, siteHost) { + var channelName, certificateId, name, claimId; + + if (asset.claimData) { + var _asset$claimData = asset.claimData; + channelName = _asset$claimData.channelName; + certificateId = _asset$claimData.certificateId; + name = _asset$claimData.name; + claimId = _asset$claimData.claimId; + } + + ; + + if (channelName) { + return "".concat(siteHost, "/").concat(channelName, ":").concat(certificateId, "/").concat(name); + } + + ; + return "".concat(siteHost, "/").concat(claimId, "/").concat(name); +}; + +var createChannelCanonicalLink = function createChannelCanonicalLink(channel, siteHost) { + var name = channel.name, + longId = channel.longId; + return "".concat(siteHost, "/").concat(name, ":").concat(longId); +}; + +var createCanonicalLink = function createCanonicalLink(asset, channel, page, siteHost) { + if (asset) { + return createAssetCanonicalLink(asset, siteHost); + } + + if (channel) { + return createChannelCanonicalLink(channel, siteHost); + } + + return createBasicCanonicalLink(page, siteHost); +}; + +exports.createCanonicalLink = createCanonicalLink; \ No newline at end of file diff --git a/client/build/utils/dynamicImport.js b/client/build/utils/dynamicImport.js new file mode 100644 index 00000000..6c3f465d --- /dev/null +++ b/client/build/utils/dynamicImport.js @@ -0,0 +1,54 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.dynamicImport = void 0; + +function getDeepestChildValue(parent, childrenKeys) { + if (!parent[childrenKeys[0]]) { + return null; + } + + var childKey = childrenKeys.shift(); + var child = parent[childKey]; + + if (childrenKeys.length >= 1) { + return getDeepestChildValue(child, childrenKeys); + } + + return child; +} + +var dynamicImport = function dynamicImport(filePath, customViews) { + console.log('looking for', filePath, 'in', customViews); // validate inputs + + if (!filePath) { + throw new Error('no file path provided to dynamicImport()'); + } + + if (typeof filePath !== 'string') { + throw new Error('file path provided to dynamicImport() must be a string'); + } + + if (!customViews) { + return null; + } // split out the file folders; filter out any empty or white-space-only strings + + + var folders = filePath.split('/').filter(function (folderName) { + return folderName.replace(/\s/g, '').length; + }); // check for the component corresponding to file path in the site config object + + var component = getDeepestChildValue(customViews, folders); + + if (component) { + console.log('found custom component for', filePath); + return component; + } else { + console.log('no custom component for', filePath); + return null; + } +}; + +exports.dynamicImport = dynamicImport; \ No newline at end of file diff --git a/client/build/utils/file.js b/client/build/utils/file.js new file mode 100644 index 00000000..34610954 --- /dev/null +++ b/client/build/utils/file.js @@ -0,0 +1,42 @@ +"use strict"; + +module.exports = { + validateFile: function validateFile(file) { + if (!file) { + throw new Error('no file provided'); + } + + if (/'/.test(file.name)) { + throw new Error('apostrophes are not allowed in the file name'); + } // validate size and type + + + switch (file.type) { + case 'image/jpeg': + case 'image/jpg': + case 'image/png': + if (file.size > 10000000) { + throw new Error('Sorry, images are limited to 10 megabytes.'); + } + + break; + + case 'image/gif': + if (file.size > 50000000) { + throw new Error('Sorry, GIFs are limited to 50 megabytes.'); + } + + break; + + case 'video/mp4': + if (file.size > 50000000) { + throw new Error('Sorry, videos are limited to 50 megabytes.'); + } + + break; + + default: + throw new Error(file.type + ' is not a supported file type. Only, .jpeg, .png, .gif, and .mp4 files are currently supported.'); + } + } +}; \ No newline at end of file diff --git a/client/build/utils/lbryUri.js b/client/build/utils/lbryUri.js new file mode 100644 index 00000000..8c48d153 --- /dev/null +++ b/client/build/utils/lbryUri.js @@ -0,0 +1,118 @@ +"use strict"; + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +module.exports = { + REGEXP_INVALID_CLAIM: /[^A-Za-z0-9-]/g, + REGEXP_INVALID_CHANNEL: /[^A-Za-z0-9-@]/g, + REGEXP_ADDRESS: /^b(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$/, + CHANNEL_CHAR: '@', + parseIdentifier: function parseIdentifier(identifier) { + var componentsRegex = new RegExp('([^:$#/]*)' + // value (stops at the first separator or end) + '([:$#]?)([^/]*)' // modifier separator, modifier (stops at the first path separator or end) + ); + + var _componentsRegex$exec = componentsRegex // eslint-disable-line no-unused-vars + .exec(identifier).map(function (match) { + return match || null; + }), + _componentsRegex$exec2 = _slicedToArray(_componentsRegex$exec, 4), + proto = _componentsRegex$exec2[0], + value = _componentsRegex$exec2[1], + modifierSeperator = _componentsRegex$exec2[2], + modifier = _componentsRegex$exec2[3]; // Validate and process name + + + if (!value) { + throw new Error("Check your URL. No channel name provided before \"".concat(modifierSeperator, "\"")); + } + + var isChannel = value.startsWith(module.exports.CHANNEL_CHAR); + var channelName = isChannel ? value : null; + var claimId; + + if (isChannel) { + if (!channelName) { + throw new Error('Check your URL. No channel name after "@".'); + } + + var nameBadChars = channelName.match(module.exports.REGEXP_INVALID_CHANNEL); + + if (nameBadChars) { + throw new Error("Check your URL. Invalid characters in channel name: \"".concat(nameBadChars.join(', '), "\".")); + } + } else { + claimId = value; + } // Validate and process modifier + + + var channelClaimId; + + if (modifierSeperator) { + if (!modifier) { + throw new Error("Check your URL. No modifier provided after separator \"".concat(modifierSeperator, "\"")); + } + + if (modifierSeperator === ':') { + channelClaimId = modifier; + } else { + throw new Error("Check your URL. The \"".concat(modifierSeperator, "\" modifier is not currently supported")); + } + } + + return { + isChannel: isChannel, + channelName: channelName, + channelClaimId: channelClaimId || null, + claimId: claimId || null + }; + }, + parseClaim: function parseClaim(name) { + var componentsRegex = new RegExp('([^:$#/.]*)' + // name (stops at the first extension) + '([:$#.]?)([^/]*)' // extension separator, extension (stops at the first path separator or end) + ); + + var _componentsRegex$exec3 = componentsRegex // eslint-disable-line no-unused-vars + .exec(name).map(function (match) { + return match || null; + }), + _componentsRegex$exec4 = _slicedToArray(_componentsRegex$exec3, 4), + proto = _componentsRegex$exec4[0], + claimName = _componentsRegex$exec4[1], + extensionSeperator = _componentsRegex$exec4[2], + extension = _componentsRegex$exec4[3]; // Validate and process name + + + if (!claimName) { + throw new Error('Check your URL. No claim name provided before "."'); + } + + var nameBadChars = claimName.match(module.exports.REGEXP_INVALID_CLAIM); + + if (nameBadChars) { + throw new Error("Check your URL. Invalid characters in claim name: \"".concat(nameBadChars.join(', '), "\".")); + } // Validate and process extension + + + if (extensionSeperator) { + if (!extension) { + throw new Error("Check your URL. No file extension provided after separator \"".concat(extensionSeperator, "\".")); + } + + if (extensionSeperator !== '.') { + throw new Error("Check your URL. The \"".concat(extensionSeperator, "\" separator is not supported in the claim name.")); + } + } + + return { + claimName: claimName, + extension: extension || null + }; + } +}; \ No newline at end of file diff --git a/client/build/utils/metaTags.js b/client/build/utils/metaTags.js new file mode 100644 index 00000000..b1b47259 --- /dev/null +++ b/client/build/utils/metaTags.js @@ -0,0 +1,203 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createMetaTags = void 0; + +var determineOgThumbnailContentType = function determineOgThumbnailContentType(thumbnail) { + if (thumbnail) { + var fileExt = thumbnail.substring(thumbnail.lastIndexOf('.')); + + switch (fileExt) { + case 'jpeg': + case 'jpg': + return 'image/jpeg'; + + case 'png': + return 'image/png'; + + case 'gif': + return 'image/gif'; + + case 'mp4': + return 'video/mp4'; + + default: + return 'image/jpeg'; + } + } + + return ''; +}; + +var createBasicMetaTags = function createBasicMetaTags(siteHost, siteDescription, siteTitle, siteTwitter) { + return [{ + property: 'og:title', + content: siteTitle + }, { + property: 'og:url', + content: siteHost + }, { + property: 'og:site_name', + content: siteTitle + }, { + property: 'og:description', + content: siteDescription + }, { + property: 'twitter:site', + content: siteTwitter + }, { + property: 'twitter:card', + content: 'summary' + }]; +}; + +var createChannelMetaTags = function createChannelMetaTags(siteTitle, siteHost, siteTwitter, channel) { + var name = channel.name, + longId = channel.longId; + return [{ + property: 'og:title', + content: "".concat(name, " on ").concat(siteTitle) + }, { + property: 'og:url', + content: "".concat(siteHost, "/").concat(name, ":").concat(longId) + }, { + property: 'og:site_name', + content: siteTitle + }, { + property: 'og:description', + content: "".concat(name, ", a channel on ").concat(siteTitle) + }, { + property: 'twitter:site', + content: siteTwitter + }, { + property: 'twitter:card', + content: 'summary' + }]; +}; + +var createAssetMetaTags = function createAssetMetaTags(siteHost, siteTitle, siteTwitter, asset, defaultDescription, defaultThumbnail) { + var claimData = asset.claimData; + var contentType = claimData.contentType; + var embedUrl = "".concat(siteHost, "/").concat(claimData.claimId, "/").concat(claimData.name); + var showUrl = "".concat(siteHost, "/").concat(claimData.claimId, "/").concat(claimData.name); + var source = "".concat(siteHost, "/").concat(claimData.claimId, "/").concat(claimData.name, ".").concat(claimData.fileExt); + var ogTitle = claimData.title || claimData.name; + var ogDescription = claimData.description || defaultDescription; + var ogThumbnailContentType = determineOgThumbnailContentType(claimData.thumbnail); + var ogThumbnail = claimData.thumbnail || defaultThumbnail; + var metaTags = [{ + property: 'og:title', + content: ogTitle + }, { + property: 'og:url', + content: showUrl + }, { + property: 'og:site_name', + content: siteTitle + }, { + property: 'og:description', + content: ogDescription + }, { + property: 'og:image:width', + content: 600 + }, { + property: 'og:image:height', + content: 315 + }, { + property: 'twitter:site', + content: siteTwitter + }]; + + if (contentType === 'video/mp4' || contentType === 'video/webm') { + metaTags.push({ + property: 'og:video', + content: source + }); + metaTags.push({ + property: 'og:video:secure_url', + content: source + }); + metaTags.push({ + property: 'og:video:type', + content: contentType + }); + metaTags.push({ + property: 'og:image', + content: ogThumbnail + }); + metaTags.push({ + property: 'og:image:type', + content: ogThumbnailContentType + }); + metaTags.push({ + property: 'og:type', + content: 'video' + }); + metaTags.push({ + property: 'twitter:card', + content: 'player' + }); + metaTags.push({ + property: 'twitter:player', + content: embedUrl + }); + metaTags.push({ + property: 'twitter:player:width', + content: 600 + }); + metaTags.push({ + property: 'twitter:text:player_width', + content: 600 + }); + metaTags.push({ + property: 'twitter:player:height', + content: 337 + }); + metaTags.push({ + property: 'twitter:player:stream', + content: source + }); + metaTags.push({ + property: 'twitter:player:stream:content_type', + content: contentType + }); + } else { + metaTags.push({ + property: 'og:image', + content: source + }); + metaTags.push({ + property: 'og:image:type', + content: contentType + }); + metaTags.push({ + property: 'og:type', + content: 'article' + }); + metaTags.push({ + property: 'twitter:card', + content: 'summary_large_image' + }); + } + + return metaTags; +}; + +var createMetaTags = function createMetaTags(siteDescription, siteHost, siteTitle, siteTwitter, asset, channel, defaultDescription, defaultThumbnail) { + if (asset) { + return createAssetMetaTags(siteHost, siteTitle, siteTwitter, asset, defaultDescription, defaultThumbnail); + } + + ; + + if (channel) { + return createChannelMetaTags(siteHost, siteTitle, siteTwitter, channel); + } + + ; + return createBasicMetaTags(siteDescription, siteHost, siteTitle, siteTwitter); +}; + +exports.createMetaTags = createMetaTags; \ No newline at end of file diff --git a/client/build/utils/pageTitle.js b/client/build/utils/pageTitle.js new file mode 100644 index 00000000..353c5c09 --- /dev/null +++ b/client/build/utils/pageTitle.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createPageTitle = void 0; + +var createPageTitle = function createPageTitle(siteTitle, pageTitle) { + if (!pageTitle) { + return "".concat(siteTitle); + } + + return "".concat(siteTitle, " - ").concat(pageTitle); +}; + +exports.createPageTitle = createPageTitle; \ No newline at end of file diff --git a/client/build/utils/publish.js b/client/build/utils/publish.js new file mode 100644 index 00000000..d2a60655 --- /dev/null +++ b/client/build/utils/publish.js @@ -0,0 +1,57 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createThumbnailUrl = exports.createPublishFormData = exports.createPublishMetadata = void 0; + +var createPublishMetadata = function createPublishMetadata(claim, _ref, _ref2, publishInChannel, selectedChannel) { + var type = _ref.type; + var title = _ref2.title, + description = _ref2.description, + license = _ref2.license, + nsfw = _ref2.nsfw; + var metadata = { + name: claim, + title: title, + description: description, + license: license, + nsfw: nsfw, + type: type + }; + + if (publishInChannel) { + metadata['channelName'] = selectedChannel; + } + + return metadata; +}; + +exports.createPublishMetadata = createPublishMetadata; + +var createPublishFormData = function createPublishFormData(file, thumbnail, metadata) { + var fd = new FormData(); // append file + + fd.append('file', file); // append thumbnail + + if (thumbnail) { + fd.append('thumbnail', thumbnail); + } // append metadata + + + for (var key in metadata) { + if (metadata.hasOwnProperty(key)) { + fd.append(key, metadata[key]); + } + } + + return fd; +}; + +exports.createPublishFormData = createPublishFormData; + +var createThumbnailUrl = function createThumbnailUrl(channel, channelId, claim, host) { + return "".concat(host, "/").concat(channel, ":").concat(channelId, "/").concat(claim, "-thumb.png"); +}; + +exports.createThumbnailUrl = createThumbnailUrl; \ No newline at end of file diff --git a/client/build/utils/request.js b/client/build/utils/request.js new file mode 100644 index 00000000..388407cf --- /dev/null +++ b/client/build/utils/request.js @@ -0,0 +1,46 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = request; + +require("cross-fetch/polyfill"); + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function parseJSON(response) { + if (response.status === 204 || response.status === 205) { + return null; + } + + return response.json(); +} + +function checkStatus(response, jsonResponse) { + if (response.status >= 200 && response.status < 300) { + return jsonResponse; + } + + var error = new Error(jsonResponse.message); + error.response = response; + throw error; +} + +function request(url, options) { + return fetch(url, options).then(function (response) { + return Promise.all([response, parseJSON(response)]); + }).then(function (_ref) { + var _ref2 = _slicedToArray(_ref, 2), + response = _ref2[0], + jsonResponse = _ref2[1]; + + return checkStatus(response, jsonResponse); + }); +} \ No newline at end of file diff --git a/client/build/utils/validate.js b/client/build/utils/validate.js new file mode 100644 index 00000000..5ffe0410 --- /dev/null +++ b/client/build/utils/validate.js @@ -0,0 +1,56 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.validateCreateChannelPasswordInput = exports.validateCreateChannelNameInput = exports.validateNoPublishErrors = exports.validateChannelSelection = void 0; + +var validateChannelSelection = function validateChannelSelection(publishInChannel, selectedChannel, loggedInChannel) { + if (publishInChannel && selectedChannel !== loggedInChannel.name) { + throw new Error('Log in to a channel or select Anonymous'); + } +}; + +exports.validateChannelSelection = validateChannelSelection; + +var validateNoPublishErrors = function validateNoPublishErrors(_ref) { + var file = _ref.file, + url = _ref.url, + channel = _ref.channel; + + if (file || url || channel) { + throw new Error('Fix the errors identified in red'); + } +}; + +exports.validateNoPublishErrors = validateNoPublishErrors; + +var validateCreateChannelNameInput = function validateCreateChannelNameInput(_ref2) { + var value = _ref2.value, + error = _ref2.error; + + if (!value) { + throw new Error('Please enter a channel name'); + } + + if (error) { + throw new Error(error); + } +}; + +exports.validateCreateChannelNameInput = validateCreateChannelNameInput; + +var validateCreateChannelPasswordInput = function validateCreateChannelPasswordInput(_ref3) { + var value = _ref3.value, + error = _ref3.error; + + if (!value) { + throw new Error('Please enter a password'); + } + + if (error) { + throw new Error(error); + } +}; + +exports.validateCreateChannelPasswordInput = validateCreateChannelPasswordInput; \ No newline at end of file diff --git a/client/src/actions/channel.js b/client/src/actions/channel.js new file mode 100644 index 00000000..cdfab270 --- /dev/null +++ b/client/src/actions/channel.js @@ -0,0 +1,26 @@ +import * as actions from '../constants/channel_action_types'; + +// export action creators + +export function updateLoggedInChannel (name, shortId, longId) { + return { + type: actions.CHANNEL_UPDATE, + data: { + name, + shortId, + longId, + }, + }; +} + +export function checkForLoggedInChannel () { + return { + type: actions.CHANNEL_LOGIN_CHECK, + }; +} + +export function logOutChannel () { + return { + type: actions.CHANNEL_LOGOUT, + }; +} diff --git a/client/src/actions/channelCreate.js b/client/src/actions/channelCreate.js new file mode 100644 index 00000000..e6671e52 --- /dev/null +++ b/client/src/actions/channelCreate.js @@ -0,0 +1,43 @@ +import * as actions from '../constants/channel_create_action_types'; + +// export action creators + +export function updateChannelCreateName (name, value) { + return { + type: actions.CHANNEL_CREATE_UPDATE_NAME, + data: { + name, + value, + }, + }; +} + +export function updateChannelCreatePassword (name, value) { + return { + type: actions.CHANNEL_CREATE_UPDATE_PASSWORD, + data: { + name, + value, + }, + }; +} + +export function updateChannelCreateStatus (status) { + return { + type: actions.CHANNEL_CREATE_UPDATE_STATUS, + data: status, + }; +} + +export function updateChannelAvailability (channel) { + return { + type: actions.CHANNEL_AVAILABILITY, + data: channel, + }; +} + +export function createChannel () { + return { + type: actions.CHANNEL_CREATE, + }; +} diff --git a/client/src/actions/index.js b/client/src/actions/index.js new file mode 100644 index 00000000..a893a5fc --- /dev/null +++ b/client/src/actions/index.js @@ -0,0 +1,7 @@ +// import { } from './channel'; +// import { } from './publish'; +import { onHandleShowPageUri } from './show'; + +export default { + onHandleShowPageUri, +} diff --git a/client/src/actions/publish.js b/client/src/actions/publish.js new file mode 100644 index 00000000..552e2aff --- /dev/null +++ b/client/src/actions/publish.js @@ -0,0 +1,94 @@ +import * as actions from '../constants/publish_action_types'; + +// export action creators +export function selectFile (file) { + return { + type: actions.FILE_SELECTED, + data: file, + }; +} + +export function clearFile () { + return { + type: actions.FILE_CLEAR, + }; +} + +export function updateMetadata (name, value) { + return { + type: actions.METADATA_UPDATE, + data: { + name, + value, + }, + }; +} + +export function updateClaim (value) { + return { + type: actions.CLAIM_UPDATE, + data: value, + }; +}; + +export function setPublishInChannel (channel) { + return { + type: actions.SET_PUBLISH_IN_CHANNEL, + channel, + }; +} + +export function updatePublishStatus (status, message) { + return { + type: actions.PUBLISH_STATUS_UPDATE, + data: { + status, + message, + }, + }; +} + +export function updateError (name, value) { + return { + type: actions.ERROR_UPDATE, + data: { + name, + value, + }, + }; +} + +export function updateSelectedChannel (channelName) { + return { + type: actions.SELECTED_CHANNEL_UPDATE, + data: channelName, + }; +} + +export function toggleMetadataInputs (showMetadataInputs) { + return { + type: actions.TOGGLE_METADATA_INPUTS, + data: showMetadataInputs, + }; +} + +export function onNewThumbnail (file) { + return { + type: actions.THUMBNAIL_NEW, + data: file, + }; +} + +export function startPublish (history) { + return { + type: actions.PUBLISH_START, + data: { history }, + }; +} + +export function validateClaim (claim) { + return { + type: actions.CLAIM_AVAILABILITY, + data: claim, + }; +} diff --git a/client/src/actions/show.js b/client/src/actions/show.js new file mode 100644 index 00000000..3399ed0c --- /dev/null +++ b/client/src/actions/show.js @@ -0,0 +1,118 @@ +import * as actions from '../constants/show_action_types'; +import { CHANNEL, ASSET_LITE, ASSET_DETAILS } from '../constants/show_request_types'; + +// basic request parsing +export function onHandleShowPageUri (params) { + return { + type: actions.HANDLE_SHOW_URI, + data: params, + }; +}; + +export function onRequestError (error) { + return { + type: actions.REQUEST_ERROR, + data: error, + }; +}; + +export function onNewChannelRequest (channelName, channelId) { + const requestType = CHANNEL; + const requestId = `cr#${channelName}#${channelId}`; + return { + type: actions.CHANNEL_REQUEST_NEW, + data: { requestType, requestId, channelName, channelId }, + }; +}; + +export function onNewAssetRequest (name, id, channelName, channelId, extension) { + const requestType = extension ? ASSET_LITE : ASSET_DETAILS; + const requestId = `ar#${name}#${id}#${channelName}#${channelId}`; + return { + type: actions.ASSET_REQUEST_NEW, + data: { + requestType, + requestId, + name, + modifier: { + id, + channel: { + name: channelName, + id : channelId, + }, + }, + }, + }; +}; + +export function onRequestUpdate (requestType, requestId) { + return { + type: actions.REQUEST_UPDATE, + data: { + requestType, + requestId, + }, + }; +}; + +export function addRequestToRequestList (id, error, key) { + return { + type: actions.REQUEST_LIST_ADD, + data: { id, error, key }, + }; +}; + +// asset actions + +export function addAssetToAssetList (id, error, name, claimId, shortId, claimData) { + return { + type: actions.ASSET_ADD, + data: { id, error, name, claimId, shortId, claimData }, + }; +} + +// channel actions + +export function addNewChannelToChannelList (id, name, shortId, longId, claimsData) { + return { + type: actions.CHANNEL_ADD, + data: { id, name, shortId, longId, claimsData }, + }; +}; + +export function onUpdateChannelClaims (channelKey, name, longId, page) { + return { + type: actions.CHANNEL_CLAIMS_UPDATE_ASYNC, + data: {channelKey, name, longId, page}, + }; +}; + +export function updateChannelClaims (channelListId, claimsData) { + return { + type: actions.CHANNEL_CLAIMS_UPDATE_SUCCESS, + data: {channelListId, claimsData}, + }; +}; + +// display a file + +export function fileRequested (name, claimId) { + return { + type: actions.FILE_REQUESTED, + data: { name, claimId }, + }; +}; + +export function updateFileAvailability (status) { + return { + type: actions.FILE_AVAILABILITY_UPDATE, + data: status, + }; +}; + +export function updateDisplayAssetError (error) { + return { + type: actions.DISPLAY_ASSET_ERROR, + data: error, + }; +}; diff --git a/client/src/api/assetApi.js b/client/src/api/assetApi.js new file mode 100644 index 00000000..20e09b21 --- /dev/null +++ b/client/src/api/assetApi.js @@ -0,0 +1,39 @@ +import Request from '../utils/request'; + +export function getLongClaimId (host, name, modifier) { + let body = {}; + // create request params + if (modifier) { + if (modifier.id) { + body['claimId'] = modifier.id; + } else { + body['channelName'] = modifier.channel.name; + body['channelClaimId'] = modifier.channel.id; + } + } + body['claimName'] = name; + const params = { + method : 'POST', + headers: { 'Content-Type': 'application/json' }, + body : JSON.stringify(body), + }; + // create url + const url = `${host}/api/claim/long-id`; + // return the request promise + return Request(url, params); +}; + +export function getShortId (host, name, claimId) { + const url = `${host}/api/claim/short-id/${claimId}/${name}`; + return Request(url); +}; + +export function getClaimData (host, name, claimId) { + const url = `${host}/api/claim/data/${name}/${claimId}`; + return Request(url); +}; + +export function checkClaimAvailability (claim) { + const url = `/api/claim/availability/${claim}`; + return Request(url); +} diff --git a/client/src/api/authApi.js b/client/src/api/authApi.js new file mode 100644 index 00000000..63275815 --- /dev/null +++ b/client/src/api/authApi.js @@ -0,0 +1,13 @@ +import Request from '../utils/request'; + +export function checkForLoggedInChannelApi () { + const url = `/user`; + const params = {credentials: 'include'}; + return Request(url, params); +} + +export function channelLogoutApi () { + const url = `/logout`; + const params = {credentials: 'include'}; + return Request(url, params); +} diff --git a/client/src/api/channelApi.js b/client/src/api/channelApi.js new file mode 100644 index 00000000..d331c273 --- /dev/null +++ b/client/src/api/channelApi.js @@ -0,0 +1,30 @@ +import Request from '../utils/request'; + +export function getChannelData (host, name, id) { + if (!id) id = 'none'; + const url = `${host}/api/channel/data/${name}/${id}`; + return Request(url); +} + +export function getChannelClaims (host, name, longId, page) { + if (!page) page = 1; + const url = `${host}/api/channel/claims/${name}/${longId}/${page}`; + return Request(url); +} + +export function checkChannelAvailability (channel) { + const url = `/api/channel/availability/${channel}`; + return Request(url); +} + +export function makeCreateChannelRequest (username, password) { + const params = { + method : 'POST', + body : JSON.stringify({username, password}), + headers: new Headers({ + 'Content-Type': 'application/json', + }), + credentials: 'include', + }; + return Request('/signup', params); +} diff --git a/client/src/api/fileApi.js b/client/src/api/fileApi.js new file mode 100644 index 00000000..0662e6a6 --- /dev/null +++ b/client/src/api/fileApi.js @@ -0,0 +1,11 @@ +import Request from '../utils/request'; + +export function checkFileAvailability (claimId, host, name) { + const url = `${host}/api/file/availability/${name}/${claimId}`; + return Request(url); +} + +export function triggerClaimGet (claimId, host, name) { + const url = `${host}/api/claim/get/${name}/${claimId}`; + return Request(url); +} diff --git a/client/src/app.js b/client/src/app.js new file mode 100644 index 00000000..ce77de14 --- /dev/null +++ b/client/src/app.js @@ -0,0 +1,25 @@ +import React from 'react'; +import { Route, Switch } from 'react-router-dom'; + +import HomePage from '@pages/HomePage'; +import AboutPage from '@pages/AboutPage'; +import LoginPage from '@pages/LoginPage'; +import ShowPage from '@pages/ShowPage'; +import FourOhFourPage from '@pages/FourOhFourPage'; +import MultisitePage from '@pages/MultisitePage'; + +const customizedApp = () => { + return ( + + + + + + + + + + ); +}; + +export default customizedApp; diff --git a/client/src/channels/publish.js b/client/src/channels/publish.js new file mode 100644 index 00000000..bdbfbf19 --- /dev/null +++ b/client/src/channels/publish.js @@ -0,0 +1,48 @@ +import {buffers, END, eventChannel} from 'redux-saga'; + +export const makePublishRequestChannel = (fd) => { + return eventChannel(emitter => { + const uri = '/api/claim/publish'; + const xhr = new XMLHttpRequest(); + // add event listeners + const onLoadStart = () => { + emitter({loadStart: true}); + }; + const onProgress = (event) => { + if (event.lengthComputable) { + const percentage = Math.round((event.loaded * 100) / event.total); + emitter({progress: percentage}); + } + }; + const onLoad = () => { + emitter({load: true}); + }; + xhr.upload.addEventListener('loadstart', onLoadStart); + xhr.upload.addEventListener('progress', onProgress); + xhr.upload.addEventListener('load', onLoad); + // set state change handler + xhr.onreadystatechange = () => { + if (xhr.readyState === 4) { + const response = JSON.parse(xhr.response); + if ((xhr.status === 200) && response.success) { + emitter({success: response}); + emitter(END); + } else { + emitter({error: new Error(response.message)}); + emitter(END); + } + } + }; + // open and send + xhr.open('POST', uri, true); + xhr.send(fd); + // clean up + return () => { + xhr.upload.removeEventListener('loadstart', onLoadStart); + xhr.upload.removeEventListener('progress', onProgress); + xhr.upload.removeEventListener('load', onLoad); + xhr.onreadystatechange = null; + xhr.abort(); + }; + }, buffers.sliding(2)); +}; diff --git a/client/src/components/ActiveStatusBar/index.jsx b/client/src/components/ActiveStatusBar/index.jsx new file mode 100644 index 00000000..69a98440 --- /dev/null +++ b/client/src/components/ActiveStatusBar/index.jsx @@ -0,0 +1,7 @@ +import React from 'react'; + +const ActiveStatusBar = () => { + return | ; +}; + +export default ActiveStatusBar; diff --git a/client/src/components/AssetPreview/index.js b/client/src/components/AssetPreview/index.js new file mode 100644 index 00000000..2023e775 --- /dev/null +++ b/client/src/components/AssetPreview/index.js @@ -0,0 +1,10 @@ +import { connect } from 'react-redux'; +import View from './view'; + +const mapStateToProps = ({site: { defaultThumbnail }}) => { + return { + defaultThumbnail, + }; +}; + +export default connect(mapStateToProps, null)(View); diff --git a/client/src/components/AssetPreview/view.jsx b/client/src/components/AssetPreview/view.jsx new file mode 100644 index 00000000..d98a1f4c --- /dev/null +++ b/client/src/components/AssetPreview/view.jsx @@ -0,0 +1,42 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; + +const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, contentType, thumbnail } }) => { + const directSourceLink = `${claimId}/${name}.${fileExt}`; + const showUrlLink = `/${claimId}/${name}`; + return ( +
+ + {(() => { + switch (contentType) { + case 'image/jpeg': + case 'image/jpg': + case 'image/png': + case 'image/gif': + return ( + {name} + ); + case 'video/mp4': + return ( + {name} + ); + default: + return ( +

unsupported file type

+ ); + } + })()} + +
+ ); +}; + +export default AssetPreview; diff --git a/client/src/components/ExpandingTextArea/index.jsx b/client/src/components/ExpandingTextArea/index.jsx new file mode 100644 index 00000000..db83c5d8 --- /dev/null +++ b/client/src/components/ExpandingTextArea/index.jsx @@ -0,0 +1,37 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; + +class ExpandingTextarea extends Component { + constructor (props) { + super(props); + this._handleChange = this._handleChange.bind(this); + } + componentDidMount () { + this.adjustTextarea({}); + } + _handleChange (event) { + const { onChange } = this.props; + if (onChange) onChange(event); + this.adjustTextarea(event); + } + adjustTextarea ({ target = this.el }) { + target.style.height = 0; + target.style.height = `${target.scrollHeight}px`; + } + render () { + const { ...rest } = this.props; + return ( +