Franknoirot/fix onboarding units feedback followup (#367)
This commit is contained in:
@ -49,6 +49,7 @@ import { PROJECT_ENTRYPOINT } from './lib/tauriFS'
|
|||||||
import { IndexLoaderData } from './Router'
|
import { IndexLoaderData } from './Router'
|
||||||
import { toast } from 'react-hot-toast'
|
import { toast } from 'react-hot-toast'
|
||||||
import { useGlobalStateContext } from 'hooks/useGlobalStateContext'
|
import { useGlobalStateContext } from 'hooks/useGlobalStateContext'
|
||||||
|
import { onboardingPaths } from 'routes/Onboarding'
|
||||||
|
|
||||||
export function App() {
|
export function App() {
|
||||||
const { code: loadedCode, project } = useLoaderData() as IndexLoaderData
|
const { code: loadedCode, project } = useLoaderData() as IndexLoaderData
|
||||||
@ -154,7 +155,7 @@ export function App() {
|
|||||||
useHotkeys('shift + d', () => togglePane('debug'))
|
useHotkeys('shift + d', () => togglePane('debug'))
|
||||||
|
|
||||||
const paneOpacity =
|
const paneOpacity =
|
||||||
onboardingStatus === '/camera'
|
onboardingStatus === onboardingPaths.CAMERA
|
||||||
? 'opacity-20'
|
? 'opacity-20'
|
||||||
: didDragInStream
|
: didDragInStream
|
||||||
? 'opacity-40'
|
? 'opacity-40'
|
||||||
|
@ -3,6 +3,11 @@ import { BaseUnit, baseUnitsUnion } from '../useStore'
|
|||||||
import { CommandBarMeta } from '../lib/commands'
|
import { CommandBarMeta } from '../lib/commands'
|
||||||
import { Themes, getSystemTheme, setThemeClass } from '../lib/theme'
|
import { Themes, getSystemTheme, setThemeClass } from '../lib/theme'
|
||||||
|
|
||||||
|
export enum UnitSystem {
|
||||||
|
Imperial = 'imperial',
|
||||||
|
Metric = 'metric',
|
||||||
|
}
|
||||||
|
|
||||||
export const SETTINGS_PERSIST_KEY = 'SETTINGS_PERSIST_KEY'
|
export const SETTINGS_PERSIST_KEY = 'SETTINGS_PERSIST_KEY'
|
||||||
|
|
||||||
export const settingsCommandBarMeta: CommandBarMeta = {
|
export const settingsCommandBarMeta: CommandBarMeta = {
|
||||||
@ -42,7 +47,7 @@ export const settingsCommandBarMeta: CommandBarMeta = {
|
|||||||
name: 'unitSystem',
|
name: 'unitSystem',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
defaultValue: 'unitSystem',
|
defaultValue: 'unitSystem',
|
||||||
options: [{ name: 'imperial' }, { name: 'metric' }],
|
options: [{ name: UnitSystem.Imperial }, { name: UnitSystem.Metric }],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -70,7 +75,7 @@ export const settingsMachine = createMachine(
|
|||||||
context: {
|
context: {
|
||||||
theme: Themes.System,
|
theme: Themes.System,
|
||||||
defaultProjectName: '',
|
defaultProjectName: '',
|
||||||
unitSystem: 'imperial' as 'imperial' | 'metric',
|
unitSystem: UnitSystem.Imperial,
|
||||||
baseUnit: 'in' as BaseUnit,
|
baseUnit: 'in' as BaseUnit,
|
||||||
defaultDirectory: '',
|
defaultDirectory: '',
|
||||||
showDebugPanel: false,
|
showDebugPanel: false,
|
||||||
@ -174,7 +179,7 @@ export const settingsMachine = createMachine(
|
|||||||
| { type: 'Set Default Directory'; data: { defaultDirectory: string } }
|
| { type: 'Set Default Directory'; data: { defaultDirectory: string } }
|
||||||
| {
|
| {
|
||||||
type: 'Set Unit System'
|
type: 'Set Unit System'
|
||||||
data: { unitSystem: 'imperial' | 'metric' }
|
data: { unitSystem: UnitSystem }
|
||||||
}
|
}
|
||||||
| { type: 'Set Base Unit'; data: { baseUnit: BaseUnit } }
|
| { type: 'Set Base Unit'; data: { baseUnit: BaseUnit } }
|
||||||
| { type: 'Set Onboarding Status'; data: { onboardingStatus: string } }
|
| { type: 'Set Onboarding Status'; data: { onboardingStatus: string } }
|
||||||
|
@ -37,8 +37,8 @@ export default function Units() {
|
|||||||
What you're seeing here is just a video, and your interactions are
|
What you're seeing here is just a video, and your interactions are
|
||||||
being sent to our Geometry Engine API, which sends back video frames
|
being sent to our Geometry Engine API, which sends back video frames
|
||||||
in real time. How cool is that? It means that you can use KittyCAD
|
in real time. How cool is that? It means that you can use KittyCAD
|
||||||
Modeling App (or whatever you want to build) on any device, even if it
|
Modeling App (or whatever you want to build) on any device, even a
|
||||||
doesn't have a GPU!
|
cheap laptop with no graphics card!
|
||||||
</p>
|
</p>
|
||||||
<div className="flex justify-between mt-6">
|
<div className="flex justify-between mt-6">
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
@ -3,9 +3,9 @@ import { BaseUnit, baseUnits } from '../../useStore'
|
|||||||
import { ActionButton } from '../../components/ActionButton'
|
import { ActionButton } from '../../components/ActionButton'
|
||||||
import { SettingsSection } from '../Settings'
|
import { SettingsSection } from '../Settings'
|
||||||
import { Toggle } from '../../components/Toggle/Toggle'
|
import { Toggle } from '../../components/Toggle/Toggle'
|
||||||
import { useState } from 'react'
|
|
||||||
import { onboardingPaths, useDismiss, useNextClick } from '.'
|
import { onboardingPaths, useDismiss, useNextClick } from '.'
|
||||||
import { useGlobalStateContext } from 'hooks/useGlobalStateContext'
|
import { useGlobalStateContext } from 'hooks/useGlobalStateContext'
|
||||||
|
import { UnitSystem } from 'machines/settingsMachine'
|
||||||
|
|
||||||
export default function Units() {
|
export default function Units() {
|
||||||
const dismiss = useDismiss()
|
const dismiss = useDismiss()
|
||||||
@ -29,9 +29,11 @@ export default function Units() {
|
|||||||
offLabel="Imperial"
|
offLabel="Imperial"
|
||||||
onLabel="Metric"
|
onLabel="Metric"
|
||||||
name="settings-units"
|
name="settings-units"
|
||||||
checked={unitSystem === 'metric'}
|
checked={unitSystem === UnitSystem.Metric}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const newUnitSystem = e.target.checked ? 'metric' : 'imperial'
|
const newUnitSystem = e.target.checked
|
||||||
|
? UnitSystem.Metric
|
||||||
|
: UnitSystem.Imperial
|
||||||
send({
|
send({
|
||||||
type: 'Set Unit System',
|
type: 'Set Unit System',
|
||||||
data: { unitSystem: newUnitSystem },
|
data: { unitSystem: newUnitSystem },
|
||||||
|
@ -13,6 +13,7 @@ import { useHotkeys } from 'react-hotkeys-hook'
|
|||||||
import { IndexLoaderData, paths } from '../Router'
|
import { IndexLoaderData, paths } from '../Router'
|
||||||
import { Themes } from '../lib/theme'
|
import { Themes } from '../lib/theme'
|
||||||
import { useGlobalStateContext } from 'hooks/useGlobalStateContext'
|
import { useGlobalStateContext } from 'hooks/useGlobalStateContext'
|
||||||
|
import { UnitSystem } from 'machines/settingsMachine'
|
||||||
|
|
||||||
export const Settings = () => {
|
export const Settings = () => {
|
||||||
const loaderData = useRouteLoaderData(paths.FILE) as IndexLoaderData
|
const loaderData = useRouteLoaderData(paths.FILE) as IndexLoaderData
|
||||||
@ -136,9 +137,11 @@ export const Settings = () => {
|
|||||||
offLabel="Imperial"
|
offLabel="Imperial"
|
||||||
onLabel="Metric"
|
onLabel="Metric"
|
||||||
name="settings-units"
|
name="settings-units"
|
||||||
checked={unitSystem === 'metric'}
|
checked={unitSystem === UnitSystem.Metric}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const newUnitSystem = e.target.checked ? 'metric' : 'imperial'
|
const newUnitSystem = e.target.checked
|
||||||
|
? UnitSystem.Metric
|
||||||
|
: UnitSystem.Imperial
|
||||||
send({
|
send({
|
||||||
type: 'Set Unit System',
|
type: 'Set Unit System',
|
||||||
data: { unitSystem: newUnitSystem },
|
data: { unitSystem: newUnitSystem },
|
||||||
|
Reference in New Issue
Block a user