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

fix: remove usage of false in component return #1487

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ import {
mockGetMembers,
mockGetMembersBy,
mockGetMembershipRequestsForItem,
mockGetOwnItems,
mockGetOwnMembershipRequests,
mockGetParents,
mockGetPublicationStatus,
Expand Down Expand Up @@ -188,8 +187,6 @@ Cypress.Commands.add(

mockGetAccessibleItems(cachedItems);

mockGetOwnItems(cachedItems);

mockGetSharedItems({ items: cachedItems, member: currentMember });

mockPostItem(cachedItems, postItemError);
Expand Down
14 changes: 0 additions & 14 deletions cypress/support/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const {
buildEditItemRoute,
buildItemUnpublishRoute,
buildGetItemRoute,
GET_OWN_ITEMS_ROUTE,
buildGetMemberRoute,
buildPostManyItemMembershipsRoute,
ITEMS_ROUTE,
Expand Down Expand Up @@ -165,19 +164,6 @@ export const mockGetCurrentMember = (
).as('getCurrentMember');
};

export const mockGetOwnItems = (items: ItemForTest[]): void => {
cy.intercept(
{
method: HttpMethod.Get,
url: `${API_HOST}/${GET_OWN_ITEMS_ROUTE}`,
},
(req) => {
const own = items.filter(isRootItem);
req.reply(own);
},
).as('getOwnItems');
};

export const mockGetAccessibleItems = (items: ItemForTest[]): void => {
cy.intercept(
{
Expand Down
4 changes: 2 additions & 2 deletions src/components/alerts/MemberValidationBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const buildLocalizedDocumentationLink = (lang: string): string => {
return `${buildLocalizedDocumentationOrigin(lang)}${MEMBER_VALIDATION_DOCUMENTATION_LINK}`;
};

const MemberValidationBanner = (): JSX.Element | false => {
const MemberValidationBanner = (): JSX.Element | null => {
const { isOpen, closeModal } = useModalStatus({
isInitiallyOpen: true,
});
Expand Down Expand Up @@ -71,6 +71,6 @@ const MemberValidationBanner = (): JSX.Element | false => {
</Alert>
);
}
return false;
return null;
};
export default MemberValidationBanner;
2 changes: 1 addition & 1 deletion src/components/common/ShowChatboxButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ShowChatboxButton = ({
return (
<ChatboxButton
color={showChatbox ? 'primary' : 'inherit'}
showChat={showChatbox || false}
showChat={showChatbox ?? false}
type={type}
onClick={onClick}
showChatText={translateBuilder(showChatTextKey)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type Props = {
const DisplayInvitationSummary = ({
userCsvData,
error,
}: Props): JSX.Element | false => {
}: Props): JSX.Element | null => {
const { t } = useBuilderTranslation();
if (error) {
const additionalMessage = getErrorFromPayload(error);
Expand Down Expand Up @@ -115,6 +115,6 @@ const DisplayInvitationSummary = ({
}

// no error and no data, display nothing
return false;
return null;
};
export default DisplayInvitationSummary;
4 changes: 2 additions & 2 deletions src/components/main/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const ResourceLinks = () => {
);
};

const MainMenu = (): JSX.Element | false => {
const MainMenu = (): JSX.Element | null => {
const { t } = useBuilderTranslation();
const navigate = useNavigate();
const { pathname } = useLocation();
Expand All @@ -57,7 +57,7 @@ const MainMenu = (): JSX.Element | false => {
};

if (!member || !member.id) {
return false;
return null;
}

const individualMenuItems =
Expand Down