From bc337027cad44a587ea16751e734687a4070609a Mon Sep 17 00:00:00 2001 From: Mitarashi Date: Thu, 13 Jan 2022 22:44:47 +0200 Subject: [PATCH 1/4] Implemented square profile pictures - Added preference "Square profile pictures" --- src/prefs_impl.nim | 4 ++++ src/sass/tweet/_base.scss | 2 +- src/views/tweet.nim | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/prefs_impl.nim b/src/prefs_impl.nim index 8435af4..3ec280d 100644 --- a/src/prefs_impl.nim +++ b/src/prefs_impl.nim @@ -75,6 +75,9 @@ genPrefs: hideReplies(checkbox, false): "Hide tweet replies" + squareProfileImages(checkbox, false): + "Square profile pictures" + Media: mp4Playback(checkbox, true): "Enable mp4 video playback (only for gifs)" @@ -107,6 +110,7 @@ genPrefs: replaceInstagram(input, ""): "Instagram -> Bibliogram" placeholder: "Bibliogram hostname" + iterator allPrefs*(): Pref = for k, v in prefList: diff --git a/src/sass/tweet/_base.scss b/src/sass/tweet/_base.scss index f7087b7..4950deb 100644 --- a/src/sass/tweet/_base.scss +++ b/src/sass/tweet/_base.scss @@ -97,7 +97,7 @@ } } -.avatar { +.avatar-round { border-radius: 50%; } diff --git a/src/views/tweet.nim b/src/views/tweet.nim index cede58c..43662a6 100644 --- a/src/views/tweet.nim +++ b/src/views/tweet.nim @@ -31,7 +31,12 @@ proc renderHeader(tweet: Tweet; retweet: string; prefs: Prefs): VNode = var size = "_bigger" if not prefs.autoplayGifs and tweet.profile.userPic.endsWith("gif"): size = "_400x400" - genImg(tweet.profile.getUserPic(size), class="avatar") + + let avatarClass = + if prefs.squareProfileImages: "avatar" + else: "avatar avatar-round" + + genImg(tweet.profile.getUserPic(size), class=avatarClass) tdiv(class="tweet-name-row"): tdiv(class="fullname-and-username"): From b2948e3071b377e44a5330dd00411f135b2a7683 Mon Sep 17 00:00:00 2001 From: Mitarashi Date: Thu, 13 Jan 2022 23:54:22 +0200 Subject: [PATCH 2/4] refined code --- src/sass/tweet/_base.scss | 20 +++++++++++--------- src/views/tweet.nim | 6 ++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/sass/tweet/_base.scss b/src/sass/tweet/_base.scss index 4950deb..80a1171 100644 --- a/src/sass/tweet/_base.scss +++ b/src/sass/tweet/_base.scss @@ -97,15 +97,17 @@ } } -.avatar-round { - border-radius: 50%; -} - -.avatar.mini { - margin-right: 5px; - margin-top: -1px; - width: 20px; - height: 20px; +.avatar { + &.round { + border-radius: 50%; + } + + &.mini { + margin-right: 5px; + margin-top: -1px; + width: 20px; + height: 20px; + } } .attribution { diff --git a/src/views/tweet.nim b/src/views/tweet.nim index 43662a6..9285d71 100644 --- a/src/views/tweet.nim +++ b/src/views/tweet.nim @@ -32,11 +32,9 @@ proc renderHeader(tweet: Tweet; retweet: string; prefs: Prefs): VNode = if not prefs.autoplayGifs and tweet.profile.userPic.endsWith("gif"): size = "_400x400" - let avatarClass = - if prefs.squareProfileImages: "avatar" - else: "avatar avatar-round" + let round = if prefs.squareProfileImages: "" else: " round" - genImg(tweet.profile.getUserPic(size), class=avatarClass) + genImg(tweet.profile.getUserPic(size), class=(&"avatar{round}")) tdiv(class="tweet-name-row"): tdiv(class="fullname-and-username"): From 8d557bc49011c1f7c198b2bb1d3eb7970090d163 Mon Sep 17 00:00:00 2001 From: Mitarashi Date: Thu, 13 Jan 2022 23:58:07 +0200 Subject: [PATCH 3/4] minor changes --- src/prefs_impl.nim | 5 ++--- src/views/tweet.nim | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/prefs_impl.nim b/src/prefs_impl.nim index 3ec280d..a40f8ef 100644 --- a/src/prefs_impl.nim +++ b/src/prefs_impl.nim @@ -75,7 +75,7 @@ genPrefs: hideReplies(checkbox, false): "Hide tweet replies" - squareProfileImages(checkbox, false): + squareAvatars(checkbox, false): "Square profile pictures" Media: @@ -109,8 +109,7 @@ genPrefs: replaceInstagram(input, ""): "Instagram -> Bibliogram" - placeholder: "Bibliogram hostname" - + placeholder: "Bibliogram hostname" iterator allPrefs*(): Pref = for k, v in prefList: diff --git a/src/views/tweet.nim b/src/views/tweet.nim index 9285d71..dcf8b75 100644 --- a/src/views/tweet.nim +++ b/src/views/tweet.nim @@ -32,8 +32,7 @@ proc renderHeader(tweet: Tweet; retweet: string; prefs: Prefs): VNode = if not prefs.autoplayGifs and tweet.profile.userPic.endsWith("gif"): size = "_400x400" - let round = if prefs.squareProfileImages: "" else: " round" - + let round = if prefs.squareAvatars: "" else: " round" genImg(tweet.profile.getUserPic(size), class=(&"avatar{round}")) tdiv(class="tweet-name-row"): From 3afe330f23e4314b2000982f51288ed089db1ae5 Mon Sep 17 00:00:00 2001 From: Mitarashi Date: Thu, 13 Jan 2022 23:59:30 +0200 Subject: [PATCH 4/4] removed weird spaces at end of line --- src/prefs_impl.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/prefs_impl.nim b/src/prefs_impl.nim index a40f8ef..0223c82 100644 --- a/src/prefs_impl.nim +++ b/src/prefs_impl.nim @@ -109,7 +109,7 @@ genPrefs: replaceInstagram(input, ""): "Instagram -> Bibliogram" - placeholder: "Bibliogram hostname" + placeholder: "Bibliogram hostname" iterator allPrefs*(): Pref = for k, v in prefList: