Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/OpenPecha/Pecha.org into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Lungsangg committed Dec 30, 2024
2 parents 6278c1f + 1450cf7 commit 7d46bda
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 13 deletions.
32 changes: 21 additions & 11 deletions static/js/BookPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,17 @@ class BookPage extends Component {
}
}

handleCheckVisibility(value) {
if("nodes" in value) {
handleCheckVisibility(schema) {
if(!("nodes" in schema)) {
if(schema.content_counts.length > 1) {
this.state.isContentVisible = true
}
else {
this.state.isContentVisible = false
}

} else{
this.state.isContentVisible = true
} else {
this.state.isContentVisible = false
}
}

Expand Down Expand Up @@ -198,7 +204,6 @@ class BookPage extends Component {
if (this.state.isContentVisible || this.props.isNarrowColumn) {
tabs.push({id: "contents", title: {en: Sefaria._("text.contents"), he: Sefaria._("text.contents")}});
}

if (this.isBookToc()){
tabs.push({id: "versions", title: {en: Sefaria._("text.versions"), he: Sefaria._("text.versions")}});
}
Expand Down Expand Up @@ -756,7 +761,9 @@ SchemaNode.propTypes = {


class JaggedArrayNode extends Component {

render() {

const offset = this.props.schema?.index_offsets_by_depth?.['1'] || 0;
if ("toc_zoom" in this.props.schema) {
let zoom = this.props.schema.toc_zoom - 1;
Expand All @@ -774,10 +781,11 @@ class JaggedArrayNode extends Component {
const specialHeaderText = this.props.topLevelHeader || this.props.schema?.sectionNames[0] || "Chapters";
let topLevelHeader = !this.props.topToggleTitles.includes(specialHeaderText) && (this.props.topLevel && (this.props.schema?.depth <= 2 || this.props.topLevelHeader)) ? (
<div className="specialNavSectionHeader">
<ContentText text={{
{/* <ContentText text={{
en: specialHeaderText,
he: Sefaria.hebrewTranslation(specialHeaderText)
}}/>
}}/> */}
<InterfaceText placeholder={{segmentNumber : ""}}>text.content.section.sabche</InterfaceText>
</div>
) : null;
return (
Expand Down Expand Up @@ -830,11 +838,12 @@ class JaggedArrayNodeSection extends Component {
let content = [];
for (let i = 0; i < this.props.contentCounts.length; i++) {
if (this.contentCountIsEmpty(this.props.contentCounts[i])) { continue; }
let [enSection, heSection] = Sefaria.getSectionStringByAddressType(this.props.addressTypes[0], i);
let [enSection, heSection, sectionString] = Sefaria.getSectionStringByAddressType(this.props.addressTypes[0], i);
content.push(
<div className="tocSection" key={i}>
<div className="sectionName">
<ContentText text={{ en:this.props.sectionNames[0] + " " + enSection , he: Sefaria.hebrewTerm(this.props.sectionNames[0]) + " " +heSection}}/>
<InterfaceText placeholder={{segmentNumber:sectionString}}>text.content.section.sabche</InterfaceText>
{/* <ContentText text={{ en:"Sapche" + " " + enSection , he: "Sapche" + " " +heSection}}/> */}
</div>
<JaggedArrayNodeSection
depth={this.props.depth - 1}
Expand All @@ -852,13 +861,14 @@ class JaggedArrayNodeSection extends Component {
let sectionLinks = [];
for (let i = 0; i < contentCounts.length; i++) {
if (this.contentCountIsEmpty(contentCounts[i])) { continue; }
let [section, heSection] = Sefaria.getSectionStringByAddressType(this.props.addressTypes[0], i, this.props.offset);
let [section, heSection, sectionString] = Sefaria.getSectionStringByAddressType(this.props.addressTypes[0], i, this.props.offset);
let ref = (this.props.refPath + ":" + section).replace(":", " ") + this.refPathTerminal(contentCounts[i]);
let currentPlace = ref == this.props?.currentlyVisibleSectionRef || ref == this.props?.currentlyVisibleRef || Sefaria.refContains(this.props?.currentlyVisibleSectionRef, ref); //the second clause is for depth 1 texts
const linkClasses = classNames({"sectionLink": 1, "current": currentPlace});
let link = (
<a className={linkClasses} href={"/" + Sefaria.normRef(ref)} data-ref={ref} key={i}>
<ContentText text={{en:section, he:heSection}}/>
{/* <ContentText text={{en:section, he:heSection}}/> */}
{sectionString}
</a>
);
sectionLinks.push(link);
Expand Down
1 change: 1 addition & 0 deletions static/js/sefaria/localizationLanguage/chinese.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
"text.reference": "参考",
"text.related Passage": "相关段落",
"text.no_connection": "",
"text.content.section.sabche": "科判 {{segmentNumber}}",
"text.version_open": "版本开放",
"text.web_pages": "网页",
"text.author": "作者",
Expand Down
1 change: 1 addition & 0 deletions static/js/sefaria/localizationLanguage/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
"panel.resources": "Resources",
"text.related_texts": "Related Texts",
"text.commentary": "Commentary",
"text.content.section.sabche": "Sapche {{segmentNumber}}",
"text.quotation": "Quotation",
"text.reference": "Reference",
"text.related Passage": "Related Passage",
Expand Down
1 change: 1 addition & 0 deletions static/js/sefaria/localizationLanguage/tibetan.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
"text.related_texts": "འབྲེལ་ཡོད་ཡིག་ཆ།",
"text.commentary": "འགྲེལ་བ།",
"text.quotation": "ལུང་ཚིག",
"text.content.section.sabche": "ས་བཅད། {{segmentNumber}}",
"text.reference": "དཔྱད་གཞི།",
"text.related Passage": "འབྲེལ་ཡོད་རྩོམ་ཡིག",
"text.no_connection": "མི་འདུག",
Expand Down
12 changes: 10 additions & 2 deletions static/js/sefaria/sefaria.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,9 @@ Sefaria = extend(Sefaria, {
* @param {number} offset - If needed, an offest to allow section addresses that do not start counting with 0
* @returns {[string,string]} Section string in both languages.
*/
getSectionStringByAddressType: function(addressType, i, offset=0) {
getSectionStringByAddressType: function(addressType, i, offset=0) {
let section = i + offset;
let sectionString = "";
let enSection, heSection;
if (addressType === 'Talmud') {
enSection = Sefaria.hebrew.intToDaf(section);
Expand All @@ -348,7 +349,14 @@ Sefaria = extend(Sefaria, {
enSection = section + 1;
heSection = Sefaria.hebrew.tibetanNumeral(section + 1);
}
return [enSection, heSection];

if(Sefaria.interfaceLang == "hebrew") {
sectionString = heSection
} else {
sectionString = enSection
}

return [enSection, heSection, sectionString];
},
titlesInText: function(text) {
// Returns an array of the known book titles that appear in text.
Expand Down

0 comments on commit 7d46bda

Please sign in to comment.