Skip to content

Commit

Permalink
fix: let users explore app without signing
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin committed Nov 6, 2024
1 parent 51227b9 commit a58f066
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ export const handle: Handle = async ({ event, resolve }) => {
if (
!event.url.pathname.startsWith(`${base}/login`) &&
!event.url.pathname.startsWith(`${base}/admin`) &&
!event.url.pathname.startsWith(`${base}/settings`) &&
!["GET", "OPTIONS", "HEAD"].includes(event.request.method)
) {
if (
Expand Down
38 changes: 20 additions & 18 deletions src/lib/components/DisclaimerModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,29 @@
</p>

<div class="flex w-full flex-col items-center gap-2">
{#if $page.data.guestMode || !$page.data.loginEnabled}
<button
class="w-full justify-center rounded-full border-2 border-gray-300 bg-black px-5 py-2 text-lg font-semibold text-gray-100 transition-colors hover:bg-gray-900"
class:bg-white={$page.data.loginEnabled}
class:text-gray-800={$page.data.loginEnabled}
class:hover:bg-slate-100={$page.data.loginEnabled}
on:click|preventDefault|stopPropagation={() => {
if (!cookiesAreEnabled()) {
window.open(window.location.href, "_blank");
}
<button
class="w-full justify-center rounded-full border-2 border-gray-300 bg-black px-5 py-2 text-lg font-semibold text-gray-100 transition-colors hover:bg-gray-900"
class:bg-white={$page.data.loginEnabled}
class:text-gray-800={$page.data.loginEnabled}
class:hover:bg-slate-100={$page.data.loginEnabled}
on:click|preventDefault|stopPropagation={() => {
if (!cookiesAreEnabled()) {
window.open(window.location.href, "_blank");
}

$settings.ethicsModalAccepted = true;
}}
>
{#if $page.data.loginEnabled}
Try as guest
$settings.ethicsModalAccepted = true;
}}
>
{#if $page.data.loginEnabled}
{#if $page.data.guestMode}
Continue as guest
{:else}
Start chatting
Explore the app
{/if}
</button>
{/if}
{:else}
Start chatting
{/if}
</button>
{#if $page.data.loginEnabled}
<form action="{base}/login" target="_parent" method="POST" class="w-full">
<button
Expand Down

0 comments on commit a58f066

Please sign in to comment.