Skip to content

Commit a54dc4d

Browse files
author
devanshu
committed
Add status selector UI, broadcast peer status, display peer statuses, and save local status
1 parent c1b277c commit a54dc4d

File tree

3 files changed

+44
-7
lines changed

3 files changed

+44
-7
lines changed

dev-dist/sw.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ define(['./workbox-9dc17825'], (function (workbox) { 'use strict';
8181
"url": "registerSW.js",
8282
"revision": "3ca0b8505b4bec776b69afdba2768812"
8383
}, {
84-
"url": "/offline.html",
85-
"revision": "0.kvp38gtfuk"
84+
"url": "index.html",
85+
"revision": "0.6f6mcaamqrg"
8686
}], {});
8787
workbox.cleanupOutdatedCaches();
88-
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("/offline.html"), {
88+
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
8989
allowlist: [/^\/$/],
9090
denylist: [/^\/api\//]
9191
}));

src/styles.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,35 @@ button:hover:not(:disabled) {
133133
audio {
134134
width: 100%;
135135
}
136+
137+
/* adding style */
138+
.status-selector {
139+
margin: 10px 0;
140+
font-weight: 500;
141+
}
142+
143+
.status-dot {
144+
text-transform: capitalize;
145+
padding: 3px 8px;
146+
border-radius: 8px;
147+
}
148+
149+
.status-dot.online {
150+
background: #2ecc71;
151+
color: white;
152+
}
153+
154+
.status-dot.away {
155+
background: #f1c40f;
156+
color: black;
157+
}
158+
159+
.status-dot.busy {
160+
background: #e74c3c;
161+
color: white;
162+
}
163+
164+
.status-dot.offline {
165+
background: #7f8c8d;
166+
color: white;
167+
}

vite.config.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@ export default defineConfig({
3131
registerType: 'autoUpdate',
3232
workbox: {
3333
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
34-
navigateFallback: '/offline.html',
35-
navigateFallbackDenylist: [/^\\/api\\//],
34+
// navigateFallback: '/offline.html',
35+
36+
// Fixed regex: only single backslashes needed in literal
37+
navigateFallbackDenylist: [/^\/api\//],
38+
3639
runtimeCaching: [
3740
{
38-
urlPattern: /^https:\\/\\/0\\.peerjs\\.com\\//,
41+
// Fixed regex: escape dots properly, not slashes
42+
urlPattern: /^https:\/\/0\.peerjs\.com\//,
3943
handler: 'NetworkFirst',
4044
options: {
4145
cacheName: 'peerjs-cache',
@@ -46,7 +50,8 @@ export default defineConfig({
4650
}
4751
},
4852
{
49-
urlPattern: /^https:\\/\\/api\\.qrserver\\.com\\//,
53+
// Fixed regex: same correction here
54+
urlPattern: /^https:\/\/api\.qrserver\.com\//,
5055
handler: 'CacheFirst',
5156
options: {
5257
cacheName: 'qr-cache',

0 commit comments

Comments
 (0)