@@ -21,7 +21,9 @@ import {
2121 squashAtomCommandFailure ,
2222} from "@t3tools/client-runtime/state/runtime" ;
2323import {
24+ DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE ,
2425 DEFAULT_UNIFIED_SETTINGS ,
26+ type EnvironmentIdentificationMode ,
2527 MAX_GLASS_OPACITY ,
2628 MIN_GLASS_OPACITY ,
2729} from "@t3tools/contracts/settings" ;
@@ -40,6 +42,10 @@ import {
4042} from "../../components/desktopUpdate.logic" ;
4143import { ProviderModelPicker } from "../chat/ProviderModelPicker" ;
4244import { TraitsPicker } from "../chat/TraitsPicker" ;
45+ import {
46+ resolveEnvironmentIdentificationPillLabel ,
47+ useEnvironmentStageLabel ,
48+ } from "../SidebarStageBackdrop" ;
4349import { isElectron } from "../../env" ;
4450import { buildHostedChannelSelectionUrl , type HostedAppChannel } from "../../hostedPairing" ;
4551import { useTheme } from "../../hooks/useTheme" ;
@@ -114,6 +120,12 @@ const THEME_OPTIONS = [
114120 } ,
115121] as const ;
116122
123+ const ENVIRONMENT_IDENTIFICATION_LABELS : Record < EnvironmentIdentificationMode , string > = {
124+ artwork : "Artwork" ,
125+ pill : "Version pill" ,
126+ none : "None" ,
127+ } ;
128+
117129const TIMESTAMP_FORMAT_LABELS = {
118130 locale : "System default" ,
119131 "12-hour" : "12-hour" ,
@@ -401,6 +413,10 @@ export function useSettingsRestore(onRestored?: () => void) {
401413 ( ) => [
402414 ...( theme !== "system" ? [ "Theme" ] : [ ] ) ,
403415 ...( settings . glassOpacity !== DEFAULT_UNIFIED_SETTINGS . glassOpacity ? [ "Glass opacity" ] : [ ] ) ,
416+ ...( settings . environmentIdentificationMode !==
417+ DEFAULT_UNIFIED_SETTINGS . environmentIdentificationMode
418+ ? [ "Environment identification" ]
419+ : [ ] ) ,
404420 ...( settings . timestampFormat !== DEFAULT_UNIFIED_SETTINGS . timestampFormat
405421 ? [ "Time format" ]
406422 : [ ] ) ,
@@ -456,6 +472,7 @@ export function useSettingsRestore(onRestored?: () => void) {
456472 settings . defaultThreadEnvMode ,
457473 settings . newWorktreesStartFromOrigin ,
458474 settings . diffIgnoreWhitespace ,
475+ settings . environmentIdentificationMode ,
459476 settings . glassOpacity ,
460477 settings . automaticGitFetchInterval ,
461478 settings . enableAssistantStreaming ,
@@ -483,6 +500,7 @@ export function useSettingsRestore(onRestored?: () => void) {
483500 timestampFormat : DEFAULT_UNIFIED_SETTINGS . timestampFormat ,
484501 wordWrap : DEFAULT_UNIFIED_SETTINGS . wordWrap ,
485502 diffIgnoreWhitespace : DEFAULT_UNIFIED_SETTINGS . diffIgnoreWhitespace ,
503+ environmentIdentificationMode : DEFAULT_UNIFIED_SETTINGS . environmentIdentificationMode ,
486504 glassOpacity : DEFAULT_UNIFIED_SETTINGS . glassOpacity ,
487505 sidebarThreadPreviewCount : DEFAULT_UNIFIED_SETTINGS . sidebarThreadPreviewCount ,
488506 sidebarProjectGroupingMode : DEFAULT_UNIFIED_SETTINGS . sidebarProjectGroupingMode ,
@@ -510,6 +528,9 @@ export function GeneralSettingsPanel() {
510528 const { theme, setTheme } = useTheme ( ) ;
511529 const settings = usePrimarySettings ( ) ;
512530 const updateSettings = useUpdatePrimarySettings ( ) ;
531+ const environmentStageLabel = useEnvironmentStageLabel ( ) ;
532+ const showEnvironmentIdentification =
533+ resolveEnvironmentIdentificationPillLabel ( environmentStageLabel ) !== null ;
513534 const lastEnabledProjectGroupingMode = useRef < SidebarProjectGroupingMode > (
514535 readLastEnabledProjectGroupingMode ( ) ,
515536 ) ;
@@ -634,6 +655,48 @@ export function GeneralSettingsPanel() {
634655 }
635656 />
636657
658+ { showEnvironmentIdentification ? (
659+ < SettingsRow
660+ title = "Environment identification"
661+ description = "Choose how Dev and Nightly environments are identified."
662+ resetAction = {
663+ settings . environmentIdentificationMode !== DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE ? (
664+ < SettingResetButton
665+ label = "environment identification"
666+ onClick = { ( ) =>
667+ updateSettings ( {
668+ environmentIdentificationMode : DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE ,
669+ } )
670+ }
671+ />
672+ ) : null
673+ }
674+ control = {
675+ < Select
676+ value = { settings . environmentIdentificationMode }
677+ onValueChange = { ( value ) => {
678+ if ( value === "artwork" || value === "pill" || value === "none" ) {
679+ updateSettings ( { environmentIdentificationMode : value } ) ;
680+ }
681+ } }
682+ >
683+ < SelectTrigger className = "w-full sm:w-40" aria-label = "Environment identification" >
684+ < SelectValue >
685+ { ENVIRONMENT_IDENTIFICATION_LABELS [ settings . environmentIdentificationMode ] }
686+ </ SelectValue >
687+ </ SelectTrigger >
688+ < SelectPopup align = "end" alignItemWithTrigger = { false } >
689+ { Object . entries ( ENVIRONMENT_IDENTIFICATION_LABELS ) . map ( ( [ value , label ] ) => (
690+ < SelectItem hideIndicator key = { value } value = { value } >
691+ { label }
692+ </ SelectItem >
693+ ) ) }
694+ </ SelectPopup >
695+ </ Select >
696+ }
697+ />
698+ ) : null }
699+
637700 < SettingsRow
638701 title = "Project Grouping"
639702 description = "Combine matching repositories across environments."
0 commit comments