mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 16:32:09 +00:00
fix: refactored the codebase
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<script setup lang="ts">
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { Check, Copy } from '@lucide/vue';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { favorite } from '@/routes/room';
|
||||
import type { RoomHeaderProps } from '@/types/room';
|
||||
|
||||
const props = defineProps<RoomHeaderProps>();
|
||||
|
||||
const copied = ref(false);
|
||||
|
||||
async function copyInviteLink(): Promise<void> {
|
||||
const inviteUrl = new URL('/room/join', window.location.origin);
|
||||
inviteUrl.searchParams.set('join_code', props.join_code);
|
||||
|
||||
await navigator.clipboard.writeText(inviteUrl.toString());
|
||||
copied.value = true;
|
||||
window.setTimeout(() => {
|
||||
copied.value = false;
|
||||
}, 1_800);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header
|
||||
class="mx-auto flex max-w-6xl flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"
|
||||
>
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold sm:text-3xl">
|
||||
{{ title ?? 'Scrum Poker' }}
|
||||
</h1>
|
||||
|
||||
<Link
|
||||
v-if="canFavorite"
|
||||
:href="favorite(id)"
|
||||
method="post"
|
||||
as="button"
|
||||
class="mt-2 inline-flex items-center gap-2"
|
||||
>
|
||||
<span>Favorit</span>
|
||||
<span class="material-icons" aria-hidden="true">
|
||||
{{ is_favorite ? 'favorite' : 'favorite_border' }}
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-fit items-center gap-3 rounded-xl border border-slate-700 bg-slate-800 px-4 py-2.5 text-left transition hover:bg-slate-700"
|
||||
@click="copyInviteLink"
|
||||
>
|
||||
<span>
|
||||
<span class="block text-sm tracking-[0.18em] text-slate-400">
|
||||
Raumcode
|
||||
</span>
|
||||
<strong class="font-mono text-lg tracking-[0.2em]">
|
||||
{{ join_code }}
|
||||
</strong>
|
||||
</span>
|
||||
<Check v-if="copied" class="size-5 text-emerald-300" />
|
||||
<Copy v-else class="size-5 text-slate-300" />
|
||||
</button>
|
||||
</header>
|
||||
</template>
|
||||
Reference in New Issue
Block a user