Profile: subscribe menu show entries
All checks were successful
/ depoly (push) Successful in 1m21s

This commit is contained in:
thislight 2024-11-03 23:52:26 +08:00
parent 376f97c5cd
commit 4a46a0fbc9
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E

View file

@ -19,6 +19,7 @@ import {
CircularProgress, CircularProgress,
Divider, Divider,
IconButton, IconButton,
ListItemAvatar,
ListItemIcon, ListItemIcon,
ListItemText, ListItemText,
MenuItem, MenuItem,
@ -67,8 +68,6 @@ const Profile: Component = () => {
const menuButId = createUniqueId(); const menuButId = createUniqueId();
const [menuOpen, setMenuOpen] = createSignal(false); const [menuOpen, setMenuOpen] = createSignal(false);
const [subscribeMenuOpen, setSubscribeMenuOpen] = createSignal(false);
let subcribeMenuAnchor: { top: number; right: number; left: number };
const [openSubscribeMenu, subscribeMenuState] = createManagedMenuState(); const [openSubscribeMenu, subscribeMenuState] = createManagedMenuState();
@ -192,11 +191,22 @@ const Profile: Component = () => {
document.getElementById(menuButId)!.getBoundingClientRect() document.getElementById(menuButId)!.getBoundingClientRect()
} }
> >
<Show when={session().account}> <Show when={session().account && profile()}>
<Show <Show
when={isCurrentSessionProfile()} when={isCurrentSessionProfile()}
fallback={ fallback={
<MenuItem disabled> <MenuItem
onClick={(event) => {
const { left, right, top } =
event.currentTarget.getBoundingClientRect();
openSubscribeMenu({
left,
right,
top,
e: 1,
});
}}
>
<ListItemIcon> <ListItemIcon>
<PlaylistAdd /> <PlaylistAdd />
</ListItemIcon> </ListItemIcon>
@ -287,9 +297,21 @@ const Profile: Component = () => {
<Menu {...subscribeMenuState}> <Menu {...subscribeMenuState}>
<MenuItem disabled> <MenuItem disabled>
<ListItemAvatar>
<Avatar src={session().account?.inf?.avatar}></Avatar>
</ListItemAvatar>
<ListItemText> <ListItemText>
<span>{session().account?.inf?.displayName || ""}</span> <span
<span>'s timeline</span> ref={(e) =>
createRenderEffect(() => {
e.innerHTML = resolveCustomEmoji(
session().account?.inf?.displayName || "",
session().account?.inf?.emojis ?? [],
);
})
}
></span>
<span>'s Home</span>
</ListItemText> </ListItemText>
</MenuItem> </MenuItem>
</Menu> </Menu>
@ -320,7 +342,9 @@ const Profile: Component = () => {
</div> </div>
<div> <div>
<Switch> <Switch>
<Match when={!session().account}>{<></>}</Match> <Match when={!session().account || profileErrorUncaught.loading}>
{<></>}
</Match>
<Match when={isCurrentSessionProfile()}> <Match when={isCurrentSessionProfile()}>
<IconButton color="inherit"> <IconButton color="inherit">
<Edit /> <Edit />