Commit 0101a09d authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Alter `ThreadList` to take an Array of `Thread` objects

parent 060e48fa
...@@ -88,7 +88,7 @@ function AnnotationView({ loadAnnotationsService, onLogin }) { ...@@ -88,7 +88,7 @@ function AnnotationView({ loadAnnotationsService, onLogin }) {
// for this scenario as well. // for this scenario as well.
<SidebarContentError errorType="annotation" onLoginRequest={onLogin} /> <SidebarContentError errorType="annotation" onLoginRequest={onLogin} />
)} )}
<ThreadList thread={rootThread} /> <ThreadList threads={rootThread.children} />
</> </>
); );
} }
......
...@@ -51,7 +51,7 @@ function NotebookView({ loadAnnotationsService }) { ...@@ -51,7 +51,7 @@ function NotebookView({ loadAnnotationsService }) {
<NotebookResultCount /> <NotebookResultCount />
</div> </div>
<div className="NotebookView__items"> <div className="NotebookView__items">
<ThreadList thread={rootThread} /> <ThreadList threads={rootThread.children} />
</div> </div>
</div> </div>
); );
......
...@@ -152,7 +152,7 @@ function SidebarView({ ...@@ -152,7 +152,7 @@ function SidebarView({
<SidebarContentError errorType="group" onLoginRequest={onLogin} /> <SidebarContentError errorType="group" onLoginRequest={onLogin} />
)} )}
{showTabs && <SelectionTabs isLoading={isLoading} />} {showTabs && <SelectionTabs isLoading={isLoading} />}
<ThreadList thread={rootThread} /> <ThreadList threads={rootThread.children} />
{showLoggedOutMessage && <LoggedOutMessage onLogin={onLogin} />} {showLoggedOutMessage && <LoggedOutMessage onLogin={onLogin} />}
</div> </div>
); );
......
...@@ -64,7 +64,7 @@ function StreamView({ api, toastMessenger }) { ...@@ -64,7 +64,7 @@ function StreamView({ api, toastMessenger }) {
const rootThread = useRootThread(); const rootThread = useRootThread();
return <ThreadList thread={rootThread} />; return <ThreadList threads={rootThread.children} />;
} }
StreamView.propTypes = { StreamView.propTypes = {
......
...@@ -33,7 +33,7 @@ function roundScrollPosition(pos) { ...@@ -33,7 +33,7 @@ function roundScrollPosition(pos) {
/** /**
* @typedef ThreadListProps * @typedef ThreadListProps
* @prop {Thread} thread * @prop {Thread[]} threads
*/ */
/** /**
...@@ -47,7 +47,7 @@ function roundScrollPosition(pos) { ...@@ -47,7 +47,7 @@ function roundScrollPosition(pos) {
* *
* @param {ThreadListProps} props * @param {ThreadListProps} props
*/ */
function ThreadList({ thread }) { function ThreadList({ threads }) {
// Height of the visible area of the scroll container. // Height of the visible area of the scroll container.
const [scrollContainerHeight, setScrollContainerHeight] = useState( const [scrollContainerHeight, setScrollContainerHeight] = useState(
window.innerHeight window.innerHeight
...@@ -74,7 +74,7 @@ function ThreadList({ thread }) { ...@@ -74,7 +74,7 @@ function ThreadList({ thread }) {
/** @type {string|null} */ (null) /** @type {string|null} */ (null)
); );
const topLevelThreads = thread.children; const topLevelThreads = threads;
const { const {
offscreenLowerHeight, offscreenLowerHeight,
...@@ -210,7 +210,7 @@ function ThreadList({ thread }) { ...@@ -210,7 +210,7 @@ function ThreadList({ thread }) {
ThreadList.propTypes = { ThreadList.propTypes = {
/** Should annotations render extra document metadata? */ /** Should annotations render extra document metadata? */
thread: propTypes.object.isRequired, threads: propTypes.array.isRequired,
}; };
export default ThreadList; export default ThreadList;
...@@ -17,9 +17,12 @@ describe('ThreadList', () => { ...@@ -17,9 +17,12 @@ describe('ThreadList', () => {
let wrappers; let wrappers;
function createComponent(props) { function createComponent(props) {
const wrapper = mount(<ThreadList thread={fakeTopThread} {...props} />, { const wrapper = mount(
attachTo: fakeScrollContainer, <ThreadList threads={fakeTopThread.children} {...props} />,
}); {
attachTo: fakeScrollContainer,
}
);
wrappers.push(wrapper); wrappers.push(wrapper);
return wrapper; return wrapper;
} }
......
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