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

toc_generation service #3465

Merged
merged 33 commits into from
Mar 8, 2021
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8ad80a4
toc_generation service, WIP
daneryl Jan 25, 2021
282a5a0
aggregations for generatedToc property
daneryl Feb 10, 2021
60263ad
review toc endpoint
daneryl Feb 11, 2021
77b0532
tocService as a feature and cronjob
daneryl Feb 11, 2021
2883177
customFilters for search endpoint
daneryl Feb 17, 2021
bcdb188
UI toc generation components, WIP
daneryl Feb 11, 2021
baa08e5
added basic styles on autogenerated toc
Feb 26, 2021
42e7dfd
toc_generation service, WIP
daneryl Jan 25, 2021
97405a3
aggregations for generatedToc property
daneryl Feb 10, 2021
ed1565a
review toc endpoint
daneryl Feb 11, 2021
2023a22
tocService as a feature and cronjob
daneryl Feb 11, 2021
5f88a16
customFilters for search endpoint
daneryl Feb 17, 2021
08bea1f
UI toc generation components, WIP
daneryl Feb 11, 2021
d1cb5d3
added basic styles on autogenerated toc
Feb 26, 2021
305f49a
Merge branch '3447_toc_service_integration' of https://github.com/hur…
Feb 26, 2021
5650300
Updated autogenerated toc
grafitto Mar 1, 2021
8868f57
fix lint errors
daneryl Mar 2, 2021
f632ead
fix blank state panel
daneryl Mar 2, 2021
eb09f2f
fix e2e
daneryl Mar 2, 2021
eba2caf
prevent crash on toc service unavailable
daneryl Mar 3, 2021
5928bb0
Removed unnecessary scss import
Mar 4, 2021
d8ef75b
fixed/refactor styles
daneryl Mar 3, 2021
adb875a
Rename spec describe
daneryl Mar 3, 2021
e0cff38
removed comment
daneryl Mar 3, 2021
cc42af9
fixed emit types
daneryl Mar 3, 2021
4967e1a
ignored eslint on spec
daneryl Mar 3, 2021
1cde69b
review fixes
daneryl Mar 4, 2021
d87b298
Removed for loop on toc scss
Mar 4, 2021
aa2f46b
uploadFile returns the full response
daneryl Mar 5, 2021
e1556b8
error handling on tocService
daneryl Mar 5, 2021
a32f998
icon for review toc
daneryl Mar 5, 2021
97efec7
filteredAggregations labels now using t function
daneryl Mar 8, 2021
0a6cd50
Merge branch 'development' into 3447_toc_service_integration
konzz Mar 8, 2021
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
Prev Previous commit
Next Next commit
added basic styles on autogenerated toc
  • Loading branch information
Kevin Nderitu committed Feb 26, 2021
commit d1cb5d3823b294d56fdd3b407d8bd3bc4090e8d5
9 changes: 5 additions & 4 deletions app/react/Documents/components/DocumentSidePanel.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* eslint-disable max-lines */
daneryl marked this conversation as resolved.
Show resolved Hide resolved
import { Tabs, TabLink, TabContent } from 'react-tabs-redux';
import { browserHistory } from 'react-router';
import { connect } from 'react-redux';
import Immutable from 'immutable';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import './scss/toc.scss';

import { MetadataFormButtons, ShowMetadata } from 'app/Metadata';
import { NeedAuthorization } from 'app/Auth';
@@ -16,7 +18,6 @@ import ShowIf from 'app/App/ShowIf';
import SidePanel from 'app/Layout/SidePanel';
import DocumentSemanticSearchResults from 'app/SemanticSearch/components/DocumentResults';
import { CopyFromEntity } from 'app/Metadata/components/CopyFromEntity';
import { FeatureToggle } from 'app/components/Elements/FeatureToggle';
import { TocGeneratedLabel, ReviewTocButton } from 'app/ToggledFeatures/tocGeneration';
import { Icon } from 'UI';

@@ -348,10 +349,10 @@ export class DocumentSidePanel extends Component {
<div className="tocHeader">
<h1>
<Translate>Table of contents</Translate>
<TocGeneratedLabel file={this.props.file} className="autoCreatedLabel">
<Translate>auto-created ⓘ </Translate>
</TocGeneratedLabel>
</h1>
<TocGeneratedLabel file={this.props.file}>
<Translate>auto-created ⓘ </Translate>
</TocGeneratedLabel>
</div>
<ShowIf if={!this.props.tocBeingEdited}>
<ShowToc
12 changes: 7 additions & 5 deletions app/react/Documents/components/ShowToc.js
Original file line number Diff line number Diff line change
@@ -4,9 +4,11 @@ import { connect } from 'react-redux';
import { scrollToToc } from 'app/Viewer/actions/uiActions';
import Immutable from 'immutable';
import ShowIf from 'app/App/ShowIf';
import { t, Translate} from 'app/I18N';
import { t } from 'app/I18N';
import { Icon } from 'UI';

import './scss/showToc.scss';
Copy link
Member

Choose a reason for hiding this comment

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

Have we moved away from creating scss files in the App folder namespaced by either component type or section type? Also, usually scss files are imported in a single place instead on a per-component basis. Is this actually working? We don't really have styled components, which would be ideal. But not sure this is the right approach?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

im not sure either, this definitely works, and it also make sense, the css go with the component, if you remove this component this css will not be part of the final build instead of having to remember that this have some associated specific css.


export class ShowToc extends Component {
scrollTo(tocElement, e) {
e.preventDefault();
@@ -38,6 +40,9 @@ export class ShowToc extends Component {
onClick={this.scrollTo.bind(this, tocElement)}
>
{tocElement.get('label')}
<span className="page-number">
{tocElement.getIn(['selectionRectangles', 0]).get('page')}
</span>
</a>
</ShowIf>
<ShowIf if={this.props.readOnly}>
@@ -65,7 +70,4 @@ function mapDispatchToProps() {
return { scrollToToc };
}

export default connect(
null,
mapDispatchToProps
)(ShowToc);
export default connect(null, mapDispatchToProps)(ShowToc);
34 changes: 34 additions & 0 deletions app/react/Documents/components/scss/showToc.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@import "../../../App/scss/config/_colors.scss";
grafitto marked this conversation as resolved.
Show resolved Hide resolved

.toc {
padding-left: 5px !important;
padding-right: 5px !important;

ul.toc-view {
$indents: 5;

@for $i from 0 through $indents {
grafitto marked this conversation as resolved.
Show resolved Hide resolved
li.toc-indent-#{$i} {
border-radius: 2px;
height: 28px;

&:hover {
background-color: $c-info-light;
}
a:hover {
text-decoration: none;
};
a {
padding-left: 4px;
}
}
}
}
}

.page-number {
position: relative;
float: right;
font-weight: normal;
padding-right: 4px;
}
daneryl marked this conversation as resolved.
Show resolved Hide resolved
18 changes: 18 additions & 0 deletions app/react/Documents/components/scss/toc.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@import "../../../App/scss/config/_colors.scss";

.tocHeader {
& {
padding-left: 5px;
}

h1 {
span.label-generatedToc {
margin-left: 10px;
padding: 1px 6px 1px 6px;
font-size: 8px;
border: 1px solid $c-info-dark;
border-radius: 20px;
background-color: $c-info-light;
}
}
}