Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: [AXIMST-658] Course unit - Copy/paste refactoring #204

Merged
merged 6 commits into from
Mar 20, 2024

Conversation

PKulkoRaccoonGang
Copy link

@PKulkoRaccoonGang PKulkoRaccoonGang commented Mar 12, 2024

@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/copy-paste-refactoring branch from 3185b66 to 367946f Compare March 13, 2024 14:20
@PKulkoRaccoonGang PKulkoRaccoonGang marked this pull request as draft March 13, 2024 15:45
@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/copy-paste-refactoring branch 2 times, most recently from 910b0bd to 19e8989 Compare March 13, 2024 18:01
@codecov-commenter
Copy link

codecov-commenter commented Mar 13, 2024

Codecov Report

Attention: Patch coverage is 86.79245% with 7 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (ts-develop@8048f9b). Click here to learn what that means.

Files Patch % Lines
src/generic/data/thunks.js 77.77% 4 Missing ⚠️
src/generic/data/api.js 57.14% 3 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@              Coverage Diff              @@
##             ts-develop     #204   +/-   ##
=============================================
  Coverage              ?   89.51%           
=============================================
  Files                 ?      648           
  Lines                 ?    10839           
  Branches              ?     2252           
=============================================
  Hits                  ?     9702           
  Misses                ?     1098           
  Partials              ?       39           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/copy-paste-refactoring branch from 19e8989 to 46ab5bb Compare March 13, 2024 18:48
@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/copy-paste-refactoring branch from 46ab5bb to c7d6a1e Compare March 13, 2024 20:59
@PKulkoRaccoonGang PKulkoRaccoonGang changed the title refactor: copy paste functional refactoring refactor: [AXIMST-658] Course unit - Copy/paste refactoring Mar 13, 2024
@PKulkoRaccoonGang PKulkoRaccoonGang self-assigned this Mar 13, 2024
@vladislavkeblysh vladislavkeblysh force-pushed the ts-develop branch 2 times, most recently from dd8a0f9 to 509070d Compare March 14, 2024 10:43
@PKulkoRaccoonGang PKulkoRaccoonGang marked this pull request as ready for review March 15, 2024 10:27
const popoverContent = queryByTestId('popover-content');
const apiBaseUrl = getConfig().STUDIO_BASE_URL;
expect(popoverContent.tagName).toBe('A');
expect(popoverContent).toHaveAttribute('href', apiBaseUrl + unit.studioUrl);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expect(popoverContent).toHaveAttribute('href', apiBaseUrl + unit.studioUrl);
expect(popoverContent).toHaveAttribute('href', `${getConfig().STUDIO_BASE_URL}${unit.studioUrl}`);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected

Comment on lines +10 to +13
* @returns {Object} - An object containing state variables and functions related to clipboard functionality.
* @property {boolean} showPasteUnit - Flag indicating whether the "Paste Unit" button should be visible.
* @property {boolean} showPasteXBlock - Flag indicating whether the "Paste XBlock" button should be visible.
* @property {Object} sharedClipboardData - The shared clipboard data object.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

const [clipboardBroadcastChannel] = useState(() => new BroadcastChannel(STUDIO_CLIPBOARD_CHANNEL));
const [showPasteUnit, setShowPasteUnit] = useState(false);
const [showPasteXBlock, setShowPasteXBlock] = useState(false);
const clipboardData = useSelector(getClipboardData);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we use this selector outside of the hook and pass as param?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can it be application wide state?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conducted refactoring and moved the redux logic associated with the copy/paste functionality into the generic slice

import { clipboardPropsTypes, OVERLAY_TRIGGERS } from './constants';

const PasteComponent = ({ handleCreateNewCourseXBlock, clipboardData }) => {
const PasteButton = ({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this we can call as ClipboardPasteComponent and inside we will have ClipboardPasteButton`?

Component - because it consist of other parts like button in this case and etc.
Button - single element that will a part of component

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed

@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/copy-paste-refactoring branch 2 times, most recently from fc730d3 to 549f3ac Compare March 18, 2024 14:32
@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/copy-paste-refactoring branch from 549f3ac to 6ebd1ad Compare March 18, 2024 15:08
import PropTypes from 'prop-types';
import { Warning as WarningIcon } from '@openedx/paragon/icons';
import { useIntl } from '@edx/frontend-platform/i18n';

import { RequestStatus } from '../../data/constants';
import { getSavingStatus } from '../data/selectors';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe here we will use the same alias?

Suggested change
import { getSavingStatus } from '../data/selectors';
import { getSavingStatus as getGenericSavingStatus } from '../data/selectors';

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed, thanks

@monteri monteri merged commit ed4532a into ts-develop Mar 20, 2024
3 checks passed
khudym pushed a commit that referenced this pull request Mar 25, 2024
* refactor: copy paste functional refactoring

* refactor: refactoring paste-button

* refactor: tests refactoring

* refactor: updated translations

* refactor: refactoring after review

* refactor: renamed status selector name
monteri pushed a commit that referenced this pull request Apr 1, 2024
* refactor: copy paste functional refactoring

* refactor: refactoring paste-button

* refactor: tests refactoring

* refactor: updated translations

* refactor: refactoring after review

* refactor: renamed status selector name
ihor-romaniuk pushed a commit that referenced this pull request Apr 15, 2024
* refactor: copy paste functional refactoring

* refactor: refactoring paste-button

* refactor: tests refactoring

* refactor: updated translations

* refactor: refactoring after review

* refactor: renamed status selector name
ihor-romaniuk pushed a commit that referenced this pull request Apr 23, 2024
* refactor: copy paste functional refactoring

* refactor: refactoring paste-button

* refactor: tests refactoring

* refactor: updated translations

* refactor: refactoring after review

* refactor: renamed status selector name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants