Skip to content

Commit

Permalink
fix: Authenticated access UX
Browse files Browse the repository at this point in the history
  • Loading branch information
surajshetty3416 committed Sep 19, 2024
1 parent 9ea76f7 commit ed1ffb3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions builder/builder/doctype/builder_page/builder_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def on_update(self):
self.has_value_changed("dynamic_route")
or self.has_value_changed("route")
or self.has_value_changed("published")
or self.has_value_changed("disable_indexing")
):
self.clear_route_cache()

Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/BuilderToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
class="h-[14px] w-4"
v-if="store.isHomePage(store.activePage)"></FeatherIcon>
</Tooltip>
<Tooltip text="This page has limited access" :hoverDelay="0.6">
<AuthenticatedUserIcon
class="size-4 text-text-icons-amber-3"
v-if="
store.activePage?.published && store.activePage?.authenticated_access
"></AuthenticatedUserIcon>
</Tooltip>
<span class="max-w-48 truncate text-base text-text-icons-gray-8">
{{ store?.activePage?.page_title || "My Page" }}
</span>
Expand Down Expand Up @@ -146,6 +153,7 @@
</div>
</template>
<script setup lang="ts">
import AuthenticatedUserIcon from "@/components/Icons/AuthenticatedUser.vue";
import PlayIcon from "@/components/Icons/Play.vue";
import SettingsGearIcon from "@/components/Icons/SettingsGear.vue";
import { webPages } from "@/data/webPage";
Expand Down
27 changes: 18 additions & 9 deletions frontend/src/components/Settings/PageGeneral.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<template>
<div
class="flex w-full items-center gap-3 rounded bg-surface-amber-1 p-3 py-2 text-text-icons-amber-3"
v-show="store.activePage?.authenticated_access">
<AuthenticatedUserIcon></AuthenticatedUserIcon>
<span class="text-sm">This page is only accessible to logged-in users</span>
</div>
<div class="no-scrollbar flex h-full flex-col items-center gap-6 overflow-y-auto">
<div class="flex w-full gap-4">
<div class="flex flex-1 flex-col gap-6">
Expand Down Expand Up @@ -37,9 +31,23 @@
<FeatherIcon
name="check-circle"
class="size-4 text-text-icons-green-3"
v-if="store.activePage?.published" />
<FeatherIcon name="alert-circle" class="size-4 text-text-icons-gray-4" v-else />
{{ store.activePage?.published ? "Published" : "Unpublished" }}
v-if="store.activePage?.published && !store.activePage.authenticated_access" />
<AuthenticatedUserIcon
class="size-4 text-text-icons-amber-3"
v-else-if="
store.activePage?.published && store.activePage?.authenticated_access
"></AuthenticatedUserIcon>
<FeatherIcon
name="alert-circle"
class="size-4 text-text-icons-gray-4"
v-else-if="!store.activePage?.published" />
{{
store.activePage?.published
? store.activePage?.authenticated_access
? "Published with limited access"
: "Published"
: "Draft"
}}
</span>
<Tooltip
:text="
Expand Down Expand Up @@ -116,6 +124,7 @@
<Switch
size="sm"
label="Authenticated Access"
:disabled="store.isHomePage(store.activePage)"
description="Only logged-in users can access this page"
:modelValue="Boolean(store.activePage?.authenticated_access)"
@update:modelValue="(val: Boolean) => store.updateActivePage('authenticated_access', val)" />
Expand Down

0 comments on commit ed1ffb3

Please sign in to comment.