Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ export default function App() {
const table = s.rpmTable.length ? s.rpmTable.map((v) => v * 10) : NOMINAL_TABLE;
const pairing = s.needsPairing && (connected || connecting);

const onDash = location.pathname.startsWith('/dashboard');
const onGuide = !onDash;
const onGuide = location.pathname.startsWith('/guide');
const onDash = !onGuide;

const guideProps: GuideProps = {
dark,
connected,
table,
onSend: (level) => {
void client.setSpeedLevel(level);
navigate('/dashboard');
navigate('/');
},
};

Expand All @@ -67,7 +67,7 @@ export default function App() {
</div>

<div className="seg" role="tablist" aria-label="Views">
<button role="tab" aria-selected={onDash} onClick={() => navigate('/dashboard')}>
<button role="tab" aria-selected={onDash} onClick={() => navigate('/')}>
<Icon name="i-gauge" />
Dashboard
</button>
Expand Down Expand Up @@ -149,7 +149,7 @@ export default function App() {

<Routes>
<Route
path="/dashboard"
path="/"
element={
<section className="view active">
<Dashboard
Expand All @@ -171,8 +171,9 @@ export default function App() {
<Route path="/guide/by-accessory" element={<GuideAccessoryGrid {...guideProps} />} />
<Route path="/guide/m/:slug" element={<MaterialPage {...guideProps} />} />
<Route path="/guide/a/:slug" element={<AccessoryPage {...guideProps} />} />
<Route path="/" element={<Navigate to="/guide" replace />} />
<Route path="*" element={<Navigate to="/guide" replace />} />
{/* The dashboard lived at /dashboard until v1.1.1 — keep old bookmarks working. */}
<Route path="/dashboard" element={<Navigate to="/" replace />} />
<Route path="*" element={<Navigate to="/" replace />} />
</Routes>

<AppFooter />
Expand Down
6 changes: 6 additions & 0 deletions src/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
import type { ToolState } from './protocol/client';
import { NOMINAL_TABLE } from './guide';
import { Icon } from './Icons';
import { useDocumentMeta } from './meta';

// Tachometer geometry — 270° open-bottom dial.
const A0 = 135;
Expand Down Expand Up @@ -37,6 +38,11 @@ export default function Dashboard({
onConnect,
onSetSpeed,
}: DashboardProps) {
// Same as index.html, so coming back from a guide page restores the app's own title + canonical.
useDocumentMeta(
'COLLET — Dremel 8260 Bluetooth companion & accessory speed guide',
'Live speed, battery and temperature from your Dremel 8260, speed control, and an accessory & material speed guide. In Chrome over Web Bluetooth — no account, no cloud.',
);
// Real per-level RPM (tool reports ÷10), else the nominal dial.
const table = state.rpmTable.length ? state.rpmTable.map((v) => v * 10) : NOMINAL_TABLE;
const levels = state.countOfSpeedLevels || table.length;
Expand Down
Loading