@@ -5,36 +5,50 @@ import { i18n } from '../../../../../../components/layouts/default/translations'
55import { useMediaState } from '../../../../../../core/api/media-context' ;
66import { $signal } from '../../../../../lit/directives/signal' ;
77import { $i18n } from '../utils' ;
8- import { DefaultMenuButton } from './items/menu-items' ;
8+ import { DefaultMenuButton , DefaultMenuSection } from './items/menu-items' ;
99
1010export function DefaultCaptionsMenu ( ) {
1111 return $signal ( ( ) => {
12- const { translations } = useDefaultLayoutContext ( ) ,
13- { hasCaptions } = useMediaState ( ) ,
14- $offText = $i18n ( translations , 'Off' ) ;
12+ const { flatSettingsMenu, noCaptions, translations } = useDefaultLayoutContext ( ) ,
13+ { hasCaptions } = useMediaState ( ) ;
1514
16- if ( ! hasCaptions ( ) ) return null ;
15+ if ( ! hasCaptions ( ) || noCaptions ( ) ) return null ;
16+
17+ if ( flatSettingsMenu ( ) )
18+ return [
19+ DefaultMenuSection ( {
20+ label : i18n ( translations , 'Captions' ) ,
21+ children : [ DefaultCaptionsMenuItems ( ) ] ,
22+ } ) ,
23+ ] ;
1724
1825 return html `
1926 < media-menu class ="vds-captions-menu vds-menu ">
2027 ${ DefaultMenuButton ( {
2128 label : ( ) => i18n ( translations , 'Captions' ) ,
2229 icon : 'menu-captions' ,
2330 } ) }
24- < media-menu-items class ="vds-menu-items ">
25- < media-captions-radio-group
26- class ="vds-captions-radio-group vds-radio-group "
27- off-label =${ $offText }
28- >
29- < template >
30- < media-radio class ="vds-caption-radio vds-radio ">
31- < slot name ="menu-radio-check-icon " data-class ="vds-icon "> </ slot >
32- < span class ="vds-radio-label " data-part ="label "> </ span >
33- </ media-radio >
34- </ template >
35- </ media-captions-radio-group >
36- </ media-menu-items >
31+ < media-menu-items class ="vds-menu-items "> ${ DefaultCaptionsMenuItems ( ) } </ media-menu-items >
3732 </ media-menu >
3833 ` ;
3934 } ) ;
4035}
36+
37+ function DefaultCaptionsMenuItems ( ) {
38+ const { translations } = useDefaultLayoutContext ( ) ,
39+ $offText = $i18n ( translations , 'Off' ) ;
40+
41+ return html `
42+ < media-captions-radio-group
43+ class ="vds-captions-radio-group vds-radio-group "
44+ off-label =${ $offText }
45+ >
46+ < template >
47+ < media-radio class ="vds-caption-radio vds-radio ">
48+ < slot name ="menu-radio-check-icon " data-class ="vds-icon "> </ slot >
49+ < span class ="vds-radio-label " data-part ="label "> </ span >
50+ </ media-radio >
51+ </ template >
52+ </ media-captions-radio-group >
53+ ` ;
54+ }
0 commit comments