Skip to content

Commit

Permalink
fix: remove usage of false in component return (#1487)
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh authored Sep 30, 2024
1 parent b9e6afe commit 9def0fb
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 24 deletions.
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

0 comments on commit 9def0fb

Please sign in to comment.