Profile: add current default account into menu
This commit is contained in:
parent
02d883e53b
commit
a0811ed6c4
1 changed files with 25 additions and 11 deletions
|
@ -10,6 +10,7 @@ import {
|
||||||
onCleanup,
|
onCleanup,
|
||||||
Show,
|
Show,
|
||||||
type Component,
|
type Component,
|
||||||
|
createMemo,
|
||||||
} from "solid-js";
|
} from "solid-js";
|
||||||
import Scaffold from "../material/Scaffold";
|
import Scaffold from "../material/Scaffold";
|
||||||
import {
|
import {
|
||||||
|
@ -137,6 +138,17 @@ const Profile: Component = () => {
|
||||||
recentTootChunk.loading ||
|
recentTootChunk.loading ||
|
||||||
(recentTootFilter().pinned && pinnedTootChunk.loading);
|
(recentTootFilter().pinned && pinnedTootChunk.loading);
|
||||||
|
|
||||||
|
const sessionDisplayName = createMemo(() =>
|
||||||
|
resolveCustomEmoji(
|
||||||
|
session().account?.inf?.displayName || "",
|
||||||
|
session().account?.inf?.emojis ?? [],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
const useSessionDisplayName = (e: HTMLElement) => {
|
||||||
|
createRenderEffect(() => (e.innerHTML = sessionDisplayName()));
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Scaffold
|
<Scaffold
|
||||||
topbar={
|
topbar={
|
||||||
|
@ -191,6 +203,17 @@ const Profile: Component = () => {
|
||||||
document.getElementById(menuButId)!.getBoundingClientRect()
|
document.getElementById(menuButId)!.getBoundingClientRect()
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
<Show when={session().account}>
|
||||||
|
<MenuItem>
|
||||||
|
<ListItemAvatar>
|
||||||
|
<Avatar src={session().account?.inf?.avatar} />
|
||||||
|
</ListItemAvatar>
|
||||||
|
<ListItemText secondary={"Default account"}>
|
||||||
|
<span ref={useSessionDisplayName}></span>
|
||||||
|
</ListItemText>
|
||||||
|
{/* <ArrowRight /> // for future */}
|
||||||
|
</MenuItem>
|
||||||
|
</Show>
|
||||||
<Show when={session().account && profile()}>
|
<Show when={session().account && profile()}>
|
||||||
<Show
|
<Show
|
||||||
when={isCurrentSessionProfile()}
|
when={isCurrentSessionProfile()}
|
||||||
|
@ -283,7 +306,7 @@ const Profile: Component = () => {
|
||||||
height: "100%",
|
height: "100%",
|
||||||
}}
|
}}
|
||||||
crossOrigin="anonymous"
|
crossOrigin="anonymous"
|
||||||
onLoad={async (event) => {
|
onLoad={(event) => {
|
||||||
const ins = new FastAverageColor();
|
const ins = new FastAverageColor();
|
||||||
const colors = ins.getColor(event.currentTarget);
|
const colors = ins.getColor(event.currentTarget);
|
||||||
setBannerSampledColors({
|
setBannerSampledColors({
|
||||||
|
@ -301,16 +324,7 @@ const Profile: Component = () => {
|
||||||
<Avatar src={session().account?.inf?.avatar}></Avatar>
|
<Avatar src={session().account?.inf?.avatar}></Avatar>
|
||||||
</ListItemAvatar>
|
</ListItemAvatar>
|
||||||
<ListItemText>
|
<ListItemText>
|
||||||
<span
|
<span ref={useSessionDisplayName}></span>
|
||||||
ref={(e) =>
|
|
||||||
createRenderEffect(() => {
|
|
||||||
e.innerHTML = resolveCustomEmoji(
|
|
||||||
session().account?.inf?.displayName || "",
|
|
||||||
session().account?.inf?.emojis ?? [],
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
></span>
|
|
||||||
<span>'s Home</span>
|
<span>'s Home</span>
|
||||||
</ListItemText>
|
</ListItemText>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|
Loading…
Reference in a new issue