Skip to content

Commit

Permalink
feat: option to skip config popup on group creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mbnuqw committed Feb 27, 2024
1 parent 2c8641f commit dacf610
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/_locales/dict.setup-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2008,6 +2008,13 @@ Beispiele: "*", "ctrl+$", "ctrl+alt+g"`,
zh_CN: '如果父标签页已折叠,则在下一级打开新标签页',
zh_TW: '如果父分頁已折疊,則在下一層開啟新分頁',
},
'settings.show_new_group_conf': {
en: 'Show config popup when creating a group',
ru: 'Показывать всплывающее окно конфигурации при создании группы',
de: 'Konfigurations-Popup anzeigen, wenn eine Gruppe erstellt wird',
zh_CN: '创建组时显示配置弹出窗口',
zh_TW: '建立群組時顯示配置彈出視窗',
},
'settings.move_new_tab': {
en: 'Place new tab (general rule)',
ru: 'Общее правило',
Expand Down
7 changes: 7 additions & 0 deletions src/_locales/dict.sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ export const sidebarTranslations: Translations = {
zh_CN: '组标题',
zh_TW: '組標題',
},
'popup.group_config.do_not_show_again': {
en: "Don't show again",
ru: 'Больше не показывать',
de: 'Nicht mehr anzeigen',
zh_CN: '不再显示',
zh_TW: '不再顯示',
},

// ---
// -- Sub-panels
Expand Down
1 change: 1 addition & 0 deletions src/defaults/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export const DEFAULT_SETTINGS: SettingsState = {
autoGroupOnClose0Lvl: false,
autoGroupOnCloseMouseOnly: false,
ignoreFoldedParent: false,
showNewGroupConf: true,

// Tabs colorization
colorizeTabs: false,
Expand Down
5 changes: 5 additions & 0 deletions src/page.setup/components/settings.tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ section(ref="el")
:inactive="!Settings.state.tabsTree"
v-model:value="Settings.state.ignoreFoldedParent"
@update:value="Settings.saveDebounced(150)")
ToggleField(
label="settings.show_new_group_conf"
:inactive="!Settings.state.tabsTree"
v-model:value="Settings.state.showNewGroupConf"
@update:value="Settings.saveDebounced(150)")

.wrapper
.sub-title: .text {{translate('settings.tabs_colorization_title')}}
Expand Down
2 changes: 1 addition & 1 deletion src/services/tabs.fg.groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export async function groupTabs(tabIds: ID[], conf?: GroupConfig): Promise<void>
}

// Show config popup
if (noConfig) {
if (noConfig && Settings.state.showNewGroupConf) {
const result = await Tabs.openGroupConfigPopup(conf)
if (result === GroupConfigResult.Cancel) return
}
Expand Down
13 changes: 12 additions & 1 deletion src/sidebar/components/popup.group-config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
:tabindex="'-1'"
:line="true"
@keydown="onTitleKD")

ToggleField.-no-separator(
label="popup.group_config.do_not_show_again"
v-model:value="doNotShowAgain")
.ctrls
.btn(@click="onOk") {{translate('btn.create')}}
.btn.-warn(@click="onCancel") {{translate('btn.cancel')}}
Expand All @@ -23,9 +25,12 @@ import { translate } from 'src/dict'
import { GroupConfigResult } from 'src/services/sidebar'
import * as Popups from 'src/services/popups'
import TextInput from 'src/components/text-input.vue'
import ToggleField from 'src/components/toggle-field.vue'
import { TextInputComponent } from 'src/types'
import { Settings } from 'src/services/settings'
const titleInput = ref<TextInputComponent | null>(null)
const doNotShowAgain = ref(!Settings.state.showNewGroupConf)
onMounted(() => {
titleInput.value?.focus()
Expand All @@ -42,6 +47,12 @@ function onTitleKD(e: KeyboardEvent): void {
function onOk(): void {
if (!Popups.reactive.groupConfigPopup) return
// Save settings
if (doNotShowAgain.value !== !Settings.state.showNewGroupConf) {
Settings.state.showNewGroupConf = !doNotShowAgain.value
Settings.saveDebounced(150)
}
Popups.reactive.groupConfigPopup.done(GroupConfigResult.Ok)
Popups.reactive.groupConfigPopup = null
}
Expand Down
1 change: 1 addition & 0 deletions src/types/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export interface SettingsState {
autoGroupOnClose0Lvl: boolean
autoGroupOnCloseMouseOnly: boolean
ignoreFoldedParent: boolean
showNewGroupConf: boolean

// Tabs colorization
colorizeTabs: boolean
Expand Down

0 comments on commit dacf610

Please sign in to comment.