fix: profile screen initial avatar alignment (#18426)

debfe1ca...debfe1ca

Signed-off-by: yqrashawn <namy.19@gmail.com>
This commit is contained in:
yqrashawn 2024-01-10 10:34:54 +08:00 committed by GitHub
parent 78576f4aeb
commit 61b0a2ecac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 8 deletions

View File

@ -73,12 +73,14 @@
:key-uid target-key-uid :key-uid target-key-uid
:theme (theme/get-theme) :theme (theme/get-theme)
:override-ring? override-ring?}) :override-ring? override-ring?})
(image-server/get-initials-avatar-uri-fn {:port port (image-server/get-initials-avatar-uri-fn
:ratio pixel-ratio/ratio {:port port
:key-uid target-key-uid :ratio pixel-ratio/ratio
:theme (theme/get-theme) :key-uid target-key-uid
:override-ring? override-ring? :theme (theme/get-theme)
:font-file font-file}))})))) :uppercase-ratio (:uppercase-ratio constants/initials-avatar-font-conf)
:override-ring? override-ring?
:font-file font-file}))}))))
(re-frame/reg-sub (re-frame/reg-sub
:multiaccount/public-key :multiaccount/public-key

View File

@ -2,6 +2,7 @@
(:require (:require
[react-native.fs :as utils.fs] [react-native.fs :as utils.fs]
[react-native.platform :as platform] [react-native.platform :as platform]
[schema.core :as schema]
[utils.datetime :as datetime])) [utils.datetime :as datetime]))
(def ^:const image-server-uri-prefix "https://localhost:") (def ^:const image-server-uri-prefix "https://localhost:")
@ -182,6 +183,19 @@
"&ringWidth=" "&ringWidth="
(* ring-width ratio))) (* ring-width ratio)))
(schema/=> get-initials-avatar-uri
[:=>
[:cat
[:map
[:color string?]
[:background-color string?]
[:size number?]
[:ratio float?]
[:uppercase-ratio number?]
[:font-size number?]
[:font-file string?]]]
[:string]])
(defn get-initials-avatar-uri-fn (defn get-initials-avatar-uri-fn
"return a fn that calls `get-account-initials-uri` "return a fn that calls `get-account-initials-uri`
pass the fn to user-avatar component to fill the style related options pass the fn to user-avatar component to fill the style related options

View File

@ -42,9 +42,9 @@
:color "#0E162000" :color "#0E162000"
:font-size 12 :font-size 12
:font-file "/font/Inter Medium.otf" :font-file "/font/Inter Medium.otf"
:uppercase-ratio "uppercase-ratio" :uppercase-ratio 0.6
:indicator-size 2 :indicator-size 2
:indicator-center-to-edge 6 :indicator-center-to-edge 6
:indicator-color "#0E1620" :indicator-color "#0E1620"
:ring-width 4}) :ring-width 4})
"https://localhost:port/accountInitials?publicKey=public-key&keyUid=key-uid&length=length&size=96&bgColor=background-color&color=%230E162000&fontSize=24&fontFile=%2Ffont%2FInter%20Medium.otf&uppercaseRatio=uppercase-ratio&theme=:light&clock=&name=full-nametimestamp&indicatorColor=%230E1620&indicatorSize=4&indicatorBorder=0&indicatorCenterToEdge=12&addRing=1&ringWidth=8")))) "https://localhost:port/accountInitials?publicKey=public-key&keyUid=key-uid&length=length&size=96&bgColor=background-color&color=%230E162000&fontSize=24&fontFile=%2Ffont%2FInter%20Medium.otf&uppercaseRatio=0.6&theme=:light&clock=&name=full-nametimestamp&indicatorColor=%230E1620&indicatorSize=4&indicatorBorder=0&indicatorCenterToEdge=12&addRing=1&ringWidth=8"))))