|
2 | 2 | import { goto } from '$app/navigation';
|
3 | 3 | import { page } from '$app/state';
|
4 | 4 | import { comments } from '$lib/dummyData';
|
5 |
| - import { BottomNav, Header, Comment, MessageInput } from '$lib/fragments'; |
6 |
| - import SideBar from '$lib/fragments/SideBar/SideBar.svelte'; |
| 5 | + import { BottomNav, Header, Comment, MessageInput, SideBar } from '$lib/fragments'; |
7 | 6 | import { Settings } from '$lib/icons';
|
8 | 7 | import { showComments } from '$lib/store/store.svelte';
|
9 | 8 | import type { CommentType } from '$lib/types';
|
|
15 | 14 | let commentInput: HTMLInputElement | undefined = $state();
|
16 | 15 | let _comments = $state(comments);
|
17 | 16 | let activeReplyToId: string | null = $state(null);
|
| 17 | + let chatFriendId = $state(); |
18 | 18 |
|
19 | 19 | const handleSend = async () => {
|
20 | 20 | const newComment = {
|
|
52 | 52 | };
|
53 | 53 |
|
54 | 54 | $effect(() => {
|
| 55 | + chatFriendId = page.params.id; |
| 56 | +
|
55 | 57 | if (route.includes('home')) {
|
56 | 58 | heading = 'Feed';
|
57 | 59 | } else if (route.includes('discover')) {
|
58 | 60 | heading = 'Search';
|
59 | 61 | } else if (route.includes('post')) {
|
60 | 62 | heading = 'Post';
|
| 63 | + } else if (route === `/messages/${chatFriendId}`) { |
| 64 | + heading = 'User Name'; |
61 | 65 | } else if (route.includes('messages')) {
|
62 | 66 | heading = 'Messages';
|
63 | 67 | } else if (route.includes('settings')) {
|
64 | 68 | heading = 'Settings';
|
65 | 69 | } else if (route.includes('profile')) {
|
66 | 70 | heading = 'Profile';
|
67 |
| - } else { |
68 |
| - heading = ''; |
69 | 71 | }
|
70 | 72 | });
|
71 | 73 | </script>
|
|
74 | 76 | class={`block h-[100dvh] ${route !== '/home' ? 'grid-cols-[20vw_auto]' : 'grid-cols-[20vw_auto_30vw]'} md:grid`}
|
75 | 77 | >
|
76 | 78 | <SideBar profileSrc="https://picsum.photos/200" handlePost={async () => alert('adas')} />
|
77 |
| - <section class="px-4 md:px-8 md:pt-8"> |
| 79 | + <section class="hide-scrollbar h-[100dvh] overflow-y-auto px-4 pb-8 md:px-8 md:pt-8"> |
78 | 80 | <div class="flex items-center justify-between">
|
79 |
| - <Header variant="primary" {heading} /> |
| 81 | + <Header |
| 82 | + variant={route === `/messages/${chatFriendId}` ? 'secondary' : 'primary'} |
| 83 | + {heading} |
| 84 | + options={[ |
| 85 | + { name: 'Report', handler: () => alert('report') }, |
| 86 | + { name: 'Clear chat', handler: () => alert('clear') } |
| 87 | + ]} |
| 88 | + /> |
80 | 89 | {#if route === '/profile'}
|
81 | 90 | <div class="mb-6 flex md:hidden">
|
82 | 91 | <button
|
|
121 | 130 | {/if}
|
122 | 131 | </aside>
|
123 | 132 | {/if}
|
124 |
| - <BottomNav profileSrc="https://picsum.photos/200" /> |
| 133 | + |
| 134 | + {#if route !== `/messages/${chatFriendId}`} |
| 135 | + <BottomNav class="btm-nav" profileSrc="https://picsum.photos/200" /> |
| 136 | + {/if} |
125 | 137 | </main>
|
0 commit comments