@@ -683,123 +683,138 @@ export const DetailView: React.FC<DetailViewProps> = ({
683683 < HeaderHighlight fields = { schema . highlightFields } data = { data } objectName = { schema . objectName } objectSchema = { objectSchema } />
684684 ) }
685685
686- { /* Auto Tabs mode: wrap sections, related, activity into tabs */ }
687- { schema . autoTabs && ! schema . tabs ?. length ? (
688- < Tabs defaultValue = "details" className = "w-full" >
689- < TabsList className = "w-full justify-start border-b rounded-none bg-transparent p-0" >
690- < TabsTrigger
691- value = "details"
692- className = "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent"
693- >
694- { t ( 'detail.details' ) }
695- </ TabsTrigger >
696- { effectiveRelated . length > 0 && (
697- < TabsTrigger
698- value = "related"
699- className = "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent"
700- >
701- < span className = "flex items-center gap-1.5" >
702- { t ( 'detail.related' ) }
703- < Badge variant = "secondary" className = "text-xs" > { effectiveRelated . length } </ Badge >
704- </ span >
705- </ TabsTrigger >
706- ) }
707- { schema . activities && schema . activities . length > 0 && (
708- < TabsTrigger
709- value = "activity"
710- className = "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent"
711- >
712- < span className = "flex items-center gap-1.5" >
713- { t ( 'detail.activity' ) }
714- < Badge variant = "secondary" className = "text-xs" > { schema . activities . length } </ Badge >
715- </ span >
716- </ TabsTrigger >
686+ { /* Auto Tabs mode: wrap sections, related, activity into tabs.
687+ When only the Details tab would render (no related, no activity),
688+ skip the Tabs strip entirely — it's pure visual noise. */ }
689+ { schema . autoTabs && ! schema . tabs ?. length ? ( ( ) => {
690+ const hasRelated = effectiveRelated . length > 0 ;
691+ const hasActivity = ! ! schema . activities && schema . activities . length > 0 ;
692+ const detailsContent = (
693+ < div className = "space-y-3 sm:space-y-4" >
694+ { /* Section Groups */ }
695+ { schema . sectionGroups && schema . sectionGroups . length > 0 && (
696+ schema . sectionGroups . map ( ( group , index ) => (
697+ < SectionGroup
698+ key = { index }
699+ group = { group }
700+ data = { { ...data , ...editedValues } }
701+ objectSchema = { objectSchema }
702+ objectName = { schema . objectName }
703+ isEditing = { isInlineEditing }
704+ onFieldChange = { handleInlineFieldChange }
705+ />
706+ ) )
717707 ) }
718- </ TabsList >
719-
720- { /* Details Tab Content */ }
721- < TabsContent value = "details" className = "mt-4" >
722- < div className = "space-y-3 sm:space-y-4" >
723- { /* Section Groups */ }
724- { schema . sectionGroups && schema . sectionGroups . length > 0 && (
725- schema . sectionGroups . map ( ( group , index ) => (
726- < SectionGroup
727- key = { index }
728- group = { group }
729- data = { { ...data , ...editedValues } }
730- objectSchema = { objectSchema }
731- objectName = { schema . objectName }
732- isEditing = { isInlineEditing }
733- onFieldChange = { handleInlineFieldChange }
734- />
735- ) )
736- ) }
737- { schema . sections && schema . sections . length > 0 && (
738- schema . sections . map ( ( section , index ) => (
739- < DetailSection
740- key = { index }
741- section = { section }
742- data = { { ...data , ...editedValues } }
743- objectSchema = { objectSchema }
744- objectName = { schema . objectName }
745- isEditing = { isInlineEditing }
746- onFieldChange = { handleInlineFieldChange }
747- />
748- ) )
749- ) }
750- { schema . fields && schema . fields . length > 0 && ! schema . sections ?. length && (
708+ { schema . sections && schema . sections . length > 0 && (
709+ schema . sections . map ( ( section , index ) => (
751710 < DetailSection
752- section = { {
753- fields : schema . fields ,
754- columns : schema . columns ,
755- } }
711+ key = { index }
712+ section = { section }
756713 data = { { ...data , ...editedValues } }
757714 objectSchema = { objectSchema }
758715 objectName = { schema . objectName }
759716 isEditing = { isInlineEditing }
760717 onFieldChange = { handleInlineFieldChange }
761718 />
719+ ) )
720+ ) }
721+ { schema . fields && schema . fields . length > 0 && ! schema . sections ?. length && (
722+ < DetailSection
723+ section = { {
724+ fields : schema . fields ,
725+ columns : schema . columns ,
726+ } }
727+ data = { { ...data , ...editedValues } }
728+ objectSchema = { objectSchema }
729+ objectName = { schema . objectName }
730+ isEditing = { isInlineEditing }
731+ onFieldChange = { handleInlineFieldChange }
732+ />
733+ ) }
734+ { /* Comments in details tab */ }
735+ { schema . comments && (
736+ < RecordComments
737+ comments = { schema . comments }
738+ onAddComment = { schema . onAddComment }
739+ />
740+ ) }
741+ </ div >
742+ ) ;
743+
744+ if ( ! hasRelated && ! hasActivity ) {
745+ // Single-tab case: render just the details content without a tab strip.
746+ return < div className = "mt-2" > { detailsContent } </ div > ;
747+ }
748+
749+ return (
750+ < Tabs defaultValue = "details" className = "w-full" >
751+ < TabsList className = "w-full justify-start border-b rounded-none bg-transparent p-0" >
752+ < TabsTrigger
753+ value = "details"
754+ className = "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent"
755+ >
756+ { t ( 'detail.details' ) }
757+ </ TabsTrigger >
758+ { hasRelated && (
759+ < TabsTrigger
760+ value = "related"
761+ className = "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent"
762+ >
763+ < span className = "flex items-center gap-1.5" >
764+ { t ( 'detail.related' ) }
765+ < Badge variant = "secondary" className = "text-xs" > { effectiveRelated . length } </ Badge >
766+ </ span >
767+ </ TabsTrigger >
762768 ) }
763- { /* Comments in details tab */ }
764- { schema . comments && (
765- < RecordComments
766- comments = { schema . comments }
767- onAddComment = { schema . onAddComment }
768- />
769+ { hasActivity && (
770+ < TabsTrigger
771+ value = "activity"
772+ className = "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent"
773+ >
774+ < span className = "flex items-center gap-1.5" >
775+ { t ( 'detail.activity' ) }
776+ < Badge variant = "secondary" className = "text-xs" > { schema . activities ! . length } </ Badge >
777+ </ span >
778+ </ TabsTrigger >
769779 ) }
770- </ div >
771- </ TabsContent >
780+ </ TabsList >
772781
773- { /* Related Tab Content */ }
774- { effectiveRelated . length > 0 && (
775- < TabsContent value = "related" className = "mt-4" >
776- < div className = "space-y-4" >
777- { effectiveRelated . map ( ( related , index ) => (
778- < RelatedList
779- key = { index }
780- title = { related . title }
781- type = { related . type }
782- api = { related . api }
783- data = { related . data }
784- columns = { related . columns as any }
785- dataSource = { dataSource }
786- objectName = { related . api }
787- collapsible
788- pageSize = { DEFAULT_RELATED_PAGE_SIZE }
789- />
790- ) ) }
791- </ div >
782+ { /* Details Tab Content */ }
783+ < TabsContent value = "details" className = "mt-4" >
784+ { detailsContent }
792785 </ TabsContent >
793- ) }
794786
795- { /* Activity Tab Content */ }
796- { schema . activities && schema . activities . length > 0 && (
797- < TabsContent value = "activity" className = "mt-4" >
798- < ActivityTimeline activities = { schema . activities } />
799- </ TabsContent >
800- ) }
801- </ Tabs >
802- ) : (
787+ { /* Related Tab Content */ }
788+ { hasRelated && (
789+ < TabsContent value = "related" className = "mt-4" >
790+ < div className = "space-y-4" >
791+ { effectiveRelated . map ( ( related , index ) => (
792+ < RelatedList
793+ key = { index }
794+ title = { related . title }
795+ type = { related . type }
796+ api = { related . api }
797+ data = { related . data }
798+ columns = { related . columns as any }
799+ dataSource = { dataSource }
800+ objectName = { related . api }
801+ collapsible
802+ pageSize = { DEFAULT_RELATED_PAGE_SIZE }
803+ />
804+ ) ) }
805+ </ div >
806+ </ TabsContent >
807+ ) }
808+
809+ { /* Activity Tab Content */ }
810+ { hasActivity && (
811+ < TabsContent value = "activity" className = "mt-4" >
812+ < ActivityTimeline activities = { schema . activities ! } />
813+ </ TabsContent >
814+ ) }
815+ </ Tabs >
816+ ) ;
817+ } ) ( ) : (
803818 < >
804819 { /* Section Groups */ }
805820 { schema . sectionGroups && schema . sectionGroups . length > 0 && (
0 commit comments