diff --git a/src/app/people/people.ts b/src/app/people/people.ts index ce35024..dcac89d 100644 --- a/src/app/people/people.ts +++ b/src/app/people/people.ts @@ -92,7 +92,7 @@ export class PeopleComponent { } async ngOnInit() { - this.appState.title = 'People'; + this.appState.updateTitle('People'); this.appState.showBackButton = false; this.appState.actions = [ { diff --git a/src/app/profile/profile.ts b/src/app/profile/profile.ts index f1f900e..7f3e54d 100644 --- a/src/app/profile/profile.ts +++ b/src/app/profile/profile.ts @@ -47,7 +47,7 @@ export class ProfileComponent { ) {} async ngOnInit() { - this.appState.title = 'Edit Profile'; + this.appState.updateTitle('Edit Profile'); this.originalProfile = { name: '', diff --git a/src/app/services/utilities.ts b/src/app/services/utilities.ts index 6371f62..e9289b8 100644 --- a/src/app/services/utilities.ts +++ b/src/app/services/utilities.ts @@ -144,13 +144,51 @@ export class Utilities { return secp.utils.bytesToHex(publicKey); } - sanitize(url: string) { + sanitizeLUD06(url?: string) { + // Do not allow http prefix. + if (!url && url?.startsWith('http')) { + return undefined; + } + + return url; + } + + sanitizeUrl(url?: string) { + if (!url && !url?.startsWith('http')) { + return ''; + } + + return url; + } + + sanitizeImageUrl(url?: string) { + url = this.sanitizeUrl(url); + + if (!url) { + return undefined; + } + + const urlLower = url.toLowerCase(); + + if (urlLower.endsWith('jpg') || urlLower.endsWith('jpeg') || urlLower.endsWith('png') || urlLower.endsWith('webp') || urlLower.endsWith('gif')) { + return url; + } + + return undefined; + } + + bypassUrl(url: string) { const clean = this.sanitizer.bypassSecurityTrustUrl(url); return clean; } - sanitizeUrl(url: string) { + bypassResourceUrl(url: string) { const clean = this.sanitizer.bypassSecurityTrustResourceUrl(url); return clean; } + + bypassStyle(url: string) { + const clean = this.sanitizer.bypassSecurityTrustStyle(url); + return clean; + } } diff --git a/src/app/shared/content/content.ts b/src/app/shared/content/content.ts index b1e8a38..829547e 100644 --- a/src/app/shared/content/content.ts +++ b/src/app/shared/content/content.ts @@ -75,7 +75,7 @@ export class ContentComponent { this.images = images.map((i) => this.utilities.sanitizeUrl(i[0])); const thisisthewayMatch = [...content.matchAll(ContentComponent.regexpThisIsTheWay)]; - const thisistheway = thisisthewayMatch.map((i) => this.utilities.sanitizeUrl(`https://i.ytimg.com/vi/LaiN63o_BxA/maxresdefault.jpg`)); + const thisistheway = thisisthewayMatch.map((i) => this.utilities.bypassResourceUrl(`https://i.ytimg.com/vi/LaiN63o_BxA/maxresdefault.jpg`)); this.images.push(...thisistheway); const videos = [...content.matchAll(ContentComponent.regexpVideo)]; diff --git a/src/app/shared/profile-header/profile-header.css b/src/app/shared/profile-header/profile-header.css index 5033219..1a171a1 100644 --- a/src/app/shared/profile-header/profile-header.css +++ b/src/app/shared/profile-header/profile-header.css @@ -81,3 +81,13 @@ width: 100%; height: 100%; } + +.profile-banner { + background-repeat: no-repeat; + background-position: center; + background-size: cover; + min-height: 240px; + /* margin-bottom: 30em; + position: fixed; */ + width: 100%; +} diff --git a/src/app/shared/profile-header/profile-header.html b/src/app/shared/profile-header/profile-header.html index ed4f4b6..21f6af3 100644 --- a/src/app/shared/profile-header/profile-header.html +++ b/src/app/shared/profile-header/profile-header.html @@ -1,24 +1,24 @@ -
-
+
+
+ +
+ +
- - +
+ + +

- - {{ profile.display_name }} - + {{ profile.display_name }} - - {{ profile.name }} - - - {{ profile.npub }} - + {{ profile.name }} + {{ profile.npub }}

diff --git a/src/app/shared/profile-header/profile-header.ts b/src/app/shared/profile-header/profile-header.ts index a28cb31..61f295d 100644 --- a/src/app/shared/profile-header/profile-header.ts +++ b/src/app/shared/profile-header/profile-header.ts @@ -46,6 +46,16 @@ export class ProfileHeaderComponent { return ProfileHeaderComponent.defaultProfileImage; } + getBannerBackgroundStyle(banner?: string) { + if (!banner) { + return 'url(https://dafb3cv85j5xj.cloudfront.net/blog/wp-content/uploads/2017/04/journey.gif)'; + } + + return `url(${banner})`; + + // return this.utilities.sanitizeStyleUrl(banner); + } + showProfileImage() { this.dialog.open(ProfileImageDialog, { data: { picture: this.imagePath }, diff --git a/src/app/user/user.css b/src/app/user/user.css index 7d4ed08..e9cf8f1 100644 --- a/src/app/user/user.css +++ b/src/app/user/user.css @@ -2,3 +2,6 @@ display: inline-block; } +.feed-page { + min-height: 1200px; +} diff --git a/src/app/user/user.ts b/src/app/user/user.ts index 003a90f..9167202 100644 --- a/src/app/user/user.ts +++ b/src/app/user/user.ts @@ -155,10 +155,20 @@ export class UserComponent { this.queueService.enqueContacts(profile.pubkey); // this.downloadFollowingAndRelays(profile); } + + if (this.previousPubKey != profile.pubkey) { + setTimeout(() => { + const element2 = document.getElementById('profile-image-anchor'); + element2!.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' }); + this.previousPubKey = profile.pubkey; + }, 50); + } }) ); } + previousPubKey?: string; + async follow() { this.ui.profile!.status = ProfileStatus.Follow; await this.profiles.follow(this.ui.pubkey); diff --git a/src/styles.scss b/src/styles.scss index ca7eeb9..9319f98 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -131,7 +131,7 @@ h3 { } .profile-page { - padding: 1.6em 1.6em 0 1.6em; + // padding: 1.6em 1.6em 0 1.6em; } .feed-page { @@ -146,9 +146,6 @@ h3 { border-left: 2px solid rgba(255, 255, 255, 0.15) !important; } - - - .image-grid { display: grid; gap: 8px; @@ -177,18 +174,6 @@ h3 { width: 100%; } - - - - - - - - - - - - /* When changing the sidenav-content to flex, the toolbar does not render properly, so a minor hack is needed. */ @media only screen and (max-width: 599px) { body { @@ -200,7 +185,11 @@ h3 { } .profile-page { - padding: 0.8em 0.8em 0 0.8em; + // padding: 0.8em 0.8em 0 0.8em; + } + + .profile-page-header { + padding: 0 0.8em 0 0.8em; } .feed-page { @@ -422,6 +411,8 @@ mat-sidenav-content mat-toolbar { } .profile-image { + // padding-top: 3em; + // margin-top: 3em; /* border: 1px solid; */ } @@ -434,12 +425,19 @@ mat-sidenav-content mat-toolbar { } .profile-page-header { + padding: 0 1.6em 0 1.6em; display: flex; gap: 1em; } .profile-page-header-left { flex: 0 1 auto; + // display: flex; +} + +.profile-image-anchor { + padding-top: 1.4em; + margin-top: -6em; } .profile-page-header-middle { @@ -495,6 +493,7 @@ mat-sidenav-content mat-toolbar { width: 150px; height: 150px; border-radius: 50%; + // margin-top: -3em; } .profile-image-large:hover { @@ -508,6 +507,11 @@ mat-sidenav-content mat-toolbar { height: 96px; border-radius: 50%; } + + .profile-image-anchor { + padding-top: 1em; + margin-top: -4em; + } } .event-header .name {