Skip to content

Commit 04ec586

Browse files
authored
Merge pull request #609 from frappe/develop
2 parents 5a64d68 + b81c9a1 commit 04ec586

File tree

9 files changed

+99
-10
lines changed

9 files changed

+99
-10
lines changed

crm/hooks.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,14 @@
293293
"label": "Settings",
294294
"type": "Route",
295295
"icon": "settings",
296-
"route": "#",
296+
"route": "#",
297+
"is_standard": 1,
298+
},
299+
{
300+
"name1": "login_to_fc",
301+
"label": "Login to Frappe Cloud",
302+
"type": "Route",
303+
"route": "#",
297304
"is_standard": 1,
298305
},
299306
{
@@ -307,7 +314,7 @@
307314
"label": "Log out",
308315
"type": "Route",
309316
"icon": "log-out",
310-
"route": "#",
317+
"route": "#",
311318
"is_standard": 1,
312319
},
313320
]

crm/www/crm.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44

55
import frappe
6+
from frappe.integrations.frappe_providers.frappecloud_billing import is_fc_site
67
from frappe.utils import cint, get_system_timezone
78
from frappe.utils.telemetry import capture
89

@@ -36,6 +37,7 @@ def get_boot():
3637
"setup_complete": cint(frappe.get_system_settings("setup_complete")),
3738
"sysdefaults": frappe.defaults.get_defaults(),
3839
"is_demo_site": frappe.conf.get("is_demo_site"),
40+
"is_fc_site": is_fc_site(),
3941
"timezone": {
4042
"system": get_system_timezone(),
4143
"user": frappe.db.get_value("User", frappe.session.user, "time_zone")

frontend/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@vueuse/core": "^10.3.0",
1515
"@vueuse/integrations": "^10.3.0",
1616
"feather-icons": "^4.28.0",
17-
"frappe-ui": "^0.1.110",
17+
"frappe-ui": "^0.1.111",
1818
"gemoji": "^8.1.0",
1919
"lodash": "^4.17.21",
2020
"mime": "^4.0.1",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<svg
3+
width="32"
4+
height="32"
5+
viewBox="0 0 32 32"
6+
fill="none"
7+
xmlns="http://www.w3.org/2000/svg"
8+
>
9+
<rect
10+
x="0.75"
11+
y="0.75"
12+
width="30.5"
13+
height="30.5"
14+
rx="6.25"
15+
stroke="currentColor"
16+
stroke-width="1.5"
17+
/>
18+
<path
19+
d="M24.5011 14.1124C23.3954 12.4873 21.532 11.5477 19.594 11.6747C18.7616 10.1384 17.2211 9.12267 15.4198 9.0084C14.1651 8.93222 12.8979 9.3766 11.9165 10.24C11.2456 10.8367 10.7611 11.5223 10.463 12.2968C10.289 12.7539 9.89151 13.0459 9.46912 13.0459H6.5V15.5852H9.46912C10.9226 15.5852 12.2271 14.6584 12.7737 13.2237C12.9227 12.8301 13.1712 12.4873 13.5439 12.1571C14.0284 11.7255 14.662 11.4969 15.2583 11.535C16.1528 11.5985 16.7863 12.0175 17.1839 12.538C17.6063 13.0205 17.8423 13.7696 17.979 14.5187C18.774 14.2902 19.6437 14.0997 20.476 14.2394C21.1593 14.3536 21.7929 14.7218 22.2525 15.2678C22.327 15.3567 22.4016 15.4456 22.4637 15.5471C23.06 16.4232 23.1718 17.5024 22.7743 18.5689C22.414 19.5592 21.0847 20.4607 19.9791 20.4607H11.3326C10.1524 20.4607 9.18339 19.5592 9.03432 18.4038H6.54969C6.71119 20.9686 8.78585 23 11.3326 23H19.9915C22.1283 23 24.3769 21.451 25.1098 19.4704C25.7931 17.6167 25.5695 15.6614 24.5135 14.0997L24.5011 14.1124Z"
20+
fill="currentColor"
21+
/>
22+
</svg>
23+
</template>

frontend/src/components/Layouts/AppSidebar.vue

+5-2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
</div>
7474
<div class="m-2 flex flex-col gap-1">
7575
<SignupBanner :isSidebarCollapsed="isSidebarCollapsed" />
76+
<TrialBanner v-if="isFCSite" />
7677
<SidebarLink
7778
:label="isSidebarCollapsed ? __('Expand') : __('Collapse')"
7879
:isCollapsed="isSidebarCollapsed"
@@ -117,15 +118,17 @@ import {
117118
unreadNotificationsCount,
118119
notificationsStore,
119120
} from '@/stores/notifications'
120-
import { FeatherIcon } from 'frappe-ui'
121+
import { FeatherIcon, TrialBanner } from 'frappe-ui'
121122
import { useStorage } from '@vueuse/core'
122-
import { computed, h } from 'vue'
123+
import { ref, computed, h } from 'vue'
123124
124125
const { getPinnedViews, getPublicViews } = viewsStore()
125126
const { toggle: toggleNotificationPanel } = notificationsStore()
126127
127128
const isSidebarCollapsed = useStorage('isSidebarCollapsed', false)
128129
130+
const isFCSite = ref(window.is_fc_site)
131+
129132
const links = [
130133
{
131134
label: 'Leads',

frontend/src/components/UserDropdown.vue

+9
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@
5050

5151
<script setup>
5252
import BrandLogo from '@/components/BrandLogo.vue'
53+
import FrappeCloudIcon from '@/components/Icons/FrappeCloudIcon.vue'
5354
import Apps from '@/components/Apps.vue'
5455
import { sessionStore } from '@/stores/session'
5556
import { usersStore } from '@/stores/users'
5657
import { getSettings } from '@/stores/settings'
5758
import { showSettings, isMobileView } from '@/composables/settings'
59+
import { confirmLoginToFrappeCloud } from '@/composables/frappecloud'
5860
import { Dropdown } from 'frappe-ui'
5961
import { theme, toggleTheme } from '@/stores/theme'
6062
import { computed, h, markRaw } from 'vue'
@@ -156,6 +158,13 @@ function getStandardItem(item) {
156158
onClick: () => (showSettings.value = true),
157159
condition: () => !isMobileView.value,
158160
}
161+
case 'login_to_fc':
162+
return {
163+
icon: h(FrappeCloudIcon),
164+
label: __(item.label),
165+
onClick: () => confirmLoginToFrappeCloud(),
166+
condition: () => !isMobileView.value && window.is_fc_site,
167+
}
159168
case 'logout':
160169
return {
161170
icon: item.icon,
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { globalStore } from '@/stores/global'
2+
import { createResource } from 'frappe-ui'
3+
import { ref } from 'vue'
4+
5+
const baseEndpoint = ref('https://frappecloud.com')
6+
const siteName = ref('')
7+
8+
export const currentSiteInfo = createResource({
9+
url: 'frappe.integrations.frappe_providers.frappecloud_billing.current_site_info',
10+
cache: 'currentSiteInfo',
11+
onSuccess: (data) => {
12+
baseEndpoint.value = data.base_url
13+
siteName.value = data.site_name
14+
},
15+
})
16+
17+
export const confirmLoginToFrappeCloud = () => {
18+
currentSiteInfo.fetch()
19+
20+
const { $dialog } = globalStore()
21+
22+
$dialog({
23+
title: __('Login to Frappe Cloud?'),
24+
message: __(
25+
'Are you sure you want to login to your Frappe Cloud dashboard?',
26+
),
27+
actions: [
28+
{
29+
label: __('Confirm'),
30+
variant: 'solid',
31+
onClick(close) {
32+
loginToFrappeCloud()
33+
close()
34+
},
35+
},
36+
],
37+
})
38+
}
39+
40+
const loginToFrappeCloud = () => {
41+
window.open(
42+
`${baseEndpoint.value}/dashboard/sites/${siteName.value}`,
43+
'_blank',
44+
)
45+
}

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -2388,10 +2388,10 @@ fraction.js@^4.3.7:
23882388
resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.7.tgz#06ca0085157e42fda7f9e726e79fefc4068840f7"
23892389
integrity sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==
23902390

2391-
frappe-ui@^0.1.110:
2392-
version "0.1.110"
2393-
resolved "https://registry.yarnpkg.com/frappe-ui/-/frappe-ui-0.1.110.tgz#dbe02d294cb0aeb0a4c1b3000682093c309450ae"
2394-
integrity sha512-kFah6SoPauULXaeSbljNUq595/82VmY4k4+KA8zi4sXxpn4sXYi12qUl/1I8GOBhsCQQizmoh46DO7e/uU2M1A==
2391+
frappe-ui@^0.1.111:
2392+
version "0.1.111"
2393+
resolved "https://registry.yarnpkg.com/frappe-ui/-/frappe-ui-0.1.111.tgz#c7615aa8f02da9af0596074352150d813d0f4b3d"
2394+
integrity sha512-JCh/SQwcbsQQxTZIFFzEULPgp2QAQZe+vwrM2jqekIx4dBgYW2H1KgXSlf+uO2ng2vqk4Q1MiStA3svHQEXsLQ==
23952395
dependencies:
23962396
"@headlessui/vue" "^1.7.14"
23972397
"@popperjs/core" "^2.11.2"

0 commit comments

Comments
 (0)