11import { useState } from 'react'
2- import { Minus , Plus } from 'lucide-react'
2+ import { Maximize2 , Minus , Plus } from 'lucide-react'
33import { getToolLabel } from '../config/tools'
44import type { LegalDocumentId } from '../content/legal'
55import type { LayoutMode } from '../hooks/useLayoutMode'
66import { useAppStore } from '../store'
77import type { SaveStatus } from '../saveStatus'
8- import {
9- ANNOTATION_TEXT_SCALE_MAX ,
10- ANNOTATION_TEXT_SCALE_MIN ,
11- ANNOTATION_TEXT_SCALE_STEP ,
12- } from '../utils/annotationTextScale'
138import { stageRef } from '../stageRef'
149import { useSaveState } from '../saveStatus'
10+ import TextSizeSlider from './TextSizeSlider'
1511import CanvasRotationControl from './CanvasRotationControl'
1612import LegalModal from './LegalModal'
1713
@@ -54,10 +50,8 @@ export default function StatusBar({
5450 const scale = useAppStore ( ( s ) => s . viewport . scale )
5551 const setViewport = useAppStore ( ( s ) => s . setViewport )
5652 const pointer = useAppStore ( ( s ) => s . pointer )
57- const textScalePct = useAppStore ( ( s ) => s . annotationTextScalePct )
58- const setAnnotationTextScalePct = useAppStore (
59- ( s ) => s . setAnnotationTextScalePct ,
60- )
53+ const hasMap = useAppStore ( ( s ) => s . mapImage !== null )
54+ const requestFitToView = useAppStore ( ( s ) => s . requestFitToView )
6155 const saveState = useSaveState ( )
6256 const [ legalDoc , setLegalDoc ] = useState < LegalDocumentId | null > ( null )
6357
@@ -66,6 +60,9 @@ export default function StatusBar({
6660 const showRotation = layoutMode !== 'touch'
6761 const showLegalLinks = layoutMode !== 'touch'
6862 const showCredit = layoutMode === 'desktop'
63+ // Narrower layouts keep the bar to the essentials; the Style sheet holds the rest on touch
64+ const showToolName = layoutMode === 'desktop'
65+ const showTextSize = layoutMode !== 'touch'
6966
7067 const zoomBy = ( direction : 1 | - 1 ) => {
7168 const viewport = useAppStore . getState ( ) . viewport
@@ -88,9 +85,17 @@ export default function StatusBar({
8885
8986 return (
9087 < footer className = "statusbar" >
91- < span className = "statusbar-zoom" >
92- Zoom: { Math . round ( scale * 100 ) } %
93- </ span >
88+ < button
89+ type = "button"
90+ className = "statusbar-zoom"
91+ disabled = { ! hasMap }
92+ onClick = { requestFitToView }
93+ title = "Fit the map to the screen"
94+ aria-label = { `Zoom ${ Math . round ( scale * 100 ) } %. Fit map to screen` }
95+ >
96+ < Maximize2 size = { 12 } aria-hidden />
97+ < span > { Math . round ( scale * 100 ) } %</ span >
98+ </ button >
9499 { showRotation && < CanvasRotationControl compact = { layoutMode === 'compact' } /> }
95100 { showZoomButtons && (
96101 < span className = "statusbar-zoom-controls" >
@@ -112,32 +117,17 @@ export default function StatusBar({
112117 </ button >
113118 </ span >
114119 ) }
115- < label className = "statusbar-font" >
116- < span > Text Size</ span >
117- < input
118- className = "statusbar-font-slider"
119- type = "range"
120- min = { ANNOTATION_TEXT_SCALE_MIN }
121- max = { ANNOTATION_TEXT_SCALE_MAX }
122- step = { ANNOTATION_TEXT_SCALE_STEP }
123- value = { textScalePct }
124- aria-label = "Font size"
125- aria-valuemin = { ANNOTATION_TEXT_SCALE_MIN }
126- aria-valuemax = { ANNOTATION_TEXT_SCALE_MAX }
127- aria-valuenow = { textScalePct }
128- aria-valuetext = { `${ textScalePct } %` }
129- onChange = { ( e ) => setAnnotationTextScalePct ( Number ( e . target . value ) ) }
130- />
131- < span className = "statusbar-font-value" > { textScalePct } %</ span >
132- </ label >
120+ { showTextSize && < TextSizeSlider label = { layoutMode === 'compact' ? 'Text' : 'Text Size' } /> }
133121 { showCoords && (
134122 < span >
135123 { pointer
136124 ? `X: ${ Math . round ( pointer . x ) } Y: ${ Math . round ( pointer . y ) } `
137125 : 'X: — Y: —' }
138126 </ span >
139127 ) }
140- < span className = "statusbar-tool" > Tool: { getToolLabel ( activeTool ) } </ span >
128+ { showToolName && (
129+ < span className = "statusbar-tool" > Tool: { getToolLabel ( activeTool ) } </ span >
130+ ) }
141131 < SaveIndicator state = { saveState } />
142132 { showLegalLinks && (
143133 < nav className = "statusbar-legal" aria-label = "Legal" >
0 commit comments