@@ -5,7 +5,10 @@ import { node, object, string, number, func } from 'prop-types';
5
5
6
6
import { Resizable } from 're-resizable' ;
7
7
8
- import { SIDEBAR_CONTAINER_ID } from '../../../../shared/constants' ;
8
+ import {
9
+ SIDEBAR_CONTAINER_ID ,
10
+ APP_NAME_SHORT ,
11
+ } from '../../../../shared/constants' ;
9
12
10
13
const iframeClass = css `
11
14
border : none;
@@ -70,6 +73,8 @@ const containerLeftMinimizedClass = css`
70
73
const FRAME_TOGGLE_FUNCTION = 'chromeIframeSidebarToggle' ;
71
74
const FRAME_FIX_SHRINK_BODY_FUNCTION = 'chromeIframeFixShrinkBody' ;
72
75
76
+ const SIDEBAR_WIDTH_KEY = `${ APP_NAME_SHORT } -sidebar-width` ;
77
+
73
78
export class Frame extends Component {
74
79
state = {
75
80
isVisible : false ,
@@ -125,22 +130,22 @@ export class Frame extends Component {
125
130
} , delay ) ;
126
131
127
132
try {
128
- chrome . storage . sync . get ( [ 'vt-sidebar-width' ] , ( result ) => {
129
- let widthObj = result [ 'vt-sidebar-width' ] ;
133
+ chrome . storage . sync . get ( [ SIDEBAR_WIDTH_KEY ] , ( result ) => {
134
+ let widthObj = result [ SIDEBAR_WIDTH_KEY ] ;
130
135
if ( widthObj !== undefined ) {
131
136
let width = JSON . parse ( widthObj ) . width ;
132
137
if ( width ) {
133
138
this . setState ( { width } ) ;
134
139
}
135
140
}
136
141
} ) ;
137
- // let widthObj = localStorage.getItem('vt-sidebar-width' );
142
+ // let widthObj = localStorage.getItem(SIDEBAR_WIDTH_KEY );
138
143
// if (widthObj !== undefined) {
139
144
// this.setState({ width: JSON.parse(widthObj).width });
140
145
// }
141
146
} catch ( e ) {
142
- chrome . storage . sync . remove ( [ 'vt-sidebar-width' ] ) ;
143
- // localStorage.removeItem('vt-sidebar-width' );
147
+ chrome . storage . sync . remove ( [ SIDEBAR_WIDTH_KEY ] ) ;
148
+ // localStorage.removeItem(SIDEBAR_WIDTH_KEY );
144
149
}
145
150
146
151
chrome . runtime . onMessage . addListener ( ( request , sender , sendResponse ) => {
@@ -301,10 +306,10 @@ export class Frame extends Component {
301
306
this . props . shrinkBody ( true ) ;
302
307
303
308
chrome . storage . sync . set ( {
304
- 'vt-sidebar-width' : JSON . stringify ( { width : width } ) ,
309
+ [ SIDEBAR_WIDTH_KEY ] : JSON . stringify ( { width : width } ) ,
305
310
} ) ;
306
311
// localStorage.setItem(
307
- // 'vt-sidebar-width' ,
312
+ // [SIDEBAR_WIDTH_KEY] ,
308
313
// JSON.stringify({ width: width })
309
314
// );
310
315
@@ -344,7 +349,7 @@ export class Frame extends Component {
344
349
} }
345
350
>
346
351
< iframe
347
- title = { 'vt -sidebar-iframe' }
352
+ title = { ` ${ APP_NAME_SHORT } -sidebar-iframe` }
348
353
className = { cx ( {
349
354
[ iframeClass ] : true ,
350
355
} ) }
0 commit comments