Skip to content

Commit

Permalink
fix nickname not showing
Browse files Browse the repository at this point in the history
  • Loading branch information
SupertigerDev committed Dec 11, 2024
1 parent 99a7e2a commit c5a3bae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
13 changes: 6 additions & 7 deletions src/components/member-context-menu/MemberContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ export default function MemberContextMenu(props: Props) {
const clickedOnMyself = props.userId === account.user()?.id;
const items: any = [];

const hasAdminPermission = selfMember()?.hasPermission(
ROLE_PERMISSIONS.ADMIN
);
const hasNicknamePermission = selfMember()?.hasPermission(
ROLE_PERMISSIONS.NICKNAME_MEMBER
);
if (hasNicknamePermission && (hasAdminPermission || clickedOnMyself)) {
const hasNicknamePermission =
selfMember()?.hasPermission(ROLE_PERMISSIONS.NICKNAME_MEMBER) ||
clickedOnMyself;

if (hasNicknamePermission) {
items.push(nickname);
}
const hasManageRolePermission = selfMember()?.hasPermission(
Expand Down Expand Up @@ -122,6 +120,7 @@ export default function MemberContextMenu(props: Props) {

const createArr = [];

hasNicknamePermission && createArr.push(nickname);
if (hasBanPermission || hasKickPermission) {
createArr.push(separator);
}
Expand Down
8 changes: 6 additions & 2 deletions src/components/ui/context-menu/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ export default function ContextMenu(props: ContextMenuProps) {
const [pos, setPos] = createSignal({ top: "0", left: "0" });
const { isMobileWidth, hasFocus } = useWindowProperties();

const [items, setItems] = createStore(props.items);
const [items, setItems] = createStore<ContextMenuItem[]>([]);

const { height, width } = useResizeObserver(contextMenuEl);

createEffect(() => {
setItems(reconcile(props.items));
if (props.position) {
setItems(reconcile(props.items));
} else {
setItems([]);
}
});

const handleOutsideClick = (e: any) => {
Expand Down

0 comments on commit c5a3bae

Please sign in to comment.