Skip to content

Commit

Permalink
pass template info in
Browse files Browse the repository at this point in the history
  • Loading branch information
kavigupta committed Aug 13, 2024
1 parent bf6e649 commit 8341a62
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion react/src/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AboutPanel extends PageTemplate {
super(props);
}

main_content() {
main_content(template_info) {
return (
<div className="serif">
<div className={headerTextClass()}>About</div>
Expand Down
2 changes: 1 addition & 1 deletion react/src/components/article-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ArticlePanel extends PageTemplate {
this.map_ref = React.createRef();
}

main_content() {
main_content(template_info) {
if (this.props.articleType == undefined) {
throw new Error("articleType is undefined");
}
Expand Down
4 changes: 2 additions & 2 deletions react/src/components/comparison-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ComparisonPanel extends PageTemplate {
return true;
}

main_content() {
main_content(template_info) {
const self = this;
if (this.props.names == undefined) {
throw new Error("ComparisonPanel: names not set");
Expand Down Expand Up @@ -96,7 +96,7 @@ class ComparisonPanel extends PageTemplate {
include_delete={this.props.datas.length > 1}
on_click={() => on_delete(self.props.names, i)}
on_change={(x) => on_change(self.props.names, i, x)}
screenshot_mode={this.state.screenshot_mode}
screenshot_mode={template_info.screenshot_mode}
/>
</div>)
)}
Expand Down
2 changes: 1 addition & 1 deletion react/src/components/mapper-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class MapperPanel extends PageTemplate {
return super.render();
}

main_content() {
main_content(template_info) {
if (this.state.map_settings === undefined) {
throw new Error("MapperPanel.main_content: map settings not set");
}
Expand Down
2 changes: 1 addition & 1 deletion react/src/components/quiz-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class QuizPanel extends PageTemplate {
this.todays_quiz = this.props.todays_quiz;
}

main_content() {
main_content(template_info) {

const quiz = this.todays_quiz;
const history = this.get_todays_quiz_history();
Expand Down
2 changes: 1 addition & 1 deletion react/src/components/statistic-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class StatisticPanel extends PageTemplate {
return style;
}

main_content() {
main_content(template_info) {
return <div>
<div ref={this.headers_ref}>
<div className={headerTextClass()}>{this.props.rendered_statname}</div>
Expand Down
2 changes: 1 addition & 1 deletion react/src/data-credit.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DataCreditPanel extends PageTemplate {
return this._refs[name];
}

main_content() {
main_content(template_info) {
return (
<div className="serif">
<div className={headerTextClass()}>Credits</div>
Expand Down
2 changes: 1 addition & 1 deletion react/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class IndexPanel extends PageTemplate {
super(props);
}

main_content() {
main_content(template_info) {
return (
<div>
<div>
Expand Down
8 changes: 6 additions & 2 deletions react/src/page_template/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class PageTemplate extends React.Component {
})
}

const template_info = {
screenshot_mode: this.state.screenshot_mode
}

return (
<Fragment>
<meta name="viewport" content="width=600" />
Expand All @@ -57,7 +61,7 @@ class PageTemplate extends React.Component {
<div style={{ marginBlockEnd: "16px" }}></div>
<BodyPanel
hamburger_open={this.state.hamburger_open}
main_content={this.main_content()}
main_content={this.main_content(template_info)}
/>
</div>
</Fragment>
Expand Down Expand Up @@ -92,7 +96,7 @@ class PageTemplate extends React.Component {
}
}

main_content() {
main_content(template_info) {
// not implemented, should be overridden
return (<div></div>);
}
Expand Down

0 comments on commit 8341a62

Please sign in to comment.