@@ -9,7 +9,7 @@ import { ListSheet, type ListKey } from './ListSheet';
99import { ModelBrowser } from './ModelBrowser' ;
1010import { Rail , type Section , type Site } from './Rail' ;
1111import { XPanel , type XTab } from './XPanel' ;
12- import { YouTubePanel } from './YouTubePanel' ;
12+ import { YouTubePanel , type YouTubeTab } from './YouTubePanel' ;
1313import { Notice } from './ui' ;
1414
1515type Form = { draft : Settings ; saved : Settings } ;
@@ -18,7 +18,7 @@ const same = (a: unknown, b: unknown) => JSON.stringify(a) === JSON.stringify(b)
1818const noop = ( ) => { } ;
1919/** `https://x.com/*` reads as x.com to the person being asked about it. */
2020const host = ( origin : string ) => origin . replace ( / ^ h t t p s : \/ \/ / , '' ) . replace ( / \/ \* $ / , '' ) ;
21- const filtered = / ^ h t t p s : \/ \/ (?: x \. c o m | t w i t t e r \. c o m | w w w \. y o u t u b e \. c o m ) \/ / ;
21+ const filtered = / ^ h t t p s : \/ \/ (?: x \. c o m | t w i t t e r \. c o m | (?: w w w | m ) \. y o u t u b e \. c o m ) \/ / ;
2222
2323/** The page the reader was looking at when they opened Sharp. Desktop Chrome
2424 * floats the popup above the page, so that is simply the active tab —
@@ -65,6 +65,7 @@ export function App() {
6565 const [ section , setSection ] = useState < Section > ( 'x' ) ;
6666 const [ xTab , setXTab ] = useState < XTab > ( 'filtering' ) ;
6767 const [ generalTab , setGeneralTab ] = useState < GeneralTab > ( 'connection' ) ;
68+ const [ youtubeTab , setYoutubeTab ] = useState < YouTubeTab > ( 'filtering' ) ;
6869 const [ overlay , setOverlay ] = useState < Overlay | null > ( null ) ;
6970 const [ stats , setStats ] = useState < Stats | null > ( null ) ;
7071 const [ bytes , setBytes ] = useState ( 0 ) ;
@@ -116,7 +117,7 @@ export function App() {
116117 if ( / ^ h t t p s : \/ \/ (?: x | t w i t t e r ) \. c o m \/ / . test ( url ) ) {
117118 setSite ( 'x' ) ;
118119 setThread ( threadId ( new URL ( url ) . pathname ) ) ;
119- } else if ( / ^ h t t p s : \/ \/ w w w \. y o u t u b e \. c o m \/ / . test ( url ) ) {
120+ } else if ( / ^ h t t p s : \/ \/ (?: w w w | m ) \. y o u t u b e \. c o m \/ / . test ( url ) ) {
120121 setSite ( 'youtube' ) ;
121122 setSection ( 'youtube' ) ;
122123 }
@@ -294,9 +295,13 @@ export function App() {
294295 [ 'filtering' , 'Filtering' ] ,
295296 [ 'rules' , 'Rules' ] ,
296297 [ 'activity' , 'Activity' ] ,
298+ [ 'misc' , 'Misc' ] ,
297299 ] as const )
298300 : section === 'youtube'
299- ? ( [ [ 'filtering' , 'Filtering' ] ] as const )
301+ ? ( [
302+ [ 'filtering' , 'Filtering' ] ,
303+ [ 'misc' , 'Misc' ] ,
304+ ] as const )
300305 : ( [
301306 [ 'connection' , 'Connection' ] ,
302307 [ 'appearance' , 'Appearance' ] ,
@@ -309,11 +314,12 @@ export function App() {
309314 class = "tab"
310315 role = "tab"
311316 aria-selected = {
312- section === 'x' ? xTab === id : section === 'youtube' || generalTab === id
317+ ( section === 'x' ? xTab : section === 'youtube' ? youtubeTab : generalTab ) === id
313318 }
314319 onClick = { ( ) => {
315320 if ( section === 'x' ) setXTab ( id as XTab ) ;
316- else if ( section === 'general' ) setGeneralTab ( id as GeneralTab ) ;
321+ else if ( section === 'youtube' ) setYoutubeTab ( id as YouTubeTab ) ;
322+ else setGeneralTab ( id as GeneralTab ) ;
317323 } }
318324 >
319325 { label }
@@ -394,7 +400,7 @@ export function App() {
394400 }
395401 />
396402 ) : section === 'youtube' ? (
397- < YouTubePanel { ...editor } />
403+ < YouTubePanel { ...editor } tab = { youtubeTab } />
398404 ) : (
399405 < GeneralPanel
400406 { ...editor }
0 commit comments