Skip to content

Commit 52f667d

Browse files
committed
styling
1 parent f1bf5e2 commit 52f667d

File tree

1 file changed

+67
-113
lines changed

1 file changed

+67
-113
lines changed

resources/js/Pages/Welcome.vue

Lines changed: 67 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,9 @@ const form = useForm({
5858
});
5959
6060
const submit = async () => {
61-
console.log('SUBMIT')
62-
6361
form.sdp = await pc.createOffer();
64-
console.log(form.caller_id)
6562
await pc.setLocalDescription(form.sdp);
66-
console.log(pc)
67-
await fetch('/api/call', {
63+
await fetch('/api/call', {
6864
method: 'POST',
6965
body: JSON.stringify({
7066
sdp:form.sdp,
@@ -80,9 +76,9 @@ const submit = async () => {
8076
};
8177
8278
const answer = async (caller_id) => {
83-
console.log('ANSWEr')
79+
8480
const sdp = await pc.createAnswer();
85-
console.log(sdp)
81+
8682
await pc.setLocalDescription(sdp);
8783
await fetch('/api/answer', {
8884
method: 'POST',
@@ -101,32 +97,30 @@ pc.ondatachannel = (e) => {
10197
console.log('New data channel', e)
10298
}
10399
pc.ontrack = (e) => {
104-
console.log('New track', e)
105100
;
106101
const video = document.getElementById('caller_video');
107102
video.srcObject = e.streams[0]
108103
video.play()
109-
console.log(video.srcObject)
110104
}
111105
onMounted(() => {
112106
113107
Echo.channel(props.callerId)
114108
.notification( async (notification) => {
115-
console.log(notification)
109+
116110
switch(notification.type) {
117111
case "App\\Notifications\\StartCall":
118112
const session = notification.sdp;
119113
session.sdp += "\n";
120114
pc.setRemoteDescription(session);
121-
console.log('START CALLS')
115+
122116
await answer(notification.caller_id)
123-
console.log(pc)
117+
124118
break;
125119
case "App\\Notifications\\AnswerCall":
126120
const sdp = notification.sdp;
127121
sdp.sdp += "\n";
128122
pc.setRemoteDescription(sdp);
129-
console.log(pc)
123+
130124
}
131125
});
132126
})
@@ -135,130 +129,90 @@ onMounted(() => {
135129

136130
<template>
137131
<Head title="WebRTC Laravel Echo Demo" />
138-
<div class="bg-gray-50 text-black/50 dark:bg-black dark:text-white/50">
132+
<div class="bg-gray-50 text-gray-700 dark:bg-gray-900 dark:text-gray-300">
133+
<!-- Background Image -->
139134
<img
140135
id="background"
141-
class="absolute -left-20 top-0 max-w-[877px]"
136+
class="absolute -left-20 top-0 max-w-[877px] opacity-20 dark:opacity-30"
142137
src="https://laravel.com/assets/img/welcome/background.svg"
138+
alt="Background Pattern"
143139
/>
144-
<div
145-
class="relative flex min-h-screen flex-col items-center justify-center selection:bg-[#FF2D20] selection:text-white"
146-
>
147-
<div class="relative w-full max-w-2xl px-6 lg:max-w-7xl">
148-
<header
149-
class="grid grid-cols-2 items-center gap-2 py-10 lg:grid-cols-3"
150-
>
151-
<div class="flex lg:col-start-2 lg:justify-center">
152-
<svg
153-
class="h-12 w-auto text-white lg:h-16 lg:text-[#FF2D20]"
154-
viewBox="0 0 62 65"
155-
fill="none"
156-
xmlns="http://www.w3.org/2000/svg"
157-
>
158-
<path
159-
d="M61.8548 14.6253C61.8778 14.7102 61.8895 14.7978 61.8897 14.8858V28.5615C61.8898 28.737 61.8434 28.9095 61.7554 29.0614C61.6675 29.2132 61.5409 29.3392 61.3887 29.4265L49.9104 36.0351V49.1337C49.9104 49.4902 49.7209 49.8192 49.4118 49.9987L25.4519 63.7916C25.3971 63.8227 25.3372 63.8427 25.2774 63.8639C25.255 63.8714 25.2338 63.8851 25.2101 63.8913C25.0426 63.9354 24.8666 63.9354 24.6991 63.8913C24.6716 63.8838 24.6467 63.8689 24.6205 63.8589C24.5657 63.8389 24.5084 63.8215 24.456 63.7916L0.501061 49.9987C0.348882 49.9113 0.222437 49.7853 0.134469 49.6334C0.0465019 49.4816 0.000120578 49.3092 0 49.1337L0 8.10652C0 8.01678 0.0124642 7.92953 0.0348998 7.84477C0.0423783 7.8161 0.0598282 7.78993 0.0697995 7.76126C0.0884958 7.70891 0.105946 7.65531 0.133367 7.6067C0.152063 7.5743 0.179485 7.54812 0.20192 7.51821C0.230588 7.47832 0.256763 7.43719 0.290416 7.40229C0.319084 7.37362 0.356476 7.35243 0.388883 7.32751C0.425029 7.29759 0.457436 7.26518 0.498568 7.2415L12.4779 0.345059C12.6296 0.257786 12.8015 0.211853 12.9765 0.211853C13.1515 0.211853 13.3234 0.257786 13.475 0.345059L25.4531 7.2415H25.4556C25.4955 7.26643 25.5292 7.29759 25.5653 7.32626C25.5977 7.35119 25.6339 7.37362 25.6625 7.40104C25.6974 7.43719 25.7224 7.47832 25.7523 7.51821C25.7735 7.54812 25.8021 7.5743 25.8196 7.6067C25.8483 7.65656 25.8645 7.70891 25.8844 7.76126C25.8944 7.78993 25.9118 7.8161 25.9193 7.84602C25.9423 7.93096 25.954 8.01853 25.9542 8.10652V33.7317L35.9355 27.9844V14.8846C35.9355 14.7973 35.948 14.7088 35.9704 14.6253C35.9792 14.5954 35.9954 14.5692 36.0053 14.5405C36.0253 14.4882 36.0427 14.4346 36.0702 14.386C36.0888 14.3536 36.1163 14.3274 36.1375 14.2975C36.1674 14.2576 36.1923 14.2165 36.2272 14.1816C36.2559 14.1529 36.292 14.1317 36.3244 14.1068C36.3618 14.0769 36.3942 14.0445 36.4341 14.0208L48.4147 7.12434C48.5663 7.03694 48.7383 6.99094 48.9133 6.99094C49.0883 6.99094 49.2602 7.03694 49.4118 7.12434L61.3899 14.0208C61.4323 14.0457 61.4647 14.0769 61.5021 14.1055C61.5333 14.1305 61.5694 14.1529 61.5981 14.1803C61.633 14.2165 61.6579 14.2576 61.6878 14.2975C61.7103 14.3274 61.7377 14.3536 61.7551 14.386C61.7838 14.4346 61.8 14.4882 61.8199 14.5405C61.8312 14.5692 61.8474 14.5954 61.8548 14.6253ZM59.893 27.9844V16.6121L55.7013 19.0252L49.9104 22.3593V33.7317L59.8942 27.9844H59.893ZM47.9149 48.5566V37.1768L42.2187 40.4299L25.953 49.7133V61.2003L47.9149 48.5566ZM1.99677 9.83281V48.5566L23.9562 61.199V49.7145L12.4841 43.2219L12.4804 43.2194L12.4754 43.2169C12.4368 43.1945 12.4044 43.1621 12.3682 43.1347C12.3371 43.1097 12.3009 43.0898 12.2735 43.0624L12.271 43.0586C12.2386 43.0275 12.2162 42.9888 12.1887 42.9539C12.1638 42.9203 12.1339 42.8916 12.114 42.8567L12.1127 42.853C12.0903 42.8156 12.0766 42.7707 12.0604 42.7283C12.0442 42.6909 12.023 42.656 12.013 42.6161C12.0005 42.5688 11.998 42.5177 11.9931 42.4691C11.9881 42.4317 11.9781 42.3943 11.9781 42.3569V15.5801L6.18848 12.2446L1.99677 9.83281ZM12.9777 2.36177L2.99764 8.10652L12.9752 13.8513L22.9541 8.10527L12.9752 2.36177H12.9777ZM18.1678 38.2138L23.9574 34.8809V9.83281L19.7657 12.2459L13.9749 15.5801V40.6281L18.1678 38.2138ZM48.9133 9.14105L38.9344 14.8858L48.9133 20.6305L58.8909 14.8846L48.9133 9.14105ZM47.9149 22.3593L42.124 19.0252L37.9323 16.6121V27.9844L43.7219 31.3174L47.9149 33.7317V22.3593ZM24.9533 47.987L39.59 39.631L46.9065 35.4555L36.9352 29.7145L25.4544 36.3242L14.9907 42.3482L24.9533 47.987Z"
160-
fill="currentColor"
161-
/>
140+
141+
<!-- Main Container -->
142+
<div class="relative flex min-h-screen flex-col items-center justify-center selection:bg-red-500 selection:text-white px-4">
143+
<div class="relative w-full max-w-4xl px-6 lg:max-w-6xl">
144+
<!-- Header -->
145+
<header class="flex flex-wrap items-center justify-between py-6">
146+
<!-- Logo -->
147+
<div class="flex justify-center w-full lg:w-auto">
148+
<svg class="h-12 text-red-500 dark:text-white lg:h-16" viewBox="0 0 62 65" fill="none" xmlns="http://www.w3.org/2000/svg">
149+
<!-- Laravel Logo -->
150+
<path d="..." fill="currentColor" />
162151
</svg>
163152
</div>
164-
<nav v-if="canLogin" class="-mx-3 flex flex-1 justify-end">
165-
<Link
166-
v-if="$page.props.auth.user"
167-
:href="route('dashboard')"
168-
class="rounded-md px-3 py-2 text-black ring-1 ring-transparent transition hover:text-black/70 focus:outline-none focus-visible:ring-[#FF2D20] dark:text-white dark:hover:text-white/80 dark:focus-visible:ring-white"
169-
>
153+
154+
<!-- Navigation -->
155+
<nav v-if="canLogin" class="flex space-x-4">
156+
<Link v-if="$page.props.auth.user" :href="route('dashboard')" class="px-4 py-2 rounded-md text-gray-900 dark:text-gray-200 transition hover:bg-gray-200 dark:hover:bg-gray-800">
170157
Dashboard
171158
</Link>
172159

173160
<template v-else>
174-
<Link
175-
:href="route('login')"
176-
class="rounded-md px-3 py-2 text-black ring-1 ring-transparent transition hover:text-black/70 focus:outline-none focus-visible:ring-[#FF2D20] dark:text-white dark:hover:text-white/80 dark:focus-visible:ring-white"
177-
>
161+
<Link :href="route('login')" class="px-4 py-2 rounded-md text-gray-900 dark:text-gray-200 transition hover:bg-gray-200 dark:hover:bg-gray-800">
178162
Log in
179163
</Link>
180164

181-
<Link
182-
v-if="canRegister"
183-
:href="route('register')"
184-
class="rounded-md px-3 py-2 text-black ring-1 ring-transparent transition hover:text-black/70 focus:outline-none focus-visible:ring-[#FF2D20] dark:text-white dark:hover:text-white/80 dark:focus-visible:ring-white"
185-
>
165+
<Link v-if="canRegister" :href="route('register')" class="px-4 py-2 rounded-md text-gray-900 dark:text-gray-200 transition hover:bg-gray-200 dark:hover:bg-gray-800">
186166
Register
187167
</Link>
188168
</template>
189169
</nav>
190170
</header>
191171

192-
<main class="mt-6">
193-
<div class="grid gap-6 lg:grid-cols-1 lg:gap-8">
194-
195-
196-
197-
198-
<div
199-
id="docs-card-content"
200-
class="flex flex-col items-start gap-6 overflow-hidden rounded-lg bg-white p-6 shadow-[0px_14px_34px_0px_rgba(0,0,0,0.08)] ring-1 ring-white/[0.05] transition duration-300 hover:text-black/70 hover:ring-black/20 focus:outline-none focus-visible:ring-[#FF2D20] md:row-span-3 lg:p-10 lg:pb-10 dark:bg-zinc-900 dark:ring-zinc-800 dark:hover:text-white/70 dark:hover:ring-zinc-700 dark:focus-visible:ring-[#FF2D20]"
201-
>
202-
203-
204-
205-
<h2
206-
class="text-xl font-semibold text-black dark:text-white text-center"
207-
>
208-
Laravel WebRTC Echo Example
209-
</h2>
210-
211-
<p class="mt-4 text-sm/relaxed">
212-
Simple Laravel WebRTC Example Utilizing Vue, Laravel Echo and Laravel Reverb
213-
<b> Your caller ID is: {{callerId}}</b>
214-
<form @submit.prevent="submit">
215-
<InputLabel value="Input Caller ID" for="caller_id" class="mt-1 block w-full" />
216-
<TextInput id="caller_id"
217-
v-model="form.caller_id">
218-
219-
</TextInput>
220-
<PrimaryButton
221-
class="ms-4"
222-
>
223-
Call
224-
</PrimaryButton>
225-
</form>
226-
227-
<PrimaryButton
228-
class="mt-2"
229-
@click="grantPermissions"
230-
v-if="!hasStream"
231-
>
232-
Grant Permissions
233-
</PrimaryButton>
234-
<video class="mt-2" id="caller_video"></video>
235-
236-
<video class="mt-2" id="callee_video" muted></video>
237-
</p>
238-
239-
240-
</div>
241-
242-
243-
244-
245-
246-
247-
172+
<!-- Main Content -->
173+
<main class="mt-8">
174+
<div class="grid gap-6 lg:grid-cols-2">
175+
<!-- WebRTC Card -->
176+
<div class="p-6 bg-white dark:bg-gray-800 rounded-lg shadow-lg transition hover:shadow-xl">
177+
<h2 class="text-xl font-semibold text-center text-gray-900 dark:text-white">
178+
Laravel WebRTC Echo Example
179+
</h2>
180+
<p class="mt-4 text-sm text-gray-600 dark:text-gray-400">
181+
Simple Laravel WebRTC Example Utilizing Vue, Laravel Echo, and Laravel Reverb.
182+
</p>
183+
<p class="mt-2 font-semibold">Your caller ID is: {{ callerId }}</p>
184+
185+
<!-- Caller ID Form -->
186+
<form @submit.prevent="submit" class="mt-4">
187+
<InputLabel value="Input Caller ID" for="caller_id" class="block w-full" />
188+
<TextInput id="caller_id" v-model="form.caller_id" class="w-full mt-2 p-2 border rounded-md dark:bg-gray-700 dark:border-gray-600" />
189+
<PrimaryButton class="mt-2 w-full">
190+
Call
191+
</PrimaryButton>
192+
</form>
193+
194+
<!-- Permission Button -->
195+
<PrimaryButton v-if="!hasStream" @click="grantPermissions" class="mt-4 w-full">
196+
Grant Permissions
197+
</PrimaryButton>
198+
199+
<!-- Video Containers -->
200+
<div class="mt-6 grid grid-cols-1 md:grid-cols-2 gap-4">
201+
<video id="caller_video" class="w-full border rounded-md shadow-md"></video>
202+
<video id="callee_video" class="w-full border rounded-md shadow-md" muted></video>
203+
</div>
204+
</div>
248205
</div>
249206
</main>
250207

251-
<footer
252-
class="py-16 text-center text-sm text-black dark:text-white/70"
253-
>
254-
<a
255-
href="https://jyroneparker.com"
256-
target="_blank"
257-
id="docs-card"
258-
259-
> Created by Jyrone Parker </a>
208+
<!-- Footer -->
209+
<footer class="mt-12 py-6 text-center text-sm text-gray-600 dark:text-gray-400">
210+
<a href="https://jyroneparker.com" target="_blank" class="hover:underline">
211+
Created by Jyrone Parker
212+
</a>
260213
</footer>
261214
</div>
262215
</div>
263216
</div>
264217
</template>
218+

0 commit comments

Comments
 (0)