From fdaf93fce87f878cd0aabb369919fc9c2c93c4aa Mon Sep 17 00:00:00 2001 From: Iwo Plaza Date: Sun, 29 Dec 2024 13:12:45 +0100 Subject: [PATCH] Better names & defaults --- .../src/components/ControlsSidebar.tsx | 43 ++++++------------- apps/phoure-demo/src/controlAtoms.ts | 14 +++--- 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/apps/phoure-demo/src/components/ControlsSidebar.tsx b/apps/phoure-demo/src/components/ControlsSidebar.tsx index ca449a9..94fe612 100644 --- a/apps/phoure-demo/src/components/ControlsSidebar.tsx +++ b/apps/phoure-demo/src/components/ControlsSidebar.tsx @@ -1,12 +1,6 @@ import type { CheckedState } from '@radix-ui/react-checkbox'; import type { SliderProps } from '@radix-ui/react-slider'; -import { - type SetStateAction, - type WritableAtom, - useAtom, - useSetAtom, -} from 'jotai'; -import type { RESET } from 'jotai/utils'; +import { type WritableAtom, useAtom, useSetAtom } from 'jotai'; import { ChevronDown } from 'lucide-react'; import { useCallback, useId } from 'react'; @@ -61,11 +55,7 @@ function ControlLabel(props: { htmlFor: string; children: string }) { function SliderControl( props: { label: string; - valueAtom: WritableAtom< - number, - [SetStateAction], - void - >; + valueAtom: WritableAtom; } & SliderProps, ) { const { label, valueAtom, ...rest } = props; @@ -103,12 +93,7 @@ function SliderControl( function CheckboxControl(props: { label: string; - valueAtom: WritableAtom< - boolean, - // biome-ignore lint/suspicious/noExplicitAny: - [boolean | any], - void - >; + valueAtom: WritableAtom; }) { const { label, valueAtom } = props; @@ -123,7 +108,7 @@ function CheckboxControl(props: { ); return ( -
+
{label}
@@ -228,7 +213,7 @@ export function ControlsSidebar() { - + - - + + { - const innerAtom = atomWithUrl('cauto', true); + const innerAtom = atomWithUrl('cauto', false); return atom( (get) => get(innerAtom), @@ -49,7 +49,7 @@ export const autoRotateControlAtom = (() => { // Rendering controls // ------------------- -export const targetResolutionAtom = atomWithUrl('res', 256); +export const targetResolutionAtom = atomWithUrl('res', 512 /* pixels */); export const displayModeAtom = atomWithUrl('mode', 'upscaled'); @@ -57,5 +57,5 @@ export const displayModeAtom = atomWithUrl('mode', 'upscaled'); // Time controls // ------------------- -export const fixedTimestepEnabledAtom = atomWithUrl('tfix', true); +export const fixedTimestepEnabledAtom = atomWithUrl('tfix', false); export const fixedTimestepAtom = atomWithUrl('tstep', 0.3 /* seconds */);