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

Feature/sc 27327/source click should open in new tab #2071

Open
wants to merge 14 commits into
base: feature/sc-27331/new-sidebar-component
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
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
19 changes: 15 additions & 4 deletions static/js/Misc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3042,11 +3042,22 @@ const TitleVariants = function({titles, update, options}) {
</div>
}

const SheetMetaDataBox = (props) => (
<div className="sheetMetaDataBox">
{props.children}
const SheetMetaDataBox = ({title, summary, authorUrl, authorStatement, authorImage, editable}) => {
return <div className="sheetMetaDataBox">
<SheetMetaDataBoxSegment text={title} className="title" editable={editable}/>
{summary && <SheetMetaDataBoxSegment text={summary} className="summary" editable={editable}/>}
<div className="user">
<ProfilePic
url={authorImage}
len={30}
name={authorStatement}
/>
<a href={authorUrl} className="sheetAuthorName">
<InterfaceText>{authorStatement}</InterfaceText>
</a>
</div>
</div>
);
}

const DivineNameReplacer = ({setDivineNameReplacement, divineNameReplacement}) => {
return (
Expand Down
7 changes: 2 additions & 5 deletions static/js/Sheet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,9 @@ class Sheet extends Component {
}

else if (Sefaria.isRef(path.slice(1))) {
e.preventDefault()
const currVersions = {en: params.get("ven"), he: params.get("vhe")};
const options = {showHighlight: path.slice(1).indexOf("-") !== -1}; // showHighlight when ref is ranged
this.props.onCitationClick(path.slice(1), `Sheet ${this.props.sheetID}`, true, currVersions)
e.preventDefault();
window.open(target.href);
}

}
}

Expand Down
31 changes: 8 additions & 23 deletions static/js/sheets/SheetContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import Component from "react-class";
import $ from "../sefaria/sefariaJquery";
import ReactDOM from "react-dom";
import Sefaria from "../sefaria/sefaria";
import {
InterfaceText, ProfilePic,
SheetMetaDataBox, SheetMetaDataBoxSegment
} from "../Misc";
import {SheetMetaDataBox} from "../Misc";
import React from "react";
import classNames from "classnames";

Expand Down Expand Up @@ -196,8 +193,12 @@ class SheetContent extends Component {
return (
<div className="sheetContent">
<div className="text">
<SheetContentMetaDataBox authorStatement={this.props.authorStatement} authorUrl={this.props.authorUrl}
authorImage={this.props.authorImage} title={this.props.title} summary={this.props.summary} />
<SheetMetaDataBox authorStatement={this.props.authorStatement}
authorUrl={this.props.authorUrl}
authorImage={this.props.authorImage}
title={this.props.title}
summary={this.props.summary}
/>
<div className="textInner" onMouseUp={this.handleTextSelection} onClick={this.props.handleClick}>
{sources}
</div>
Expand All @@ -212,22 +213,6 @@ class SheetContent extends Component {
}
}

const SheetContentMetaDataBox = ({title, summary, authorUrl, authorStatement, authorImage}) => {
return <SheetMetaDataBox>
<SheetMetaDataBoxSegment text={title} className="title"/>
{summary && <SheetMetaDataBoxSegment text={summary} className="summary"/>}
<div className="user">
<ProfilePic
url={authorImage}
len={30}
name={authorStatement}
/>
<a href={authorUrl} className="sheetAuthorName">
<InterfaceText>{authorStatement}</InterfaceText>
</a>
</div>
</SheetMetaDataBox>
}
class SheetSource extends Component {
render() {

Expand Down Expand Up @@ -332,7 +317,7 @@ class SheetComment extends Component {
}
}

class SheetHeader extends Component {
class SheetSegmentHeader extends Component {
render() {
const lang = Sefaria.hebrew.isHebrew(this.props.source.outsideText.stripHtml().replace(/\s+/g, ' ')) ? "he" : "en";
const containerClasses = classNames("sheetItem",
Expand Down
Loading