Skip to content

Commit

Permalink
feat(ui): sidebar: beta badge (#1272)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssiyad authored Jun 19, 2023
1 parent f262c96 commit 6524075
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions desk/src/components/desk/sidebar/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const menuOptions = computed(() => [
label: "Knowledge base",
icon: IconKnowledgeBase,
to: "DeskKBHome",
isBeta: true,
},
{
label: showExtra.value ? "Less" : "More",
Expand Down Expand Up @@ -108,6 +109,7 @@ const extraOptions = [
label: "Canned responses",
icon: IconCannedResponse,
to: AGENT_PORTAL_CANNED_RESPONSE_LIST,
isBeta: true,
},
{
label: "Customers",
Expand Down
18 changes: 14 additions & 4 deletions desk/src/components/desk/sidebar/SidebarLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,40 @@
>
<component :is="icon" class="h-4 w-4 shrink-0"></component>
<div
class="ml-2 shrink-0 text-base transition-all duration-300 ease-in-out"
class="ml-2 flex shrink-0 grow items-center justify-between text-base transition-all duration-300 ease-in-out"
:class="{
'opacity-100': sidebarStore.isExpanded,
'opacity-0': !sidebarStore.isExpanded,
'-z-50': !sidebarStore.isExpanded,
}"
>
{{ label }}
<Tooltip :text="betaText">
<Badge v-if="isBeta" theme="orange" variant="subtle">beta</Badge>
</Tooltip>
</div>
</div>
</template>

<script setup lang="ts">
import { computed } from "vue";
import { useRoute, useRouter } from "vue-router";
import { Badge, Tooltip } from "frappe-ui";
import { useSidebarStore } from "@/stores/sidebar";
const props = defineProps({
icon: {
type: Object,
required: true,
},
label: {
type: String,
required: true,
},
icon: {
type: Object,
required: true,
isBeta: {
type: Boolean,
required: false,
default: false,
},
to: {
type: String,
Expand All @@ -54,6 +63,7 @@ const route = useRoute();
const router = useRouter();
const sidebarStore = useSidebarStore();
const isActive = computed(() => props.to.includes(route.name.toString()));
const betaText = "This feature is a work in progress. Use with caution";
function handle() {
props.onClick();
Expand Down

0 comments on commit 6524075

Please sign in to comment.