Prechádzať zdrojové kódy

Fix profile website links

Zed 7 rokov pred
rodič
commit
b718bbe15c
3 zmenil súbory, kde vykonal 7 pridanie a 2 odobranie
  1. 1 1
      public/style.css
  2. 1 1
      src/views/profile.nim
  3. 5 0
      src/views/renderutils.nim

+ 1 - 1
public/style.css

@@ -597,7 +597,7 @@ video {
     float: none;
     border-radius: 0;
     position: relative;
-    width: auto;
+    width: 100%;
     background-color: #0f0f0f !important;
 }
 

+ 1 - 1
src/views/profile.nim

@@ -33,7 +33,7 @@ proc renderProfileCard*(profile: Profile): VNode =
         tdiv(class="profile-website"):
           span:
             text "🔗 "
-            a(href=profile.website): text profile.website
+            linkText(profile.website)
 
       tdiv(class="profile-joindate"):
         span(title=getJoinDateFull(profile)):

+ 5 - 0
src/views/renderutils.nim

@@ -19,3 +19,8 @@ proc linkUser*(profile: Profile, class=""): VNode =
 proc genImg*(url: string; class=""): VNode =
   buildHtml():
     img(src=url.getSigUrl("pic"), class=class, alt="Image")
+
+proc linkText*(text: string; class=""): VNode =
+  let url = if "http" notin text: "http://" & text else: text
+  buildHtml():
+    a(href=url, class=class): text text