Skip to content

Commit

Permalink
refactor: update ParticipantView Leave Group button and +page.svelte …
Browse files Browse the repository at this point in the history
…for responsive screen (#105)

- Moved Leave Group button to be responsive, displaying differently on small and larger screens.
- Wrapped HostView and ParticipantView components in a div with margin for better layout consistency.
  • Loading branch information
howard9199 authored Dec 25, 2024
1 parent 1046b77 commit c2cc5d6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
31 changes: 21 additions & 10 deletions src/lib/components/session/ParticipantView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -598,16 +598,6 @@
<span class="font-medium">Group </span>
<span class="text-lg">#{groupDoc.data.number}</span>
</div>
{#if $session?.status === 'preparing'}
<Button
color="red"
size="xs"
onclick={() => groupDoc?.id && handleLeaveGroup(groupDoc.id, user.uid)}
>
<LogOut class="mr-2 h-4 w-4" />
Leave Group
</Button>
{/if}
</div>
<div>
<h3 class="mb-2 font-medium">Members:</h3>
Expand All @@ -632,6 +622,27 @@
{/each}
</ul>
</div>
<div>
{#if $session?.status === 'preparing'}
<Button
color="red"
size="xs"
class="hidden sm:flex"
onclick={() => groupDoc?.id && handleLeaveGroup(groupDoc.id, user.uid)}
>
<LogOut class="mr-2 h-4 w-4" />
Leave Group
</Button>
<Button
color="red"
size="xs"
class="sm:hidden"
onclick={() => groupDoc?.id && handleLeaveGroup(groupDoc.id, user.uid)}
>
<LogOut class="h-4 w-4" />
</Button>
{/if}
</div>
</div>
{:else if $session?.status === 'preparing'}
<div class="mt-6 space-y-4">
Expand Down
8 changes: 6 additions & 2 deletions src/routes/session/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
</svelte:head>

{#if isHost}
<HostView {session} />
<div class="mx-4">
<HostView {session} />
</div>
{:else}
<ParticipantView {session} user={data.user} />
<div class="mx-4">
<ParticipantView {session} user={data.user} />
</div>
{/if}

0 comments on commit c2cc5d6

Please sign in to comment.