fix: gate signaling behind profile setup, fix SW cache
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 37s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 37s
This commit is contained in:
parent
e3085ea7a2
commit
d8d747276a
@ -11,6 +11,16 @@ import PublicRoomPanel from "../components/PublicRoomPanel";
|
|||||||
import ProfileSetup from "../components/ProfileSetup";
|
import ProfileSetup from "../components/ProfileSetup";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
|
const isSetUp = useProfileStore((s) => s.isSetUp);
|
||||||
|
|
||||||
|
if (!isSetUp) {
|
||||||
|
return <ProfileSetup onDone={() => {}} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <HomeConnected />;
|
||||||
|
}
|
||||||
|
|
||||||
|
function HomeConnected() {
|
||||||
const { sendFiles, sendText, acceptTransfer, rejectTransfer, createPublicRoom } =
|
const { sendFiles, sendText, acceptTransfer, rejectTransfer, createPublicRoom } =
|
||||||
useSignaling();
|
useSignaling();
|
||||||
|
|
||||||
@ -22,7 +32,7 @@ export default function Home() {
|
|||||||
const setShowTextModal = useStore((s) => s.setShowTextModal);
|
const setShowTextModal = useStore((s) => s.setShowTextModal);
|
||||||
const setError = useStore((s) => s.setError);
|
const setError = useStore((s) => s.setError);
|
||||||
|
|
||||||
const { deviceName, avatar, isSetUp } = useProfileStore();
|
const { deviceName, avatar } = useProfileStore();
|
||||||
const [showProfileEdit, setShowProfileEdit] = useState(false);
|
const [showProfileEdit, setShowProfileEdit] = useState(false);
|
||||||
|
|
||||||
const handlePeerSelect = useCallback(
|
const handlePeerSelect = useCallback(
|
||||||
@ -145,10 +155,7 @@ export default function Home() {
|
|||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Profile setup — first time or edit */}
|
{/* Profile edit modal */}
|
||||||
{!isSetUp && (
|
|
||||||
<ProfileSetup onDone={() => {}} />
|
|
||||||
)}
|
|
||||||
{showProfileEdit && (
|
{showProfileEdit && (
|
||||||
<ProfileSetup isEditing onDone={() => setShowProfileEdit(false)} />
|
<ProfileSetup isEditing onDone={() => setShowProfileEdit(false)} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -12,9 +12,19 @@ import ProfileSetup from "../components/ProfileSetup";
|
|||||||
|
|
||||||
export default function JoinRoom() {
|
export default function JoinRoom() {
|
||||||
const { code } = useParams<{ code: string }>();
|
const { code } = useParams<{ code: string }>();
|
||||||
|
const isSetUp = useProfileStore((s) => s.isSetUp);
|
||||||
|
|
||||||
|
if (!isSetUp) {
|
||||||
|
return <ProfileSetup onDone={() => {}} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <JoinRoomConnected code={code} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
function JoinRoomConnected({ code }: { code?: string }) {
|
||||||
const { sendFiles, sendText, acceptTransfer, rejectTransfer } = useSignaling(code);
|
const { sendFiles, sendText, acceptTransfer, rejectTransfer } = useSignaling(code);
|
||||||
|
|
||||||
const { deviceName, avatar, isSetUp } = useProfileStore();
|
const { deviceName, avatar } = useProfileStore();
|
||||||
const [showProfileEdit, setShowProfileEdit] = useState(false);
|
const [showProfileEdit, setShowProfileEdit] = useState(false);
|
||||||
const selectedPeerId = useStore((s) => s.selectedPeerId);
|
const selectedPeerId = useStore((s) => s.selectedPeerId);
|
||||||
const showTextModal = useStore((s) => s.showTextModal);
|
const showTextModal = useStore((s) => s.showTextModal);
|
||||||
@ -146,10 +156,7 @@ export default function JoinRoom() {
|
|||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Profile setup — first time or edit */}
|
{/* Profile edit modal */}
|
||||||
{!isSetUp && (
|
|
||||||
<ProfileSetup onDone={() => {}} />
|
|
||||||
)}
|
|
||||||
{showProfileEdit && (
|
{showProfileEdit && (
|
||||||
<ProfileSetup isEditing onDone={() => setShowProfileEdit(false)} />
|
<ProfileSetup isEditing onDone={() => setShowProfileEdit(false)} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -15,6 +15,17 @@ export default defineConfig({
|
|||||||
VitePWA({
|
VitePWA({
|
||||||
registerType: "autoUpdate",
|
registerType: "autoUpdate",
|
||||||
includeAssets: ["favicon.svg"],
|
includeAssets: ["favicon.svg"],
|
||||||
|
workbox: {
|
||||||
|
skipWaiting: true,
|
||||||
|
clientsClaim: true,
|
||||||
|
navigateFallback: "index.html",
|
||||||
|
runtimeCaching: [
|
||||||
|
{
|
||||||
|
urlPattern: ({ request }) => request.mode === "navigate",
|
||||||
|
handler: "NetworkFirst",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
manifest: {
|
manifest: {
|
||||||
name: "AnyDrop",
|
name: "AnyDrop",
|
||||||
short_name: "AnyDrop",
|
short_name: "AnyDrop",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user