Skip to content

Commit

Permalink
fix&style: conversation can't create when join existing group after s…
Browse files Browse the repository at this point in the history
…tarted, improve layout (#124)

* fix: some user getUser zoderror

* fix: conversation can't create when join existing group after started

* style: chatroom larger textarea for phone size

* style: adjust the chatroom size to modify the device size

* style: update Chatroom layout for message word count
  • Loading branch information
howard9199 authored Dec 26, 2024
1 parent 7b92ecd commit c486a61
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
30 changes: 16 additions & 14 deletions src/lib/components/Chatroom.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
}
</script>

<div class="flex h-full flex-col">
<div class="flex h-full min-h-[400px] flex-col">
<div bind:this={messagesContainer} class="flex-1 space-y-4 overflow-y-auto p-4">
{#each conversations as conv}
<div class="flex flex-col {conv.self ? 'items-end' : 'items-start'} gap-1">
Expand Down Expand Up @@ -116,20 +116,22 @@

{#if !readonly}
<div class="border-t bg-white p-4">
<div class="flex gap-2">
<Textarea
class="max-h-32 min-h-10 flex-1"
placeholder="Type your message...(max 500 characters)"
rows={1}
bind:value={text}
disabled={operating}
on:keydown={handleKeydown}
maxlength={500}
/>
<div class="text-right text-sm text-gray-500">
{text.length} / 500
<div class="flex flex-wrap gap-2">
<div class="flex min-w-[200px] flex-1 flex-col">
<Textarea
class="max-h-32 min-h-16 flex-1"
placeholder="Type your message...(max 500 characters)"
rows={1}
bind:value={text}
disabled={operating}
on:keydown={handleKeydown}
maxlength={500}
/>
<div class="text-right text-sm text-gray-500">
{text.length} / 500
</div>
</div>
<div class="flex gap-2">
<div class="ml-auto flex gap-2">
<Button
color={recording && !operating ? 'red' : 'primary'}
class="gap-2"
Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/session/HostView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,9 @@
</Button>
</div>
{:else}
<p class="text-center text-5xl font-bold text-orange-600">{code}</p>
<div class="flex justify-center">
<p class="text-center text-5xl font-bold text-orange-600">{code}</p>
</div>
{/if}
</div>
{/if}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/session/ParticipantView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,9 @@
</div>
</div>

<div class="max-h-[calc(100vh-12rem)] overflow-y-auto rounded-lg border p-6 md:col-span-3">
<div
class="max-h-[calc(100vh-12rem)] min-h-[calc(100vh-12rem)] overflow-y-auto rounded-lg border p-6 md:col-span-3"
>
{#if $session?.status === 'preparing'}
<div class="mt-4">
<h3 class="mb-2 font-medium">Waiting for session to start...</h3>
Expand Down
3 changes: 2 additions & 1 deletion src/lib/server/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export async function createConversation(
.doc(group_number)
.collection('conversations');

const existingConversations = await conversationsRef.get();
// 檢查是否已存在該使用者的對話
const existingConversations = await conversationsRef.where('userId', '==', userId).get();
if (!existingConversations.empty) {
return existingConversations.docs[0].id;
}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/api/auth/signin/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
uid,
displayName: user.displayName || 'User',
email: user.email || '',
title: '',
bio: '',
title: 'Title',
bio: 'Bio',
createdAt: FieldValue.serverTimestamp(),
updatedAt: FieldValue.serverTimestamp()
};
Expand Down

0 comments on commit c486a61

Please sign in to comment.