From 37896f6960f8145a13e2943fbb0cde52da430d30 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 11 Mar 2021 14:38:02 +0100 Subject: move sidebar and timeline out of align folder --- .../components/tableOfContents.component.js | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 animism-align/frontend/app/views/editor/sidebar/components/tableOfContents.component.js (limited to 'animism-align/frontend/app/views/editor/sidebar/components/tableOfContents.component.js') diff --git a/animism-align/frontend/app/views/editor/sidebar/components/tableOfContents.component.js b/animism-align/frontend/app/views/editor/sidebar/components/tableOfContents.component.js new file mode 100644 index 0000000..239dc69 --- /dev/null +++ b/animism-align/frontend/app/views/editor/sidebar/components/tableOfContents.component.js @@ -0,0 +1,30 @@ +import React, { Component } from 'react' +// import { Link } from 'react-router-dom' +import { connect } from 'react-redux' + +import { ROMAN_NUMERALS } from 'app/constants' +import actions from 'app/actions' + +class TableOfContents extends Component { + render() { + const { loading, order, lookup } = this.props.annotation + if (loading || !order) return null + const sectionIds = order.filter(id => lookup[id].type === "section_heading") + return ( +
+ {!sectionIds.length &&
No sections found
} + {sectionIds.map((id, i) => ( +
actions.align.setScrollPosition(lookup[id].start_ts)}> + {ROMAN_NUMERALS[i]}{'. '}{lookup[id].text} +
+ ))} +
+ ) + } +} + +const mapStateToProps = state => ({ + annotation: state.annotation.index, +}) + +export default connect(mapStateToProps)(TableOfContents) -- cgit v1.2.3-70-g09d2