Skip to content

Commit

Permalink
rename groupsIds to groupIds
Browse files Browse the repository at this point in the history
  • Loading branch information
Georges-GNM committed Jan 30, 2025
1 parent 20e8acc commit 8225941
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
12 changes: 6 additions & 6 deletions fronts-client/src/components/FrontsEdit/Collection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ interface ConnectedCollectionContextProps extends CollectionContextProps {
handleBlur: () => void;
lastDesktopArticle?: string;
lastMobileArticle?: string;
groupsIds: string[];
groupIds: string[];
updateCardMeta: (id: string, meta: CardMeta) => void;
addImageToCard: (uuid: string, imageData: ValidationResponse) => void;
}
Expand All @@ -137,7 +137,7 @@ class CollectionContext extends React.Component<ConnectedCollectionContextProps>
removeSupportingCard,
lastDesktopArticle,
lastMobileArticle,
groupsIds,
groupIds,
updateCardMeta,
addImageToCard,
} = this.props;
Expand All @@ -163,7 +163,7 @@ class CollectionContext extends React.Component<ConnectedCollectionContextProps>
isUneditable={isUneditable}
groupId={group.uuid}
groupName={group.name ? group.name : ''}
groupsIds={groupsIds}
groupIds={groupIds}
onMove={handleMove}
onDrop={handleInsert}
cardIds={group.cards}
Expand Down Expand Up @@ -198,7 +198,7 @@ class CollectionContext extends React.Component<ConnectedCollectionContextProps>
isUneditable={isUneditable}
cardId={card.uuid}
groupName={group.name ? group.name : ''}
groupsIds={groupsIds}
groupIds={groupIds}
onMove={handleMove}
onDrop={handleInsert}
cardTypeAllowList={this.getPermittedCardTypes(
Expand Down Expand Up @@ -264,10 +264,10 @@ const createMapStateToProps = () => {
collectionSet: props.browsingStage,
});

const groupsIds = state.collections.data[props.id]?.draft || [];
const groupIds = state.collections.data[props.id]?.draft || [];

return {
groupsIds: groupsIds,
groupIds: groupIds,
lastDesktopArticle: articleVisibilityDetails.desktop,
lastMobileArticle: articleVisibilityDetails.mobile,
};
Expand Down
24 changes: 12 additions & 12 deletions fronts-client/src/components/FrontsEdit/FrontContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class FrontContent extends React.Component<FrontProps, FrontState> {
// if we're in the splash and we insert an article and there's already another article, then we also look at the index we're inserting to
// if we're inserting to index 0, i.e. top of the group, then we want to grab the pre-existing article and move it to the other group
else if (
!!move.to.groupsIds &&
!!move.to.groupIds &&
move.to.cards !== undefined &&
move.to.index === 0
) {
Expand All @@ -213,15 +213,15 @@ class FrontContent extends React.Component<FrontProps, FrontState> {
);

//then we need to move the other article to the other group
const otherGroup = move.to.groupsIds.filter(
const otherGroup = move.to.groupIds.filter(
(groupId) => groupId !== move.to.id,
)[0];
const existingCardData = move.to.cards[0];
const existingCardTo = {
index: 0,
id: otherGroup,
type: 'group',
groupsIds: move.to.groupsIds,
groupIds: move.to.groupIds,
};
const existingCardMoveData: Move<TCard> = {
data: existingCardData,
Expand All @@ -234,20 +234,20 @@ class FrontContent extends React.Component<FrontProps, FrontState> {
// if we're in the splash and we insert an article and there's already another article, then we also look at the index we're inserting to
// if we're inserting to index 1, i.e. bottom of the group, then we add this story to the other group
else if (
!!move.to.groupsIds &&
!!move.to.groupIds &&
!!numberOfArticlesAlreadyInGroup &&
numberOfArticlesAlreadyInGroup > 0 &&
move.to.index > 0
) {
const otherGroup = move.to.groupsIds.filter(
const otherGroup = move.to.groupIds.filter(
(groupId) => groupId !== move.to.id,
)[0];

const amendedTo = {
index: 0,
id: otherGroup,
type: 'group',
groupsIds: move.to.groupsIds,
groupIds: move.to.groupIds,
};
events.dropArticle(this.props.id, 'collection');

Expand Down Expand Up @@ -279,7 +279,7 @@ class FrontContent extends React.Component<FrontProps, FrontState> {
}
// if we're in the splash and we insert an article and there's already another article, then we also look at the index we're inserting to
// if we're inserting to index 0, i.e. top of the group, then we want to grab the pre-existing article and move it to the other group
else if (!!to.groupsIds && to.cards !== undefined && to.index === 0) {
else if (!!to.groupIds && to.cards !== undefined && to.index === 0) {
// we do the regular insert steps for the article we're inserting to splash
events.dropArticle(
this.props.id,
Expand All @@ -289,15 +289,15 @@ class FrontContent extends React.Component<FrontProps, FrontState> {

//then we need to move the other article to the other group

const otherGroup = to.groupsIds.filter(
const otherGroup = to.groupIds.filter(
(groupId) => groupId !== to.id,
)[0];
const existingCardData = to.cards[0];
const existingCardTo = {
index: 0,
id: otherGroup,
type: 'group',
groupsIds: to.groupsIds,
groupIds: to.groupIds,
};
const existingCardMoveData: Move<TCard> = {
data: existingCardData,
Expand All @@ -310,20 +310,20 @@ class FrontContent extends React.Component<FrontProps, FrontState> {
// if we're in the splash and we insert an article and there's already another article, then we also look at the index we're inserting to
// if we're inserting to index 1, i.e. bottom of the group, then we add this story to the other group
else if (
!!to.groupsIds &&
!!to.groupIds &&
!!numberOfArticlesAlreadyInGroup &&
numberOfArticlesAlreadyInGroup > 0 &&
to.index > 0
) {
const otherGroup = to.groupsIds.filter(
const otherGroup = to.groupIds.filter(
(groupId) => groupId !== to.id,
)[0];

const amendedTo = {
index: 0,
id: otherGroup,
type: 'group',
groupsIds: to.groupsIds,
groupIds: to.groupIds,
};
events.dropArticle(
this.props.id,
Expand Down
6 changes: 3 additions & 3 deletions fronts-client/src/components/clipboard/CardLevel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface OuterProps {
dropMessage?: string;
cardTypeAllowList?: CardTypes[];
groupName?: string;
groupsIds?: string[];
groupIds?: string[];
}

interface InnerProps {
Expand Down Expand Up @@ -52,14 +52,14 @@ const CardLevel = ({
dropMessage,
cardTypeAllowList,
groupName,
groupsIds,
groupIds,
}: Props) => (
<CardTypeLevel
arr={supporting || []}
parentType="card"
parentId={cardId}
groupName={groupName}
groupsIds={groupsIds}
groupIds={groupIds}
onMove={onMove}
onDrop={onDrop}
canDrop={!isUneditable}
Expand Down
6 changes: 3 additions & 3 deletions fronts-client/src/components/clipboard/GroupLevel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface OuterProps {
onDrop: DropHandler;
isUneditable?: boolean;
groupName: string;
groupsIds: string[];
groupIds: string[];
}

interface InnerProps {
Expand Down Expand Up @@ -63,14 +63,14 @@ const GroupLevel = ({
onDrop,
isUneditable,
groupName,
groupsIds,
groupIds,
}: Props) => (
<CardTypeLevel
arr={cards}
parentType="group"
parentId={groupId}
groupName={groupName}
groupsIds={groupsIds}
groupIds={groupIds}
onMove={onMove}
onDrop={onDrop}
canDrop={!isUneditable}
Expand Down
6 changes: 3 additions & 3 deletions fronts-client/src/lib/dnd/Level.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface PosSpec {
id: string;
index: number;
groupName?: string;
groupsIds?: string[];
groupIds?: string[];
cards?: any[];
}

Expand Down Expand Up @@ -60,7 +60,7 @@ export interface LevelProps<T> {
parentId: string;
parentType: string;
groupName?: string;
groupsIds?: string[];
groupIds?: string[];
type: string;
getDropType?: (item: T) => string;
dragImageOffsetX?: number;
Expand Down Expand Up @@ -184,7 +184,7 @@ class Level<T> extends React.Component<Props<T>, State> {
type: this.props.parentType,
id: this.props.parentId,
groupName: this.props.groupName,
groupsIds: this.props.groupsIds,
groupIds: this.props.groupIds,
cards: this.props.arr,
};

Expand Down
6 changes: 3 additions & 3 deletions fronts-client/src/lib/dnd/__tests__/dnd.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('Curation', () => {
to: {
cards: [{ id: '3' }, { id: '4' }],
groupName: undefined,
groupsIds: undefined,
groupIds: undefined,
id: '2',
index: 1,
type: 'a',
Expand Down Expand Up @@ -174,7 +174,7 @@ describe('Curation', () => {
to: {
cards: [{ id: '3' }, { id: '4' }],
groupName: undefined,
groupsIds: undefined,
groupIds: undefined,
id: '2',
index: 0,
type: 'a',
Expand Down Expand Up @@ -290,7 +290,7 @@ describe('Curation', () => {
expect(to).toEqual({
cards: [{ id: '1' }],
groupName: undefined,
groupsIds: undefined,
groupIds: undefined,
id: '2',
index: 1,
type: 'a',
Expand Down

0 comments on commit 8225941

Please sign in to comment.