Commit 8986c475 authored by Robert Knight's avatar Robert Knight

Remove propTypes declarations from components

Prop-types checking has been replaced by JSDoc + TypeScript.
parent d2301501
import classnames from 'classnames';
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
import { useShortcut } from '../../shared/shortcut';
......@@ -33,14 +32,6 @@ function ToolbarButton({ badgeCount, icon, label, onClick, shortcut }) {
);
}
ToolbarButton.propTypes = {
badgeCount: propTypes.number,
icon: propTypes.string,
label: propTypes.string.isRequired,
onClick: propTypes.func.isRequired,
shortcut: propTypes.string,
};
/**
* Union of possible toolbar commands.
*
......@@ -132,10 +123,3 @@ export default function AdderToolbar({
</div>
);
}
AdderToolbar.propTypes = {
arrowDirection: propTypes.oneOf(['up', 'down']).isRequired,
isVisible: propTypes.bool.isRequired,
onCommand: propTypes.func.isRequired,
annotationCount: propTypes.number,
};
import classnames from 'classnames';
import propTypes from 'prop-types';
import scrollIntoView from 'scroll-into-view';
import { setHighlightsFocused } from '../highlighter';
......@@ -48,11 +47,6 @@ function BucketButton({ bucket, onSelectAnnotations }) {
);
}
BucketButton.propTypes = {
bucket: propTypes.object.isRequired,
onSelectAnnotations: propTypes.func.isRequired,
};
/**
* An up- or down-pointing button that will scroll to the next closest bucket
* of annotations in the given direction.
......@@ -83,11 +77,6 @@ function NavigationBucketButton({ bucket, direction }) {
);
}
NavigationBucketButton.propTypes = {
bucket: propTypes.object.isRequired,
direction: propTypes.string,
};
/**
* A list of buckets, including up and down navigation (when applicable) and
* on-screen buckets
......@@ -134,10 +123,3 @@ export default function Buckets({
</ul>
);
}
Buckets.propTypes = {
above: propTypes.object.isRequired,
below: propTypes.object.isRequired,
buckets: propTypes.array.isRequired,
onSelectAnnotations: propTypes.func.isRequired,
};
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
/**
* @param {Object} props
......@@ -42,16 +41,6 @@ function ToolbarButton({
);
}
ToolbarButton.propTypes = {
buttonRef: propTypes.any,
expanded: propTypes.bool,
className: propTypes.string,
label: propTypes.string.isRequired,
icon: propTypes.string.isRequired,
onClick: propTypes.func.isRequired,
selected: propTypes.bool,
};
/**
* @typedef ToolbarProps
*
......@@ -137,15 +126,3 @@ export default function Toolbar({
</div>
);
}
Toolbar.propTypes = {
closeSidebar: propTypes.func.isRequired,
createAnnotation: propTypes.func.isRequired,
isSidebarOpen: propTypes.bool.isRequired,
newAnnotationType: propTypes.oneOf(['annotation', 'note']).isRequired,
showHighlights: propTypes.bool.isRequired,
toggleHighlights: propTypes.func.isRequired,
toggleSidebar: propTypes.func.isRequired,
toggleSidebarRef: propTypes.any,
useMinimalControls: propTypes.bool,
};
import classnames from 'classnames';
import propTypes from 'prop-types';
import { useStoreProxy } from '../../store/use-store';
import { quote } from '../../helpers/annotation-metadata';
......@@ -121,16 +120,6 @@ function Annotation({
);
}
Annotation.propTypes = {
annotation: propTypes.object,
hasAppliedFilter: propTypes.bool.isRequired,
isReply: propTypes.bool,
onToggleReplies: propTypes.func,
replyCount: propTypes.number.isRequired,
threadIsCollapsed: propTypes.bool.isRequired,
annotationsService: propTypes.object.isRequired,
};
Annotation.injectedProps = ['annotationsService'];
export default withServices(Annotation);
import propTypes from 'prop-types';
import { useStoreProxy } from '../../store/use-store';
import {
sharingEnabled,
......@@ -121,14 +119,6 @@ function AnnotationActionBar({
);
}
AnnotationActionBar.propTypes = {
annotation: propTypes.object.isRequired,
onReply: propTypes.func.isRequired,
annotationsService: propTypes.object.isRequired,
settings: propTypes.object.isRequired,
toastMessenger: propTypes.object.isRequired,
};
AnnotationActionBar.injectedProps = [
'annotationsService',
'settings',
......
import { useState } from 'preact/hooks';
import propTypes from 'prop-types';
import { useStoreProxy } from '../../store/use-store';
import { isHidden } from '../../helpers/annotation-metadata';
......@@ -90,11 +89,6 @@ function AnnotationBody({ annotation, settings }) {
);
}
AnnotationBody.propTypes = {
annotation: propTypes.object.isRequired,
settings: propTypes.object,
};
AnnotationBody.injectedProps = ['settings'];
export default withServices(AnnotationBody);
import propTypes from 'prop-types';
/** @typedef {import("../../../types/api").Annotation} Annotation */
/**
......@@ -33,9 +31,3 @@ export default function AnnotationDocumentInfo({ domain, link, title }) {
</div>
);
}
AnnotationDocumentInfo.propTypes = {
domain: propTypes.string,
link: propTypes.string,
title: propTypes.string.isRequired,
};
import { normalizeKeyName } from '@hypothesis/frontend-shared';
import { useState } from 'preact/hooks';
import propTypes from 'prop-types';
import { withServices } from '../../service-context';
import { applyTheme } from '../../helpers/theme';
......@@ -158,14 +157,6 @@ function AnnotationEditor({
);
}
AnnotationEditor.propTypes = {
annotation: propTypes.object.isRequired,
annotationsService: propTypes.object,
settings: propTypes.object,
tags: propTypes.object.isRequired,
toastMessenger: propTypes.object,
};
AnnotationEditor.injectedProps = [
'annotationsService',
'settings',
......
import { SvgIcon } from '@hypothesis/frontend-shared';
import { useMemo } from 'preact/hooks';
import propTypes from 'prop-types';
import { useStoreProxy } from '../../store/use-store';
import {
......@@ -144,10 +143,3 @@ export default function AnnotationHeader({
</header>
);
}
AnnotationHeader.propTypes = {
annotation: propTypes.object.isRequired,
isEditing: propTypes.bool,
replyCount: propTypes.number,
threadIsCollapsed: propTypes.bool.isRequired,
};
......@@ -22,5 +22,3 @@ export default function AnnotationLicense() {
</div>
);
}
AnnotationLicense.propTypes = {};
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
import { useStoreProxy } from '../../store/use-store';
import { isNew, isReply } from '../../helpers/annotation-metadata';
......@@ -132,13 +131,6 @@ function AnnotationPublishControl({
);
}
AnnotationPublishControl.propTypes = {
annotation: propTypes.object.isRequired,
isDisabled: propTypes.bool,
onSave: propTypes.func.isRequired,
settings: propTypes.object.isRequired,
};
AnnotationPublishControl.injectedProps = ['settings'];
export default withServices(AnnotationPublishControl);
import classnames from 'classnames';
import propTypes from 'prop-types';
import { isOrphan, quote } from '../../helpers/annotation-metadata';
import { withServices } from '../../service-context';
......@@ -61,12 +60,6 @@ function AnnotationQuote({ annotation, isFocused, settings = {} }) {
);
}
AnnotationQuote.propTypes = {
annotation: propTypes.object.isRequired,
isFocused: propTypes.bool,
settings: propTypes.object,
};
AnnotationQuote.injectedProps = ['settings'];
export default withServices(AnnotationQuote);
import propTypes from 'prop-types';
import Button from '../Button';
/**
......@@ -32,10 +30,4 @@ function AnnotationReplyToggle({
);
}
AnnotationReplyToggle.propTypes = {
onToggleReplies: propTypes.func,
replyCount: propTypes.number,
threadIsCollapsed: propTypes.bool.isRequired,
};
export default AnnotationReplyToggle;
import { SvgIcon, useElementShouldClose } from '@hypothesis/frontend-shared';
import { useEffect, useRef, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import { isShareableURI } from '../../helpers/annotation-sharing';
import { copyText } from '../../util/copy-to-clipboard';
......@@ -181,14 +180,6 @@ function AnnotationShareControl({
);
}
AnnotationShareControl.propTypes = {
annotation: propTypes.object.isRequired,
group: propTypes.object,
shareUri: propTypes.string.isRequired,
analytics: propTypes.object.isRequired,
toastMessenger: propTypes.object.isRequired,
};
AnnotationShareControl.injectedProps = ['analytics', 'toastMessenger'];
export default withServices(AnnotationShareControl);
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
import { useStoreProxy } from '../../store/use-store';
import { isPrivate } from '../../helpers/permissions';
......@@ -56,8 +55,4 @@ function AnnotationShareInfo({ annotation }) {
);
}
AnnotationShareInfo.propTypes = {
annotation: propTypes.object.isRequired,
};
export default AnnotationShareInfo;
import { useEffect, useMemo, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import { format as formatDate } from '../../util/date';
import { decayingInterval, toFuzzyString } from '../../util/time';
......@@ -108,10 +107,3 @@ export default function AnnotationTimestamps({
</div>
);
}
AnnotationTimestamps.propTypes = {
annotationCreated: propTypes.string,
annotationUpdated: propTypes.string,
annotationUrl: propTypes.string,
withEditedTimestamp: propTypes.bool,
};
import propTypes from 'prop-types';
import { isThirdPartyUser, username } from '../../helpers/account-id';
import { withServices } from '../../service-context';
......@@ -67,12 +65,6 @@ function AnnotationUser({ annotation, features, serviceUrl, settings }) {
);
}
AnnotationUser.propTypes = {
annotation: propTypes.object.isRequired,
features: propTypes.object.isRequired,
serviceUrl: propTypes.func.isRequired,
settings: propTypes.object.isRequired,
};
AnnotationUser.injectedProps = ['features', 'serviceUrl', 'settings'];
export default withServices(AnnotationUser);
import { useEffect, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import { withServices } from '../service-context';
......@@ -93,11 +92,6 @@ function AnnotationView({ loadAnnotationsService, onLogin }) {
);
}
AnnotationView.propTypes = {
onLogin: propTypes.func.isRequired,
loadAnnotationsService: propTypes.object,
};
AnnotationView.injectedProps = ['loadAnnotationsService'];
export default withServices(AnnotationView);
import classnames from 'classnames';
import { useMemo } from 'preact/hooks';
import propTypes from 'prop-types';
const defaultListFormatter = item => item;
......@@ -95,13 +94,3 @@ export default function AutocompleteList({
</div>
);
}
AutocompleteList.propTypes = {
activeItem: propTypes.number,
id: propTypes.string,
itemPrefixId: propTypes.string,
list: propTypes.array.isRequired,
listFormatter: propTypes.func,
onSelectItem: propTypes.func.isRequired,
open: propTypes.bool,
};
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
/**
* @typedef ButtonProps
......@@ -87,36 +86,3 @@ export default function Button({
</button>
);
}
/**
* Validation callback for `propTypes`. The given `propName` is conditionally
* required depending on the presence or absence of the `buttonText` property. Return
* an `Error` on validation failure, per propTypes API.
*
* @return {Error|undefined}
*/
function requiredStringIfButtonTextMissing(props, propName, componentName) {
if (
typeof props.buttonText !== 'string' &&
typeof props[propName] !== 'string'
) {
return new Error(
`string property '${propName}' must be supplied to component '${componentName}'\
if string property 'buttonText' omitted`
);
}
return undefined;
}
Button.propTypes = {
buttonText: propTypes.string,
className: propTypes.string,
icon: requiredStringIfButtonTextMissing,
iconPosition: propTypes.string,
isExpanded: propTypes.bool,
isPressed: propTypes.bool,
onClick: propTypes.func,
disabled: propTypes.bool,
style: propTypes.object,
title: requiredStringIfButtonTextMissing,
};
import classnames from 'classnames';
import { useCallback, useLayoutEffect, useRef, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import observeElementSize from '../util/observe-element-size';
import { withServices } from '../service-context';
......@@ -39,12 +38,6 @@ function InlineControls({ isCollapsed, setCollapsed, linkStyle = {} }) {
);
}
InlineControls.propTypes = {
isCollapsed: propTypes.bool,
setCollapsed: propTypes.func,
linkStyle: propTypes.object,
};
const noop = () => {};
/**
......@@ -163,17 +156,6 @@ function Excerpt({
);
}
Excerpt.propTypes = {
children: propTypes.object,
inlineControls: propTypes.bool,
collapse: propTypes.bool,
collapsedHeight: propTypes.number,
overflowThreshold: propTypes.number,
onCollapsibleChanged: propTypes.func,
onToggleCollapsed: propTypes.func,
settings: propTypes.object,
};
Excerpt.injectedProps = ['settings'];
export default withServices(Excerpt);
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
import Menu from './Menu';
import MenuItem from './MenuItem';
......@@ -56,13 +55,4 @@ function FilterSelect({
);
}
FilterSelect.propTypes = {
defaultOption: propTypes.object,
icon: propTypes.string,
onSelect: propTypes.func,
options: propTypes.array,
selectedOption: propTypes.object,
title: propTypes.string,
};
export default FilterSelect;
import { useMemo } from 'preact/hooks';
import propTypes from 'prop-types';
import { countVisible } from '../helpers/thread';
......@@ -104,16 +103,6 @@ function FilterStatusPanel({
);
}
FilterStatusPanel.propTypes = {
resultCount: propTypes.number.isRequired,
actionButton: propTypes.object.isRequired,
additionalCount: propTypes.number,
entitySingular: propTypes.string,
entityPlural: propTypes.string,
filterQuery: propTypes.string,
focusDisplayName: propTypes.string,
};
/**
* This status is used when there are selected annotations (including direct-
* linked annotations). This status takes precedence over others.
......@@ -165,11 +154,6 @@ function SelectionFilterStatus({ filterState, rootThread }) {
);
}
SelectionFilterStatus.propTypes = {
filterState: propTypes.object.isRequired,
rootThread: propTypes.object.isRequired,
};
/**
* This status is used when there is an applied filter query and
* `SelectionFilterStatus` does not apply.
......@@ -210,11 +194,6 @@ function QueryFilterStatus({ filterState, rootThread }) {
);
}
QueryFilterStatus.propTypes = {
filterState: propTypes.object.isRequired,
rootThread: propTypes.object.isRequired,
};
/**
* This status is used if user-focus mode is configured and neither
* `SelectionFilterStatus` nor `QueryFilterStatus` apply.
......@@ -263,11 +242,6 @@ function FocusFilterStatus({ filterState, rootThread }) {
);
}
FocusFilterStatus.propTypes = {
filterState: propTypes.object.isRequired,
rootThread: propTypes.object.isRequired,
};
/**
* Determine which (if any) of the filter status variants to render depending
* on current `filterState`. Only one filter status panel is displayed at a time:
......@@ -313,5 +287,3 @@ export default function FilterStatus() {
}
return null;
}
FilterStatus.propTypes = {};
import { useMemo, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import serviceConfig from '../config/service-config';
import { useStoreProxy } from '../store/use-store';
......@@ -149,11 +148,6 @@ function GroupList({ serviceUrl, settings }) {
);
}
GroupList.propTypes = {
serviceUrl: propTypes.func,
settings: propTypes.object,
};
GroupList.injectedProps = ['serviceUrl', 'settings'];
export default withServices(GroupList);
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import { copyText } from '../util/copy-to-clipboard';
import { orgName } from '../helpers/group-list-item-common';
......@@ -148,15 +146,6 @@ function GroupListItem({
);
}
GroupListItem.propTypes = {
group: propTypes.object.isRequired,
isExpanded: propTypes.bool,
onExpand: propTypes.func,
analytics: propTypes.object.isRequired,
groups: propTypes.object.isRequired,
toastMessenger: propTypes.object.isRequired,
};
GroupListItem.injectedProps = ['analytics', 'groups', 'toastMessenger'];
export default withServices(GroupListItem);
import propTypes from 'prop-types';
import GroupListItem from './GroupListItem';
import MenuSection from './MenuSection';
......@@ -42,10 +40,3 @@ export default function GroupListSection({
</MenuSection>
);
}
GroupListSection.propTypes = {
expandedGroup: propTypes.object,
groups: propTypes.arrayOf(propTypes.object),
heading: propTypes.string,
onExpandGroup: propTypes.func,
};
import { SvgIcon } from '@hypothesis/frontend-shared';
import { useCallback, useMemo, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import { withServices } from '../service-context';
......@@ -41,11 +40,6 @@ function HelpPanelTab({ linkText, url }) {
);
}
HelpPanelTab.propTypes = {
linkText: propTypes.string.isRequired,
url: propTypes.string.isRequired,
};
/**
* @typedef HelpPanelProps
* @prop {AuthState} auth - Object with auth and user information
......@@ -160,10 +154,6 @@ function HelpPanel({ auth, session }) {
);
}
HelpPanel.propTypes = {
auth: propTypes.object.isRequired,
session: propTypes.object.isRequired,
};
HelpPanel.injectedProps = ['session'];
export default withServices(HelpPanel);
import classnames from 'classnames';
import { useEffect, useMemo } from 'preact/hooks';
import propTypes from 'prop-types';
import bridgeEvents from '../../shared/bridge-events';
import serviceConfig from '../config/service-config';
......@@ -201,15 +200,6 @@ function HypothesisApp({
);
}
HypothesisApp.propTypes = {
auth: propTypes.object,
bridge: propTypes.object,
serviceUrl: propTypes.func,
settings: propTypes.object,
session: propTypes.object,
toastMessenger: propTypes.object,
};
HypothesisApp.injectedProps = [
'auth',
'bridge',
......
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
import { withServices } from '../service-context';
......@@ -55,11 +54,6 @@ function LoggedOutMessage({ onLogin, serviceUrl }) {
);
}
LoggedOutMessage.propTypes = {
onLogin: propTypes.func.isRequired,
serviceUrl: propTypes.func.isRequired,
};
LoggedOutMessage.injectedProps = ['serviceUrl'];
export default withServices(LoggedOutMessage);
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import Button from './Button';
......@@ -44,8 +42,3 @@ export default function LoginPromptPanel({ onLogin, onSignUp }) {
</SidebarPanel>
);
}
LoginPromptPanel.propTypes = {
onLogin: propTypes.func.isRequired,
onSignUp: propTypes.func.isRequired,
};
......@@ -2,7 +2,6 @@ import classnames from 'classnames';
import { SvgIcon, normalizeKeyName } from '@hypothesis/frontend-shared';
import { createRef } from 'preact';
import { useEffect, useMemo, useRef, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import {
LinkType,
......@@ -147,17 +146,6 @@ function ToolbarButton({
);
}
ToolbarButton.propTypes = {
buttonRef: propTypes.object.isRequired,
disabled: propTypes.bool,
iconName: propTypes.string,
label: propTypes.string,
onClick: propTypes.func.isRequired,
shortcutKey: propTypes.string,
tabIndex: propTypes.number.isRequired,
title: propTypes.string,
};
/**
* @typedef {'bold'|'italic'|'quote'|'link'|'image'|'math'|'numlist'|'list'|'preview'|'help'} ButtonID
*/
......@@ -383,12 +371,6 @@ function Toolbar({ isPreviewing, onCommand, onTogglePreview }) {
);
}
Toolbar.propTypes = {
isPreviewing: propTypes.bool,
onCommand: propTypes.func,
onTogglePreview: propTypes.func,
};
/**
* @typedef MarkdownEditorProps
* @prop {string} label - An accessible label for the input field.
......@@ -478,10 +460,3 @@ export default function MarkdownEditor({
</div>
);
}
MarkdownEditor.propTypes = {
textStyle: propTypes.object,
label: propTypes.string.isRequired,
text: propTypes.string,
onEditText: propTypes.func,
};
import classnames from 'classnames';
import { useEffect, useMemo, useRef } from 'preact/hooks';
import propTypes from 'prop-types';
import { replaceLinksWithEmbeds } from '../media-embedder';
import renderMarkdown from '../render-markdown';
......@@ -52,9 +51,3 @@ export default function MarkdownView({
/>
);
}
MarkdownView.propTypes = {
markdown: propTypes.string,
textClass: propTypes.object,
textStyle: propTypes.object,
};
......@@ -5,7 +5,6 @@ import {
useElementShouldClose,
} from '@hypothesis/frontend-shared';
import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import MenuKeyboardNavigation from './MenuKeyboardNavigation';
......@@ -207,19 +206,3 @@ export default function Menu({
</div>
);
}
Menu.propTypes = {
align: propTypes.oneOf(['left', 'right']),
arrowClass: propTypes.string,
label: propTypes.oneOfType([
propTypes.object.isRequired,
propTypes.string.isRequired,
]),
children: propTypes.any,
containerPositioned: propTypes.bool,
contentClass: propTypes.string,
defaultOpen: propTypes.bool,
onOpenChanged: propTypes.func,
title: propTypes.string.isRequired,
menuIndicator: propTypes.bool,
};
import classnames from 'classnames';
import { SvgIcon, normalizeKeyName } from '@hypothesis/frontend-shared';
import { useEffect, useRef } from 'preact/hooks';
import propTypes from 'prop-types';
import MenuKeyboardNavigation from './MenuKeyboardNavigation';
import Slider from './Slider';
......@@ -230,18 +229,3 @@ export default function MenuItem({
</>
);
}
MenuItem.propTypes = {
href: propTypes.string,
iconAlt: propTypes.string,
icon: propTypes.string,
isDisabled: propTypes.bool,
isExpanded: propTypes.bool,
isSelected: propTypes.bool,
isSubmenuItem: propTypes.bool,
isSubmenuVisible: propTypes.bool,
label: propTypes.string.isRequired,
onClick: propTypes.func,
onToggleSubmenu: propTypes.func,
submenu: propTypes.any,
};
import { normalizeKeyName } from '@hypothesis/frontend-shared';
import { useEffect, useRef } from 'preact/hooks';
import propTypes from 'prop-types';
function isElementVisible(element) {
return element.offsetParent !== null;
......@@ -110,18 +109,3 @@ export default function MenuKeyboardNavigation({
</div>
);
}
MenuKeyboardNavigation.propTypes = {
className: propTypes.string,
// Callback when the menu is closed via keyboard input
closeMenu: propTypes.func,
// When true`, sets focus on the first item in the list
// which has a role="menuitem" attribute.
visible: propTypes.bool,
// Array of nodes which may contain <MenuItems> or any nodes
// that have role set to 'menuitem', 'menuitemradio', or 'menuitemcheckbox'
children: propTypes.any.isRequired,
};
import { toChildArray } from 'preact';
import propTypes from 'prop-types';
/** @typedef {import("preact").JSX.Element} JSXElement */
......@@ -38,8 +37,3 @@ export default function MenuSection({ heading, children }) {
</>
);
}
MenuSection.propTypes = {
heading: propTypes.string,
children: propTypes.any.isRequired,
};
import classnames from 'classnames';
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import * as annotationMetadata from '../helpers/annotation-metadata';
......@@ -97,12 +96,6 @@ function ModerationBanner({ annotation, api, toastMessenger }) {
);
}
ModerationBanner.propTypes = {
annotation: propTypes.object.isRequired,
api: propTypes.object.isRequired,
toastMessenger: propTypes.object.isRequired,
};
ModerationBanner.injectedProps = ['api', 'toastMessenger'];
export default withServices(ModerationBanner);
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import { withServices } from '../service-context';
import { applyTheme } from '../helpers/theme';
......@@ -48,10 +46,6 @@ function NewNoteButton({ annotationsService, settings }) {
</div>
);
}
NewNoteButton.propTypes = {
annotationsService: propTypes.object.isRequired,
settings: propTypes.object.isRequired,
};
NewNoteButton.injectedProps = ['annotationsService', 'settings'];
......
......@@ -28,6 +28,4 @@ function NotebookFilters() {
);
}
NotebookFilters.propTypes = {};
export default NotebookFilters;
import propTypes from 'prop-types';
import useRootThread from './hooks/use-root-thread';
import { countVisible } from '../helpers/thread';
......@@ -67,11 +65,4 @@ function NotebookResultCount({
);
}
NotebookResultCount.propTypes = {
forcedVisibleCount: propTypes.number,
isFiltered: propTypes.bool,
isLoading: propTypes.bool,
resultCount: propTypes.number,
};
export default NotebookResultCount;
import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import scrollIntoView from 'scroll-into-view';
import { withServices } from '../service-context';
......@@ -105,10 +104,6 @@ function NotebookView({ loadAnnotationsService }) {
);
}
NotebookView.propTypes = {
loadAnnotationsService: propTypes.object,
};
NotebookView.injectedProps = ['loadAnnotationsService'];
export default withServices(NotebookView);
import { useMemo } from 'preact/hooks';
import propTypes from 'prop-types';
import { countVisible } from '../helpers/thread';
......@@ -57,12 +56,4 @@ function PaginatedThreadList({
);
}
PaginatedThreadList.propTypes = {
isLoading: propTypes.bool,
threads: propTypes.array,
currentPage: propTypes.number,
onChangePage: propTypes.func,
pageSize: propTypes.number,
};
export default PaginatedThreadList;
import propTypes from 'prop-types';
import { pageNumberOptions } from '../util/pagination';
import Button from './Button';
......@@ -80,10 +78,4 @@ function PaginationNavigation({ currentPage, onChangePage, totalPages }) {
);
}
PaginationNavigation.propTypes = {
currentPage: propTypes.number,
onChangePage: propTypes.func,
totalPages: propTypes.number,
};
export default PaginationNavigation;
import classnames from 'classnames';
import { useRef, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
......@@ -90,9 +89,3 @@ export default function SearchInput({ alwaysExpanded, query, onSearch }) {
</form>
);
}
SearchInput.propTypes = {
alwaysExpanded: propTypes.bool,
query: propTypes.string,
onSearch: propTypes.func,
};
import classnames from 'classnames';
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import { withServices } from '../service-context';
......@@ -69,15 +68,6 @@ function Tab({
);
}
Tab.propTypes = {
children: propTypes.node.isRequired,
count: propTypes.number.isRequired,
isSelected: propTypes.bool.isRequired,
isWaitingToAnchor: propTypes.bool.isRequired,
label: propTypes.string.isRequired,
onSelect: propTypes.func.isRequired,
};
/**
* @typedef SelectionTabsProps
* @prop {boolean} isLoading - Are we waiting on any annotations from the server?
......@@ -169,10 +159,6 @@ function SelectionTabs({ isLoading, settings }) {
</div>
);
}
SelectionTabs.propTypes = {
isLoading: propTypes.bool.isRequired,
settings: propTypes.object.isRequired,
};
SelectionTabs.injectedProps = ['settings'];
......
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import { pageSharingLink } from '../helpers/annotation-sharing';
......@@ -123,11 +122,6 @@ function ShareAnnotationsPanel({ analytics, toastMessenger }) {
);
}
ShareAnnotationsPanel.propTypes = {
analytics: propTypes.object.isRequired,
toastMessenger: propTypes.object.isRequired,
};
ShareAnnotationsPanel.injectedProps = ['analytics', 'toastMessenger'];
export default withServices(ShareAnnotationsPanel);
import { SvgIcon } from '@hypothesis/frontend-shared';
import classnames from 'classnames';
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
......@@ -76,9 +75,3 @@ export default function SidebarContentError({
</div>
);
}
SidebarContentError.propTypes = {
errorType: propTypes.oneOf(['annotation', 'group']).isRequired,
showClearSelection: propTypes.bool,
onLoginRequest: propTypes.func.isRequired,
};
import { SvgIcon } from '@hypothesis/frontend-shared';
import { useEffect, useRef } from 'preact/hooks';
import propTypes from 'prop-types';
import scrollIntoView from 'scroll-into-view';
import { useStoreProxy } from '../store/use-store';
......@@ -82,11 +81,3 @@ export default function SidebarPanel({
</Slider>
);
}
SidebarPanel.propTypes = {
children: propTypes.any,
icon: propTypes.string,
panelName: propTypes.string.isRequired,
title: propTypes.string.isRequired,
onActiveChanged: propTypes.func,
};
import propTypes from 'prop-types';
import { useEffect, useRef } from 'preact/hooks';
import useRootThread from './hooks/use-root-thread';
......@@ -158,14 +157,6 @@ function SidebarView({
);
}
SidebarView.propTypes = {
onLogin: propTypes.func.isRequired,
onSignUp: propTypes.func.isRequired,
frameSync: propTypes.object,
loadAnnotationsService: propTypes.object,
streamer: propTypes.object,
};
SidebarView.injectedProps = ['frameSync', 'loadAnnotationsService', 'streamer'];
export default withServices(SidebarView);
import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
import propTypes from 'prop-types';
/**
* @typedef SliderProps
......@@ -102,8 +101,3 @@ export default function Slider({ children, visible }) {
</div>
);
}
Slider.propTypes = {
children: propTypes.any,
visible: propTypes.bool,
};
......@@ -46,5 +46,3 @@ export default function SortMenu() {
</div>
);
}
SortMenu.propTypes = {};
......@@ -16,5 +16,3 @@ export default function Spinner() {
</div>
);
}
Spinner.propTypes = {};
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import { withServices } from '../service-context';
......@@ -31,10 +29,6 @@ function StreamSearchInput({ router }) {
);
}
StreamSearchInput.propTypes = {
router: propTypes.object,
};
StreamSearchInput.injectedProps = ['router'];
export default withServices(StreamSearchInput);
import { useCallback, useEffect } from 'preact/hooks';
import propTypes from 'prop-types';
import * as searchFilter from '../util/search-filter';
import { withServices } from '../service-context';
......@@ -67,11 +66,6 @@ function StreamView({ api, toastMessenger }) {
return <ThreadList threads={rootThread.children} />;
}
StreamView.propTypes = {
api: propTypes.object,
toastMessenger: propTypes.object,
};
StreamView.injectedProps = ['api', 'toastMessenger'];
export default withServices(StreamView);
......@@ -4,7 +4,6 @@ import {
useElementShouldClose,
} from '@hypothesis/frontend-shared';
import { useRef, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import { withServices } from '../service-context';
......@@ -339,14 +338,6 @@ function TagEditor({
);
}
TagEditor.propTypes = {
onAddTag: propTypes.func.isRequired,
onRemoveTag: propTypes.func.isRequired,
onTagInput: propTypes.func,
tagList: propTypes.array.isRequired,
tags: propTypes.object.isRequired,
};
TagEditor.injectedProps = ['tags'];
export default withServices(TagEditor);
import { useMemo } from 'preact/hooks';
import propTypes from 'prop-types';
import { isThirdPartyUser } from '../helpers/account-id';
import { withServices } from '../service-context';
......@@ -62,13 +61,6 @@ function TagList({ annotation, serviceUrl, settings, tags }) {
);
}
TagList.propTypes = {
annotation: propTypes.object.isRequired,
tags: propTypes.array.isRequired,
serviceUrl: propTypes.func,
settings: propTypes.object,
};
TagList.injectedProps = ['serviceUrl', 'settings'];
export default withServices(TagList);
import classnames from 'classnames';
import { useCallback, useMemo } from 'preact/hooks';
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import { withServices } from '../service-context';
import { countHidden, countVisible } from '../helpers/thread';
......@@ -125,13 +124,6 @@ function Thread({ thread, threadsService }) {
);
}
Thread.propTypes = {
thread: propTypes.object.isRequired,
// Injected
threadsService: propTypes.object.isRequired,
};
Thread.injectedProps = ['threadsService'];
export default withServices(Thread);
......@@ -2,7 +2,6 @@ import classnames from 'classnames';
import debounce from 'lodash.debounce';
import { useCallback, useMemo } from 'preact/hooks';
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import { withServices } from '../service-context';
......@@ -80,11 +79,6 @@ function ThreadCard({ frameSync, thread }) {
);
}
ThreadCard.propTypes = {
thread: propTypes.object.isRequired,
frameSync: propTypes.object.isRequired,
};
ThreadCard.injectedProps = ['frameSync'];
export default withServices(ThreadCard);
import { useEffect, useLayoutEffect, useMemo, useState } from 'preact/hooks';
import propTypes from 'prop-types';
import debounce from 'lodash.debounce';
import { useStoreProxy } from '../store/use-store';
......@@ -208,9 +207,4 @@ function ThreadList({ threads }) {
);
}
ThreadList.propTypes = {
/** Should annotations render extra document metadata? */
threads: propTypes.array.isRequired,
};
export default ThreadList;
import classnames from 'classnames';
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
import { useStoreProxy } from '../store/use-store';
import { withServices } from '../service-context';
......@@ -75,11 +74,6 @@ function ToastMessage({ message, onDismiss }) {
);
}
ToastMessage.propTypes = {
message: propTypes.object.isRequired,
onDismiss: propTypes.func,
};
/**
* @typedef ToastMessagesProps
* @prop {Object} toastMessenger - Injected service
......@@ -113,10 +107,6 @@ function ToastMessages({ toastMessenger }) {
);
}
ToastMessages.propTypes = {
toastMessenger: propTypes.object.isRequired,
};
ToastMessages.injectedProps = ['toastMessenger'];
export default withServices(ToastMessages);
import propTypes from 'prop-types';
import bridgeEvents from '../../shared/bridge-events';
import serviceConfig from '../config/service-config';
import { useStoreProxy } from '../store/use-store';
......@@ -165,23 +163,6 @@ function TopBar({
);
}
TopBar.propTypes = {
auth: propTypes.shape({
status: propTypes.string.isRequired,
// Additional properties when user is logged in.
displayName: propTypes.string,
userid: propTypes.string,
username: propTypes.string,
}),
bridge: propTypes.object.isRequired,
isSidebar: propTypes.bool,
onLogin: propTypes.func,
onLogout: propTypes.func,
onSignUp: propTypes.func,
settings: propTypes.object,
streamer: propTypes.object,
};
TopBar.injectedProps = ['bridge', 'settings', 'streamer'];
export default withServices(TopBar);
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
import isThirdPartyService from '../helpers/is-third-party-service';
import { withServices } from '../service-context';
......@@ -72,10 +71,6 @@ function Tutorial({ settings }) {
);
}
Tutorial.propTypes = {
settings: propTypes.object.isRequired,
};
Tutorial.injectedProps = ['settings'];
export default withServices(Tutorial);
import { SvgIcon } from '@hypothesis/frontend-shared';
import propTypes from 'prop-types';
import bridgeEvents from '../../shared/bridge-events';
import serviceConfig from '../config/service-config';
......@@ -109,14 +108,6 @@ function UserMenu({ auth, bridge, onLogout, serviceUrl, settings }) {
);
}
UserMenu.propTypes = {
auth: propTypes.object.isRequired,
onLogout: propTypes.func.isRequired,
bridge: propTypes.object.isRequired,
serviceUrl: propTypes.func.isRequired,
settings: propTypes.object.isRequired,
};
UserMenu.injectedProps = ['bridge', 'serviceUrl', 'settings'];
export default withServices(UserMenu);
import propTypes from 'prop-types';
import { copyText } from '../util/copy-to-clipboard';
import { withServices } from '../service-context';
......@@ -53,11 +51,6 @@ function VersionInfo({ toastMessenger, versionData }) {
);
}
VersionInfo.propTypes = {
versionData: propTypes.object.isRequired,
toastMessenger: propTypes.object.isRequired,
};
VersionInfo.injectedProps = ['toastMessenger'];
export default withServices(VersionInfo);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment