Skip to content

Commit 98e8f15

Browse files
ryan-williamsclaude
andcommitted
Replace custom FAB + ThemeToggle with use-kbd stock SpeedDial
Delete `MobileSpeedDial.tsx` (166 LOC custom FAB with long-press), `ThemeToggle.tsx` (scroll-based show/hide floating controls), and their SCSS files. Replace with a single `<SpeedDial>` from use-kbd that provides GitHub link + theme toggle as secondary actions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 91a7afc commit 98e8f15

File tree

6 files changed

+14
-495
lines changed

6 files changed

+14
-495
lines changed

www/src/App.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@
1010
@use 'styles/legend';
1111
@use 'styles/devices';
1212
@use 'styles/tooltip';
13-
@use 'styles/theme-toggle';
1413
@use 'styles/kbd';
15-
@use 'styles/speed-dial';

www/src/App.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { QueryClientProvider } from '@tanstack/react-query'
22
import { useCallback, useEffect, useMemo, useState } from 'react'
3-
import { HotkeysProvider, LookupModal, Omnibar, SequenceModal, ShortcutsModal, useHotkeysContext } from 'use-kbd'
3+
import { FaGithub } from 'react-icons/fa'
4+
import { MdBrightnessAuto, MdDarkMode, MdLightMode } from 'react-icons/md'
5+
import { HotkeysProvider, LookupModal, Omnibar, SequenceModal, ShortcutsModal, SpeedDial } from 'use-kbd'
46
import { useUrlState } from 'use-prms'
57
import 'use-kbd/styles.css'
68
import { AwairChart } from './components/AwairChart'
79
import { DevicePoller, type DeviceDataResult } from './components/DevicePoller'
810
import { TableNavigationRenderer, YAxisMetricsRenderer } from './components/groupRenderers'
9-
import { MobileSpeedDial } from './components/MobileSpeedDial'
10-
import { ThemeToggle } from './components/ThemeToggle'
1111
import { KbdTooltip } from './components/Tooltip'
1212
import { HOTKEY_GROUPS, HOTKEY_GROUP_ORDER } from './config/hotkeyConfig'
13-
import { ThemeProvider } from './contexts/ThemeContext'
13+
import { ThemeProvider, useTheme } from './contexts/ThemeContext'
1414
import { useDevices } from './hooks/useDevices'
1515
import { queryClient } from './lib/queryClient'
1616
import { boolParam, deviceIdsParam, timeRangeParam, refetchIntervalParam, smoothingParam } from './lib/urlParams'
@@ -24,9 +24,7 @@ const GROUP_RENDERERS = {
2424

2525
function AppContent() {
2626
const [isOgMode] = useUrlState('og', boolParam)
27-
28-
// Only need openModal for ThemeToggle; ShortcutsModal uses context internally
29-
const { openModal } = useHotkeysContext()
27+
const { theme, setTheme } = useTheme()
3028

3129
// Add og-mode class to body for CSS overrides
3230
useEffect(() => {
@@ -212,8 +210,15 @@ function AppContent() {
212210
{
213211
!isOgMode &&
214212
<>
215-
<ThemeToggle onOpenShortcuts={openModal} />
216-
{/* Modal and Omnibar - all props come from HotkeysContext */}
213+
<SpeedDial actions={[
214+
{ key: 'github', label: 'GitHub', icon: <FaGithub />, href: 'https://github.com/runsascoded/awair' },
215+
{
216+
key: 'theme',
217+
label: `Theme: ${theme === 'light' ? 'Light' : theme === 'dark' ? 'Dark' : 'System'}`,
218+
icon: theme === 'light' ? <MdLightMode /> : theme === 'dark' ? <MdDarkMode /> : <MdBrightnessAuto />,
219+
onClick: () => setTheme(theme === 'light' ? 'dark' : theme === 'dark' ? 'system' : 'light'),
220+
},
221+
]} />
217222
<ShortcutsModal
218223
groups={HOTKEY_GROUPS}
219224
groupOrder={HOTKEY_GROUP_ORDER}
@@ -225,7 +230,6 @@ function AppContent() {
225230
<Omnibar placeholder="Search actions..." maxResults={15} />
226231
<LookupModal />
227232
<SequenceModal />
228-
<MobileSpeedDial />
229233
</>
230234
}
231235
</div>

www/src/components/MobileSpeedDial.tsx

Lines changed: 0 additions & 165 deletions
This file was deleted.

www/src/components/ThemeToggle.tsx

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)