55 CircleDotIcon ,
66 CircleMinusIcon ,
77 FilePenLineIcon ,
8+ GitMergeIcon ,
89 GitPullRequestIcon ,
910 ShieldAlertIcon ,
1011 XCircleIcon ,
@@ -27,6 +28,7 @@ import {
2728 useCustomTabs ,
2829} from '~/composables/useCustomTabs' ;
2930import {
31+ applyCustomTabEditorState ,
3032 buildCustomTabHumanPreview ,
3133 buildCustomTabSearchParts ,
3234 buildCustomTabSearchQuery ,
@@ -35,13 +37,16 @@ import {
3537 createGitHubCustomTabPreviewUrl ,
3638 customTabArchivedOptions ,
3739 customTabDraftOptions ,
40+ type CustomTabEditorState ,
41+ getCustomTabEditorState ,
42+ customTabIssueStateOptions ,
3843 customTabOrderOptions ,
44+ customTabPullStateOptions ,
3945 customTabReviewOptions ,
4046 customTabScopeOptions ,
4147 customTabSortOptions ,
4248 customTabSourceOptions ,
4349 type CustomTabSourceOption ,
44- customTabStateOptions ,
4550 customTabTypeOptions ,
4651 customTabVisibilityOptions ,
4752} from '~/composables/useCustomTabSettingsOptions' ;
@@ -103,7 +108,6 @@ export const useTabsSettingsPage = () => {
103108
104109 const sourceOptions = customTabSourceOptions ;
105110 const typeOptions = customTabTypeOptions ;
106- const stateOptions = customTabStateOptions ;
107111 const scopeOptions = customTabScopeOptions ;
108112 const sortOptions = customTabSortOptions ;
109113 const orderOptions = customTabOrderOptions ;
@@ -120,6 +124,7 @@ export const useTabsSettingsPage = () => {
120124 pulls : { icon : GitPullRequestIcon , activeColor : 'var(--gitpulse-purple)' } ,
121125 open : { icon : CircleDotIcon , activeColor : 'var(--gitpulse-success-solid)' } ,
122126 closed : { icon : CircleMinusIcon , activeColor : 'var(--gitpulse-danger-solid)' } ,
127+ merged : { icon : GitMergeIcon , activeColor : 'var(--gitpulse-purple)' } ,
123128 draft : { icon : FilePenLineIcon , activeColor : 'var(--gitpulse-warning-solid)' } ,
124129 ready : { icon : CheckCircle2Icon , activeColor : 'var(--gitpulse-success-solid)' } ,
125130 approved : { icon : CheckCircle2Icon , activeColor : 'var(--gitpulse-success-solid)' } ,
@@ -159,7 +164,7 @@ export const useTabsSettingsPage = () => {
159164 commenter : '' ,
160165 involves : '' ,
161166 milestone : '' ,
162- state : 'open' as CustomTabState | 'any' ,
167+ state : 'open' as CustomTabEditorState ,
163168 scopes : [ 'title' , 'body' ] as CustomTabSearchScope [ ] ,
164169 labels : [ ] as string [ ] ,
165170 visibility : 'any' as CustomTabVisibility ,
@@ -309,6 +314,10 @@ export const useTabsSettingsPage = () => {
309314 return newTab . query . type === 'pulls' ;
310315 } ) ;
311316
317+ const stateOptions = computed ( ( ) => {
318+ return isPullRequestSearch . value ? customTabPullStateOptions : customTabIssueStateOptions ;
319+ } ) ;
320+
312321 const advancedFilterCount = computed ( ( ) => {
313322 let count = 0 ;
314323 if ( newTab . query . repo . trim ( ) ) count ++ ;
@@ -390,7 +399,7 @@ export const useTabsSettingsPage = () => {
390399 const buildCurrentQuery = ( ) : CustomTabQuery => {
391400 const labels = cleanLabels ( ) ;
392401
393- return {
402+ const query : CustomTabQuery = {
394403 text : newTab . query . text . trim ( ) || undefined ,
395404 type : newTab . query . type ,
396405 repo : newTab . query . repo . trim ( ) || undefined ,
@@ -402,7 +411,6 @@ export const useTabsSettingsPage = () => {
402411 commenter : newTab . query . commenter . trim ( ) || undefined ,
403412 involves : newTab . query . involves . trim ( ) || undefined ,
404413 milestone : newTab . query . milestone . trim ( ) || undefined ,
405- state : newTab . query . state === 'any' ? undefined : newTab . query . state ,
406414 scopes : newTab . query . scopes . length > 0 ? [ ...newTab . query . scopes ] : undefined ,
407415 labels : labels . length > 0 ? labels : undefined ,
408416 visibility : newTab . query . visibility === 'any' ? undefined : newTab . query . visibility ,
@@ -415,6 +423,8 @@ export const useTabsSettingsPage = () => {
415423 order : newTab . query . order ,
416424 perPage : newTab . query . perPage ,
417425 } ;
426+
427+ return applyCustomTabEditorState ( query , newTab . query . state ) ;
418428 } ;
419429
420430 const searchQueryParts = computed ( ( ) => {
@@ -559,6 +569,17 @@ export const useTabsSettingsPage = () => {
559569 newTab . query . scopes = [ ...newTab . query . scopes , scope ] ;
560570 } ;
561571
572+ const setSearchType = ( type : CustomTabSearchType ) => {
573+ newTab . query . type = type ;
574+ if ( type !== 'pulls' && newTab . query . state === 'merged' ) {
575+ newTab . query . state = 'closed' ;
576+ }
577+ } ;
578+
579+ const setQueryState = ( state : CustomTabEditorState ) => {
580+ newTab . query . state = state ;
581+ } ;
582+
562583 const addLabel = ( label : string ) => {
563584 const normalized = label . trim ( ) ;
564585 if ( ! normalized || newTab . query . labels . includes ( normalized ) ) {
@@ -755,7 +776,7 @@ export const useTabsSettingsPage = () => {
755776 newTab . groupId = tab . groupId ;
756777 newTab . source = tab . source ?? 'github-search' ;
757778
758- const q = tab . query ?? { } ;
779+ const q : CustomTabQuery = tab . query ?? { } ;
759780 newTab . query . text = q . text ?? '' ;
760781 newTab . query . type = q . type ?? 'issues' ;
761782 newTab . query . repo = q . repo ?? '' ;
@@ -767,7 +788,7 @@ export const useTabsSettingsPage = () => {
767788 newTab . query . commenter = q . commenter ?? '' ;
768789 newTab . query . involves = q . involves ?? '' ;
769790 newTab . query . milestone = q . milestone ?? '' ;
770- newTab . query . state = q . state ?? 'open' ;
791+ newTab . query . state = getCustomTabEditorState ( q ) ;
771792 newTab . query . scopes = q . scopes ?? [ 'title' , 'body' ] ;
772793 newTab . query . labels = q . labels ?? [ ] ;
773794 newTab . query . visibility = q . visibility ?? 'any' ;
@@ -990,6 +1011,8 @@ export const useTabsSettingsPage = () => {
9901011 confirmDeleteGroup,
9911012 setActiveSource,
9921013 setNewTabGroup,
1014+ setSearchType,
1015+ setQueryState,
9931016 toggleScope,
9941017 addLabel,
9951018 handleLabelEnter,
0 commit comments