fix: added TrialBanner in sidebar
This commit is contained in:
parent
37e535a28e
commit
65abf1131b
@ -73,6 +73,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="m-2 flex flex-col gap-1">
|
<div class="m-2 flex flex-col gap-1">
|
||||||
<SignupBanner :isSidebarCollapsed="isSidebarCollapsed" />
|
<SignupBanner :isSidebarCollapsed="isSidebarCollapsed" />
|
||||||
|
<TrialBanner v-if="isFCSite" />
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
:label="isSidebarCollapsed ? __('Expand') : __('Collapse')"
|
:label="isSidebarCollapsed ? __('Expand') : __('Collapse')"
|
||||||
:isCollapsed="isSidebarCollapsed"
|
:isCollapsed="isSidebarCollapsed"
|
||||||
@ -117,15 +118,17 @@ import {
|
|||||||
unreadNotificationsCount,
|
unreadNotificationsCount,
|
||||||
notificationsStore,
|
notificationsStore,
|
||||||
} from '@/stores/notifications'
|
} from '@/stores/notifications'
|
||||||
import { FeatherIcon } from 'frappe-ui'
|
import { FeatherIcon, TrialBanner } from 'frappe-ui'
|
||||||
import { useStorage } from '@vueuse/core'
|
import { useStorage } from '@vueuse/core'
|
||||||
import { computed, h } from 'vue'
|
import { ref, computed, h } from 'vue'
|
||||||
|
|
||||||
const { getPinnedViews, getPublicViews } = viewsStore()
|
const { getPinnedViews, getPublicViews } = viewsStore()
|
||||||
const { toggle: toggleNotificationPanel } = notificationsStore()
|
const { toggle: toggleNotificationPanel } = notificationsStore()
|
||||||
|
|
||||||
const isSidebarCollapsed = useStorage('isSidebarCollapsed', false)
|
const isSidebarCollapsed = useStorage('isSidebarCollapsed', false)
|
||||||
|
|
||||||
|
const isFCSite = ref(window.is_fc_site)
|
||||||
|
|
||||||
const links = [
|
const links = [
|
||||||
{
|
{
|
||||||
label: 'Leads',
|
label: 'Leads',
|
||||||
|
|||||||
@ -1,10 +1,23 @@
|
|||||||
import { globalStore } from '@/stores/global'
|
import { globalStore } from '@/stores/global'
|
||||||
import { call } from 'frappe-ui'
|
import { createResource } from 'frappe-ui'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const frappeCloudBaseEndpoint = 'https://frappecloud.com'
|
const frappeCloudBaseEndpoint = 'https://frappecloud.com'
|
||||||
|
const isPaymentModeAdded = ref(false)
|
||||||
|
|
||||||
|
export const currentSiteInfo = createResource({
|
||||||
|
url: 'frappe.integrations.frappe_providers.frappecloud_billing.current_site_info',
|
||||||
|
cache: 'currentSiteInfo',
|
||||||
|
onSuccess: (data) => {
|
||||||
|
isPaymentModeAdded.value = data.is_payment_method_added
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
export const confirmLoginToFrappeCloud = () => {
|
export const confirmLoginToFrappeCloud = () => {
|
||||||
|
currentSiteInfo.fetch()
|
||||||
|
|
||||||
const { $dialog } = globalStore()
|
const { $dialog } = globalStore()
|
||||||
|
|
||||||
$dialog({
|
$dialog({
|
||||||
title: __('Login to Frappe Cloud?'),
|
title: __('Login to Frappe Cloud?'),
|
||||||
message: __(
|
message: __(
|
||||||
@ -24,19 +37,13 @@ export const confirmLoginToFrappeCloud = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const loginToFrappeCloud = () => {
|
const loginToFrappeCloud = () => {
|
||||||
call(
|
let redirectRoute = ''
|
||||||
'frappe.integrations.frappe_providers.frappecloud_billing.current_site_info',
|
|
||||||
).then((response) => {
|
|
||||||
if (!response) return
|
|
||||||
|
|
||||||
let redirectRoute = ''
|
if (isPaymentModeAdded.value) {
|
||||||
|
redirectRoute = '/dashboard'
|
||||||
|
} else {
|
||||||
|
redirectRoute = '/dashboard/welcome'
|
||||||
|
}
|
||||||
|
|
||||||
if (response.is_payment_method_added) {
|
window.open(`${frappeCloudBaseEndpoint}${redirectRoute}`, '_blank')
|
||||||
redirectRoute = '/dashboard'
|
|
||||||
} else {
|
|
||||||
redirectRoute = '/dashboard/welcome'
|
|
||||||
}
|
|
||||||
|
|
||||||
window.open(`${frappeCloudBaseEndpoint}${redirectRoute}`, '_blank')
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user