Revert "feat: integrate feeder package"
This commit is contained in:
1
.env
1
.env
@@ -19,4 +19,3 @@ REFRESH_ACCESS_TOKEN_ENDPOINT=''
|
||||
SEGMENT_KEY=''
|
||||
SITE_NAME=''
|
||||
USER_INFO_COOKIE_NAME=''
|
||||
FEEDER_PROJECT_ID=''
|
||||
|
||||
@@ -20,4 +20,3 @@ REFRESH_ACCESS_TOKEN_ENDPOINT='http://localhost:18000/login_refresh'
|
||||
SEGMENT_KEY=''
|
||||
SITE_NAME=localhost
|
||||
USER_INFO_COOKIE_NAME='edx-user-info'
|
||||
FEEDER_PROJECT_ID=''
|
||||
|
||||
@@ -18,4 +18,3 @@ REFRESH_ACCESS_TOKEN_ENDPOINT='http://localhost:18000/login_refresh'
|
||||
SEGMENT_KEY=''
|
||||
SITE_NAME=localhost
|
||||
USER_INFO_COOKIE_NAME='edx-user-info'
|
||||
FEEDER_PROJECT_ID=''
|
||||
|
||||
5
package-lock.json
generated
5
package-lock.json
generated
@@ -7808,11 +7808,6 @@
|
||||
"integrity": "sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q==",
|
||||
"dev": true
|
||||
},
|
||||
"feeder-react-feedback": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/feeder-react-feedback/-/feeder-react-feedback-0.0.6.tgz",
|
||||
"integrity": "sha512-BdilgLncuOdoFFC0Da3wYMIYODSxZaH3vUS4662QUTzKOGrGrc63yDywRFw2x4b30Kie3kwD4z3rXcaTznq7Mg=="
|
||||
},
|
||||
"figures": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
"babel-polyfill": "6.26.0",
|
||||
"classnames": "2.3.1",
|
||||
"core-js": "3.19.1",
|
||||
"feeder-react-feedback": "0.0.6",
|
||||
"formik": "2.2.9",
|
||||
"lodash.snakecase": "4.1.1",
|
||||
"prop-types": "15.7.2",
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
export const FeedbackTypes = ['Review', 'Bug', 'Idea'];
|
||||
export const primaryColor = '#00262b';
|
||||
@@ -1,103 +0,0 @@
|
||||
@import "feeder-react-feedback/dist/feeder-react-feedback.css";
|
||||
|
||||
.frf-feedback-container {
|
||||
position: unset;
|
||||
bottom: unset;
|
||||
z-index: unset;
|
||||
width: unset;
|
||||
right: unset;
|
||||
}
|
||||
|
||||
#feedbackEmail {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div[for="feedbackEmail"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.frf-trigger-button {
|
||||
position: unset;
|
||||
box-shadow: unset;
|
||||
}
|
||||
|
||||
.frf-feedback-icon::after {
|
||||
content: "Give Feedback" !important;
|
||||
margin-left: 8px !important;
|
||||
font-size: unset !important;
|
||||
}
|
||||
|
||||
.frf-feedback-icon-open:after {
|
||||
content: "Close" !important;
|
||||
font-size: inherit !important;
|
||||
}
|
||||
|
||||
.frf-modal-container {
|
||||
right: unset;
|
||||
bottom: unset;
|
||||
}
|
||||
|
||||
.frf-dialog-enter-active {
|
||||
animation-name: unset;
|
||||
animation-duration: unset;
|
||||
opacity: unset;
|
||||
transition: unset;
|
||||
}
|
||||
|
||||
.frf-dialog-enter {
|
||||
opacity: unset;
|
||||
}
|
||||
|
||||
.frf-dialog-exit-active {
|
||||
animation-name: unset;
|
||||
animation-duration: unset;
|
||||
opacity: unset;
|
||||
transition: unset;
|
||||
}
|
||||
|
||||
.frf-dialog-exit {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.frf-water {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
.frf-trigger-button {
|
||||
transition: unset;
|
||||
|
||||
&:hover {
|
||||
.frf-feedback-icon:after {
|
||||
content: unset;
|
||||
margin-left: unset;
|
||||
font-size: unset;
|
||||
opacity: unset;
|
||||
transition: unset;
|
||||
}
|
||||
|
||||
.frf-feedback-icon-open:after {
|
||||
content: unset;
|
||||
font-size: unset;
|
||||
opacity: unset;
|
||||
transition: unset;
|
||||
}
|
||||
}
|
||||
|
||||
.frf-feedback-icon:after {
|
||||
content: unset;
|
||||
padding-left: unset;
|
||||
font-size: unset;
|
||||
opacity: unset;
|
||||
transition: unset;
|
||||
}
|
||||
|
||||
.frf-feedback-icon-open:after {
|
||||
content: unset;
|
||||
padding-left: unset;
|
||||
font-size: unset;
|
||||
opacity: unset;
|
||||
transition: unset;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
import React from 'react';
|
||||
|
||||
import Feedback from 'feeder-react-feedback';
|
||||
|
||||
import { ensureConfig, getConfig } from '@edx/frontend-platform';
|
||||
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
|
||||
import { FeedbackTypes, primaryColor } from './constants';
|
||||
import messages from './messages';
|
||||
|
||||
import './feeder.scss';
|
||||
|
||||
ensureConfig(['FEEDER_PROJECT_ID'], 'Feedback');
|
||||
|
||||
const Index = ({ intl, ...props }) => {
|
||||
const { email } = getAuthenticatedUser();
|
||||
const projectId = getConfig().FEEDER_PROJECT_ID;
|
||||
|
||||
return (
|
||||
projectId && (
|
||||
<Feedback
|
||||
projectId={projectId}
|
||||
email
|
||||
emailDefaultValue={email}
|
||||
feedbackTypes={FeedbackTypes}
|
||||
primaryColor={primaryColor}
|
||||
submitButtonMsg={intl.formatMessage(messages.submitButton)}
|
||||
postSubmitButtonMsg={intl.formatMessage(messages.postSubmitButton)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
Index.propTypes = {
|
||||
intl: intlShape.isRequired,
|
||||
};
|
||||
|
||||
export default injectIntl(Index);
|
||||
@@ -1,16 +0,0 @@
|
||||
import { defineMessages } from '@edx/frontend-platform/i18n';
|
||||
|
||||
const messages = defineMessages({
|
||||
submitButton: {
|
||||
id: 'feeder.submit.button',
|
||||
defaultMessage: 'Send Feedback',
|
||||
description: 'Alt text for feedback submission button.',
|
||||
},
|
||||
postSubmitButton: {
|
||||
id: 'feeder.post.submit.button',
|
||||
defaultMessage: 'Thank You For The Feedback!',
|
||||
description: 'Alt text for feedback post submission button',
|
||||
},
|
||||
});
|
||||
|
||||
export default messages;
|
||||
@@ -3,7 +3,7 @@ import { IntlProvider } from 'react-intl';
|
||||
import { Context as ResponsiveContext } from 'react-responsive';
|
||||
import { MemoryRouter } from 'react-router';
|
||||
|
||||
import { getConfig, initializeMockApp, setConfig } from '@edx/frontend-platform';
|
||||
import { initializeMockApp } from '@edx/frontend-platform';
|
||||
import { AppProvider } from '@edx/frontend-platform/react';
|
||||
|
||||
import { initializeStore } from '../../store';
|
||||
@@ -29,16 +29,10 @@ function renderComponent(location = `/${courseId}/`) {
|
||||
|
||||
describe('DiscussionsHome', () => {
|
||||
beforeEach(async () => {
|
||||
setConfig({
|
||||
...getConfig(),
|
||||
FEEDER_PROJECT_ID: 'test-id',
|
||||
});
|
||||
|
||||
initializeMockApp({
|
||||
authenticatedUser: {
|
||||
userId: 3,
|
||||
username: 'abc123',
|
||||
email: 'abc123@example.com',
|
||||
administrator: true,
|
||||
roles: [],
|
||||
},
|
||||
@@ -56,7 +50,7 @@ describe('DiscussionsHome', () => {
|
||||
await screen.findByTestId('topics-view');
|
||||
});
|
||||
|
||||
test('full view should show header, footer and feedback button and hide close button', async () => {
|
||||
test('full view should show header and footer and hide close button', async () => {
|
||||
renderComponent(`/${courseId}/topics`);
|
||||
expect(screen.queryByText(navigationBarMessages.allTopics.defaultMessage))
|
||||
.toBeInTheDocument();
|
||||
@@ -71,11 +65,9 @@ describe('DiscussionsHome', () => {
|
||||
// Footer should be visible
|
||||
expect(screen.queryByRole('contentinfo'))
|
||||
.toBeInTheDocument();
|
||||
|
||||
expect(screen.queryByTestId('feedback').childElementCount).toEqual(1);
|
||||
});
|
||||
|
||||
test('in-context view should hide header and footer and show close and feedback button', async () => {
|
||||
test('in-context view should hide header and footer and show close button', async () => {
|
||||
renderComponent(`/${courseId}/topics?inContext`);
|
||||
|
||||
expect(screen.queryByText(navigationBarMessages.allTopics.defaultMessage))
|
||||
@@ -93,6 +85,5 @@ describe('DiscussionsHome', () => {
|
||||
expect(screen.queryByRole('contentinfo'))
|
||||
.not
|
||||
.toBeInTheDocument();
|
||||
expect(screen.queryByTestId('feedback').childElementCount).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
} from '@edx/paragon';
|
||||
import { Close } from '@edx/paragon/icons';
|
||||
|
||||
import Feedback from '../../../components/Feedback';
|
||||
import { Routes } from '../../../data/constants';
|
||||
import { DiscussionContext } from '../../common/context';
|
||||
import { discussionsPath } from '../../utils';
|
||||
@@ -30,9 +29,6 @@ function PostActionsBar({
|
||||
const handleCloseInContext = () => null;
|
||||
return (
|
||||
<div className="d-flex justify-content-end py-1 flex-grow-1">
|
||||
<div className="mr-3" data-testid="feedback">
|
||||
<Feedback />
|
||||
</div>
|
||||
{!inContext && (
|
||||
<>
|
||||
<SearchField
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { Context as ResponsiveContext } from 'react-responsive';
|
||||
|
||||
import { getConfig, initializeMockApp, setConfig } from '@edx/frontend-platform';
|
||||
import { AppProvider } from '@edx/frontend-platform/react';
|
||||
|
||||
import { initializeStore } from '../../../store';
|
||||
import messages from './messages';
|
||||
import PostActionsBar from './PostActionsBar';
|
||||
|
||||
let store;
|
||||
|
||||
function renderComponent(inContext) {
|
||||
render(
|
||||
<IntlProvider locale="en">
|
||||
<ResponsiveContext.Provider value={{ width: 1280 }}>
|
||||
<AppProvider store={store}>
|
||||
<PostActionsBar inContext={inContext} />
|
||||
</AppProvider>
|
||||
</ResponsiveContext.Provider>
|
||||
</IntlProvider>,
|
||||
);
|
||||
}
|
||||
|
||||
describe.each([
|
||||
{ inContext: false },
|
||||
{ inContext: true },
|
||||
])('PostActionsBar', ({ inContext }) => {
|
||||
beforeEach(async () => {
|
||||
setConfig({
|
||||
...getConfig(),
|
||||
FEEDER_PROJECT_ID: 'test-id',
|
||||
});
|
||||
|
||||
initializeMockApp({
|
||||
authenticatedUser: {
|
||||
userId: 3,
|
||||
username: 'abc123',
|
||||
email: 'abc123@example.com',
|
||||
administrator: true,
|
||||
roles: [],
|
||||
},
|
||||
});
|
||||
|
||||
store = initializeStore();
|
||||
});
|
||||
|
||||
test(`'full view should show feedback, add post, ${inContext ? 'close button and title and hide searchbar'
|
||||
: 'searchbar and hide title and close button'} when inContext is ${inContext}`, () => {
|
||||
renderComponent(inContext);
|
||||
|
||||
expect(screen.queryByTestId('feedback').childElementCount).toEqual(1);
|
||||
expect(screen.queryByRole('button', { name: 'Add a post' })).toBeInTheDocument();
|
||||
|
||||
if (inContext) {
|
||||
expect(screen.queryByPlaceholderText(messages.searchAllPosts.defaultMessage)).not.toBeInTheDocument();
|
||||
expect(screen.queryByText(messages.title.defaultMessage)).toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: 'Close' })).toBeInTheDocument();
|
||||
} else {
|
||||
expect(screen.queryByPlaceholderText(messages.searchAllPosts.defaultMessage)).toBeInTheDocument();
|
||||
expect(screen.queryByText(messages.title.defaultMessage)).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: 'Close' })).not.toBeInTheDocument();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -42,7 +42,6 @@ initialize({
|
||||
config() {
|
||||
mergeConfig({
|
||||
POST_MARK_AS_READ_DELAY: process.env.POST_MARK_AS_READ_DELAY || 2000,
|
||||
FEEDER_PROJECT_ID: process.env.FEEDER_PROJECT_ID || '',
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user