Skip to content

Commit

Permalink
fix: removed old Billing component from settings page and added Billi…
Browse files Browse the repository at this point in the history
…ng action button in user dropdown
  • Loading branch information
shariquerik committed Nov 15, 2024
1 parent 9d30a7a commit 9aea597
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 68 deletions.
16 changes: 0 additions & 16 deletions frontend/src/components/Icons/BillingIcon.vue

This file was deleted.

16 changes: 0 additions & 16 deletions frontend/src/components/Icons/PlansIcon.vue

This file was deleted.

22 changes: 11 additions & 11 deletions frontend/src/components/Layouts/AppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@
</Section>
</div>
</div>
<TrialBanner
:isSidebarCollapsed="isSidebarCollapsed"
@upgradePlan="showBillingSettingPage"
/>
<TrialBanner v-if="isFCSite.data" />
<div class="m-2 flex flex-col gap-1">
<SidebarLink
:label="isSidebarCollapsed ? __('Expand') : __('Collapse')"
Expand Down Expand Up @@ -119,10 +116,9 @@ import {
unreadNotificationsCount,
notificationsStore,
} from '@/stores/notifications'
import { showSettings, activeSettingsPage } from '@/composables/settings'
import { FeatherIcon, TrialBanner } from 'frappe-ui'
import { FeatherIcon, TrialBanner, createResource } from 'frappe-ui'
import { useStorage } from '@vueuse/core'
import { computed, h } from 'vue'
import { computed, h, provide } from 'vue'
const { getPinnedViews, getPublicViews } = viewsStore()
const { toggle: toggleNotificationPanel } = notificationsStore()
Expand Down Expand Up @@ -234,8 +230,12 @@ function getIcon(routeName, icon) {
}
}
function showBillingSettingPage() {
showSettings.value = true
activeSettingsPage.value = 'Billing'
}
const isFCSite = createResource({
url: 'frappe.integrations.frappe_providers.frappecloud_billing.is_fc_site',
cache: 'isFCSite',
auto: true,
transform: (data) => Boolean(data),
})
provide('isFCSite', isFCSite)
</script>
26 changes: 2 additions & 24 deletions frontend/src/components/Settings/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
import WhatsAppIcon from '@/components/Icons/WhatsAppIcon.vue'
import ERPNextIcon from '@/components/Icons/ERPNextIcon.vue'
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
import PlansIcon from '@/components/Icons/PlansIcon.vue'
import BillingIcon from '@/components/Icons/BillingIcon.vue'
import InviteMemberPage from '@/components/Settings/InviteMemberPage.vue'
import ProfileSettings from '@/components/Settings/ProfileSettings.vue'
import WhatsAppSettings from '@/components/Settings/WhatsAppSettings.vue'
Expand All @@ -59,8 +57,8 @@ import {
showSettings,
activeSettingsPage,
} from '@/composables/settings'
import { Dialog, Plans, Billing } from 'frappe-ui'
import { ref, markRaw, computed, watch, h } from 'vue'
import { Dialog } from 'frappe-ui'
import { ref, markRaw, computed, watch } from 'vue'
const { isManager } = usersStore()
Expand All @@ -83,26 +81,6 @@ const tabs = computed(() => {
},
],
},
{
label: __('Subscription'),
condition: () => window.fc_communication_secret && isManager(),
items: [
{
label: 'Plans',
icon: PlansIcon,
component: markRaw(Plans),
},
{
label: 'Billing',
icon: BillingIcon,
component: markRaw(
h(Billing, {
onChangePlan: () => setActiveTab('Plans'),
}),
),
},
],
},
{
label: __('Integrations'),
items: [
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/components/UserDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { sessionStore } from '@/stores/session'
import { usersStore } from '@/stores/users'
import { showSettings } from '@/composables/settings'
import { Dropdown } from 'frappe-ui'
import { computed, ref, markRaw } from 'vue'
import { computed, ref, markRaw, inject } from 'vue'
const props = defineProps({
isCollapsed: {
Expand All @@ -67,6 +67,8 @@ const { getUser } = usersStore()
const user = computed(() => getUser() || {})
const isFCSite = inject('isFCSite')
let dropdownOptions = ref([
{
group: 'Manage',
Expand All @@ -91,6 +93,12 @@ let dropdownOptions = ref([
group: 'Others',
hideLabel: true,
items: [
{
icon: 'credit-card',
label: computed(() => __('Billing')),
onClick: () => (window.location.href = '/billing'),
condition: () => isFCSite.data,
},
{
icon: 'settings',
label: computed(() => __('Settings')),
Expand Down

0 comments on commit 9aea597

Please sign in to comment.