Skip to content

Commit

Permalink
commentary_share_option_update (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lungsangg authored Oct 28, 2024
2 parents d2313d9 + 85354ca commit d822afd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sefaria/local_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@


################ These are things you DO NOT NEED to touch unless you know what you are doing. ##############################
DEBUG = os.getenv("DEBUG", False)
DEBUG = os.getenv("DEBUG", True)

REMOTE_HOSTS = os.getenv('REMOTE_HOSTS', 'staging.pecha.org').replace(" ", "")

Expand Down
23 changes: 22 additions & 1 deletion static/js/TextList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ class TextList extends Component {
<ConnectionButtons>
<OpenConnectionTabButton srefs={[link.sourceRef]} openInTabCallback={this.props.onTextClick}/>
<AddConnectionToSheetButton srefs={[link.sourceRef]} addToSheetCallback={this.props.setConnectionsMode}/>
<ShareConnectionButton srefs={[link.sourceRef]} setConnectionsMode={this.props.setConnectionsMode}/>
{Sefaria.is_moderator ?
<DeleteConnectionButton delUrl={"/api/links/" + link._id} connectionDeleteCallback={this.onDataChange}/> : null
}
Expand Down Expand Up @@ -357,6 +358,26 @@ const AddConnectionToSheetButton = ({srefs, addToSheetCallback, versions= {"en":
);
}


const ShareConnectionButton = ({srefs, setConnectionsMode}) => {
/*
ConnectionButton composite element. Goes inside a ConnectionButtons
Takes a ref(s) and callback to open sharing UI
*/
const handleShare = () => {
setConnectionsMode("Share", {"connectionRefs": srefs});
}

return (
<SimpleLinkedBlock
aclasses={"connection-button share-link"}
onClick={handleShare}
en={"Share"}
he={"རྒྱུད་སྤེལ།"}
/>
);
}

const ConnectionButtons = ({children}) =>{
/* This is basically just a composition container, and allows to apply css rules to a container for connection buttons.
can also be expanded to use a default set of connection buttons, if not children are present?
Expand All @@ -369,4 +390,4 @@ const ConnectionButtons = ({children}) =>{
}


export {TextList as default, ConnectionButtons, AddConnectionToSheetButton, OpenConnectionTabButton, DeleteConnectionButton};
export {TextList as default, ConnectionButtons, AddConnectionToSheetButton, OpenConnectionTabButton, DeleteConnectionButton, ShareConnectionButton};

0 comments on commit d822afd

Please # to comment.