Skip to content

Commit

Permalink
Dev (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lungsangg authored Dec 30, 2024
2 parents 6d3db34 + 7d46bda commit 6dde3c9
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 19 deletions.
2 changes: 1 addition & 1 deletion sefaria/local_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
"type": "service_account",
"project_id": os.getenv("project_id"),
"private_key_id": os.getenv("private_key_id"),
"private_key": os.getenv("private_key").replace("\\n", "\n"),
"private_key": os.getenv("private_key").replace('\\\\n', '\n'),
"client_email": os.getenv("client_email"),
"client_id": os.getenv("client_id"),
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
Expand Down
77 changes: 75 additions & 2 deletions static/css/s2.css

Large diffs are not rendered by default.

Binary file added static/fonts/IBMPlexSansJP-Regular.ttf
Binary file not shown.
Binary file added static/fonts/ZenOldMincho-Regular.ttf
Binary file not shown.
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
7 changes: 4 additions & 3 deletions static/js/sefaria/localizationLanguage/tibetan.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,11 @@
"text.english_version": "དབྱིན་སྐད།",
"text.button.continue_reading": "སྔར་གྱི་མཚམས་ནས་ཀློག།",
"panel.title": "དུམ་ཚན་འདིའི་འབྲེལ་ཡོད།",
"panel.resources": "རྒྱུ་ཆ།",
"text.related_texts": "བརྗོད་བྱ་འདི་དང་མཐུན་པ",
"panel.resources": "འབྲེལ་ཡོད་རྒྱུ་ཆ་གཞན",
"text.related_texts": "འབྲེལ་ཡོད་ཡིག་ཆ",
"text.commentary": "འགྲེལ་བ།",
"text.quotation": "ལུང་ཚིག",
"text.content.section.sabche": "ས་བཅད། {{segmentNumber}}",
"text.reference": "དཔྱད་གཞི།",
"text.related Passage": "འབྲེལ་ཡོད་རྩོམ་ཡིག",
"text.no_connection": "མི་འདུག",
Expand Down Expand Up @@ -296,7 +297,7 @@
"text.all_commentary": "ཚན་པ་འདིའི་འགྲེལ་བ་ཡོད་ཚད།",
"text.show_all_commnentaries": "འགྲེལ་བ་རྣམས་སྟོན།",
"text.topic_connected_to": "བརྗོད་གཞི་འདི་ནི་གཤམ་གྱི་དེར་སྦྲེལ་འདུག",
"connection_panel.tools": "ལག་ཆ།",
"connection_panel.tools": "འབྲེལ་ཡོད་ལག་ཆ།",
"connection_panel.more_options": "བསྐུར་སྟངས་གཞན།",
"connection_panel.notes": "མཆན་འགོད་ས།",
"connection_panel.compare_text": "གཤིབ་བསྡུར་གྱིས།",
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 6dde3c9

Please sign in to comment.