mirror of
https://github.com/jcreek/EstimationPoker.git
synced 2026-07-12 18:43:47 +00:00
Merge pull request #18 from jcreek/15-enable-joining-a-room-within-the-pwa-by-pasting-the-link-into-a-textbox
feat(#15): Enable joining a room within the PWA by pasting the link i…
This commit is contained in:
@@ -2,10 +2,20 @@
|
|||||||
import { generateId } from './estimation/estimation.js';
|
import { generateId } from './estimation/estimation.js';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
|
let roomId = '';
|
||||||
|
|
||||||
function startARoom() {
|
function startARoom() {
|
||||||
const roomId = generateId();
|
const roomId = generateId();
|
||||||
goto(`/estimation/${roomId}`);
|
goto(`/estimation/${roomId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function joinRoom() {
|
||||||
|
const match = roomId.match(/\/estimation\/(.+)/);
|
||||||
|
if (match) {
|
||||||
|
const roomId = match[1];
|
||||||
|
goto(`/estimation/${roomId}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -13,6 +23,11 @@
|
|||||||
Simply start a room and share the URL to everyone else who needs to join the estimation session.
|
Simply start a room and share the URL to everyone else who needs to join the estimation session.
|
||||||
</p>
|
</p>
|
||||||
<button class="button button-green" on:click={startARoom}>Start a room</button>
|
<button class="button button-green" on:click={startARoom}>Start a room</button>
|
||||||
|
<div class="join-room-container">
|
||||||
|
<label for="room-id">Join a room:</label>
|
||||||
|
<input type="text" id="room-id" placeholder="Paste a shared room link" bind:value={roomId} />
|
||||||
|
<button class="button button-yellow" on:click={joinRoom}>Join</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -29,6 +44,28 @@
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.join-room-container {
|
||||||
|
margin-top: 50px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.join-room-container label {
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.join-room-container input[type='text'] {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 20rem;
|
||||||
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
appearance: none;
|
appearance: none;
|
||||||
border: 1px solid rgba(27, 31, 35, 0.15);
|
border: 1px solid rgba(27, 31, 35, 0.15);
|
||||||
@@ -111,4 +148,12 @@
|
|||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button-yellow {
|
||||||
|
background-color: #eea236;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-yellow:hover {
|
||||||
|
background-color: #d18f2e;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user