Explorar el Código

Merge pull request #513 from LainLayer/square_avatars

Implemented square profile pictures preference
Zed hace 4 años
padre
commit
cc0e4b1668
Se han modificado 3 ficheros con 16 adiciones y 9 borrados
  1. 3 0
      src/prefs_impl.nim
  2. 10 8
      src/sass/tweet/_base.scss
  3. 3 1
      src/views/tweet.nim

+ 3 - 0
src/prefs_impl.nim

@@ -75,6 +75,9 @@ genPrefs:
     hideReplies(checkbox, false):
       "Hide tweet replies"
 
+    squareAvatars(checkbox, false):
+      "Square profile pictures"
+
   Media:
     mp4Playback(checkbox, true):
       "Enable mp4 video playback (only for gifs)"

+ 10 - 8
src/sass/tweet/_base.scss

@@ -98,14 +98,16 @@
 }
 
 .avatar {
-    border-radius: 50%;
-}
-
-.avatar.mini {
-    margin-right: 5px;
-    margin-top: -1px;
-    width: 20px;
-    height: 20px;
+    &.round {
+        border-radius: 50%;
+    }
+    
+    &.mini {
+        margin-right: 5px;
+        margin-top: -1px;
+        width: 20px;
+        height: 20px;
+    }
 }
 
 .attribution {

+ 3 - 1
src/views/tweet.nim

@@ -31,7 +31,9 @@ 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 round = if prefs.squareAvatars: "" else: " round"        
+        genImg(tweet.profile.getUserPic(size), class=(&"avatar{round}"))
 
       tdiv(class="tweet-name-row"):
         tdiv(class="fullname-and-username"):