FYP: "Don't recommend channel"
This commit is contained in:
parent
51079ea611
commit
a31ea6417a
6 changed files with 91 additions and 10 deletions
|
@ -1324,6 +1324,7 @@
|
|||
"I like this": "I like this",
|
||||
"I dislike this": "I dislike this",
|
||||
"Not interested": "Not interested",
|
||||
"Also, don't recommend channel": "Also, don't recommend channel",
|
||||
"Let %channel% know you enjoyed this!": "Let %channel% know you enjoyed this!",
|
||||
"An account with %domain% allows you to earn rewards and backup your data.": "An account with %domain% allows you to earn rewards and backup your data.",
|
||||
"Sync my YouTube channel": "Sync my YouTube channel",
|
||||
|
|
|
@ -48,3 +48,4 @@ export const CONFIRM_REMOVE_CARD = 'CONFIRM_REMOVE_CARD';
|
|||
export const CONFIRM_REMOVE_COMMENT = 'CONFIRM_REMOVE_COMMENT';
|
||||
export const CONFIRM_ODYSEE_MEMBERSHIP = 'CONFIRM_ODYSEE_MEMBERSHIP';
|
||||
export const MEMBERSHIP_SPLASH = 'MEMBERSHIP_SPLASH';
|
||||
export const HIDE_RECOMMENDATION = 'HIDE_RECOMMENDATION';
|
||||
|
|
9
ui/modal/modalHideRecommendation/index.js
Normal file
9
ui/modal/modalHideRecommendation/index.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doHideModal } from 'redux/actions/app';
|
||||
import ModalHideRecommendation from './view';
|
||||
|
||||
const perform = {
|
||||
doHideModal,
|
||||
};
|
||||
|
||||
export default connect(null, perform)(ModalHideRecommendation);
|
55
ui/modal/modalHideRecommendation/view.jsx
Normal file
55
ui/modal/modalHideRecommendation/view.jsx
Normal file
|
@ -0,0 +1,55 @@
|
|||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import ClaimPreview from 'component/claimPreview';
|
||||
import Card from 'component/common/card';
|
||||
import { FormField } from 'component/common/form-components/form-field';
|
||||
import { Modal } from 'modal/modal';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
onConfirm: (hideChannel: boolean) => void,
|
||||
doHideModal: () => void,
|
||||
};
|
||||
|
||||
export default function ModalHideRecommendation(props: Props) {
|
||||
const { uri, onConfirm, doHideModal } = props;
|
||||
const [hideChannel, setHideChannel] = React.useState(false);
|
||||
|
||||
function handleOnClick() {
|
||||
if (onConfirm) {
|
||||
onConfirm(hideChannel);
|
||||
}
|
||||
doHideModal();
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal isOpen type="card" onAborted={doHideModal}>
|
||||
<Card
|
||||
title={__('Not interested')}
|
||||
body={
|
||||
<div className="content__non-clickable">
|
||||
<ClaimPreview uri={uri} hideMenu hideActions type="inline" properties={false} />
|
||||
</div>
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
<div className="section__checkbox">
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="hide_channel"
|
||||
label={__("Also, don't recommend channel")}
|
||||
checked={hideChannel}
|
||||
onChange={() => setHideChannel(!hideChannel)}
|
||||
/>
|
||||
</div>
|
||||
<div className="section__actions">
|
||||
<Button button="primary" label={__('Submit')} onClick={handleOnClick} />
|
||||
<Button button="link" label={__('Cancel')} onClick={doHideModal} />
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
}
|
|
@ -28,6 +28,7 @@ const MAP = Object.freeze({
|
|||
[MODALS.FILE_SELECTION]: lazyImport(() => import('modal/modalFileSelection' /* webpackChunkName: "modalFileSelection" */)),
|
||||
[MODALS.FILE_TIMEOUT]: lazyImport(() => import('modal/modalFileTimeout' /* webpackChunkName: "modalFileTimeout" */)),
|
||||
[MODALS.FIRST_REWARD]: lazyImport(() => import('modal/modalFirstReward' /* webpackChunkName: "modalFirstReward" */)),
|
||||
[MODALS.HIDE_RECOMMENDATION]: lazyImport(() => import('modal/modalHideRecommendation' /* webpackChunkName: "modalHideRecommendation" */)),
|
||||
[MODALS.IMAGE_UPLOAD]: lazyImport(() => import('modal/modalImageUpload' /* webpackChunkName: "modalImageUpload" */)),
|
||||
[MODALS.LIQUIDATE_SUPPORTS]: lazyImport(() => import('modal/modalSupportsLiquidate' /* webpackChunkName: "modalSupportsLiquidate" */)),
|
||||
[MODALS.MASS_TIP_UNLOCK]: lazyImport(() => import('modal/modalMassTipUnlock' /* webpackChunkName: "modalMassTipUnlock" */)),
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectClaimForUri, selectClaimIdForUri, selectClaimIsNsfwForUri } from 'redux/selectors/claims';
|
||||
|
@ -46,8 +48,13 @@ const recsysFyp = {
|
|||
});
|
||||
},
|
||||
|
||||
ignoreRecommendation: (userId: string, gid: string, claimId: string) => {
|
||||
return fetch(`${RECSYS_FYP_ENDPOINT}/${userId}/fyp/${gid}/c/${claimId}/ignore`, {
|
||||
ignoreRecommendation: (userId: string, gid: string, claimId: string, ignoreChannel: boolean) => {
|
||||
let endpoint = `${RECSYS_FYP_ENDPOINT}/${userId}/fyp/${gid}/c/${claimId}/ignore`;
|
||||
if (ignoreChannel) {
|
||||
endpoint += '?entire_channel=1';
|
||||
}
|
||||
|
||||
return fetch(endpoint, {
|
||||
method: 'POST',
|
||||
headers: { [X_LBRY_AUTH_TOKEN]: getAuthToken() },
|
||||
})
|
||||
|
@ -281,8 +288,12 @@ export const doRemovePersonalRecommendation = (uri: string) => (dispatch: Dispat
|
|||
return;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
doOpenModal(MODALS.HIDE_RECOMMENDATION, {
|
||||
uri,
|
||||
onConfirm: (hideChannel) => {
|
||||
recsysFyp
|
||||
.ignoreRecommendation(user.id, personalRecommendations.gid, claimId)
|
||||
.ignoreRecommendation(user.id, personalRecommendations.gid, claimId, hideChannel)
|
||||
.then((res) => {
|
||||
dispatch({ type: ACTIONS.FYP_HIDE_URI, data: { uri } });
|
||||
dispatch(doToast({ message: __('Recommendation removed. Thanks for the feedback!') }));
|
||||
|
@ -290,6 +301,9 @@ export const doRemovePersonalRecommendation = (uri: string) => (dispatch: Dispat
|
|||
.catch((err) => {
|
||||
console.log('doRemovePersonalRecommendation:', err);
|
||||
});
|
||||
},
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
export { lighthouse, recsysFyp };
|
||||
|
|
Loading…
Reference in a new issue