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

Get rid of some prop type console warnings #4072

Merged
merged 3 commits into from
Jan 8, 2025
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
11 changes: 6 additions & 5 deletions src/components/IIIFAuthentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ import WindowAuthenticationBar from '../containers/WindowAuthenticationBar';
* Opens a new window for click
*/
export function IIIFAuthentication({
accessTokenServiceId, authServiceId, confirm = undefined, description = undefined,
accessTokenServiceId = undefined, authServiceId = undefined, confirm = undefined, description = undefined,
failureDescription = undefined, failureHeader = undefined, features = 'centerscreen',
handleAuthInteraction, header = undefined, isInteractive = true, label = undefined,
logoutConfirm = undefined, logoutServiceId = undefined, openWindow = window.open,
resetAuthenticationState, resolveAccessTokenRequest, resolveAuthenticationRequest,
status = null, windowId,
}) {
const { t } = useTranslation();

if (!accessTokenServiceId || !authServiceId) return null;

Comment on lines +19 to +21
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
if (!accessTokenServiceId || !authServiceId) return null;

authServiceId is covered later:
https://github.com/ProjectMirador/mirador/pull/4072/files#diff-dfe0ec8d6ff147fa74246b2b5bddddb923d72f4572ba8da097a5b4f991168fd9R101

I can't tell if accessTokenServiceId is critical to rendering the UI (it looks like maybe it's just used in the callbacks?)

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, re: authServiceId since it is referenced on line 24 I will keep this and remove the later check?

/** */
const onReceiveAccessTokenMessage = (payload) => {
resolveAccessTokenRequest(authServiceId, accessTokenServiceId, payload);
Expand Down Expand Up @@ -95,8 +98,6 @@ export function IIIFAuthentication({
);
};

if (!authServiceId) return null;

if (status === null) return renderLogin();
if (status === 'cookie') return renderLoggingInCookie();
if (status === 'token') return renderLoggingInToken();
Expand All @@ -107,8 +108,8 @@ export function IIIFAuthentication({
}

IIIFAuthentication.propTypes = {
accessTokenServiceId: PropTypes.string.isRequired,
authServiceId: PropTypes.string.isRequired,
accessTokenServiceId: PropTypes.string,
authServiceId: PropTypes.string,
confirm: PropTypes.string,
description: PropTypes.string,
failureDescription: PropTypes.string,
Expand Down
6 changes: 3 additions & 3 deletions src/components/IIIFThumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Image = styled('img', { name: 'IIIFThumbnail', slot: 'image' })(() => ({
*/
const LazyLoadedImage = ({
border = false, placeholder, style = {}, thumbnail = null,
resource, maxHeight, maxWidth, thumbnailsConfig = {}, ...props
resource, maxHeight = null, maxWidth = null, thumbnailsConfig = {}, ...props
}) => {
const { ref, inView } = useInView();
const [loaded, setLoaded] = useState(false);
Expand Down Expand Up @@ -117,8 +117,8 @@ const LazyLoadedImage = ({

LazyLoadedImage.propTypes = {
border: PropTypes.bool,
maxHeight: PropTypes.number.isRequired,
maxWidth: PropTypes.number.isRequired,
maxHeight: PropTypes.number,
maxWidth: PropTypes.number,
placeholder: PropTypes.string.isRequired,
resource: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
style: PropTypes.object, // eslint-disable-line react/forbid-prop-types
Expand Down
2 changes: 1 addition & 1 deletion src/components/WindowSideBarButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ WindowSideBarButtons.propTypes = {
hasCurrentLayers: PropTypes.bool,
hasSearchResults: PropTypes.bool,
hasSearchService: PropTypes.bool,
panels: PropTypes.arrayOf(PropTypes.bool),
panels: PropTypes.objectOf(PropTypes.bool),
PluginComponents: PropTypes.array, // eslint-disable-line react/forbid-prop-types
sideBarPanel: PropTypes.string,
};
Loading