Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions platforms/blabsy/src/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Link from 'next/link';
import { useRouter } from 'next/router';
import { useAuth } from '@lib/context/auth-context';
import { useWindow } from '@lib/context/window-context';
import { useModal } from '@lib/hooks/useModal';
Expand Down Expand Up @@ -61,10 +62,12 @@ const navLinks: Readonly<NavLink[]> = [
export function Sidebar(): JSX.Element {
const { user } = useAuth();
const { isMobile } = useWindow();
const { pathname } = useRouter();

const { open, openModal, closeModal } = useModal();

const username = user?.username as string;
const isOnChatPage = pathname.startsWith('/chat');

return (
<header
Expand Down Expand Up @@ -113,18 +116,20 @@ export function Sidebar(): JSX.Element {
)}
{!isMobile && <MoreSettings />}
</nav>
<Button
className='accent-tab absolute right-4 -translate-y-[72px] bg-main-accent text-lg font-bold text-white
outline-none transition hover:brightness-90 active:brightness-75 xs:static xs:translate-y-0
xs:hover:bg-main-accent/90 xs:active:bg-main-accent/75 xl:w-11/12'
onClick={openModal}
>
<CustomIcon
className='block h-6 w-6 xl:hidden'
iconName='FeatherIcon'
/>
<p className='hidden xl:block'>Blab</p>
</Button>
{!(isMobile && isOnChatPage) && (
<Button
className='accent-tab absolute right-4 -translate-y-[72px] bg-main-accent text-lg font-bold text-white
outline-none transition hover:brightness-90 active:brightness-75 xs:static xs:translate-y-0
xs:hover:bg-main-accent/90 xs:active:bg-main-accent/75 xl:w-11/12'
onClick={openModal}
>
<CustomIcon
className='block h-6 w-6 xl:hidden'
iconName='FeatherIcon'
/>
<p className='hidden xl:block'>Blab</p>
</Button>
)}
</section>
{!isMobile && <SidebarProfile />}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
</div>

<div class={cn(`max-w-[50%] ${isHeadNeeded ? 'mt-4' : 'mt-0'}`)}>
{#if isHeadNeeded && !isOwn && sender}
<p class="text-black-400 mb-1 px-1 text-xs font-medium">
{#if isHeadNeeded && sender}
<p class="text-black-800 mb-1 px-1 text-xs font-semibold">
{sender.name}
</p>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@
};
}

// Handle regular user messages
const sender = m.sender as Record<string, string>;
const isOwn = sender.id !== userId;
// Handle regular user messages
const sender = m.sender as Record<string, string>;
const isOwn = sender.id !== userId;

console.log('Message sender ID:', sender.id, 'User ID:', userId, 'IsOwn:', isOwn);
console.log('Message sender ID:', sender.id, 'User ID:', userId, 'IsOwn:', isOwn);

return {
id: m.id,
Expand Down