mirror of https://github.com/logseq/logseq
fix: broken avatar
parent
f768744380
commit
31a8498e3c
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -15,7 +15,9 @@
|
||||||
[frontend.components.repo :as repo]
|
[frontend.components.repo :as repo]
|
||||||
[frontend.components.search :as search]
|
[frontend.components.search :as search]
|
||||||
[frontend.handler.project :as project-handler]
|
[frontend.handler.project :as project-handler]
|
||||||
[frontend.handler.web.nfs :as nfs]))
|
[frontend.handler.web.nfs :as nfs]
|
||||||
|
[goog.dom :as gdom]
|
||||||
|
[goog.object :as gobj]))
|
||||||
|
|
||||||
(rum/defc logo < rum/reactive
|
(rum/defc logo < rum/reactive
|
||||||
[{:keys [white?]}]
|
[{:keys [white?]}]
|
||||||
|
@ -49,73 +51,76 @@
|
||||||
[:button.max-w-xs.flex.items-center.text-sm.rounded-full.focus:outline-none.focus:shadow-outline.h-7.w-7.ml-2
|
[:button.max-w-xs.flex.items-center.text-sm.rounded-full.focus:outline-none.focus:shadow-outline.h-7.w-7.ml-2
|
||||||
{:on-click toggle-fn}
|
{:on-click toggle-fn}
|
||||||
(if-let [avatar (:avatar me)]
|
(if-let [avatar (:avatar me)]
|
||||||
[:img.h-7.w-7.rounded-full
|
[:img#avatar.h-7.w-7.rounded-full
|
||||||
{:src avatar}]
|
{:src avatar
|
||||||
|
:on-error (fn [this]
|
||||||
|
(let [elem (gdom/getElement "avatar")]
|
||||||
|
(gobj/set elem "src" (config/asset-uri "/static/img/broken-avatar.png"))))}]
|
||||||
[:div.h-7.w-7.rounded-full.bg-base-2.opacity-70.hover:opacity-100 {:style {:padding 1.5}}
|
[:div.h-7.w-7.rounded-full.bg-base-2.opacity-70.hover:opacity-100 {:style {:padding 1.5}}
|
||||||
[:a svg/user]])])
|
[:a svg/user]])])
|
||||||
(let [logged? (:name me)]
|
(let [logged? (:name me)]
|
||||||
(->>
|
(->>
|
||||||
[(when current-repo
|
[(when current-repo
|
||||||
{:title (t :graph)
|
{:title (t :graph)
|
||||||
:options {:href (rfe/href :graph)}
|
:options {:href (rfe/href :graph)}
|
||||||
:icon svg/graph-sm})
|
:icon svg/graph-sm})
|
||||||
|
|
||||||
(when (or logged? (and (nfs/supported?) current-repo))
|
(when (or logged? (and (nfs/supported?) current-repo))
|
||||||
{:title (t :all-graphs)
|
{:title (t :all-graphs)
|
||||||
:options {:href (rfe/href :repos)}
|
:options {:href (rfe/href :repos)}
|
||||||
:icon svg/repos-sm})
|
:icon svg/repos-sm})
|
||||||
|
|
||||||
(when current-repo
|
(when current-repo
|
||||||
{:title (t :all-pages)
|
{:title (t :all-pages)
|
||||||
:options {:href (rfe/href :all-pages)}
|
:options {:href (rfe/href :all-pages)}
|
||||||
:icon svg/pages-sm})
|
:icon svg/pages-sm})
|
||||||
|
|
||||||
(when current-repo
|
(when current-repo
|
||||||
{:title (t :all-files)
|
{:title (t :all-files)
|
||||||
:options {:href (rfe/href :all-files)}
|
:options {:href (rfe/href :all-files)}
|
||||||
:icon svg/folder-sm})
|
:icon svg/folder-sm})
|
||||||
|
|
||||||
(when (and default-home current-repo)
|
(when (and default-home current-repo)
|
||||||
{:title (t :all-journals)
|
{:title (t :all-journals)
|
||||||
:options {:href (rfe/href :all-journals)}
|
:options {:href (rfe/href :all-journals)}
|
||||||
:icon svg/calendar-sm})
|
:icon svg/calendar-sm})
|
||||||
|
|
||||||
(when (project-handler/get-current-project current-repo projects)
|
(when (project-handler/get-current-project current-repo projects)
|
||||||
{:title (t :my-publishing)
|
{:title (t :my-publishing)
|
||||||
:options {:href (rfe/href :my-publishing)}})
|
:options {:href (rfe/href :my-publishing)}})
|
||||||
|
|
||||||
(when-let [project (and current-repo
|
(when-let [project (and current-repo
|
||||||
(project-handler/get-current-project current-repo projects))]
|
(project-handler/get-current-project current-repo projects))]
|
||||||
(let [link (str config/website "/" project)]
|
(let [link (str config/website "/" project)]
|
||||||
{:title (str (t :go-to) "/" project)
|
{:title (str (t :go-to) "/" project)
|
||||||
:options {:href link
|
:options {:href link
|
||||||
:target "_blank"}
|
:target "_blank"}
|
||||||
:icon svg/external-link}))
|
:icon svg/external-link}))
|
||||||
|
|
||||||
{:title (t :settings)
|
{:title (t :settings)
|
||||||
:options {:href (rfe/href :settings)}
|
:options {:href (rfe/href :settings)}
|
||||||
:icon svg/settings-sm}
|
:icon svg/settings-sm}
|
||||||
|
|
||||||
(when (and logged? current-repo)
|
(when (and logged? current-repo)
|
||||||
{:title (t :export)
|
{:title (t :export)
|
||||||
:options {:on-click (fn []
|
:options {:on-click (fn []
|
||||||
(export/export-repo-as-html! current-repo))}
|
(export/export-repo-as-html! current-repo))}
|
||||||
:icon nil})
|
:icon nil})
|
||||||
(when current-repo
|
(when current-repo
|
||||||
{:title (t :import)
|
{:title (t :import)
|
||||||
:options {:href (rfe/href :import)}
|
:options {:href (rfe/href :import)}
|
||||||
:icon svg/import-sm})
|
:icon svg/import-sm})
|
||||||
{:title [:div.flex-row.flex.justify-between.items-center
|
{:title [:div.flex-row.flex.justify-between.items-center
|
||||||
[:span (t :join-community)]]
|
[:span (t :join-community)]]
|
||||||
:options {:href "https://discord.gg/KpN4eHY"
|
:options {:href "https://discord.gg/KpN4eHY"
|
||||||
:title (t :discord-title)
|
:title (t :discord-title)
|
||||||
:target "_blank"}
|
:target "_blank"}
|
||||||
:icon svg/discord}
|
:icon svg/discord}
|
||||||
(when logged?
|
(when logged?
|
||||||
{:title (t :sign-out)
|
{:title (t :sign-out)
|
||||||
:options {:on-click user-handler/sign-out!}
|
:options {:on-click user-handler/sign-out!}
|
||||||
:icon svg/logout-sm})]
|
:icon svg/logout-sm})]
|
||||||
(remove nil?)))
|
(remove nil?)))
|
||||||
{})))
|
{})))
|
||||||
|
|
||||||
(rum/defc right-menu-button < rum/reactive
|
(rum/defc right-menu-button < rum/reactive
|
||||||
|
|
Loading…
Reference in New Issue