@@ -24,12 +24,12 @@ import { tab_to_path } from "@cocalc/util/misc";
24
24
import { COLORS } from "@cocalc/util/theme" ;
25
25
import { getValidActivityBarOption } from "./activity-bar" ;
26
26
import {
27
- TOGGLE_ACTIVITY_BAR_TOGGLE_BUTTON_SPACE ,
28
27
ACTIVITY_BAR_EXPLANATION ,
29
28
ACTIVITY_BAR_KEY ,
30
29
ACTIVITY_BAR_LABELS ,
31
30
ACTIVITY_BAR_OPTIONS ,
32
31
ACTIVITY_BAR_TOGGLE_LABELS ,
32
+ TOGGLE_ACTIVITY_BAR_TOGGLE_BUTTON_SPACE ,
33
33
} from "./activity-bar-consts" ;
34
34
import { FileTab , FIXED_PROJECT_TABS , FixedTab } from "./file-tab" ;
35
35
import FileTabs from "./file-tabs" ;
@@ -94,9 +94,10 @@ interface FVTProps {
94
94
setHomePageButtonWidth : ( width : number ) => void ;
95
95
}
96
96
97
- export function VerticalFixedTabs ( props : Readonly < FVTProps > ) {
97
+ export function VerticalFixedTabs ( {
98
+ setHomePageButtonWidth,
99
+ } : Readonly < FVTProps > ) {
98
100
const intl = useIntl ( ) ;
99
- const { setHomePageButtonWidth } = props ;
100
101
const {
101
102
actions,
102
103
project_id,
@@ -122,6 +123,7 @@ export function VerticalFixedTabs(props: Readonly<FVTProps>) {
122
123
123
124
const gh = gap . current . clientHeight ;
124
125
const ph = parent . current . clientHeight ;
126
+ if ( ph == 0 ) return ;
125
127
126
128
if ( refCondensed . current ) {
127
129
// 5px slack to avoid flickering
@@ -133,7 +135,6 @@ export function VerticalFixedTabs(props: Readonly<FVTProps>) {
133
135
if ( gh < 1 ) {
134
136
setCondensed ( true ) ;
135
137
refCondensed . current = true ;
136
- // max? because when we start with a thin window, the ph is already smaller than th
137
138
breakPoint . current = ph ;
138
139
}
139
140
}
@@ -151,6 +152,10 @@ export function VerticalFixedTabs(props: Readonly<FVTProps>) {
151
152
} ;
152
153
} , [ ] ) ;
153
154
155
+ useEffect ( ( ) => {
156
+ calcCondensed ( ) ;
157
+ } , [ showActBarLabels , parent . current , gap . current ] ) ;
158
+
154
159
useEffect ( ( ) => {
155
160
if ( parent . current == null ) return ;
156
161
@@ -171,7 +176,7 @@ export function VerticalFixedTabs(props: Readonly<FVTProps>) {
171
176
return ( ) => {
172
177
observer . disconnect ( ) ;
173
178
} ;
174
- } , [ condensed , parent . current ] ) ;
179
+ } , [ condensed , showActBarLabels , parent . current , gap . current ] ) ;
175
180
176
181
const items : ReactNode [ ] = [ ] ;
177
182
for ( const nameStr in FIXED_PROJECT_TABS ) {
@@ -269,7 +274,7 @@ export function VerticalFixedTabs(props: Readonly<FVTProps>) {
269
274
>
270
275
{ items }
271
276
{ /* moves the layout selector to the bottom */ }
272
- < div ref = { gap } style = { { flex : 1 } } > </ div > { " " }
277
+ < div ref = { gap } style = { { flex : 1 } } > </ div >
273
278
{ /* moves hide switch to the bottom */ }
274
279
< LayoutSelector actBar = { actBar } />
275
280
{ renderToggleActivityBar ( ) }
0 commit comments