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 27331/new sidebar component #2070

Open
wants to merge 44 commits into
base: feature/sc-29713/create-profilebio-component-for-sidebar
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
992281e
chore: started sidebar
stevekaplan123 Aug 29, 2024
9c593df
chore: create SheetContentMetaDataBox and SheetSidebar
stevekaplan123 Sep 1, 2024
b2b6ef9
chore: create SheetMetaDataBoxSegment
stevekaplan123 Sep 1, 2024
37f211d
chore: num of followers for sheet sidebar
stevekaplan123 Sep 1, 2024
7a8c0e5
chore: fix styling for sheet sidebar
stevekaplan123 Sep 1, 2024
7054c71
chore: remove CollectionStatement
stevekaplan123 Sep 1, 2024
6c4d65c
chore: remove unused case in handleSheetSegmentClick
stevekaplan123 Sep 3, 2024
7492c58
Merge branch 'modularization-main' into feature/sc-27331/new-sidebar-…
stevekaplan123 Sep 8, 2024
d37a9d4
chore: SheetContent displays public collections and summary
stevekaplan123 Sep 8, 2024
4c44caa
chore: Sheet Sidebar css fixes
stevekaplan123 Sep 8, 2024
a077e6b
Merge branch 'feature/sc-27320/remove-reader-header-bar' into feature…
stevekaplan123 Sep 9, 2024
893904f
Merge branch 'feature/sc-27320/remove-reader-header-bar' into feature…
stevekaplan123 Sep 10, 2024
5eb5203
Merge branch 'feature/sc-27313/remove-resources-panel' into feature/s…
stevekaplan123 Sep 10, 2024
fd3be73
Merge branch 'feature/sc-27320/remove-reader-header-bar' into feature…
stevekaplan123 Sep 10, 2024
2c565a4
Merge branch 'feature/sc-27320/remove-reader-header-bar' into feature…
stevekaplan123 Sep 10, 2024
97a55a1
Merge branch 'feature/sc-27320/remove-reader-header-bar' into feature…
stevekaplan123 Sep 10, 2024
5ed16e0
chore: reorganize css for sheetmetadatabox
stevekaplan123 Sep 12, 2024
3f28204
chore: profile-pic for sheets sidebar should have own class and not s…
stevekaplan123 Sep 18, 2024
acac7e8
Merge branch 'feature/sc-29344/sheet-header' into feature/sc-27331/ne…
stevekaplan123 Sep 18, 2024
32b8978
Merge branch 'feature/sc-29344/sheet-header' into feature/sc-27331/ne…
stevekaplan123 Sep 18, 2024
179351f
Merge branch 'feature/sc-29344/sheet-header' into feature/sc-27331/ne…
stevekaplan123 Sep 19, 2024
f503d90
chore: deal with sheetAuthorName for sidebar
stevekaplan123 Sep 19, 2024
ba2110c
chore: update profile pic position
stevekaplan123 Sep 19, 2024
18117b3
Merge branch 'feature/sc-29344/sheet-header' into feature/sc-27331/ne…
stevekaplan123 Sep 19, 2024
0b7e06c
Merge branch 'feature/sc-29344/sheet-header' into feature/sc-27331/ne…
stevekaplan123 Sep 22, 2024
ab9c9fa
Merge branch 'feature/sc-29344/sheet-header' into feature/sc-27331/ne…
stevekaplan123 Sep 23, 2024
a012676
chore: fix imports
stevekaplan123 Sep 23, 2024
2ca531f
chore: use ProfileSummary in SheetSIdebar
stevekaplan123 Sep 30, 2024
737feef
chore: start refactoring ProfileSummary
stevekaplan123 Sep 30, 2024
adc796d
chore: refactor UserProfile to use new component ProfileBio
stevekaplan123 Oct 1, 2024
b7a24e2
chore: rename SheetSidebar to SheetContentSidebar
stevekaplan123 Oct 1, 2024
f103934
chore: finish renaming SheetSidebar to SheetContentSidebar
stevekaplan123 Oct 1, 2024
330a592
chore: changed component name but forgot to change its usage
stevekaplan123 Oct 1, 2024
1d01a61
Merge branch 'feature/sc-29344/sheet-header' into feature/sc-27331/ne…
stevekaplan123 Oct 9, 2024
aebe5fc
chore: remove 0 from ProfileBio
stevekaplan123 Oct 10, 2024
dec02da
Merge branch 'feature/sc-29344/sheet-header' into feature/sc-27331/ne…
stevekaplan123 Oct 10, 2024
d3b587e
Merge branch 'feature/sc-29344/sheet-header' into feature/sc-27331/ne…
stevekaplan123 Oct 15, 2024
e368269
chore: use var for css color
stevekaplan123 Oct 15, 2024
ed1fc2a
Merge branch 'feature/sc-29713/create-profilebio-component-for-sideba…
stevekaplan123 Oct 15, 2024
fd8b874
chore: use better css names for PartOfCollections component
stevekaplan123 Oct 15, 2024
a83b0fd
chore: undo changes to SheetAuthorStatement which is unused by Sheets…
stevekaplan123 Oct 15, 2024
c1221a0
chore: remove unnecessary import
stevekaplan123 Oct 15, 2024
57d458b
Merge branch 'feature/sc-29713/create-profilebio-component-for-sideba…
stevekaplan123 Oct 15, 2024
86f7dce
Merge branch 'feature/sc-29713/create-profilebio-component-for-sideba…
stevekaplan123 Nov 10, 2024
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
78 changes: 53 additions & 25 deletions static/css/s2.css
Original file line number Diff line number Diff line change
Expand Up @@ -3272,7 +3272,6 @@ a.cardTitle:hover {
}
.bookPage .tocTitle,
.bookMetaDataBox .title {
text-align: center;
font-size: 30px;
line-height: 1.3;
unicode-bidi: plaintext;
Expand All @@ -3284,6 +3283,28 @@ a.cardTitle:hover {
flex-direction: row;
justify-content: space-between;
}

.sheetContentSidebar .profile-pic {
display: block;
margin-block-end: 20px;
margin-block-start: 30px;
margin-inline-start: -5px;
}
.sheetContentSidebar .profileFollowers {
--english-font: var(--english-sans-serif-font-family);
--hebrew-font: var(--hebrew-sans-serif-font-family);
font-size: 16px;
font-weight: 400;
line-height: 18.75px;
margin-block-end: 20px;
color: var(--dark-grey);
}
.sheetViewer {
display: flex;
}
.sheetContentSidebar {
width: 33%;
}
.bookPage .currentSection,
.bookPage .authorStatement {
font-size: 17px;
Expand Down Expand Up @@ -8412,9 +8433,8 @@ a .button:hover {
.sheetMetaDataBox {
margin-block-end: 40px;
}
.sheetContent .sheetMetaDataBox a.sheetAuthorName {
a.sheetAuthorName {
color: var(--midrash-green);
margin-inline-start: 5px;
--english-font: var(--english-sans-serif-font-family);
--hebrew-font: var(--hebrew-sans-serif-font-family);
font-size: 16px;
Expand All @@ -8423,9 +8443,12 @@ a .button:hover {
display: inline;
margin-block-end: 10px;
}
.sheetContent .sheetMetaDataBox a.sheetAuthorName:hover {
a.sheetAuthorName:hover {
text-decoration: none;
}
.sheetContentSidebar a.sheetAuthorName {
display: block;
}
.sheetMetaDataBox .summary {
--english-font: var(--english-sans-serif-font-family);
--hebrew-font: var(--hebrew-sans-serif-font-family);
Expand Down Expand Up @@ -9071,15 +9094,17 @@ body.interface-english .publishBox .react-tags__suggestions ul {
opacity: 0.6;
}

ul.aboutSheetLinks {
ul.sheetCollectionsLinks {
list-style-type: none;
padding-inline-start: 0;
--english-font: var(--english-serif-font-family);
--hebrew-font: var(--hebrew-serif-font-family);
font-size: var(--serif-body-font-size);
--english-font: var(--english-sans-serif-font-family);
--hebrew-font: var(--hebrew-sans-serif-font-family);
font-size: 16px;
font-weight: 400;
line-height: 18.75px;
}

h3.aboutSheetHeader {
h3.sheetCollections {
text-transform: none;
color: var(--dark-grey);
font-size: var(--sans-serif-h3-font-size);
Expand Down Expand Up @@ -9117,14 +9142,6 @@ h3.aboutSheetHeader {
border: 1px solid var(--light-grey);
}

.aboutSheetPanel div.description {
color: var(--dark-grey);
--english-font: var(--english-sans-serif-font-family);
--hebrew-font: var(--hebrew-sans-serif-font-family);
font-size: var(--sans-serif-body-font-size);
margin: 20px 0px;
}

.aboutSheetPanel h2 {
font-size: var(--serif-h3-font-size);
color: #000000;
Expand Down Expand Up @@ -11236,11 +11253,22 @@ cursor: pointer;
opacity: 0.6;
cursor:pointer;
}
.profile-page .social-icon img {
.profile-page .social-icon img, .sheetContentSidebar .social-icon img {
width: 13px;
height: 13px;
opacity: 0.4;
}
.sheetContentSidebar .title.sub-title, .sheetContentSidebar .title.sub-sub-title {
--english-font: var(--english-sans-serif-font-family);
--hebrew-font: var(--hebrew-sans-serif-font-family);
font-size: 14px;
font-weight: 400;
line-height: 18px;
margin-block-end: 10px;
}
.sheetContentSidebar .title.sub-sub-title {
margin-block-end: 20px;
}
.profile-page .social-icon + .social-icon {
padding: 0 5px;
}
Expand Down Expand Up @@ -11520,19 +11548,19 @@ cursor: pointer;
.profile-page .profile-summary .summary-column.end {
flex-grow: 1;
}
.profile-page .profile-summary .small-margin {
.profile-summary .small-margin {
margin: 0 4px;
}
.profile-page .profile-summary .sub-sub-title > .small-margin:first-child,
.profile-page .profile-summary .sub-sub-title > span:first-child .small-margin {
.profile-summary .sub-sub-title > .small-margin:first-child,
.profile-summary .sub-sub-title > span:first-child .small-margin {
margin: 0 4px 0 0;
}
.profile-page .profile-summary .sub-sub-title > .small-margin:last-child,
.profile-page .profile-summary .sub-sub-title > span:last-child .small-margin {
.profile-summary .sub-sub-title > .small-margin:last-child,
.profile-summary .sub-sub-title > span:last-child .small-margin {
margin: 0 0 0 4px;
}
.interface-hebrew .profile-page .profile-summary .sub-sub-title > .small-margin:last-child,
.interface-hebrew .profile-page .profile-summary .sub-sub-title > span:last-child .small-margin {
.interface-hebrew .profile-summary .sub-sub-title > .small-margin:last-child,
.interface-hebrew .profile-summary .sub-sub-title > span:last-child .small-margin {
margin: 0 4px 0 0;
}
.profile-page .aboutText {
Expand Down
3 changes: 2 additions & 1 deletion static/js/ReaderPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import TopicsPage from './TopicsPage';
import CollectionPage from "./CollectionPage"
import { NotificationsPanel } from './NotificationsPanel';
import UserHistoryPanel from './UserHistoryPanel';
import {UserProfile} from './UserProfile';
import {UserProfile} from './UserProfile';
import CommunityPage from './CommunityPage';
import CalendarsPage from './CalendarsPage'
import UserStats from './UserStats';
Expand Down Expand Up @@ -678,6 +678,7 @@ class ReaderPanel extends Component {
setDivineNameReplacement={this.props.setDivineNameReplacement}
divineNameReplacement={this.props.divineNameReplacement}
hasSidebar={this.props.hasSidebar}
toggleSideUpModal={this.props.toggleSignUpModal}
/>
);
}
Expand Down
55 changes: 31 additions & 24 deletions static/js/Sheet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
InterfaceText,
LoadingMessage,
} from './Misc';
import SheetContentSidebar from "./sheets/SheetContentSidebar";
import SheetContent from "./sheets/SheetContent";


class Sheet extends Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -100,29 +100,36 @@ class Sheet extends Component {
}
else {
content = (
<SheetContent
sheetNotice={sheet.sheetNotice}
sources={sheet.sources}
title={sheet.title}
onRefClick={this.props.onRefClick}
handleClick={this.handleClick}
sheetSourceClick={this.props.onSegmentClick}
highlightedNode={this.props.highlightedNode}
highlightedRefsInSheet={this.props.highlightedRefsInSheet}
scrollToHighlighted={this.props.scrollToHighlighted}
authorStatement={sheet.ownerName}
authorUrl={sheet.ownerProfileUrl}
authorImage={sheet.ownerImageUrl}
collectionName={sheet.collectionName}
collectionSlug={sheet.displayedCollection}
collectionImage={sheet.collectionImage}
editable={Sefaria._uid === sheet.owner}
setSelectedWords={this.props.setSelectedWords}
sheetNumbered={sheet.options.numbered}
hideImages={!!sheet.hideImages}
sheetID={sheet.id}
summary={sheet.summary}
/>
<div className="sidebarLayout">
<SheetContent
sheetNotice={sheet.sheetNotice}
sources={sheet.sources}
title={sheet.title}
onRefClick={this.props.onRefClick}
handleClick={this.handleClick}
sheetSourceClick={this.props.onSegmentClick}
highlightedNode={this.props.highlightedNode}
highlightedRefsInSheet={this.props.highlightedRefsInSheet}
scrollToHighlighted={this.props.scrollToHighlighted}
editable={Sefaria._uid === sheet.owner}
setSelectedWords={this.props.setSelectedWords}
sheetNumbered={sheet.options.numbered}
hideImages={!!sheet.hideImages}
sheetID={sheet.id}
authorStatement={sheet.ownerName}
authorID={sheet.owner}
authorUrl={sheet.ownerProfileUrl}
authorImage={sheet.ownerImageUrl}
summary={sheet.summary}
/>
<SheetContentSidebar
authorStatement={sheet.ownerName}
authorUrl={sheet.ownerProfileUrl}
authorImage={sheet.ownerImageUrl}
collections={sheet.collections}
toggleSignUpModal={this.props.toggleSignUpModal}
/>
</div>
);
}
return (
Expand Down
2 changes: 0 additions & 2 deletions static/js/UserProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ class UserProfile extends Component {
<div>
<ProfileSummary
profile={this.props.profile}
follow={this.follow}
openFollowers={this.openFollowers}
openFollowing={this.openFollowing}
toggleSignUpModal={this.props.toggleSignUpModal}
Expand Down Expand Up @@ -551,7 +550,6 @@ const EditorToggleHeader = ({usesneweditor}) => {
)
}


const ProfileBio = ({profile: p}) => {
// used in ProfileSummary and in SheetContentSidebar, renders user education, organization, and location info
const social = ['facebook', 'twitter', 'youtube', 'linkedin'];
Expand Down
59 changes: 59 additions & 0 deletions static/js/sheets/SheetContentSidebar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import {FollowButton, InterfaceText, ProfilePic} from "../Misc";
import Sefaria from "../sefaria/sefaria";
import React, {useEffect, useState} from "react";
import {ProfileBio} from "../UserProfile";
const SheetContentSidebar = ({authorImage, authorStatement, authorUrl, toggleSignUpModal, collections}) => {
const [loading, setLoading] = useState(true);
const [profile, setProfile] = useState(null);
useEffect(() => {
Sefaria.profileAPI(authorUrl.replace("/profile/", "")).then(profile => {
setProfile(profile);
setLoading(false);
})
});
const authorName = <a href={authorUrl} className="sheetAuthorName">
{Sefaria._(authorStatement)}
</a>;
return <div className="sheetContentSidebar">
<ProfilePic
url={authorImage}
len={100}
name={authorStatement}
/>
{authorName}
{!loading && <SheetProfileInfo profile={profile}/>}
{<PartOfCollections collections={collections}/>}
</div>;
}

const SheetProfileInfo = ({profile}) => {
const profileFollowers = <div className="profileFollowers">
<InterfaceText>{String(profile.followers.length)}</InterfaceText>&nbsp;
<InterfaceText>followers</InterfaceText>
</div>;
return <span className="profile-summary">
{profileFollowers}
<ProfileBio profile={profile}/>
{Sefaria._uid !== profile.id && <FollowButton
large={true}
uid={profile.id}
following={Sefaria.following.indexOf(profile.id) > -1}/>
}
</span>;
}
const PartOfCollections = ({collections}) => {
return collections.length > 0 &&
<div>
<h3 className="sheetCollections"><InterfaceText>Part of Collections</InterfaceText></h3>
<div>
<ul className="sheetCollectionsLinks">
{collections.map((collection, i) => (
<li key={i}><a
href={"/collections/" + collection.slug}><InterfaceText>{collection.name}</InterfaceText></a>
</li>
))}
</ul>
</div>
</div>;
}
export default SheetContentSidebar;
Loading