Browse Source

refactor: remove snackbar component from main layout

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2071/head
Pranav C 2 years ago
parent
commit
37c7d4ccbe
  1. 3
      packages/nc-gui/layouts/default.vue
  2. 22
      packages/nc-gui/store/settings.js
  3. 8
      packages/nc-gui/store/tabs.js

3
packages/nc-gui/layouts/default.vue

@ -1,6 +1,5 @@
<template>
<v-app v-if="isProjectInfoLoaded">
<snackbar />
<v-app-bar
class="elevation-0"
color="primary"
@ -338,7 +337,6 @@ import XBtn from '../components/global/XBtn'
import dlgUnexpectedError from '../components/utils/DlgUnexpectedError'
import settings from '../components/Settings'
import { copyTextToClipboard } from '@/helpers/xutils'
import Snackbar from '~/components/Snackbar'
import Language from '~/components/utils/Language'
import Loader from '~/components/Loader'
import PreviewAs from '~/components/PreviewAs'
@ -353,7 +351,6 @@ export default {
ReleaseInfo,
Language,
XBtn,
Snackbar,
dlgUnexpectedError,
settings,
ImportantAnnouncement

22
packages/nc-gui/store/settings.js

@ -209,17 +209,17 @@ export const actions = {
commit('MutToggleDarkMode', status)
},
ActCheckMaxTable({ state, commit, rootState }, { tableIndex }) {
const prepareToastMessage = () => {
return `You are allowed to access only ${rootState.users.ui_ability.rules.maxTables} tables.<br/>
You can either upgrade or <a href="#/referral" style="color: white;font-weight: bold;">refer</a> us. `
}
if (process.env.ui_ability) {
if (tableIndex > rootState.users.ui_ability.rules.maxTables) {
this.commit('snackbar/setSnack', prepareToastMessage())
return false
}
}
// const prepareToastMessage = () => {
// return `You are allowed to access only ${rootState.users.ui_ability.rules.maxTables} tables.<br/>
// You can either upgrade or <a href="#/referral" style="color: white;font-weight: bold;">refer</a> us. `
// }
//
// if (process.env.ui_ability) {
// if (tableIndex > rootState.users.ui_ability.rules.maxTables) {
// this.commit('snackbar/setSnack', prepareToastMessage())
// return false
// }
// }
return true
},
ActSetTheme({ state, commit, rootState }, { theme, themeName, custom }) {

8
packages/nc-gui/store/tabs.js

@ -377,10 +377,10 @@ export const actions = {
},
async ActAddTab({ commit, state, rootState }, item) {
if (rootState.users.ui_ability.rules.maxTabs <= state.list.length) {
this.commit('snackbar/setSnack', `Free plan limits to ${rootState.users.ui_ability.rules.maxTabs} tabs. Please <a href="https://nocodb.com/pricing" style="color: white;font-weight: bold;">upgrade</a> your plan for unlimited tabs.`)
return
}
// if (rootState.users.ui_ability.rules.maxTabs <= state.list.length) {
// this.commit('snackbar/setSnack', `Free plan limits to ${rootState.users.ui_ability.rules.maxTabs} tabs. Please <a href="https://nocodb.com/pricing" style="color: white;font-weight: bold;">upgrade</a> your plan for unlimited tabs.`)
// return
// }
commit('add', item)
await Vue.nextTick()
const index = state.list.length - 1

Loading…
Cancel
Save