Settings pages relooking

This commit is contained in:
loucass003 committed 2026-10-12 20:58:38 +02:00
1 parent 662d949ebe
commit 862ecbdfef
31 files changed
+1767 -1970

No files matched your search

+41 -24
View File
@@ -429,7 +429,7 @@ mounting_selection_menu = Which way is this tracker facing?
mounting_selection_menu-close = Close
## Sidebar settings
settings-sidebar-title = Settings
settings-advanced_section = Advanced settings
settings-sidebar-general = General
settings-sidebar-outputs = Outputs
settings-sidebar-routing = Bone Routing
@@ -446,7 +446,6 @@ settings-sidebar-serial = USB Serial Console
settings-sidebar-appearance = Appearance
settings-sidebar-home = Home Screen
settings-sidebar-checklist = Tracking checklist
settings-sidebar-notifications = Notifications
settings-sidebar-behavior = Behaviour
settings-sidebar-firmware-tool = DIY Firmware Tool
settings-sidebar-vrc_warnings = VRChat Config Warnings
@@ -510,9 +509,10 @@ settings-routing-hands-warning-done = Route hands
settings-driver = SteamVR / Monado
settings-driver-description = Settings for the SlimeVR driver, used by SteamVR and Monado alike.
settings-driver-output_group = Output
settings-driver-data_group = Data sent
settings-driver-enable = Enable
settings-driver-enable-description = Send your trackers to and receive trackers from SteamVR or Monado through the SlimeVR driver. If this is off, they won't be able to connect to SlimeVR at all.
settings-driver-enable-label = Enable
settings-driver-status-title = Status
settings-driver-status-connection = Driver connection
settings-driver-status-badge-connected = Connected
@@ -531,13 +531,13 @@ settings-driver-velocity-description = Send linear and angular velocity data to
## Tracker mechanics
settings-general-mounting_method = Mounting calibration method
settings-general-mounting_method-pose_only = Only used by pose mounting calibration.
settings-general-mounting_method-description = What mounting calibration method to use to calibrate your trackers' mounting orientations.
settings-general-tracker_mechanics-filtering = Filtering
# This also cares about multilines
settings-general-tracker_mechanics-filtering-description =
Choose the filtering type for your trackers.
Prediction predicts movement while smoothing smooths movement.
settings-general-tracker_mechanics-filtering-type = Filter type
settings-general-tracker_mechanics-filtering-type-none = No filtering
settings-general-tracker_mechanics-filtering-type-none-description = Use rotations as is. Will not do any filtering.
settings-general-tracker_mechanics-filtering-type-smoothing = Smoothing
@@ -545,30 +545,32 @@ settings-general-tracker_mechanics-filtering-type-smoothing-description = Smooth
settings-general-tracker_mechanics-filtering-type-prediction = Prediction
settings-general-tracker_mechanics-filtering-type-prediction-description = Reduces latency and makes movements more snappy, but may increase jitter.
settings-general-tracker_mechanics-filtering-amount = Filter strength
settings-general-tracker_mechanics-filtering-amount-no_filtering = Pick a filtering type to set its strength.
settings-general-fk_settings-reset_behaviour_group = Reset behaviour
settings-general-tracker_mechanics-yaw-reset-smooth-time = Yaw reset smooth time
settings-general-tracker_mechanics-yaw-reset-smooth-time-description = Smooths the trackers' rotations upon doing a yaw reset. 0s disables smoothing.
settings-general-tracker_mechanics-save_mounting_reset = Save automatic mounting calibration
settings-general-tracker_mechanics-save_mounting_reset-description =
Saves the automatic mounting calibration for the trackers between restarts. Useful
when wearing a suit where trackers don't move between sessions. <b>Not recommended for normal users!</b>
settings-general-tracker_mechanics-save_mounting_reset-enabled-label = Save mounting calibration
settings-general-tracker_mechanics-magnetometer_group = Magnetometer
settings-general-tracker_mechanics-connection_group = Connection
settings-general-tracker_mechanics-use_mag_on_all_trackers = Use magnetometer on all IMU trackers that support it
settings-general-tracker_mechanics-use_mag_on_all_trackers-description =
Uses magnetometer on all trackers that have a compatible firmware for it, reducing drift in stable magnetic environments.
Can be disabled per tracker in the tracker's settings. <b>Please don't shutdown any of the trackers while toggling this!</b>
settings-general-tracker_mechanics-use_mag_on_all_trackers-label = Use magnetometer on trackers
settings-general-tracker_mechanics-trackers_over_usb = Trackers over USB
settings-general-tracker_mechanics-trackers_over_usb-description =
Enables receiving HID tracker data over USB. Make sure connected trackers have <b>connection over HID</b> enabled!
settings-general-tracker_mechanics-trackers_over_usb-enabled-label = Allow HID trackers to connect directly over USB
settings-general-tracker_mechanics-timeout_delay = Timeout delay
settings-general-tracker_mechanics-timeout_delay-description = How long until a tracker is marked as '{ tracker-status-disconnected }' when the connection is lost.
settings-stay_aligned-description = Stay Aligned reduces drift by gradually adjusting your trackers to match your relaxed poses.
settings-stay_aligned-setup_group = Setup
settings-stay_aligned-setup-label = Setup Stay Aligned
settings-stay_aligned-setup-open = Open setup
settings-stay_aligned-setup-description = You must complete "Setup Stay Aligned" to enable Stay Aligned.
settings-stay_aligned-enabled-label = Enable Stay Aligned
settings-stay_aligned-general-label = General
settings-stay_aligned-relaxed_poses-label = Relaxed Poses
settings-stay_aligned-relaxed_poses-description = Stay Aligned uses your relaxed poses to keep the trackers aligned. Use "Setup Stay Aligned" to update these poses.
settings-stay_aligned-relaxed_poses-standing = Adjust trackers while standing
@@ -580,6 +582,7 @@ settings-stay_aligned-relaxed_poses-close = Close
settings-stay_aligned-debug-label = Debugging
settings-stay_aligned-debug-description = Please include your settings when reporting problems about Stay Aligned.
settings-stay_aligned-debug-copy-label = Copy settings to clipboard
settings-stay_aligned-debug-copy-short = Copy
## Keybinds Page
settings-keybinds = Keybind settings
@@ -635,11 +638,11 @@ settings-general-fk_settings-leg_tweak-foot_plant-description = Foot-plant rotat
settings-general-fk_settings-leg_fk = Leg tracking
settings-general-fk_settings-leg_fk-reset_mounting_feet-v1 = Force feet mounting calibration
settings-general-fk_settings-leg_fk-reset_mounting_feet-description-v1 = Force feet mounting calibration during body mounting calibration.
settings-general-fk_settings-constraints_group = Constraints
settings-general-fk_settings-enforce_joint_constraints = Skeletal Limits
settings-general-fk_settings-enforce_joint_constraints-enforce_constraints = Enforce constraints
settings-general-fk_settings-enforce_joint_constraints-enforce_constraints-description = Prevents joints from rotating past their limit
settings-general-fk_settings-position_group = Position tracking
settings-general-fk_settings-ik = Position data
settings-general-fk_settings-ik-use_position = Use Position data
settings-general-fk_settings-ik-use_position-description = Enables the use of position data from trackers that provide it. When enabling this make sure to full reset and recalibrate in game.
settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude = Reset HMD attitude
settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude-description = Reset a VR headset's vertical rotation upon doing a full reset. Useful when wearing one on the forehead for VTubing or mocap. Do not enable for VR.
@@ -675,6 +678,13 @@ settings-general-gesture_control-trackers = { $amount ->
[one] 1 tracker
*[other] { $amount } trackers
}
settings-general-gesture_control-column-reset = Reset
settings-general-gesture_control-column-tracker = Tracker
settings-general-gesture_control-column-taps = Taps
settings-general-gesture_control-column-delay = Delay
settings-general-gesture_control-yawReset-name = Yaw reset
settings-general-gesture_control-fullReset-name = Full reset
settings-general-gesture_control-mountingReset-name = Mounting calibration
settings-general-gesture_control-yawResetEnabled = Enable tap to yaw reset
settings-general-gesture_control-yawResetDelay = Yaw reset delay
settings-general-gesture_control-yawResetTaps = Taps for yaw reset
@@ -693,9 +703,11 @@ settings-general-gesture_control-numberTrackersOverThreshold-description = Incre
## Appearance settings
settings-interface-appearance = Appearance
settings-interface-appearance-text_group = Text
settings-interface-appearance-language_group = Language
settings-utils-advanced-developer_group = Developer
settings-general-interface-dev_mode = Developer Mode
settings-general-interface-dev_mode-description = This mode can be useful if you need in-depth data or to interact with connected trackers on a more advanced level.
settings-general-interface-dev_mode-label = Developer Mode
settings-general-interface-theme = Colour theme
settings-general-interface-lang = Select language
settings-general-interface-lang-description = Change the default language.
@@ -718,29 +730,29 @@ settings-interface-appearance-font_size-description = This affects the font size
## Notification settings
settings-general-interface-feedback_sound = Feedback sound
settings-general-interface-feedback_sound-description = This option plays a sound when a reset is triggered.
settings-general-interface-feedback_sound-label = Feedback sound
settings-general-interface-feedback_sound-volume = Feedback sound volume
settings-general-interface-connected_trackers_warning = Connected trackers warning
settings-general-interface-connected_trackers_warning-description = This option will show a pop-up every time you try exiting SlimeVR while having one or more connected trackers. It reminds you to turn off your trackers when you are done to preserve battery life.
settings-general-interface-connected_trackers_warning-label = Connected trackers warning on exit
## Behavior settings
settings-interface-behavior = Behaviour
settings-interface-notifications = Notifications
settings-interface-behavior-desktop_group = Desktop
settings-interface-behavior-input_group = Input
settings-interface-behavior-privacy_group = Privacy
settings-general-interface-dev_mode = Developer Mode
settings-general-interface-dev_mode-description = This mode can be useful if you need in-depth data or need to interact with connected trackers on a more advanced level.
settings-general-interface-dev_mode-label = Developer Mode
settings-general-interface-use_tray = Minimize to system tray
settings-general-interface-use_tray-description = Lets you close the window without closing the SlimeVR Server so you can continue using it without having the GUI bother you.
settings-general-interface-use_tray-label = Minimize to system tray
settings-general-interface-discord_presence = Share activity on Discord
settings-general-interface-discord_presence-description = Tells your Discord client that you are using SlimeVR along with the number of IMU trackers you are using.
settings-general-interface-discord_presence-label = Share activity on Discord
settings-general-interface-discord_presence-message = { $amount ->
[0] Sliming around
[one] Using 1 tracker
*[other] Using { $amount } trackers
}
settings-interface-behavior-error_tracking = Error collection via Sentry.io
settings-interface-behavior-error_tracking-label = Send errors to developers
settings-interface-behavior-error_tracking-description_v2 =
<h1>Do you consent to the collection of error and diagnostic data?</h1>
@@ -755,16 +767,16 @@ settings-interface-behavior-error_tracking-description_v2 =
This data is linked to a random ID, not to your identity, and helps us detect bugs and issues with SlimeVR. It is collected via Sentry.io.
settings-interface-behavior-error_tracking-label = Send errors to developers
settings-interface-behavior-bvh_directory = Directory to save BVH recordings
settings-interface-behavior-bvh_directory-description = Choose a directory to save your BVH recordings instead of having to choose where to save them each time.
settings-interface-behavior-bvh_directory-label = Directory for BVH recordings
settings-interface-behavior-skeleton_mesh = Skeleton preview style
settings-interface-behavior-skeleton_mesh-description = Draw the body preview with solid 3D shapes instead of simple lines. Turn this off on low-end machines.
settings-interface-behavior-skeleton_mesh-label = Use 3D shapes
settings-interface-behavior-skeleton_mesh-lines = Lines
settings-interface-behavior-skeleton_mesh-mesh = 3D shapes
settings-interface-behavior-controller_nav = Game controller navigation
settings-interface-behavior-controller_nav-description = Move focus around the interface with a game controller: the D-pad or left stick move between controls, A activates, B goes back, only while a controller is connected. Holding Ctrl or Alt with the arrow keys always moves focus the same way.
settings-interface-behavior-controller_nav-label = Navigate with a controller
## Serial settings
settings-serial = USB Serial Console
@@ -809,9 +821,10 @@ settings-osc-vrchat-description-v1 =
Change settings specific to VRChat OSC and the OSC Trackers standard used to send
tracking data to applications without SteamVR (ex. Quest standalone).
Make sure to enable OSC in VRChat via the Action Menu under OSC > Enabled.
settings-osc-vrchat-output_group = Output
settings-osc-vrchat-network_group = Network
settings-osc-vrchat-enable = Enable
settings-osc-vrchat-enable-description = Toggle the sending and receiving of data.
settings-osc-vrchat-enable-label = Enable
settings-osc-vrchat-network = Network ports
settings-osc-vrchat-network-port_in =
.label = Port In
@@ -850,8 +863,10 @@ settings-osc-vrchat-status-oscquery-searching = No VRChat clients found yet.
settings-osc-vrchat-status-oscquery-discovered-title = Discovered VRChat clients:
settings-osc-vrchat-status-oscquery-switch = Switch
settings-osc-vrchat-status-network-mode = Network mode
settings-osc-vrchat-status-network-mode-auto = Automatic
settings-osc-vrchat-status-network-mode-manual = Manual
settings-osc-vrchat-status-network-mode-manual_only = Only used while the network mode is manual.
settings-osc-vrchat-status-network-mode-description = Automatic mode discovers VRChat through OSCQuery. Manual mode uses the configured address and ports.
settings-osc-vrchat-status-network-mode-toggle = Manual network settings
settings-osc-vrchat-status-network-manual-description = Configure the local input port and the VRChat OSC target manually.
settings-osc-vrchat-status-badge-idle = Idle
@@ -871,9 +886,10 @@ settings-osc-vmc = Virtual Motion Capture
settings-osc-vmc-description =
Change settings specific to the VMC (Virtual Motion Capture) protocol
to send SlimeVR's bone data and receive bone data from other apps.
settings-osc-vmc-output_group = Output
settings-osc-vmc-network_group = Network
settings-osc-vmc-enable = Enable
settings-osc-vmc-enable-description = Toggle the sending and receiving of data.
settings-osc-vmc-enable-label = Enable
settings-osc-vmc-network = Network ports
settings-osc-vmc-network-description = Set the ports for listening and sending data via VMC.
settings-osc-vmc-network-port_in =
@@ -885,17 +901,15 @@ settings-osc-vmc-network-port_out =
settings-osc-vmc-network-address = Network address
settings-osc-vmc-network-address-description = Choose which address to send out data at via VMC.
settings-osc-vmc-network-address-placeholder = IPV4 address
settings-osc-vmc-avatar_group = Avatar
settings-osc-vmc-vrm = VRM Model
settings-osc-vmc-vrm-description = Load a VRM model to use its own bone proportions and enable a higher compatibility with other applications.
settings-osc-vmc-vrm-untitled_model = Untitled model
settings-osc-vmc-vrm-file_select = Drag & drop a model to use, or <u>browse</u>
settings-osc-vmc-anchor_hip = Anchor at hips
settings-osc-vmc-anchor_hip-description = When enabled, the avatar stays pinned at its hips and only rotations are sent, useful for seated VTubing. When disabled, the avatar follows your head and moves around.
settings-osc-vmc-anchor_hip-label = Anchor at hips
settings-osc-vmc-mirror_tracking = Mirror tracking
settings-osc-vmc-mirror_tracking-description = Mirror the tracking horizontally.
settings-osc-vmc-mirror_tracking-label = Mirror tracking
settings-osc-vmc-status-title = Status
settings-osc-vmc-status-input = Input
settings-osc-vmc-status-output = Output
settings-osc-vmc-status-vrm = VRM model
@@ -911,6 +925,7 @@ settings-osc-vmc-status-output-last-frame = Last frame sent: {$elapsed}.
settings-osc-vmc-status-output-no-frame = No frame sent yet.
settings-osc-vmc-status-vrm-none = No model loaded, using estimated bone offsets.
settings-osc-vmc-status-vrm-loaded = Model loaded, using its bone offsets.
settings-osc-vmc-status-title = Status
settings-osc-vmc-status-badge-idle = Idle
settings-osc-vmc-status-badge-listening = Listening
settings-osc-vmc-status-badge-ready = Ready
@@ -946,6 +961,7 @@ settings-utils-advanced-reset_warning =
settings-utils-advanced-reset_warning-reset = Reset settings
settings-utils-advanced-reset_warning-cancel = Cancel
settings-utils-advanced-folders_group = Folders
settings-utils-advanced-open_data-v1 = Config folder
settings-utils-advanced-open_data-description-v1 = Open SlimeVR's config folder in file explorer, containing the configuration
settings-utils-advanced-open_data-label = Open folder
@@ -962,6 +978,7 @@ settings-home-list-layout-table = Table
settings-home-table_columns = Table columns
settings-home-table_columns-desc = Choose which columns are shown in the trackers table
settings-home-display_group = Display
settings-home-tracker_display = Tracker info
settings-home-tracker_display-desc = Choose which extra details are shown on trackers
settings-home-tracker_display-battery_voltage = Battery voltage
+1 -1
View File
@@ -58,7 +58,7 @@ export function BaseModal({
classNames(
'items-center focus:ring-transparent focus:ring-offset-transparent',
'focus:outline-transparent outline-none bg-background-60 p-6 rounded-lg m-2',
'text-background-10',
'text-background-10 text-standard',
props.appendClasses
)
}
+7 -1
View File
@@ -16,6 +16,7 @@ export const CheckboxInternal = forwardRef<
outlined?: boolean;
loading?: boolean;
name: string;
id?: string;
} & Partial<React.HTMLProps<HTMLInputElement>>
>(function AppCheckbox(
{
@@ -28,6 +29,7 @@ export const CheckboxInternal = forwardRef<
onChange,
checked,
name,
id,
},
ref
) {
@@ -85,6 +87,7 @@ export const CheckboxInternal = forwardRef<
>
<input
ref={ref}
id={id}
onChange={onChange}
checked={checked}
name={name}
@@ -130,10 +133,12 @@ export function CheckBox<T extends FieldValues = FieldValues>({
name,
loading,
disabled,
id,
}: {
label: string;
label?: string;
control: Control<T>;
name: FieldPath<T>;
id?: string;
variant?: 'checkbox' | 'toggle';
color?: 'primary' | 'secondary' | 'tertiary';
outlined?: boolean;
@@ -146,6 +151,7 @@ export function CheckBox<T extends FieldValues = FieldValues>({
render={({ field: { onChange, value, ref, name } }) => (
<CheckboxInternal
label={label}
id={id}
variant={variant}
color={color}
outlined={outlined}
+4 -1
View File
@@ -32,15 +32,18 @@ export const FileInputContentBlank = ({
isDragging,
label,
directory = false,
compact = false,
}: {
isDragging: boolean;
label: string;
directory?: boolean;
compact?: boolean;
}) => {
return (
<div
className={classNames(
'flex justify-center w-full h-32 px-4 transition border-2',
'flex justify-center w-full px-4 transition border-2',
compact ? 'h-12' : 'h-32',
'border-background-20 rounded-md appearance-none cursor-pointer',
'hover:border-accent-background-20 focus:outline-none',
'border-dashed'
@@ -9,8 +9,10 @@ import { Dropdown, DropdownDirection } from './Dropdown';
export function LangSelector({
direction = 'up',
alignment = 'right',
display,
}: {
direction?: DropdownDirection;
display?: 'fit' | 'block';
alignment?: 'right' | 'left';
}) {
const { changeLocales } = useContext(LangContext);
@@ -58,6 +60,7 @@ export function LangSelector({
items={languagesItems}
direction={direction}
alignment={alignment}
display={display}
/>
);
}
@@ -14,12 +14,14 @@ export function InnerSystemFileInput({
value,
onChange,
directory,
compact = false,
refCallback: refCallback,
}: {
label: string;
value: string | null;
onChange: (...event: any[]) => void;
directory: boolean;
compact?: boolean;
refCallback: RefCallBack;
}) {
const electron = useElectron();
@@ -45,7 +47,12 @@ export function InnerSystemFileInput({
importedFileName: value,
onClearPicker: () => onChange(null),
})
: FileInputContentBlank({ isDragging: false, label, directory })}
: FileInputContentBlank({
isDragging: false,
label,
directory,
compact,
})}
</div>
);
}
@@ -56,6 +63,7 @@ export function SystemFileInput<T extends FieldValues = FieldValues>({
name,
label,
directory = false,
compact = false,
}: {
rules: UseControllerProps<T, FieldPath<T>>['rules'];
control: Control<T>;
@@ -65,6 +73,7 @@ export function SystemFileInput<T extends FieldValues = FieldValues>({
label: string;
name: FieldPath<T>;
directory?: boolean;
compact?: boolean;
disabled?: boolean;
}) {
return (
@@ -79,6 +88,7 @@ export function SystemFileInput<T extends FieldValues = FieldValues>({
onChange={onChange}
refCallback={ref}
directory={directory}
compact={compact}
/>
)}
/>
@@ -0,0 +1,157 @@
import classNames from 'classnames';
import { ReactNode } from 'react';
import { Typography } from '@/components/commons/Typography';
import { Tooltip } from '@/components/commons/Tooltip';
export function SettingsGroupLabel({ id }: { id: string }) {
return (
<div className="flex items-center gap-3 uppercase">
<Typography variant="section-title" id={id} />
{/* Tinted from the text colour so it shows on any surface it lands on. */}
<div className="h-[1px] flex-grow bg-background-10/15" />
</div>
);
}
export function SettingRow({
title,
description,
details,
control,
below,
controlId,
disabledReason,
controlWidth = 'auto',
disabled = false,
childrenDisabled = false,
children,
}: {
title: string;
description?: string;
details?: ReactNode;
control?: ReactNode;
below?: ReactNode;
controlId?: string;
disabledReason?: string;
controlWidth?: 'auto' | 'wide';
disabled?: boolean;
childrenDisabled?: boolean;
children?: ReactNode;
}) {
const hasText = Boolean(description || details);
const band = (
<>
<div className="col-start-1 row-start-1 min-w-0">
<Typography variant="section-title" id={title} />
</div>
{hasText && (
<div className="col-start-1 row-start-2 col-span-2 xs:col-span-1 min-w-0 max-w-[75ch]">
{description && <Typography id={description} />}
{details}
</div>
)}
{control && (
<div
className={classNames('flex self-center justify-self-end min-w-0', {
'col-start-2 row-start-1 xs:row-span-2': controlWidth === 'auto',
[classNames(
'col-start-1 col-span-2 w-full',
hasText ? 'row-start-3' : 'row-start-2',
'xs:col-start-2 xs:col-span-1 xs:row-start-1 xs:row-span-2 xs:w-56 lg:w-72'
)]: controlWidth === 'wide',
})}
>
{control}
</div>
)}
</>
);
const bandClasses =
'grid grid-cols-[minmax(0,1fr)_auto] gap-x-6 gap-y-1 items-center';
return (
<fieldset
disabled={disabled}
className={classNames(
'flex flex-col gap-3 min-w-0 px-3 py-3 xs:px-4 xs:py-4 transition-colors',
!disabled && 'hover:bg-background-70/30'
)}
>
<Tooltip
content={<Typography id={disabledReason ?? ''} />}
preferedDirection="top"
disabled={!disabled || !disabledReason}
>
{controlId ? (
<label
htmlFor={controlId}
className={classNames(
bandClasses,
disabled ? 'opacity-50' : 'cursor-pointer'
)}
>
{band}
</label>
) : (
<div className={classNames(bandClasses, disabled && 'opacity-50')}>
{band}
</div>
)}
</Tooltip>
{below && <div className="min-w-0">{below}</div>}
{children && (
<fieldset
disabled={childrenDisabled}
className={classNames(
'flex flex-col gap-4 pl-3 ml-1 xs:pl-4 border-l-2 border-background-60 min-w-0',
childrenDisabled && 'opacity-50'
)}
>
{children}
</fieldset>
)}
</fieldset>
);
}
export function SettingsGroup({
title,
description,
details,
children,
}: {
title?: string;
description?: string;
details?: ReactNode;
children?: ReactNode;
}) {
return (
<div className="flex flex-col gap-3 min-w-0 mt-8 first:mt-0">
{(title || description || details) && (
<div className="flex flex-col gap-2 min-w-0 px-3 xs:px-4">
{title && <SettingsGroupLabel id={title} />}
{(description || details) && (
<div className="flex flex-col gap-1 min-w-0 max-w-[75ch]">
{description && <Typography id={description} />}
{details}
</div>
)}
</div>
)}
<div className="flex flex-col rounded-2xl bg-background-80 divide-y divide-background-70 overflow-hidden">
{children}
</div>
</div>
);
}
export function SettingsAdvanced({ children }: { children?: ReactNode }) {
return (
<fieldset className="flex flex-col mt-10 rounded-2xl border border-background-50 px-2 xs:px-3 pt-4 pb-5 min-w-0">
<legend className="uppercase px-2 ml-2">
<Typography variant="section-title" id="settings-advanced_section" />
</legend>
<div className="flex flex-col gap-3 min-w-0">{children}</div>
</fieldset>
);
}
@@ -141,7 +141,7 @@ export function SettingsLayout({ children }: { children: ReactNode }) {
<div
data-nav-region="page"
style={{ gridArea: 'c' }}
className="xs:pl-2 xs:pb-2 xs:mt-2 mobile:mt-7 overflow-y-auto"
className="xs:pl-2 xs:pr-2 xs:pb-2 xs:mt-2 mobile:mt-7 overflow-y-auto"
>
{isMobile && <SettingSelectorMobile />}
{children}
@@ -1,27 +1,31 @@
import classNames from 'classnames';
import { ReactNode } from 'react';
import { Typography } from '@/components/commons/Typography';
export function SettingsPagePaneLayout({
children,
className,
icon,
title,
...props
}: {
children: ReactNode;
icon: ReactNode;
title?: string;
} & React.HTMLAttributes<HTMLDivElement>) {
return (
<div
className={classNames(
'bg-background-70 rounded-lg px-4 py-8 flex xs:gap-4 w-full relative',
'bg-background-70 rounded-lg p-3 xs:p-4 pt-10 xs:pt-4 pb-6 xs:pb-8 flex flex-col gap-4 w-full relative',
className
)}
{...props}
>
<div className="flex mobile:absolute mobile:right-4">
<div className="w-10 h-10 bg-accent-background-40 flex justify-center items-center rounded-full fill-background-10">
<div className="flex items-center gap-4">
<div className="w-10 h-10 flex-none bg-accent-background-40 flex justify-center items-center rounded-full fill-background-10">
{icon}
</div>
{title && <Typography variant="main-title" id={title} />}
</div>
<div className="flex-col w-full min-w-0">{children}</div>
</div>
@@ -8,7 +8,7 @@ export function SettingsLink({ to, id }: { id: string; to: string }) {
<NavLink
to={to}
className={({ isActive }) =>
classNames('pl-5 py-2 hover:bg-background-60 rounded-lg', {
classNames('pl-5 py-1.5 hover:bg-background-60 rounded-lg', {
'bg-background-60': isActive,
})
}
@@ -22,11 +22,10 @@ export function SettingsSidebar() {
const { state: vrcConfigState } = useVRCConfig();
return (
<div className="flex flex-col px-5 py-5 gap-3 overflow-y-auto bg-background-70 rounded-lg h-full">
<Typography variant="main-title" id="settings-sidebar-title" />
<div className="flex flex-col gap-3">
<div className="flex flex-col px-5 py-4 gap-4 overflow-y-auto no-scrollbar bg-background-70 rounded-lg h-full">
<div className="flex flex-col gap-2">
<Typography variant="section-title" id="settings-sidebar-general" />
<div className="flex flex-col gap-2">
<div className="flex flex-col gap-1">
<SettingsLink
to="/settings/tracking"
id="settings-sidebar-tracking"
@@ -42,9 +41,9 @@ export function SettingsSidebar() {
/>
</div>
</div>
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-2">
<Typography variant="section-title" id="settings-sidebar-interface" />
<div className="flex flex-col gap-2">
<div className="flex flex-col gap-1">
<SettingsLink
to="/settings/appearance"
id="settings-sidebar-appearance"
@@ -64,9 +63,9 @@ export function SettingsSidebar() {
/>
</div>
</div>
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-2">
<Typography variant="section-title" id="settings-sidebar-outputs" />
<div className="flex flex-col gap-2">
<div className="flex flex-col gap-1">
<SettingsLink to="/settings/routing" id="settings-sidebar-routing" />
<SettingsLink to="/settings/driver" id="settings-sidebar-driver" />
<SettingsLink
@@ -76,9 +75,9 @@ export function SettingsSidebar() {
<SettingsLink to="/settings/osc/vmc" id="settings-sidebar-osc_vmc" />
</div>
</div>
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-2">
<Typography variant="section-title" id="settings-sidebar-utils" />
<div className="flex flex-col gap-2">
<div className="flex flex-col gap-1">
<SettingsLink to="/settings/serial" id="settings-sidebar-serial" />
<SettingsLink
to="/settings/firmware-tool"
@@ -3,6 +3,7 @@ import { useEffect, useState } from 'react';
import { FieldPath, useForm } from 'react-hook-form';
import { Typography } from '@/components/commons/Typography';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import { SettingRow, SettingsGroup } from '@/components/settings/SettingRow';
import { BugIcon } from '@/components/commons/icon/BugIcon';
import { Button } from '@/components/commons/Button';
import { CheckBox } from '@/components/commons/Checkbox';
@@ -102,220 +103,158 @@ export function AdvancedSettings() {
}
};
return (
<form className="flex flex-col gap-2 w-full">
<SettingsPagePaneLayout icon={<BugIcon />}>
<>
<Typography variant="main-title">
{l10n.getString('settings-utils-advanced')}
</Typography>
const resets = [
{
id: 'gui',
title: 'settings-utils-advanced-reset-gui',
description: 'settings-utils-advanced-reset-gui-description',
label: 'settings-utils-advanced-reset-gui-label',
open: showWarningGUI,
setOpen: setShowWarningGUI,
accept: () => {
setConfig(guiDefaults());
setShowWarningGUI(false);
},
},
{
id: 'server',
title: 'settings-utils-advanced-reset-server',
description: 'settings-utils-advanced-reset-server-description',
label: 'settings-utils-advanced-reset-server-label',
open: showWarningServer,
setOpen: setShowWarningServer,
accept: () => {
sendRPCPacket(
RpcMessage.SettingsResetRequest,
new SettingsResetRequestT()
);
setShowWarningServer(false);
},
},
{
id: 'all',
title: 'settings-utils-advanced-reset-all',
description: 'settings-utils-advanced-reset-all-description',
label: 'settings-utils-advanced-reset-all-label',
open: showWarningAll,
setOpen: setShowWarningAll,
accept: () => {
sendRPCPacket(
RpcMessage.SettingsResetRequest,
new SettingsResetRequestT()
);
setConfig(guiDefaults());
setShowWarningAll(false);
},
},
] as const;
<div className="grid gap-6 pt-4">
<div className="flex flex-col gap-2">
<div className="flex flex-col">
<Typography variant="section-title">
{l10n.getString('settings-general-interface-dev_mode')}
</Typography>
<Typography>
{l10n.getString(
'settings-general-interface-dev_mode-description'
)}
</Typography>
</div>
<div className="grid">
return (
<form className="w-full">
<SettingsPagePaneLayout
icon={<BugIcon />}
title="settings-utils-advanced"
>
<div className="flex flex-col">
<SettingsGroup title="settings-utils-advanced-developer_group">
<SettingRow
title="settings-general-interface-dev_mode"
description="settings-general-interface-dev_mode-description"
controlId="advanced-dev-mode"
control={
<CheckBox
variant="toggle"
control={control}
outlined
name="developer.enabled"
label={l10n.getString(
'settings-general-interface-dev_mode-label'
)}
id="advanced-dev-mode"
/>
}
childrenDisabled={!config?.debug}
>
<div className="grid sm:grid-cols-2 gap-2 py-1">
{Object.entries(devToggles).map(([name, label]) => (
<CheckBox
key={name}
control={control}
variant="toggle"
outlined
name={`developer.${name}` as FieldPath<DeveloperModeForm>}
label={l10n.getString(`widget-developer_mode-${label}`)}
/>
))}
</div>
{!!config?.debug && (
<div className="grid sm:grid-cols-2 gap-2 p-4 rounded-2xl bg-background-80">
{Object.entries(devToggles).map(([name, label]) => (
<CheckBox
key={name}
control={control}
variant="toggle"
outlined
name={`developer.${name}` as FieldPath<DeveloperModeForm>}
label={l10n.getString(`widget-developer_mode-${label}`)}
/>
))}
</div>
</SettingRow>
</SettingsGroup>
{electron.isElectron && (
<SettingsGroup title="settings-utils-advanced-folders_group">
<SettingRow
title="settings-utils-advanced-open_data-v1"
description="settings-utils-advanced-open_data-description-v1"
control={
<Button
variant="secondary"
className="whitespace-nowrap"
onClick={openConfigFolder}
id="settings-utils-advanced-open_data-label"
/>
}
/>
<SettingRow
title="settings-utils-advanced-open_logs"
description="settings-utils-advanced-open_logs-description"
control={
<Button
variant="secondary"
className="whitespace-nowrap"
onClick={openLogsFolder}
id="settings-utils-advanced-open_logs-label"
/>
}
/>
</SettingsGroup>
)}
<fieldset className="flex flex-col mt-10 rounded-2xl border border-status-critical px-2 xs:px-3 pt-4 pb-5 min-w-0">
<legend className="uppercase px-2 ml-2">
<Typography
variant="section-title"
color="text-status-critical"
id="settings-utils-advanced-danger_zone"
/>
</legend>
<div className="px-3 xs:px-4 pb-2 max-w-[75ch]">
<Typography id="settings-utils-advanced-danger_zone-description" />
</div>
<SettingsGroup>
{resets.map(
({ id, title, description, label, open, setOpen, accept }) => (
<SettingRow
key={id}
title={title}
description={description}
control={
<>
<Button
variant="secondary"
className="!bg-status-critical whitespace-nowrap"
onClick={() => setOpen(true)}
id={label}
/>
<SettingsResetModal
accept={accept}
onClose={() => setOpen(false)}
isOpen={open}
variant={id}
/>
</>
}
/>
)
)}
</div>
{electron.isElectron && (
<>
<div className="sm:grid sm:grid-cols-[1.75fr,_1fr] items-center">
<div>
<Typography variant="section-title">
{l10n.getString('settings-utils-advanced-open_data-v1')}
</Typography>
<div className="flex flex-col">
<Typography>
{l10n.getString(
'settings-utils-advanced-open_data-description-v1'
)}
</Typography>
</div>
</div>
<div className="flex flex-col nsm:pt-2">
<Button variant="secondary" onClick={openConfigFolder}>
{l10n.getString(
'settings-utils-advanced-open_data-label'
)}
</Button>
</div>
</div>
<div className="sm:grid sm:grid-cols-[1.75fr,_1fr] items-center">
<div>
<Typography variant="section-title">
{l10n.getString('settings-utils-advanced-open_logs')}
</Typography>
<div className="flex flex-col">
<Typography>
{l10n.getString(
'settings-utils-advanced-open_logs-description'
)}
</Typography>
</div>
</div>
<div className="flex flex-col nsm:pt-2">
<Button variant="secondary" onClick={openLogsFolder}>
{l10n.getString(
'settings-utils-advanced-open_logs-label'
)}
</Button>
</div>
</div>
</>
)}
<div className="flex flex-col gap-4 p-4 rounded-2xl border border-status-critical">
<div className="flex flex-col">
<Typography
variant="section-title"
color="text-status-critical"
id="settings-utils-advanced-danger_zone"
/>
<Typography
color="text-status-critical"
id="settings-utils-advanced-danger_zone-description"
/>
</div>
<div className="sm:grid sm:grid-cols-[1.75fr,_1fr] items-center">
<div>
<Typography variant="section-title">
{l10n.getString('settings-utils-advanced-reset-gui')}
</Typography>
<div className="flex flex-col">
<Typography>
{l10n.getString(
'settings-utils-advanced-reset-gui-description'
)}
</Typography>
</div>
</div>
<div className="flex flex-col nsm:pt-2">
<Button
variant="secondary"
onClick={() => setShowWarningGUI(true)}
>
{l10n.getString('settings-utils-advanced-reset-gui-label')}
</Button>
<SettingsResetModal
accept={() => {
setConfig(guiDefaults());
setShowWarningGUI(false);
}}
onClose={() => setShowWarningGUI(false)}
isOpen={showWarningGUI}
variant="gui"
/>
</div>
</div>
<div className="sm:grid sm:grid-cols-[1.75fr,_1fr] items-center">
<div>
<Typography variant="section-title">
{l10n.getString('settings-utils-advanced-reset-server')}
</Typography>
<div className="flex flex-col">
<Typography>
{l10n.getString(
'settings-utils-advanced-reset-server-description'
)}
</Typography>
</div>
</div>
<div className="flex flex-col nsm:pt-2">
<Button
variant="secondary"
onClick={() => setShowWarningServer(true)}
>
{l10n.getString(
'settings-utils-advanced-reset-server-label'
)}
</Button>
<SettingsResetModal
accept={() => {
sendRPCPacket(
RpcMessage.SettingsResetRequest,
new SettingsResetRequestT()
);
setShowWarningServer(false);
}}
onClose={() => setShowWarningServer(false)}
isOpen={showWarningServer}
variant="server"
/>
</div>
</div>
<div className="sm:grid sm:grid-cols-[1.75fr,_1fr] items-center">
<div>
<Typography variant="section-title">
{l10n.getString('settings-utils-advanced-reset-all')}
</Typography>
<div className="flex flex-col">
<Typography>
{l10n.getString(
'settings-utils-advanced-reset-all-description'
)}
</Typography>
</div>
</div>
<div className="flex flex-col nsm:pt-2">
<Button
variant="secondary"
onClick={() => setShowWarningAll(true)}
>
{l10n.getString('settings-utils-advanced-reset-all-label')}
</Button>
<SettingsResetModal
accept={() => {
sendRPCPacket(
RpcMessage.SettingsResetRequest,
new SettingsResetRequestT()
);
setConfig(guiDefaults());
setShowWarningAll(false);
}}
onClose={() => setShowWarningAll(false)}
isOpen={showWarningAll}
variant="all"
/>
</div>
</div>
</div>
</div>
</>
</SettingsGroup>
</fieldset>
</div>
</SettingsPagePaneLayout>
</form>
);
@@ -3,13 +3,14 @@ import { useEffect } from 'react';
import { useForm } from 'react-hook-form';
import { Typography } from '@/components/commons/Typography';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import { SettingRow, SettingsGroup } from '@/components/settings/SettingRow';
import { defaultConfig, useConfig } from '@/hooks/config';
import { ThemeSelector } from '@/components/commons/ThemeSelector';
import { SquaresIcon } from '@/components/commons/icon/SquaresIcon';
import { useLocaleConfig } from '@/i18n/config';
import { LangSelector } from '@/components/commons/LangSelector';
import { Button } from '@/components/commons/Button';
import { Range } from '@/components/commons/Range';
import { NumberSelector } from '@/components/commons/NumberSelector';
import { Dropdown } from '@/components/commons/Dropdown';
import { useElectron } from '@/hooks/electron';
@@ -69,9 +70,22 @@ export function AppearanceSettings() {
return () => subscription.unsubscribe();
}, [onSubmit]);
const themes = [
{ value: 'slime', colors: '!bg-slime' },
{ value: 'slime-green', colors: '!bg-slime-green' },
{ value: 'slime-yellow', colors: '!bg-slime-yellow' },
{ value: 'slime-orange', colors: '!bg-slime-orange' },
{ value: 'slime-red', colors: '!bg-slime-red' },
{ value: 'dark', colors: '!bg-dark' },
{ value: 'light', colors: '!bg-light' },
{ value: 'trans', colors: '!bg-trans-flag' },
{ value: 'asexual', colors: '!bg-asexual-flag' },
{ value: 'snep', colors: '!bg-snep' },
];
return (
<form
className="flex flex-col gap-2 w-full"
className="w-full"
// Don't resize the font size for this page because you have access to font resizing on it and we don't want to break the layout just in case
style={
{
@@ -82,183 +96,107 @@ export function AppearanceSettings() {
} as React.CSSProperties
}
>
<SettingsPagePaneLayout icon={<SquaresIcon />}>
<>
<Typography variant="main-title">
{l10n.getString('settings-interface-appearance')}
</Typography>
<div className="pb-4">
<Typography variant="section-title">
{l10n.getString('settings-general-interface-theme')}
</Typography>
<div className="flex flex-wrap gap-3 pt-2">
<ThemeSelector
control={control}
name="theme"
value={'slime'}
colors="!bg-slime"
/>
<ThemeSelector
control={control}
name="theme"
value={'slime-green'}
colors="!bg-slime-green"
/>
<ThemeSelector
control={control}
name="theme"
value={'slime-yellow'}
colors="!bg-slime-yellow"
/>
<ThemeSelector
control={control}
name="theme"
value={'slime-orange'}
colors="!bg-slime-orange"
/>
<ThemeSelector
control={control}
name="theme"
value={'slime-red'}
colors="!bg-slime-red"
/>
<ThemeSelector
control={control}
name="theme"
value={'dark'}
colors="!bg-dark"
/>
<ThemeSelector
control={control}
name="theme"
value={'light'}
colors="!bg-light"
/>
<ThemeSelector
control={control}
name="theme"
value={'trans'}
colors="!bg-trans-flag"
/>
<ThemeSelector
control={control}
name="theme"
value={'asexual'}
colors="!bg-asexual-flag"
/>
<ThemeSelector
control={control}
name="theme"
value={'snep'}
colors="!bg-snep"
/>
<SettingsPagePaneLayout
icon={<SquaresIcon />}
title="settings-interface-appearance"
>
<div className="flex flex-col">
<SettingsGroup title="settings-general-interface-theme">
<div className="flex flex-wrap gap-3 p-3 xs:p-4">
{themes.map(({ value, colors }) => (
<ThemeSelector
key={value}
control={control}
name="theme"
value={value}
colors={colors}
/>
))}
</div>
</div>
</SettingsGroup>
<Typography variant="section-title">
{l10n.getString('settings-interface-appearance-font')}
</Typography>
<div className="flex flex-col pt-1 pb-2">
<Typography>
{l10n.getString('settings-interface-appearance-font-description')}
</Typography>
</div>
<div className="grid sm:grid-cols-2 pb-4">
<Dropdown
control={control}
name="fonts"
placeholder={l10n.getString(
'settings-interface-appearance-font-placeholder'
)}
/* Supports multiple items by separating them with a comma */
items={fontOptions.map((option) => ({
label: (
<span style={{ fontFamily: option.fontName }}>
{option.label}
</span>
),
value: option.value,
}))}
alignment="left"
/>
</div>
<Typography variant="section-title">
{l10n.getString('settings-interface-appearance-font_size')}
</Typography>
<div className="flex flex-col pt-1 pb-2">
<Typography>
{l10n.getString(
'settings-interface-appearance-font_size-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-2 pb-4">
<Range
control={control}
name="textSize"
min={10}
max={15}
step={1}
values={[
{ value: 10, label: '10pt' },
{ value: 11, label: '11pt' },
{ value: 12, label: '12pt', defaultValue: true },
{ value: 13, label: '13pt' },
{ value: 14, label: '14pt' },
{ value: 15, label: '15pt' },
]}
/>
</div>
<Typography variant="section-title">
{l10n.getString('settings-general-interface-lang')}
</Typography>
<div className="flex flex-col pt-1 pb-2">
<Typography>
{l10n.getString('settings-general-interface-lang-description')}
</Typography>
</div>
<div className="grid sm:grid-cols-2 pb-4">
<LangSelector alignment="left" />
</div>
{electron.isElectron && (
<>
<Typography
variant="section-title"
id="settings-general-interface-crowdin_in_context"
/>
<div className="flex flex-col pt-1 pb-2">
<Typography
id={
inContext
? 'settings-general-interface-crowdin_in_context-description-active'
: 'settings-general-interface-crowdin_in_context-description'
}
<SettingsGroup title="settings-interface-appearance-text_group">
<SettingRow
title="settings-interface-appearance-font"
description="settings-interface-appearance-font-description"
controlWidth="wide"
control={
<Dropdown
control={control}
name="fonts"
placeholder={l10n.getString(
'settings-interface-appearance-font-placeholder'
)}
/* Supports multiple items by separating them with a comma */
display="block"
items={fontOptions.map((option) => ({
label: (
<span style={{ fontFamily: option.fontName }}>
{option.label}
</span>
),
value: option.value,
}))}
alignment="left"
/>
{inContextFailed && (
<Typography
color="text-status-critical"
id="settings-general-interface-crowdin_in_context-failed"
}
/>
<SettingRow
title="settings-interface-appearance-font_size"
description="settings-interface-appearance-font_size-description"
controlWidth="wide"
control={
<NumberSelector
control={control}
name="textSize"
valueLabelFormat={(value) => `${Math.round(value)}pt`}
min={10}
max={15}
step={1}
/>
}
/>
</SettingsGroup>
<SettingsGroup title="settings-interface-appearance-language_group">
<SettingRow
title="settings-general-interface-lang"
description="settings-general-interface-lang-description"
controlWidth="wide"
control={<LangSelector alignment="left" display="block" />}
/>
{electron.isElectron && (
<SettingRow
title="settings-general-interface-crowdin_in_context"
description={
inContext
? 'settings-general-interface-crowdin_in_context-description-active'
: 'settings-general-interface-crowdin_in_context-description'
}
details={
inContextFailed && (
<Typography
color="text-status-critical"
id="settings-general-interface-crowdin_in_context-failed"
/>
)
}
control={
<Button
variant={inContext ? 'tertiary' : 'secondary'}
className="whitespace-nowrap"
id={
inContext
? 'settings-general-interface-crowdin_in_context-close'
: 'settings-general-interface-crowdin_in_context-enable'
}
onClick={() => setInContext(!inContext)}
/>
)}
</div>
<div className="grid sm:grid-cols-2 pb-4">
<Button
variant={inContext ? 'tertiary' : 'secondary'}
id={
inContext
? 'settings-general-interface-crowdin_in_context-close'
: 'settings-general-interface-crowdin_in_context-enable'
}
onClick={() => setInContext(!inContext)}
/>
</div>
</>
)}
</>
}
/>
)}
</SettingsGroup>
</div>
</SettingsPagePaneLayout>
</form>
);
@@ -1,9 +1,10 @@
import { Localized, useLocalization } from '@fluent/react';
import { Localized } from '@fluent/react';
import { useEffect } from 'react';
import { useForm } from 'react-hook-form';
import { CheckBox, CheckboxInternal } from '@/components/commons/Checkbox';
import { Typography } from '@/components/commons/Typography';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import { SettingRow, SettingsGroup } from '@/components/settings/SettingRow';
import { defaultConfig, useConfig } from '@/hooks/config';
import { ArrowRightLeftIcon } from '@/components/commons/icon/ArrowIcons';
import { NumberSelector } from '@/components/commons/NumberSelector';
@@ -31,7 +32,6 @@ interface BehaviorSettingsForm {
export function BehaviorSettings() {
const electron = useElectron();
const { l10n } = useLocalization();
const { currentLocales } = useLocaleConfig();
const { config, setConfig } = useConfig();
const errorReporting = useErrorReporting();
@@ -82,205 +82,126 @@ export function BehaviorSettings() {
return () => subscription.unsubscribe();
}, [onSubmit]);
const toggle = (name: keyof BehaviorSettingsForm) => ({
controlId: `behavior-${name}`,
control: (
<CheckBox
variant="toggle"
control={control}
name={name}
id={`behavior-${name}`}
/>
),
});
return (
<form className="flex flex-col gap-2 w-full">
<SettingsPagePaneLayout icon={<ArrowRightLeftIcon />}>
<>
<Typography variant="main-title">
{l10n.getString('settings-interface-behavior')}
</Typography>
<div className="pt-2">
<Typography variant="section-title">
{l10n.getString('settings-general-interface-feedback_sound')}
</Typography>
<div className="flex flex-col pt-1 pb-2">
<Typography>
{l10n.getString(
'settings-general-interface-feedback_sound-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-2 pb-4">
<CheckBox
variant="toggle"
control={control}
outlined
name="feedbackSound"
label={l10n.getString(
'settings-general-interface-feedback_sound-label'
)}
/>
</div>
<div className="grid sm:grid-cols-2 pb-4">
<NumberSelector
control={control}
name="feedbackSoundVolume"
label={l10n.getString(
'settings-general-interface-feedback_sound-volume'
)}
valueLabelFormat={(value) => percentageFormat.format(value)}
min={0.1}
max={1.0}
step={0.1}
/>
</div>
<Typography variant="section-title">
{l10n.getString(
'settings-general-interface-connected_trackers_warning'
)}
</Typography>
<div className="flex flex-col pt-1 pb-2">
<Typography>
{l10n.getString(
'settings-general-interface-connected_trackers_warning-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-2 pb-4">
<CheckBox
variant="toggle"
control={control}
outlined
name="connectedTrackersWarning"
label={l10n.getString(
'settings-general-interface-connected_trackers_warning-label'
)}
/>
</div>
{electron.isElectron && (
<>
<Typography variant="section-title">
{l10n.getString('settings-general-interface-use_tray')}
</Typography>
<div className="flex flex-col pt-1 pb-2">
<Typography>
{l10n.getString(
'settings-general-interface-use_tray-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-2 pb-4">
<CheckBox
variant="toggle"
<form className="w-full">
<SettingsPagePaneLayout
icon={<ArrowRightLeftIcon />}
title="settings-interface-behavior"
>
<div className="flex flex-col">
<SettingsGroup title="settings-interface-notifications">
<SettingRow
title="settings-general-interface-feedback_sound"
description="settings-general-interface-feedback_sound-description"
childrenDisabled={!watch('feedbackSound')}
{...toggle('feedbackSound')}
>
<SettingRow
title="settings-general-interface-feedback_sound-volume"
controlWidth="wide"
control={
<NumberSelector
control={control}
outlined
name="useTray"
label={l10n.getString(
'settings-general-interface-use_tray-label'
)}
name="feedbackSoundVolume"
valueLabelFormat={(value) => percentageFormat.format(value)}
min={0.1}
max={1.0}
step={0.1}
/>
</div>
</>
)}
<Typography variant="section-title">
{l10n.getString('settings-general-interface-discord_presence')}
</Typography>
<div className="flex flex-col pt-1 pb-2">
<Typography>
{l10n.getString(
'settings-general-interface-discord_presence-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-2 pb-4">
<CheckBox
variant="toggle"
control={control}
outlined
name="discordPresence"
label={l10n.getString(
'settings-general-interface-discord_presence-label'
)}
/>
</div>
<Typography variant="section-title">
{l10n.getString('settings-interface-behavior-controller_nav')}
</Typography>
<div className="flex flex-col pt-1 pb-2">
<Typography>
{l10n.getString(
'settings-interface-behavior-controller_nav-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-2 pb-4">
<CheckBox
variant="toggle"
control={control}
outlined
name="controllerNav"
label={l10n.getString(
'settings-interface-behavior-controller_nav-label'
)}
/>
</div>
<Typography variant="section-title">
{l10n.getString('settings-interface-behavior-error_tracking')}
</Typography>
<div className="flex flex-col pt-1 pb-2">
<Localized
id={'settings-interface-behavior-error_tracking-description_v2'}
elems={{
b: <b />,
}}
>
<Typography whitespace="whitespace-pre-line" />
</Localized>
</div>
<div className="grid sm:grid-cols-2 pb-4">
<CheckboxInternal
variant="toggle"
outlined
name="errorReporting"
label={l10n.getString(
'settings-interface-behavior-error_tracking-label'
)}
disabled={errorReporting.consent === null}
checked={
errorReporting.consent === ErrorReportingConsent.ALLOWED
}
onChange={(event) =>
errorReporting.answer(
event.currentTarget.checked
? ErrorReportingConsent.ALLOWED
: ErrorReportingConsent.DENIED
)
}
/>
</div>
</SettingRow>
<SettingRow
title="settings-general-interface-connected_trackers_warning"
description="settings-general-interface-connected_trackers_warning-description"
{...toggle('connectedTrackersWarning')}
/>
</SettingsGroup>
<SettingsGroup title="settings-interface-behavior-desktop_group">
{electron.isElectron && (
<>
<Typography variant="section-title">
{l10n.getString('settings-interface-behavior-bvh_directory')}
</Typography>
<div className="flex flex-col pt-1 pb-2">
<Localized
id={'settings-interface-behavior-bvh_directory-description'}
>
<Typography />
</Localized>
</div>
<div className="grid gap-3 pb-5">
<SettingRow
title="settings-general-interface-use_tray"
description="settings-general-interface-use_tray-description"
{...toggle('useTray')}
/>
)}
<SettingRow
title="settings-general-interface-discord_presence"
description="settings-general-interface-discord_presence-description"
{...toggle('discordPresence')}
/>
{electron.isElectron && (
<SettingRow
title="settings-interface-behavior-bvh_directory"
description="settings-interface-behavior-bvh_directory-description"
below={
<SystemFileInput
name="bvhDirectory"
rules={{
required: false,
}}
rules={{ required: false }}
control={control}
label="settings-interface-behavior-bvh_directory-label"
directory
compact
/>
</div>
</>
}
/>
)}
</div>
</>
</SettingsGroup>
<SettingsGroup title="settings-interface-behavior-input_group">
<SettingRow
title="settings-interface-behavior-controller_nav"
description="settings-interface-behavior-controller_nav-description"
{...toggle('controllerNav')}
/>
</SettingsGroup>
<SettingsGroup title="settings-interface-behavior-privacy_group">
<SettingRow
title="settings-interface-behavior-error_tracking-label"
details={
<Localized
id="settings-interface-behavior-error_tracking-description_v2"
elems={{ b: <b /> }}
>
<Typography whitespace="whitespace-pre-line" />
</Localized>
}
controlId="behavior-error-reporting"
control={
<CheckboxInternal
variant="toggle"
name="errorReporting"
id="behavior-error-reporting"
disabled={errorReporting.consent === null}
checked={
errorReporting.consent === ErrorReportingConsent.ALLOWED
}
onChange={(event) =>
errorReporting.answer(
event.currentTarget.checked
? ErrorReportingConsent.ALLOWED
: ErrorReportingConsent.DENIED
)
}
/>
}
/>
</SettingsGroup>
</div>
</SettingsPagePaneLayout>
</form>
);
@@ -36,6 +36,7 @@ import {
} from '@/components/commons/StatusBadge';
import { Typography } from '@/components/commons/Typography';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import { SettingsGroupLabel } from '@/components/settings/SettingRow';
import {
ArrowDownIcon,
ArrowUpIcon,
@@ -521,9 +522,8 @@ export function BoneRoutingSettings() {
setHandsWarning(null);
}}
/>
<SettingsPagePaneLayout icon={<RouterIcon />}>
<SettingsPagePaneLayout icon={<RouterIcon />} title="settings-routing">
<>
<Typography variant="main-title" id="settings-routing" />
<div className="flex flex-col pt-1 pb-4">
<Typography
id="settings-routing-description"
@@ -531,7 +531,7 @@ export function BoneRoutingSettings() {
/>
</div>
<Typography variant="section-title" id="settings-routing-mode" />
<SettingsGroupLabel id="settings-routing-mode" />
<div className="flex flex-col gap-2 pt-1 pb-5">
<Typography
id="settings-routing-mode-description"
@@ -547,8 +547,8 @@ export function BoneRoutingSettings() {
/>
</div>
<Typography variant="section-title" id="settings-routing-outputs" />
<div className="flex flex-col bg-background-80 px-4 py-2 mt-1 mb-3 rounded-md divide-y divide-background-60">
<SettingsGroupLabel id="settings-routing-outputs" />
<div className="flex flex-col bg-background-80 px-4 py-2 mt-2 mb-3 rounded-md divide-y divide-background-60">
{outputs.map((status) => (
<OutputStatusRow
key={status.output}
@@ -558,7 +558,7 @@ export function BoneRoutingSettings() {
))}
</div>
<Typography variant="section-title" id="settings-routing-bones" />
<SettingsGroupLabel id="settings-routing-bones" />
<div className="pt-1 pb-2">
<Typography id="settings-routing-bones-description" />
</div>
@@ -1,12 +1,13 @@
import { CheckIcon } from '@/components/commons/icon/CheckIcon';
import { Typography } from '@/components/commons/Typography';
import { Checklist } from '@/components/commons/icon/ChecklistIcon';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import { TrackingChecklistSettings } from './components/TrackingChecklistSettings';
export function ChecklistSettings() {
return (
<SettingsPagePaneLayout icon={<CheckIcon size={18} />}>
<Typography variant="main-title" id="tracking_checklist" />
<SettingsPagePaneLayout
icon={<Checklist size={22} />}
title="tracking_checklist"
>
<TrackingChecklistSettings variant="settings" />
</SettingsPagePaneLayout>
);
@@ -1,4 +1,3 @@
import { useLocalization } from '@fluent/react';
import { useEffect, useState } from 'react';
import { DefaultValues, useForm } from 'react-hook-form';
import { Button } from '@/components/commons/Button';
@@ -20,6 +19,12 @@ import {
} from '@/components/commons/StatusBadge';
import { Typography } from '@/components/commons/Typography';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import {
SettingRow,
SettingsAdvanced,
SettingsGroup,
SettingsGroupLabel,
} from '@/components/settings/SettingRow';
import { SteamIcon } from '@/components/commons/icon/SteamIcon';
type DriverForm = {
@@ -68,10 +73,7 @@ function StatusCard({ status }: { status: DriverStatusChangeResponseT }) {
/>
}
>
<Typography
color="secondary"
id={`settings-driver-status-connection-${badge}`}
/>
<Typography id={`settings-driver-status-connection-${badge}`} />
</StatusRow>
</div>
);
@@ -84,7 +86,6 @@ export function DriverSettings() {
const [status, setStatus] = useState<DriverStatusChangeResponseT | null>(
null
);
const { l10n } = useLocalization();
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const { control, watch, handleSubmit, getValues, reset } =
@@ -138,61 +139,70 @@ export function DriverSettings() {
);
return (
<SettingsPagePaneLayout icon={<SteamIcon size={24} />}>
<>
<Typography variant="main-title">SteamVR / Monado</Typography>
<div className="flex flex-col pt-1 pb-4">
<SettingsPagePaneLayout
icon={<SteamIcon size={24} />}
title="settings-sidebar-driver"
>
<div className="flex flex-col">
<div className="pb-4 max-w-[75ch]">
<Typography id="settings-driver-description" />
</div>
<Typography variant="section-title" id="settings-driver-enable" />
<div className="flex flex-col pt-1 pb-2">
<Typography id="settings-driver-enable-description" />
</div>
<div className="grid grid-cols-2 gap-3 pb-5">
<CheckBox
variant="toggle"
outlined
control={control}
name="enabled"
label={l10n.getString('settings-driver-enable-label')}
<SettingsGroup title="settings-driver-output_group">
<SettingRow
title="settings-driver-enable"
description="settings-driver-enable-description"
controlId="driver-enabled"
control={
<CheckBox
variant="toggle"
control={control}
name="enabled"
id="driver-enabled"
/>
}
/>
</div>
<SettingRow
title="settings-driver-bones"
description="settings-driver-bones-description"
control={
<Button
variant="secondary"
className="whitespace-nowrap"
to="/settings/routing"
id="settings-driver-bones-link"
/>
}
/>
</SettingsGroup>
{enabled && status && (
<>
<Typography
variant="section-title"
id="settings-driver-status-title"
/>
<div className="flex flex-col gap-2 mt-8 min-w-0">
<div className="px-3 xs:px-4">
<SettingsGroupLabel id="settings-driver-status-title" />
</div>
<StatusCard status={status} />
</>
</div>
)}
<Typography variant="section-title" id="settings-driver-bones" />
<div className="flex flex-col gap-2 pt-1 pb-4">
<Typography id="settings-driver-bones-description" />
<div className="w-fit">
<Button
variant="secondary"
to="/settings/routing"
id="settings-driver-bones-link"
<SettingsAdvanced>
<SettingsGroup title="settings-driver-data_group">
<SettingRow
title="settings-driver-velocity"
description="settings-driver-velocity-description"
controlId="driver-velocity"
control={
<CheckBox
variant="toggle"
control={control}
name="sendVelocity"
id="driver-velocity"
/>
}
/>
</div>
</div>
<Typography variant="section-title" id="settings-driver-velocity" />
<div className="pt-1 pb-2">
<Typography id="settings-driver-velocity-description" />
</div>
<CheckBox
variant="toggle"
outlined
control={control}
name="sendVelocity"
label={l10n.getString('settings-driver-velocity')}
/>
</>
</SettingsGroup>
</SettingsAdvanced>
</div>
</SettingsPagePaneLayout>
);
}
@@ -1,12 +1,10 @@
import { HomeIcon } from '@/components/commons/icon/HomeIcon';
import { Typography } from '@/components/commons/Typography';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import { HomeLayoutSettings } from './components/HomeLayoutSettings';
export function HomeScreenSettings() {
return (
<SettingsPagePaneLayout icon={<HomeIcon />}>
<Typography variant="main-title" id="home-settings" />
<SettingsPagePaneLayout icon={<HomeIcon />} title="home-settings">
<HomeLayoutSettings variant="settings" />
</SettingsPagePaneLayout>
);
@@ -1,6 +1,6 @@
import { KeybindRecorderModal } from '@/components/commons/KeybindRecorderModal';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import { WrenchIcon } from '@/components/commons/icon/WrenchIcon';
import { KeyboardIcon } from '@/components/commons/icon/KeyboardIcon';
import { WarningIcon } from '@/components/commons/icon/WarningIcon';
import { Typography } from '@/components/commons/Typography';
import { useLocalization } from '@fluent/react';
@@ -269,10 +269,12 @@ export function KeybindSettings() {
}, [watch]);
return (
<SettingsPagePaneLayout icon={<WrenchIcon />}>
<SettingsPagePaneLayout
icon={<KeyboardIcon size={20} />}
title="settings-keybinds"
>
<div className="flex flex-col gap-4">
<div>
<Typography variant="main-title" id="settings-keybinds" />
<div className="flex flex-col pt-2 text-background-30">
{l10n
.getString('settings-keybinds-description')
@@ -10,6 +10,11 @@ import { Typography } from '@/components/commons/Typography';
import { MountingMethodRadio } from '@/components/mounting/MountingMethodRadio';
import { ArmsMountingResetMode, MountingMethod } from 'solarxr-protocol';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import {
SettingRow,
SettingsAdvanced,
SettingsGroup,
} from '@/components/settings/SettingRow';
import { FullResetIcon } from '@/components/commons/icon/ResetIcon';
import { TapDetectionSettings } from './components/TapDetectionSettings';
@@ -72,171 +77,132 @@ export function ResetsSettings() {
}, [settings]);
return (
<SettingsPagePaneLayout icon={<FullResetIcon width={20} />}>
<div className="flex flex-col pb-3">
<Typography variant="main-title" id="settings-sidebar-resets" />
</div>
<div className="flex flex-col pt-5 gap-1">
<Typography
variant="section-title"
id="settings-general-mounting_method"
/>
<Typography id="settings-general-mounting_method-description" />
<MountingMethodRadio />
</div>
{isPoseMounting && (
<>
<div className="flex flex-col pt-5 pb-2 gap-1">
<Typography variant="section-title">
{l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-description'
)}
</Typography>
<div className="grid md:grid-cols-3 gap-3">
<Radio
control={control}
name="armsMountingResetMode"
label={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-back'
)}
description={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-back-description'
)}
value={ArmsMountingResetMode.BACK}
/>
<Radio
control={control}
name="armsMountingResetMode"
label={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-forward'
)}
description={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-forward-description'
)}
value={ArmsMountingResetMode.FORWARD}
/>
<Radio
control={control}
name="armsMountingResetMode"
label={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-t_pose'
)}
description={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-t_pose-description'
)}
value={ArmsMountingResetMode.SIDE}
/>
</div>
</div>
<div className="flex flex-col gap-1 pt-5">
<Typography variant="section-title">
{l10n.getString(
'settings-general-fk_settings-leg_fk-reset_mounting_feet-v1'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-fk_settings-leg_fk-reset_mounting_feet-description-v1'
)}
</Typography>
<CheckBox
variant="toggle"
outlined
control={control}
name="resetMountingFeet"
label={l10n.getString(
'settings-general-fk_settings-leg_fk-reset_mounting_feet-v1'
)}
/>
</div>
</>
)}
<div className="flex flex-col pt-5 gap-1">
<Typography variant="section-title">
{l10n.getString(
'settings-general-tracker_mechanics-yaw-reset-smooth-time'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-tracker_mechanics-yaw-reset-smooth-time-description'
)}
</Typography>
<NumberSelector
control={control}
name="yawResetSmoothTime"
valueLabelFormat={(value) => secondsFormat.format(value)}
min={0.0}
max={0.5}
step={0.05}
/>
</div>
<div className="flex flex-col pt-5 gap-1">
<Typography variant="section-title">
{l10n.getString(
'settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude-description'
)}
</Typography>
<CheckBox
variant="toggle"
outlined
control={control}
name="resetReliableReferenceAttitude"
label={l10n.getString(
'settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude'
)}
/>
</div>
<div className="flex flex-col pt-5 gap-1">
<Typography variant="section-title">
{l10n.getString(
'settings-general-tracker_mechanics-save_mounting_reset'
)}
</Typography>
<Localized
id="settings-general-tracker_mechanics-save_mounting_reset-description"
elems={{ b: <b /> }}
<SettingsPagePaneLayout
icon={<FullResetIcon width={20} />}
title="settings-sidebar-resets"
>
<div className="flex flex-col">
<SettingsGroup
title="settings-general-mounting_method"
description="settings-general-mounting_method-description"
>
<Typography />
</Localized>
<CheckBox
variant="toggle"
outlined
control={control}
name="saveMountingReset"
label={l10n.getString(
'settings-general-tracker_mechanics-save_mounting_reset-enabled-label'
<div className="p-3 xs:p-4">
<MountingMethodRadio />
</div>
{isPoseMounting && (
<>
<SettingRow
title="settings-general-fk_settings-arms_mounting_reset_mode"
description="settings-general-fk_settings-arms_mounting_reset_mode-description"
>
<div className="grid md:grid-cols-3 gap-3">
<Radio
control={control}
name="armsMountingResetMode"
label={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-back'
)}
description={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-back-description'
)}
value={ArmsMountingResetMode.BACK}
/>
<Radio
control={control}
name="armsMountingResetMode"
label={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-forward'
)}
description={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-forward-description'
)}
value={ArmsMountingResetMode.FORWARD}
/>
<Radio
control={control}
name="armsMountingResetMode"
label={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-t_pose'
)}
description={l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode-t_pose-description'
)}
value={ArmsMountingResetMode.SIDE}
/>
</div>
</SettingRow>
<SettingRow
title="settings-general-fk_settings-leg_fk-reset_mounting_feet-v1"
description="settings-general-fk_settings-leg_fk-reset_mounting_feet-description-v1"
controlId="resets-mounting-feet"
control={
<CheckBox
variant="toggle"
control={control}
name="resetMountingFeet"
id="resets-mounting-feet"
/>
}
/>
</>
)}
/>
</div>
</SettingsGroup>
<TapDetectionSettings />
<TapDetectionSettings />
<SettingsAdvanced>
<SettingsGroup title="settings-general-fk_settings-reset_behaviour_group">
<SettingRow
title="settings-general-tracker_mechanics-yaw-reset-smooth-time"
description="settings-general-tracker_mechanics-yaw-reset-smooth-time-description"
controlWidth="wide"
control={
<NumberSelector
control={control}
name="yawResetSmoothTime"
valueLabelFormat={(value) => secondsFormat.format(value)}
min={0.0}
max={0.5}
step={0.05}
/>
}
/>
<SettingRow
title="settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude"
description="settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude-description"
controlId="resets-hmd-attitude"
control={
<CheckBox
variant="toggle"
control={control}
name="resetReliableReferenceAttitude"
id="resets-hmd-attitude"
/>
}
/>
<SettingRow
title="settings-general-tracker_mechanics-save_mounting_reset"
details={
<Localized
id="settings-general-tracker_mechanics-save_mounting_reset-description"
elems={{ b: <b /> }}
>
<Typography />
</Localized>
}
controlId="resets-save-mounting"
control={
<CheckBox
variant="toggle"
control={control}
name="saveMountingReset"
id="resets-save-mounting"
/>
}
/>
</SettingsGroup>
</SettingsAdvanced>
</div>
</SettingsPagePaneLayout>
);
}
@@ -11,6 +11,11 @@ import { Button } from '@/components/commons/Button';
import { CheckBox } from '@/components/commons/Checkbox';
import { Typography } from '@/components/commons/Typography';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import {
SettingRow,
SettingsAdvanced,
SettingsGroup,
} from '@/components/settings/SettingRow';
import { HorizontalAlignIcon } from '@/components/commons/icon/HorizontalAlignIcon';
import { useAtomValue, atom, useSetAtom } from 'jotai';
import { selectAtom } from 'jotai/utils';
@@ -110,8 +115,12 @@ ${trackers
};
return (
<Button variant="primary" onClick={copySettings}>
{l10n.getString('settings-stay_aligned-debug-copy-label')}
<Button
variant="secondary"
className="whitespace-nowrap"
onClick={copySettings}
>
{l10n.getString('settings-stay_aligned-debug-copy-short')}
</Button>
);
}
@@ -119,7 +128,6 @@ ${trackers
export function StayAlignedSettings() {
const setSettings = useSetAtom(stayAlignedSettingsAtom);
const settings = useAtomValue(stayAlignedSettingsValueAtom);
const { l10n } = useLocalization();
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const { control, watch, handleSubmit, getValues, reset } =
@@ -207,126 +215,112 @@ export function StayAlignedSettings() {
const openSitting = useState(false);
const openFlat = useState(false);
const poses = [
{
id: 'standing',
name: 'standingEnabled' as const,
hasPose: hasStandingPose,
open: openStanding,
modal: <StandingRelaxedPoseModal open={openStanding} />,
},
{
id: 'sitting',
name: 'sittingEnabled' as const,
hasPose: hasSittingPose,
open: openSitting,
modal: <SittingRelaxedPoseModal open={openSitting} />,
},
{
id: 'flat',
name: 'flatEnabled' as const,
hasPose: hasFlatPose,
open: openFlat,
modal: <FlatRelaxedPoseModal open={openFlat} />,
},
];
return (
<SettingsPagePaneLayout icon={<HorizontalAlignIcon />}>
<Typography variant="main-title" id="settings-sidebar-stay_aligned" />
<div className="pt-3">
<Typography>
{l10n.getString('settings-stay_aligned-description')}
</Typography>
<Typography>
{l10n.getString('settings-stay_aligned-setup-description')}
</Typography>
<div className="flex pt-2">
<Button
variant="primary"
to="/onboarding/stay-aligned"
state={{ alonePage: true }}
>
{l10n.getString('settings-stay_aligned-setup-label')}
</Button>
<SettingsPagePaneLayout
icon={<HorizontalAlignIcon />}
title="settings-sidebar-stay_aligned"
>
<div className="flex flex-col">
<div className="flex flex-col gap-1 pb-4 max-w-[75ch]">
<Typography id="settings-stay_aligned-description" />
<Typography id="settings-stay_aligned-setup-description" />
</div>
</div>
<div className="pt-6">
<Typography variant="section-title">
{l10n.getString('settings-stay_aligned-general-label')}
</Typography>
<div className="pt-2">
<CheckBox
variant="toggle"
outlined
control={control}
name="enabled"
label={l10n.getString('settings-stay_aligned-enabled-label')}
disabled={!config.setupComplete}
<SettingsGroup title="settings-stay_aligned-setup_group">
<SettingRow
title="settings-stay_aligned-setup-label"
control={
<Button
variant="primary"
to="/onboarding/stay-aligned"
state={{ alonePage: true }}
id="settings-stay_aligned-setup-open"
/>
}
/>
</div>
</div>
<div className="pt-6">
<Typography variant="section-title">
{l10n.getString('settings-stay_aligned-relaxed_poses-label')}
</Typography>
<div className="pt-1">
<Typography>
{l10n.getString('settings-stay_aligned-relaxed_poses-description')}
</Typography>
</div>
<div className="grid sm:grid-cols-1 gap-3 pt-2">
<div className="flex gap-2">
<CheckBox
variant="toggle"
outlined
control={control}
name="standingEnabled"
label={l10n.getString(
'settings-stay_aligned-relaxed_poses-standing'
)}
disabled={!config.setupComplete || !hasStandingPose}
/>
<StandingRelaxedPoseModal open={openStanding} />
<Localized id="settings-stay_aligned-relaxed_poses-save_pose">
<Button
variant="primary"
className="w-full max-w-32"
disabled={!config.setupComplete}
onClick={() => openStanding[1](true)}
<SettingRow
title="settings-stay_aligned-enabled-label"
disabled={!config.setupComplete}
disabledReason="settings-stay_aligned-setup-description"
controlId="stay-aligned-enabled"
control={
<CheckBox
variant="toggle"
control={control}
name="enabled"
id="stay-aligned-enabled"
/>
</Localized>
</div>
<div className="flex gap-2">
<CheckBox
variant="toggle"
outlined
control={control}
name="sittingEnabled"
label={l10n.getString(
'settings-stay_aligned-relaxed_poses-sitting'
)}
disabled={!config.setupComplete || !hasSittingPose}
}
/>
</SettingsGroup>
<SettingsGroup
title="settings-stay_aligned-relaxed_poses-label"
description="settings-stay_aligned-relaxed_poses-description"
>
{poses.map(({ id, name, hasPose, open, modal }) => (
<SettingRow
key={id}
title={`settings-stay_aligned-relaxed_poses-${id}`}
disabled={!config.setupComplete}
disabledReason="settings-stay_aligned-setup-description"
controlId={`stay-aligned-${id}`}
control={
<div className="flex gap-2 items-center">
{modal}
<Localized id="settings-stay_aligned-relaxed_poses-save_pose">
<Button
variant="secondary"
className="whitespace-nowrap"
onClick={() => open[1](true)}
/>
</Localized>
<CheckBox
variant="toggle"
control={control}
name={name}
id={`stay-aligned-${id}`}
disabled={!config.setupComplete || !hasPose}
/>
</div>
}
/>
<SittingRelaxedPoseModal open={openSitting} />
<Localized id="settings-stay_aligned-relaxed_poses-save_pose">
<Button
variant="primary"
className="w-full max-w-32"
disabled={!config.setupComplete}
onClick={() => openSitting[1](true)}
/>
</Localized>
</div>
<div className="flex gap-2">
<CheckBox
variant="toggle"
outlined
control={control}
name="flatEnabled"
label={l10n.getString('settings-stay_aligned-relaxed_poses-flat')}
disabled={!config.setupComplete || !hasFlatPose}
))}
</SettingsGroup>
<SettingsAdvanced>
<SettingsGroup title="settings-stay_aligned-debug-label">
<SettingRow
title="settings-stay_aligned-debug-copy-label"
description="settings-stay_aligned-debug-description"
control={<CopySettingsButton values={values} />}
/>
<FlatRelaxedPoseModal open={openFlat} />
<Localized id="settings-stay_aligned-relaxed_poses-save_pose">
<Button
variant="primary"
className="w-full max-w-32"
disabled={!config.setupComplete}
onClick={() => openFlat[1](true)}
/>
</Localized>
</div>
</div>
</div>
<div className="pt-6">
<Typography variant="section-title">
{l10n.getString('settings-stay_aligned-debug-label')}
</Typography>
<div className="pt-1">
<Typography>
{l10n.getString('settings-stay_aligned-debug-description')}
</Typography>
</div>
<div className="pt-2">
<CopySettingsButton values={values} />
</div>
</SettingsGroup>
</SettingsAdvanced>
</div>
</SettingsPagePaneLayout>
);
@@ -1,5 +1,8 @@
import { Typography } from '@/components/commons/Typography';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import {
SettingsAdvanced,
SettingsGroup,
} from '@/components/settings/SettingRow';
import { WrenchIcon } from '@/components/commons/icon/WrenchIcon';
import { MagnetometerToggleSetting } from './components/MagnetometerToggleSetting';
import { TimeoutSettings } from './components/TimeoutSettings';
@@ -7,14 +10,22 @@ import { HIDSettings } from './components/HIDSettings';
export function TrackersSettings() {
return (
<SettingsPagePaneLayout icon={<WrenchIcon />}>
<div className="flex flex-col pb-3">
<Typography variant="main-title" id="settings-sidebar-trackers" />
</div>
<SettingsPagePaneLayout
icon={<WrenchIcon />}
title="settings-sidebar-trackers"
>
<div className="flex flex-col">
<SettingsGroup title="settings-general-tracker_mechanics-magnetometer_group">
<MagnetometerToggleSetting settingType="general" />
</SettingsGroup>
<MagnetometerToggleSetting settingType="general" />
<TimeoutSettings />
<HIDSettings />
<SettingsAdvanced>
<SettingsGroup title="settings-general-tracker_mechanics-connection_group">
<TimeoutSettings />
<HIDSettings />
</SettingsGroup>
</SettingsAdvanced>
</div>
</SettingsPagePaneLayout>
);
}
@@ -1,6 +1,6 @@
import { useLocalization } from '@fluent/react';
import { useEffect } from 'react';
import { DefaultValues, useForm } from 'react-hook-form';
import { DefaultValues, FieldPath, useForm } from 'react-hook-form';
import {
ChangeSkeletonSettingsRequestT,
FilteringType,
@@ -18,6 +18,11 @@ import { NumberSelector } from '@/components/commons/NumberSelector';
import { Radio } from '@/components/commons/Radio';
import { Typography } from '@/components/commons/Typography';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import {
SettingRow,
SettingsAdvanced,
SettingsGroup,
} from '@/components/settings/SettingRow';
import { atom, useAtomValue, useSetAtom } from 'jotai';
import { isEqual } from '@react-hookz/deep-equal';
import { selectAtom } from 'jotai/utils';
@@ -182,19 +187,44 @@ export function TrackingSettings() {
}
);
const filteringEnabled = watch('filtering.type') !== FilteringType.NONE;
const skatingCorrection = watch('toggles.skatingCorrection');
const stepper = (name: FieldPath<SkeletonForm>, min = 0.0) => ({
controlWidth: 'wide' as const,
control: (
<NumberSelector
control={control}
name={name}
valueLabelFormat={(value) => percentageFormat.format(value)}
min={min}
max={1.0}
step={0.05}
/>
),
});
const toggle = (name: FieldPath<SkeletonForm>) => ({
controlId: `tracking-${name}`,
control: (
<CheckBox
variant="toggle"
control={control}
name={name}
id={`tracking-${name}`}
/>
),
});
return (
<SettingsPagePaneLayout icon={<MartialArtsIcon />}>
<>
<Typography variant="main-title" id="settings-sidebar-tracking" />
<div className="flex flex-col pt-3">
<Typography variant="section-title">
{l10n.getString('settings-general-tracker_mechanics-filtering')}
</Typography>
</div>
<div className="flex flex-col pt-1 pb-3">
{l10n
<SettingsPagePaneLayout
icon={<MartialArtsIcon />}
title="settings-sidebar-tracking"
>
<div className="flex flex-col">
<SettingsGroup
title="settings-general-tracker_mechanics-filtering"
details={l10n
.getString(
'settings-general-tracker_mechanics-filtering-description'
)
@@ -202,283 +232,124 @@ export function TrackingSettings() {
.map((line, i) => (
<Typography key={i}>{line}</Typography>
))}
</div>
<Typography bold>
{l10n.getString('settings-general-tracker_mechanics-filtering-type')}
</Typography>
<div className="flex md:flex-row flex-col gap-3 pt-2">
<Radio
control={control}
name="filtering.type"
label={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-none'
)}
description={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-none-description'
)}
value={FilteringType.NONE}
/>
<Radio
control={control}
name="filtering.type"
label={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-smoothing'
)}
description={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-smoothing-description'
)}
value={FilteringType.SMOOTHING}
/>
<Radio
control={control}
name="filtering.type"
label={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-prediction'
)}
description={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-prediction-description'
)}
value={FilteringType.PREDICTION}
/>
</div>
<div className="flex pt-3 md:flex-row flex-col">
<NumberSelector
control={control}
name="filtering.amount"
label={l10n.getString(
'settings-general-tracker_mechanics-filtering-amount'
)}
valueLabelFormat={(value) => percentageFormat.format(value)}
min={0.0}
max={1.0}
step={0.05}
/>
</div>
>
<div className="flex md:flex-row flex-col gap-3 p-4">
<Radio
control={control}
name="filtering.type"
label={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-none'
)}
description={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-none-description'
)}
value={FilteringType.NONE}
/>
<Radio
control={control}
name="filtering.type"
label={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-smoothing'
)}
description={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-smoothing-description'
)}
value={FilteringType.SMOOTHING}
/>
<Radio
control={control}
name="filtering.type"
label={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-prediction'
)}
description={l10n.getString(
'settings-general-tracker_mechanics-filtering-type-prediction-description'
)}
value={FilteringType.PREDICTION}
/>
</div>
{filteringEnabled && (
<SettingRow
title="settings-general-tracker_mechanics-filtering-amount"
{...stepper('filtering.amount')}
/>
)}
</SettingsGroup>
<div className="flex flex-col pt-6 pb-2 gap-1">
<Typography variant="section-title">
{l10n.getString(
'settings-general-fk_settings-leg_tweak-skating_correction'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-fk_settings-leg_tweak-skating_correction-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-1 gap-2">
<CheckBox
variant="toggle"
outlined
control={control}
name="toggles.skatingCorrection"
label={l10n.getString(
'settings-general-fk_settings-leg_tweak-skating_correction'
)}
<SettingsGroup title="settings-general-fk_settings-leg_fk">
<SettingRow
title="settings-general-fk_settings-leg_tweak-floor_clip"
description="settings-general-fk_settings-leg_tweak-floor_clip-description"
{...toggle('toggles.floorClip')}
/>
<NumberSelector
control={control}
name="ratios.skatingCorrectionStrength"
label={l10n.getString(
'settings-general-fk_settings-leg_tweak-skating_correction-amount'
)}
valueLabelFormat={(value) => percentageFormat.format(value)}
min={0.1}
max={1.0}
step={0.1}
<SettingRow
title="settings-general-fk_settings-leg_tweak-foot_plant"
description="settings-general-fk_settings-leg_tweak-foot_plant-description"
{...toggle('toggles.footPlant')}
/>
</div>
<SettingRow
title="settings-general-fk_settings-leg_tweak-toe_snap"
description="settings-general-fk_settings-leg_tweak-toe_snap-description"
{...toggle('toggles.toeSnap')}
/>
<SettingRow
title="settings-general-fk_settings-leg_tweak-skating_correction"
description="settings-general-fk_settings-leg_tweak-skating_correction-description"
childrenDisabled={!skatingCorrection}
{...toggle('toggles.skatingCorrection')}
>
<SettingRow
title="settings-general-fk_settings-leg_tweak-skating_correction-amount"
{...stepper('ratios.skatingCorrectionStrength', 0.1)}
/>
</SettingRow>
</SettingsGroup>
<div className="flex flex-col pt-6 pb-1">
<Typography variant="section-title">
{l10n.getString('settings-general-fk_settings-leg_fk')}
</Typography>
</div>
<div className="grid sm:grid-cols-1 pb-2">
<Typography>
{l10n.getString(
'settings-general-fk_settings-leg_tweak-floor_clip-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-1">
<CheckBox
variant="toggle"
outlined
control={control}
name="toggles.floorClip"
label={l10n.getString(
'settings-general-fk_settings-leg_tweak-floor_clip'
)}
<SettingsGroup title="settings-general-fk_settings-position_group">
<SettingRow
title="settings-general-fk_settings-ik"
description="settings-general-fk_settings-ik-use_position-description"
{...toggle('toggles.useTrackerPositions')}
/>
</div>
<div className="flex flex-col pt-5 pb-2">
<Typography>
{l10n.getString(
'settings-general-fk_settings-leg_tweak-foot_plant-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-1">
<CheckBox
variant="toggle"
outlined
control={control}
name="toggles.footPlant"
label={l10n.getString(
'settings-general-fk_settings-leg_tweak-foot_plant'
)}
<SettingRow
title="settings-general-fk_settings-self_localization-title"
description="settings-general-fk_settings-self_localization-description"
{...toggle('toggles.mocapMode')}
/>
</div>
<div className="flex flex-col pt-5">
<Typography>
{l10n.getString(
'settings-general-fk_settings-leg_tweak-toe_snap-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-1 gap-3 pt-2">
<CheckBox
variant="toggle"
outlined
control={control}
name="toggles.toeSnap"
label={l10n.getString(
'settings-general-fk_settings-leg_tweak-toe_snap'
)}
/>
</div>
</SettingsGroup>
<div className="flex flex-col pt-5">
<Typography variant="section-title">
{l10n.getString(
'settings-general-fk_settings-enforce_joint_constraints'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-fk_settings-enforce_joint_constraints-enforce_constraints-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-1 pt-2">
<CheckBox
variant="toggle"
outlined
control={control}
name="toggles.enforceConstraints"
label={l10n.getString(
'settings-general-fk_settings-enforce_joint_constraints-enforce_constraints'
)}
/>
</div>
<SettingsAdvanced>
<SettingsGroup title="settings-general-fk_settings-constraints_group">
<SettingRow
title="settings-general-fk_settings-enforce_joint_constraints"
description="settings-general-fk_settings-enforce_joint_constraints-enforce_constraints-description"
{...toggle('toggles.enforceConstraints')}
/>
</SettingsGroup>
<div className="flex flex-col pt-5">
<Typography variant="section-title">
{l10n.getString('settings-general-fk_settings-ik')}
</Typography>
<Typography>
{l10n.getString(
'settings-general-fk_settings-ik-use_position-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-1 pt-2">
<CheckBox
variant="toggle"
outlined
control={control}
name="toggles.useTrackerPositions"
label={l10n.getString(
'settings-general-fk_settings-ik-use_position'
)}
/>
</div>
<div className="flex flex-col pt-5">
<Typography variant="section-title">
{l10n.getString(
'settings-general-fk_settings-self_localization-title'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-fk_settings-self_localization-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-1 pt-2">
<CheckBox
variant="toggle"
outlined
control={control}
name="toggles.mocapMode"
label={l10n.getString(
'settings-general-fk_settings-self_localization-title'
)}
/>
</div>
<div className="flex flex-col pt-5">
<Typography variant="section-title">
{l10n.getString(
'settings-general-fk_settings-skeleton_settings-ratios'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-fk_settings-skeleton_settings-ratios-description'
)}
</Typography>
</div>
<div className="grid sm:grid-cols-2 gap-3 pt-2">
<NumberSelector
control={control}
name="ratios.imputeSpineFromUpperToLower"
label={l10n.getString(
'settings-general-fk_settings-skeleton_settings-impute_spine_from_upper_to_lower'
)}
valueLabelFormat={(value) => percentageFormat.format(value)}
min={0.0}
max={1.0}
step={0.05}
/>
<NumberSelector
control={control}
name="ratios.imputeSpineCurvature"
label={l10n.getString(
'settings-general-fk_settings-skeleton_settings-impute_spine_curvature'
)}
valueLabelFormat={(value) => percentageFormat.format(value)}
min={0.0}
max={1.0}
step={0.05}
/>
<NumberSelector
control={control}
name="ratios.interpolateHipWithUpperLegs"
label={l10n.getString(
'settings-general-fk_settings-skeleton_settings-interpolate_hip_with_upper_legs'
)}
valueLabelFormat={(value) => percentageFormat.format(value)}
min={0.0}
max={1.0}
step={0.05}
/>
<NumberSelector
control={control}
name="ratios.interpolateUpperLegsTwistWithLowerLegs"
label={l10n.getString(
'settings-general-fk_settings-skeleton_settings-interpolate_upper_legs_twist_with_lower_legs'
)}
valueLabelFormat={(value) => percentageFormat.format(value)}
min={0.0}
max={1.0}
step={0.05}
/>
</div>
</>
<SettingsGroup
title="settings-general-fk_settings-skeleton_settings-ratios"
description="settings-general-fk_settings-skeleton_settings-ratios-description"
>
<SettingRow
title="settings-general-fk_settings-skeleton_settings-impute_spine_from_upper_to_lower"
{...stepper('ratios.imputeSpineFromUpperToLower')}
/>
<SettingRow
title="settings-general-fk_settings-skeleton_settings-impute_spine_curvature"
{...stepper('ratios.imputeSpineCurvature')}
/>
<SettingRow
title="settings-general-fk_settings-skeleton_settings-interpolate_hip_with_upper_legs"
{...stepper('ratios.interpolateHipWithUpperLegs')}
/>
<SettingRow
title="settings-general-fk_settings-skeleton_settings-interpolate_upper_legs_twist_with_lower_legs"
{...stepper('ratios.interpolateUpperLegsTwistWithLowerLegs')}
/>
</SettingsGroup>
</SettingsAdvanced>
</div>
</SettingsPagePaneLayout>
);
}
@@ -29,6 +29,12 @@ import {
import { Typography } from '@/components/commons/Typography';
import { magic } from '@/utils/formatting';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import {
SettingRow,
SettingsAdvanced,
SettingsGroup,
SettingsGroupLabel,
} from '@/components/settings/SettingRow';
import { error } from '@/utils/logging';
import {
OSCPortsAddress,
@@ -208,32 +214,22 @@ function StatusCard({ status }: { status: VMCOSCStatusChangeResponseT }) {
}
>
{inputState === VMCOSCInputState.IDLE ? (
<Typography
color="secondary"
id="settings-osc-vmc-status-input-idle"
/>
<Typography id="settings-osc-vmc-status-input-idle" />
) : (
<>
<Typography
color="secondary"
id="settings-osc-vmc-status-input-listening"
vars={{ port: status.inputPort?.toString() ?? 'null' }}
/>
{inputState === VMCOSCInputState.ERROR && status.inputError ? (
<Typography color="secondary">
{status.inputError?.toString() ?? ''}
</Typography>
<Typography>{status.inputError?.toString() ?? ''}</Typography>
) : lastInputElapsed ? (
<Typography
color="secondary"
id="settings-osc-vmc-status-input-last-data"
vars={{ elapsed: lastInputElapsed }}
/>
) : (
<Typography
color="secondary"
id="settings-osc-vmc-status-input-no-data"
/>
<Typography id="settings-osc-vmc-status-input-no-data" />
)}
</>
)}
@@ -251,7 +247,6 @@ function StatusCard({ status }: { status: VMCOSCStatusChangeResponseT }) {
{outputState === VMCOSCOutputState.IDLE ? (
status.targetAddress ? (
<Typography
color="secondary"
id="settings-osc-vmc-status-output-waiting"
vars={{
address: status.targetAddress.toString(),
@@ -259,15 +254,11 @@ function StatusCard({ status }: { status: VMCOSCStatusChangeResponseT }) {
}}
/>
) : (
<Typography
color="secondary"
id="settings-osc-vmc-status-output-idle"
/>
<Typography id="settings-osc-vmc-status-output-idle" />
)
) : (
<>
<Typography
color="secondary"
id={
outputState === VMCOSCOutputState.READY
? 'settings-osc-vmc-status-output-sending'
@@ -279,20 +270,14 @@ function StatusCard({ status }: { status: VMCOSCStatusChangeResponseT }) {
}}
/>
{outputState === VMCOSCOutputState.ERROR && status.outputError ? (
<Typography color="secondary">
{status.outputError?.toString() ?? ''}
</Typography>
<Typography>{status.outputError?.toString() ?? ''}</Typography>
) : lastFrameElapsed ? (
<Typography
color="secondary"
id="settings-osc-vmc-status-output-last-frame"
vars={{ elapsed: lastFrameElapsed }}
/>
) : (
<Typography
color="secondary"
id="settings-osc-vmc-status-output-no-frame"
/>
<Typography id="settings-osc-vmc-status-output-no-frame" />
)}
</>
)}
@@ -308,12 +293,9 @@ function StatusCard({ status }: { status: VMCOSCStatusChangeResponseT }) {
badge={<VmcBadge badge={VRM_BADGES[vrmState]} />}
>
{vrmState === VMCOSCVrmState.ERROR && status.vrmError ? (
<Typography color="secondary">
{status.vrmError?.toString() ?? ''}
</Typography>
<Typography>{status.vrmError?.toString() ?? ''}</Typography>
) : (
<Typography
color="secondary"
id={
vrmState === VMCOSCVrmState.LOADED
? 'settings-osc-vmc-status-vrm-loaded'
@@ -406,164 +388,153 @@ export function VMCSettings() {
);
return (
<form className="flex flex-col gap-2 w-full">
<SettingsPagePaneLayout icon={<VMCIcon />}>
<>
<Typography variant="main-title">Virtual Motion Capture</Typography>
<div className="flex flex-col pt-2 pb-4">
<>
{l10n
.getString('settings-osc-vmc-description')
.split('\n')
.map((line, i) => (
<Typography key={i}>{line}</Typography>
))}
</>
<form className="w-full">
<SettingsPagePaneLayout
icon={<VMCIcon />}
title="settings-sidebar-osc_vmc"
>
<div className="flex flex-col">
<div className="flex flex-col pb-4 max-w-[75ch]">
{l10n
.getString('settings-osc-vmc-description')
.split('\n')
.map((line, i) => (
<Typography key={i}>{line}</Typography>
))}
</div>
<Typography variant="section-title">
{l10n.getString('settings-osc-vmc-enable')}
</Typography>
<div className="flex flex-col pb-2">
<Typography>
{l10n.getString('settings-osc-vmc-enable-description')}
</Typography>
</div>
<div className="grid grid-cols-2 gap-3 pb-5">
<CheckBox
variant="toggle"
outlined
control={control}
name="enabled"
label={l10n.getString('settings-osc-vmc-enable-label')}
<SettingsGroup title="settings-osc-vmc-output_group">
<SettingRow
title="settings-osc-vmc-enable"
description="settings-osc-vmc-enable-description"
controlId="vmc-enabled"
control={
<CheckBox
variant="toggle"
control={control}
name="enabled"
id="vmc-enabled"
/>
}
/>
</div>
<SettingRow
title="settings-driver-bones"
description="settings-driver-bones-description"
control={
<Button
variant="secondary"
className="whitespace-nowrap"
to="/settings/routing"
id="settings-driver-bones-link"
/>
}
/>
</SettingsGroup>
{enabled && status && (
<>
<Typography
variant="section-title"
id="settings-osc-vmc-status-title"
/>
<div className="flex flex-col gap-2 mt-8 min-w-0">
<div className="px-3 xs:px-4">
<SettingsGroupLabel id="settings-osc-vmc-status-title" />
</div>
<StatusCard status={status} />
</>
</div>
)}
<Typography variant="section-title" id="settings-driver-bones" />
<div className="flex flex-col gap-2 pt-1 pb-4">
<Typography id="settings-driver-bones-description" />
<div className="w-fit">
<Button
variant="secondary"
to="/settings/routing"
id="settings-driver-bones-link"
/>
</div>
</div>
<SettingsGroup title="settings-osc-vmc-avatar_group">
<SettingRow
title="settings-osc-vmc-vrm"
description="settings-osc-vmc-vrm-description"
below={<VRMFileUpload />}
/>
<SettingRow
title="settings-osc-vmc-anchor_hip"
description="settings-osc-vmc-anchor_hip-description"
controlId="vmc-anchor-hip"
control={
<CheckBox
variant="toggle"
control={control}
name="anchorHip"
id="vmc-anchor-hip"
/>
}
/>
<SettingRow
title="settings-osc-vmc-mirror_tracking"
description="settings-osc-vmc-mirror_tracking-description"
controlId="vmc-mirror"
control={
<CheckBox
variant="toggle"
control={control}
name="mirrorTracking"
id="vmc-mirror"
/>
}
/>
</SettingsGroup>
<Typography variant="section-title">
{l10n.getString('settings-osc-vmc-network')}
</Typography>
<div className="flex flex-col pb-2">
<>
{l10n
.getString('settings-osc-vmc-network-description')
.split('\n')
.map((line, i) => (
<Typography key={i}>{line}</Typography>
))}
</>
</div>
<div className="grid grid-cols-2 gap-3 pb-5">
<Localized
id="settings-osc-vmc-network-port_in"
attrs={{ placeholder: true, label: true }}
>
<Input
type="number"
control={control}
name="portsAddress.portIn"
placeholder="9002"
label=""
<SettingsAdvanced>
<SettingsGroup title="settings-osc-vmc-network_group">
<SettingRow
title="settings-osc-vmc-network"
details={
<>
{l10n
.getString('settings-osc-vmc-network-description')
.split('\n')
.map((line, i) => (
<Typography key={i}>{line}</Typography>
))}
</>
}
below={
<div className="grid sm:grid-cols-2 gap-3">
<Localized
id="settings-osc-vmc-network-port_in"
attrs={{ placeholder: true, label: true }}
>
<Input
type="number"
control={control}
name="portsAddress.portIn"
placeholder="9002"
label=""
/>
</Localized>
<Localized
id="settings-osc-vmc-network-port_out"
attrs={{ placeholder: true, label: true }}
>
<Input
type="number"
control={control}
name="portsAddress.portOut"
placeholder="9000"
label=""
/>
</Localized>
</div>
}
/>
</Localized>
<Localized
id="settings-osc-vmc-network-port_out"
attrs={{ placeholder: true, label: true }}
>
<Input
type="number"
control={control}
name="portsAddress.portOut"
placeholder="9000"
label=""
<SettingRow
title="settings-osc-vmc-network-address"
description="settings-osc-vmc-network-address-description"
below={
<Input
type="text"
control={control}
name="portsAddress.address"
placeholder={l10n.getString(
'settings-osc-vmc-network-address-placeholder'
)}
label=""
/>
}
/>
</Localized>
</div>
<Typography variant="section-title">
{l10n.getString('settings-osc-vmc-network-address')}
</Typography>
<div className="flex flex-col pb-2">
<Typography>
{l10n.getString('settings-osc-vmc-network-address-description')}
</Typography>
</div>
<div className="grid gap-3 pb-5">
<Input
type="text"
control={control}
name="portsAddress.address"
placeholder={l10n.getString(
'settings-osc-vmc-network-address-placeholder'
)}
label=""
/>
</div>
<Typography variant="section-title">
{l10n.getString('settings-osc-vmc-vrm')}
</Typography>
<div className="flex flex-col pb-2">
<Typography>
{l10n.getString('settings-osc-vmc-vrm-description')}
</Typography>
</div>
<div className="grid gap-3 pb-5">
<VRMFileUpload />
</div>
<Typography variant="section-title">
{l10n.getString('settings-osc-vmc-anchor_hip')}
</Typography>
<div className="flex flex-col pb-2">
<Typography>
{l10n.getString('settings-osc-vmc-anchor_hip-description')}
</Typography>
</div>
<div className="grid grid-cols-2 gap-3 pb-5">
<CheckBox
variant="toggle"
outlined
control={control}
name="anchorHip"
label={l10n.getString('settings-osc-vmc-anchor_hip-label')}
/>
</div>
<Typography variant="section-title">
{l10n.getString('settings-osc-vmc-mirror_tracking')}
</Typography>
<div className="flex flex-col pb-2">
<Typography>
{l10n.getString('settings-osc-vmc-mirror_tracking-description')}
</Typography>
</div>
<div className="grid grid-cols-2 gap-3 pb-5">
<CheckBox
variant="toggle"
outlined
control={control}
name="mirrorTracking"
label={l10n.getString('settings-osc-vmc-mirror_tracking-label')}
/>
</div>
</>
</SettingsGroup>
</SettingsAdvanced>
</div>
</SettingsPagePaneLayout>
</form>
);
@@ -21,6 +21,7 @@ import { A } from '@/components/commons/A';
import { Button } from '@/components/commons/Button';
import { CheckBox } from '@/components/commons/Checkbox';
import { Input } from '@/components/commons/Input';
import { DropdownInside } from '@/components/commons/Dropdown';
import { Typography } from '@/components/commons/Typography';
import {
StatusBadge,
@@ -29,6 +30,12 @@ import {
} from '@/components/commons/StatusBadge';
import { VRCIcon } from '@/components/commons/icon/VRCIcon';
import { SettingsPagePaneLayout } from '@/components/settings/SettingsPagePaneLayout';
import {
SettingRow,
SettingsAdvanced,
SettingsGroup,
SettingsGroupLabel,
} from '@/components/settings/SettingRow';
import { useWebsocketAPI } from '@/hooks/websocket-api';
import { useRelativeTime } from '@/hooks/relative-time';
import {
@@ -160,32 +167,22 @@ function StatusCard({
}
>
{inputState === VRCOSCInputState.IDLE ? (
<Typography
color="secondary"
id="settings-osc-vrchat-status-input-idle"
/>
<Typography id="settings-osc-vrchat-status-input-idle" />
) : (
<>
<Typography
color="secondary"
id="settings-osc-vrchat-status-input-listening"
vars={{ port: status.inputPort?.toString() ?? 'null' }}
/>
{inputState === VRCOSCInputState.ERROR && status.inputError ? (
<Typography color="secondary">
{status.inputError?.toString() ?? ''}
</Typography>
<Typography>{status.inputError?.toString() ?? ''}</Typography>
) : lastInputElapsed ? (
<Typography
color="secondary"
id="settings-osc-vrchat-status-input-last-data"
vars={{ elapsed: lastInputElapsed }}
/>
) : (
<Typography
color="secondary"
id="settings-osc-vrchat-status-input-no-data"
/>
<Typography id="settings-osc-vrchat-status-input-no-data" />
)}
</>
)}
@@ -203,14 +200,12 @@ function StatusCard({
{trackingDataState === VRCOSCTrackingDataState.RECEIVED ? (
lastTrackingElapsed ? (
<Typography
color="secondary"
id="settings-osc-vrchat-status-tracking-received"
vars={{ elapsed: lastTrackingElapsed }}
/>
) : null
) : trackingDataState === VRCOSCTrackingDataState.DISABLED_IN_VRCHAT ? (
<Typography
color="secondary"
id="settings-osc-vrchat-status-tracking-disabled"
elems={{
OscTrackingLink: (
@@ -219,10 +214,7 @@ function StatusCard({
}}
/>
) : (
<Typography
color="secondary"
id="settings-osc-vrchat-status-tracking-unknown"
/>
<Typography id="settings-osc-vrchat-status-tracking-unknown" />
)}
</StatusRow>
@@ -238,7 +230,6 @@ function StatusCard({
{outputState === VRCOSCOutputState.IDLE ? (
<>
<Typography
color="secondary"
id={
status.targetAddress
? 'settings-osc-vrchat-status-output-waiting'
@@ -250,15 +241,11 @@ function StatusCard({
source: sourceLabel,
}}
/>
<Typography
color="secondary"
id="settings-osc-vrchat-status-output-no-frame"
/>
<Typography id="settings-osc-vrchat-status-output-no-frame" />
</>
) : (
<>
<Typography
color="secondary"
id={
outputState === VRCOSCOutputState.READY
? 'settings-osc-vrchat-status-output-sending'
@@ -271,20 +258,14 @@ function StatusCard({
}}
/>
{outputState === VRCOSCOutputState.ERROR && status.outputError ? (
<Typography color="secondary">
{status.outputError?.toString() ?? ''}
</Typography>
<Typography>{status.outputError?.toString() ?? ''}</Typography>
) : lastFrameElapsed ? (
<Typography
color="secondary"
id="settings-osc-vrchat-status-output-last-frame"
vars={{ elapsed: lastFrameElapsed }}
/>
) : (
<Typography
color="secondary"
id="settings-osc-vrchat-status-output-no-frame"
/>
<Typography id="settings-osc-vrchat-status-output-no-frame" />
)}
</>
)}
@@ -295,18 +276,12 @@ function StatusCard({
badge={<VrcBadge badge={OSCQUERY_BADGES[oscQueryState]} />}
>
{oscQueryState === VRCOSCOscQueryState.DISABLED ? (
<Typography
color="secondary"
id="settings-osc-vrchat-status-oscquery-disabled"
/>
<Typography id="settings-osc-vrchat-status-oscquery-disabled" />
) : oscQueryState === VRCOSCOscQueryState.ERROR ? (
<Typography color="secondary">
{status.oscqueryError?.toString() ?? ''}
</Typography>
<Typography>{status.oscqueryError?.toString() ?? ''}</Typography>
) : (
<>
<Typography
color="secondary"
id="settings-osc-vrchat-status-oscquery-advertising"
vars={{
port: status.oscqueryAdvertisedPort?.toString() ?? 'null',
@@ -315,17 +290,14 @@ function StatusCard({
{oscQueryState === VRCOSCOscQueryState.FOUND &&
status.discoveredTargets.length > 0 ? (
<>
<Typography
color="secondary"
id="settings-osc-vrchat-status-oscquery-discovered-title"
/>
<Typography id="settings-osc-vrchat-status-oscquery-discovered-title" />
<ul className="flex flex-col gap-1">
{status.discoveredTargets.map((target, index) => (
<li
key={index}
className="flex items-center justify-between gap-2"
>
<Typography color="secondary">
<Typography>
{target.name?.toString() ?? ''} (
{target.address?.toString() ?? ''}:{target.portOut})
</Typography>
@@ -344,10 +316,7 @@ function StatusCard({
</ul>
</>
) : (
<Typography
color="secondary"
id="settings-osc-vrchat-status-oscquery-searching"
/>
<Typography id="settings-osc-vrchat-status-oscquery-searching" />
)}
</>
)}
@@ -436,161 +405,162 @@ export function VRCOSCSettings() {
);
return (
<form className="flex flex-col gap-2 w-full">
<SettingsPagePaneLayout icon={<VRCIcon />}>
<>
<Typography variant="main-title">VRChat OSC</Typography>
<div className="flex flex-col pt-2 pb-4">
<>
{l10n
.getString('settings-osc-vrchat-description-v1')
.split('\n')
.map((line, i) => (
<Typography key={i}>{line}</Typography>
))}
</>
<form className="w-full">
<SettingsPagePaneLayout
icon={<VRCIcon />}
title="settings-sidebar-vrchat_osc"
>
<div className="flex flex-col">
<div className="flex flex-col pb-4 max-w-[75ch]">
{l10n
.getString('settings-osc-vrchat-description-v1')
.split('\n')
.map((line, i) => (
<Typography key={i}>{line}</Typography>
))}
</div>
<Typography variant="section-title">
{l10n.getString('settings-osc-vrchat-enable')}
</Typography>
<div className="flex flex-col pb-2">
<Typography>
{l10n.getString('settings-osc-vrchat-enable-description')}
</Typography>
</div>
<div className="grid grid-cols-2 gap-3 pb-5">
<CheckBox
variant="toggle"
outlined
control={control}
name="enabled"
label={l10n.getString('settings-osc-vrchat-enable-label')}
<SettingsGroup title="settings-osc-vrchat-output_group">
<SettingRow
title="settings-osc-vrchat-enable"
description="settings-osc-vrchat-enable-description"
controlId="vrchat-enabled"
control={
<CheckBox
variant="toggle"
control={control}
name="enabled"
id="vrchat-enabled"
/>
}
/>
</div>
<SettingRow
title="settings-driver-bones"
description="settings-driver-bones-description"
control={
<Button
variant="secondary"
className="whitespace-nowrap"
to="/settings/routing"
id="settings-driver-bones-link"
/>
}
/>
</SettingsGroup>
{enabled && status && (
<>
<Typography variant="section-title">
{l10n.getString('settings-osc-vrchat-status-title')}
</Typography>
<div className="flex flex-col gap-2 mt-8 min-w-0">
<div className="px-3 xs:px-4">
<SettingsGroupLabel id="settings-osc-vrchat-status-title" />
</div>
<StatusCard
status={status}
onSwitchToTarget={(target) => {
setValue('useManualNetwork', true, {
shouldDirty: true,
});
setValue('useManualNetwork', true, { shouldDirty: true });
setValue(
'portsAddress.address',
target.address?.toString() ?? '',
{
shouldDirty: true,
}
{ shouldDirty: true }
);
setValue('portsAddress.portOut', target.portOut, {
shouldDirty: true,
});
}}
/>
</>
)}
<Typography variant="section-title" id="settings-driver-bones" />
<div className="flex flex-col gap-2 pt-1 pb-4">
<Typography id="settings-driver-bones-description" />
<div className="w-fit">
<Button
variant="secondary"
to="/settings/routing"
id="settings-driver-bones-link"
/>
</div>
</div>
<Typography variant="section-title">
{l10n.getString('settings-osc-vrchat-status-network-mode')}
</Typography>
<div className="flex flex-col pb-2">
<Typography>
{l10n.getString(
'settings-osc-vrchat-status-network-mode-description'
)}
</Typography>
</div>
<div className="grid grid-cols-2 gap-3 pb-5">
<CheckBox
variant="toggle"
outlined
control={control}
name="useManualNetwork"
label={l10n.getString(
'settings-osc-vrchat-status-network-mode-toggle'
)}
/>
</div>
{useManualNetwork && (
<>
<Typography variant="section-title">
{l10n.getString('settings-osc-vrchat-network')}
</Typography>
<div className="flex flex-col pb-2">
<Typography>
{l10n.getString(
'settings-osc-vrchat-status-network-manual-description'
)}
</Typography>
</div>
<div className="grid grid-cols-2 gap-3 pb-5">
<Localized
id="settings-osc-vrchat-network-port_in"
attrs={{ placeholder: true, label: true }}
>
<Input
type="number"
control={control}
name="portsAddress.portIn"
placeholder="9001"
label=""
/>
</Localized>
<Localized
id="settings-osc-vrchat-network-port_out"
attrs={{ placeholder: true, label: true }}
>
<Input
type="number"
control={control}
name="portsAddress.portOut"
placeholder="9000"
label=""
/>
</Localized>
</div>
<Typography variant="section-title">
{l10n.getString('settings-osc-vrchat-network-address')}
</Typography>
<div className="flex flex-col pb-2">
<Typography>
{l10n.getString(
'settings-osc-vrchat-network-address-description-v1'
)}
</Typography>
</div>
<div className="grid gap-3 pb-5">
<Input
type="text"
control={control}
name="portsAddress.address"
placeholder={l10n.getString(
'settings-osc-vrchat-network-address-placeholder'
)}
label=""
/>
</div>
</>
)}
</>
<SettingsAdvanced>
<SettingsGroup title="settings-osc-vrchat-network_group">
<SettingRow
title="settings-osc-vrchat-status-network-mode"
description="settings-osc-vrchat-status-network-mode-description"
controlWidth="wide"
control={
<DropdownInside
name="networkMode"
display="block"
direction="down"
placeholder=""
value={useManualNetwork ? 'manual' : 'auto'}
onChange={(value) => {
setValue('useManualNetwork', value === 'manual', {
shouldDirty: true,
});
handleSubmit(onSubmit)();
}}
items={[
{
label: l10n.getString(
'settings-osc-vrchat-status-network-mode-auto'
),
value: 'auto',
},
{
label: l10n.getString(
'settings-osc-vrchat-status-network-mode-manual'
),
value: 'manual',
},
]}
/>
}
>
{useManualNetwork && (
<>
<SettingRow
title="settings-osc-vrchat-network"
description="settings-osc-vrchat-status-network-manual-description"
below={
<div className="grid sm:grid-cols-2 gap-3">
<Localized
id="settings-osc-vrchat-network-port_in"
attrs={{ placeholder: true, label: true }}
>
<Input
type="number"
control={control}
name="portsAddress.portIn"
placeholder="9001"
label=""
/>
</Localized>
<Localized
id="settings-osc-vrchat-network-port_out"
attrs={{ placeholder: true, label: true }}
>
<Input
type="number"
control={control}
name="portsAddress.portOut"
placeholder="9000"
label=""
/>
</Localized>
</div>
}
/>
<SettingRow
title="settings-osc-vrchat-network-address"
description="settings-osc-vrchat-network-address-description-v1"
below={
<Input
type="text"
control={control}
name="portsAddress.address"
placeholder={l10n.getString(
'settings-osc-vrchat-network-address-placeholder'
)}
label=""
/>
}
/>
</>
)}
</SettingRow>
</SettingsGroup>
</SettingsAdvanced>
</div>
</SettingsPagePaneLayout>
</form>
);
@@ -1,4 +1,4 @@
import { useLocalization, Localized } from '@fluent/react';
import { Localized } from '@fluent/react';
import { useEffect } from 'react';
import { DefaultValues, useForm } from 'react-hook-form';
import {
@@ -13,6 +13,7 @@ import { Typography } from '@/components/commons/Typography';
import { atom, useAtomValue, useSetAtom } from 'jotai';
import { isEqual } from '@react-hookz/deep-equal';
import { selectAtom } from 'jotai/utils';
import { SettingRow } from '@/components/settings/SettingRow';
type HIDForm = {
trackersOverHID: boolean;
@@ -32,7 +33,6 @@ const hidSettingsValueAtom = selectAtom(
export function HIDSettings() {
const setSettings = useSetAtom(hidSettingsAtom);
const settings = useAtomValue(hidSettingsValueAtom);
const { l10n } = useLocalization();
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const { control, watch, handleSubmit, getValues, reset } = useForm<HIDForm>({
@@ -73,29 +73,25 @@ export function HIDSettings() {
);
return (
<>
<div className="flex flex-col pt-5 pb-2">
<Typography variant="section-title">
{l10n.getString(
'settings-general-tracker_mechanics-trackers_over_usb'
)}
</Typography>
<SettingRow
title="settings-general-tracker_mechanics-trackers_over_usb"
details={
<Localized
id="settings-general-tracker_mechanics-trackers_over_usb-description"
elems={{ b: <b /> }}
>
<Typography />
</Localized>
</div>
<CheckBox
variant="toggle"
outlined
control={control}
name="trackersOverHID"
label={l10n.getString(
'settings-general-tracker_mechanics-trackers_over_usb-enabled-label'
)}
/>
</>
}
controlId="trackers-over-usb"
control={
<CheckBox
variant="toggle"
control={control}
name="trackersOverHID"
id="trackers-over-usb"
/>
}
/>
);
}
@@ -12,6 +12,8 @@ import {
useConfig,
} from '@/hooks/config';
import { useLocalization } from '@fluent/react';
import { DropdownInside } from '@/components/commons/Dropdown';
import { SettingRow, SettingsGroup } from '@/components/settings/SettingRow';
import classNames from 'classnames';
import { ReactNode } from 'react';
import { track } from '@/utils/sentry';
@@ -69,7 +71,7 @@ const trackersTableColumnLabel: Record<
url: 'tracker-table-column-url',
};
export function TrackersTableColumnsSettings({
export function TrackersTableColumnToggles({
variant,
}: {
variant: 'settings' | 'modal';
@@ -84,26 +86,36 @@ export function TrackersTableColumnsSettings({
});
};
return (
<div className="grid sm:grid-cols-2 md:grid-cols-3 gap-2">
{trackersTableColumnOrder.map((key) => (
<CheckboxInternal
key={key}
variant="toggle"
outlined
color={variant === 'settings' ? 'primary' : 'secondary'}
name={key}
checked={columns[key]}
onChange={() => toggleColumn(key)}
label={l10n.getString(trackersTableColumnLabel[key])}
/>
))}
</div>
);
}
export function TrackersTableColumnsSettings({
variant,
}: {
variant: 'settings' | 'modal';
}) {
return (
<div className="flex flex-col gap-2">
<div className="flex flex-col pt-4 pb-2">
<Typography bold id="settings-home-table_columns" />
<Typography color="secondary" id="settings-home-table_columns-desc" />
</div>
<div className="grid sm:grid-cols-2 md:grid-cols-3 gap-2">
{trackersTableColumnOrder.map((key) => (
<CheckboxInternal
key={key}
variant="toggle"
outlined
color={variant === 'settings' ? 'primary' : 'secondary'}
name={key}
checked={columns[key]}
onChange={() => toggleColumn(key)}
label={l10n.getString(trackersTableColumnLabel[key])}
/>
))}
<Typography id="settings-home-table_columns-desc" />
</div>
<TrackersTableColumnToggles variant={variant} />
</div>
);
}
@@ -118,7 +130,7 @@ const trackerDisplayToggleLabel: Record<keyof TrackerDisplayConfig, string> = {
showNumericSignal: 'settings-home-tracker_display-numeric_signal',
};
export function TrackerDisplaySettings({
export function TrackerDisplayToggles({
variant,
}: {
variant: 'settings' | 'modal';
@@ -134,30 +146,44 @@ export function TrackerDisplaySettings({
};
return (
<div className="flex flex-col gap-2">
<div className="flex flex-col pt-4 pb-2">
<Typography bold id="settings-home-tracker_display" />
<Typography color="secondary" id="settings-home-tracker_display-desc" />
</div>
<div className="grid sm:grid-cols-2 gap-2">
{trackerDisplayToggleOrder.map((key) => (
<CheckboxInternal
key={key}
variant="toggle"
outlined
color={variant === 'settings' ? 'primary' : 'secondary'}
name={key}
checked={trackerDisplay[key]}
onChange={() => toggle(key)}
label={l10n.getString(trackerDisplayToggleLabel[key])}
/>
))}
</div>
<div className="grid sm:grid-cols-2 gap-2">
{trackerDisplayToggleOrder.map((key) => (
<CheckboxInternal
key={key}
variant="toggle"
outlined
color={variant === 'settings' ? 'primary' : 'secondary'}
name={key}
checked={trackerDisplay[key]}
onChange={() => toggle(key)}
label={l10n.getString(trackerDisplayToggleLabel[key])}
/>
))}
</div>
);
}
export function SkeletonPreviewSettings({
export function TrackerDisplaySettings({
variant,
}: {
variant: 'settings' | 'modal';
}) {
return (
<div className="flex flex-col gap-2">
<div className="flex flex-col pt-4 pb-2">
<Typography bold id="settings-home-tracker_display" />
<Typography id="settings-home-tracker_display-desc" />
</div>
<TrackerDisplayToggles variant={variant} />
</div>
);
}
/**
* The home screen's settings, shared by its settings page and the quick
* settings modal on the home screen so both read the same.
*/
export function HomeLayoutSettings({
variant,
}: {
variant: 'settings' | 'modal';
@@ -168,83 +194,92 @@ export function SkeletonPreviewSettings({
(config?.skeletonPreviewStyle ?? defaultConfig.skeletonPreviewStyle) ===
'mesh';
return (
<div className="flex flex-col gap-2">
<div className="flex flex-col pt-4 pb-2">
<Typography bold id="settings-interface-behavior-skeleton_mesh" />
<Typography
color="secondary"
id="settings-interface-behavior-skeleton_mesh-description"
/>
</div>
<div className="grid sm:grid-cols-2 gap-2">
<CheckboxInternal
variant="toggle"
outlined
color={variant === 'settings' ? 'primary' : 'secondary'}
name="skeletonMesh"
checked={mesh}
onChange={() =>
setConfig({ skeletonPreviewStyle: mesh ? 'lines' : 'mesh' })
}
label={l10n.getString(
'settings-interface-behavior-skeleton_mesh-label'
)}
/>
</div>
</div>
);
}
export function HomeLayoutSettings({
variant,
}: {
variant: 'settings' | 'modal';
}) {
const { config, setConfig } = useConfig();
const setLayout = (layout: Config['homeLayout']) => {
setConfig({ homeLayout: layout });
track('change_layout', { layout, from: variant });
};
return (
<div className="flex flex-col gap-2">
<div className="flex flex-col pt-4 pb-2">
<Typography bold id="settings-home-list-layout" />
<Typography color="secondary" id="settings-home-list-layout-desc" />
</div>
<div className="flex gap-4">
<LayoutSelector
name="settings-home-list-layout-grid"
active={config?.homeLayout === 'default'}
onClick={() => setLayout('default')}
>
<div className="grid grid-cols-2 gap-2 p-2">
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
</div>
</LayoutSelector>
<LayoutSelector
name="settings-home-list-layout-table"
active={config?.homeLayout === 'table'}
onClick={() => setLayout('table')}
>
<div className="grid grid-cols-1 gap-2 p-2">
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
</div>
</LayoutSelector>
</div>
<SkeletonPreviewSettings variant={variant} />
<TrackerDisplaySettings variant={variant} />
{config?.homeLayout === 'table' && (
<TrackersTableColumnsSettings variant={variant} />
)}
<div className="flex flex-col">
<SettingsGroup
title="settings-home-list-layout"
description="settings-home-list-layout-desc"
>
<div className="flex gap-4 p-3 xs:p-4">
<LayoutSelector
name="settings-home-list-layout-grid"
active={config?.homeLayout === 'default'}
onClick={() => setLayout('default')}
>
<div className="grid grid-cols-2 gap-2 p-2">
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
</div>
</LayoutSelector>
<LayoutSelector
name="settings-home-list-layout-table"
active={config?.homeLayout === 'table'}
onClick={() => setLayout('table')}
>
<div className="grid grid-cols-1 gap-2 p-2">
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
<div className="h-2 rounded-lg bg-background-40" />
</div>
</LayoutSelector>
</div>
{config?.homeLayout === 'table' && (
<SettingRow
title="settings-home-table_columns"
description="settings-home-table_columns-desc"
below={<TrackersTableColumnToggles variant={variant} />}
/>
)}
</SettingsGroup>
<SettingsGroup title="settings-home-display_group">
<SettingRow
title="settings-interface-behavior-skeleton_mesh"
description="settings-interface-behavior-skeleton_mesh-description"
controlWidth="wide"
control={
<DropdownInside
name="skeletonPreviewStyle"
display="block"
direction="down"
placeholder=""
value={mesh ? 'mesh' : 'lines'}
onChange={(value) =>
setConfig({
skeletonPreviewStyle: value as Config['skeletonPreviewStyle'],
})
}
items={[
{
label: l10n.getString(
'settings-interface-behavior-skeleton_mesh-lines'
),
value: 'lines',
},
{
label: l10n.getString(
'settings-interface-behavior-skeleton_mesh-mesh'
),
value: 'mesh',
},
]}
/>
}
/>
<SettingRow
title="settings-home-tracker_display"
description="settings-home-tracker_display-desc"
below={<TrackerDisplayToggles variant={variant} />}
/>
</SettingsGroup>
</div>
);
}
@@ -11,6 +11,7 @@ import {
RpcMessage,
} from 'solarxr-protocol';
import { Link } from 'react-router-dom';
import { SettingRow } from '@/components/settings/SettingRow';
interface MagnetometerToggleForm {
magToggle: boolean;
@@ -76,31 +77,27 @@ export function MagnetometerToggleSetting({
});
return settingType === 'general' ? (
<>
<div className="flex flex-col pb-2">
<Typography variant="section-title">
{l10n.getString(
'settings-general-tracker_mechanics-use_mag_on_all_trackers'
)}
</Typography>
<SettingRow
title="settings-general-tracker_mechanics-use_mag_on_all_trackers"
details={
<Localized
id="settings-general-tracker_mechanics-use_mag_on_all_trackers-description"
elems={{ b: <b /> }}
>
<Typography whitespace="whitespace-pre-line" />
</Localized>
</div>
<CheckBox
variant="toggle"
outlined
control={control}
loading={waitingMag}
name="magToggle"
label={l10n.getString(
'settings-general-tracker_mechanics-use_mag_on_all_trackers-label'
)}
/>
</>
}
controlId="trackers-magnetometer"
control={
<CheckBox
variant="toggle"
control={control}
loading={waitingMag}
name="magToggle"
id="trackers-magnetometer"
/>
}
/>
) : (
<div className="flex flex-col gap-2 w-full mt-3">
<Typography variant="section-title">
@@ -10,14 +10,25 @@ import {
} from 'solarxr-protocol';
import { useWebsocketAPI } from '@/hooks/websocket-api';
import { NumberSelector } from '@/components/commons/NumberSelector';
import { Typography } from '@/components/commons/Typography';
import { CheckBox } from '@/components/commons/Checkbox';
import { Dropdown } from '@/components/commons/Dropdown';
import { TAP_DETECTION_BODY_PARTS } from '@/hooks/tracker-picker';
import { atom, useAtomValue, useSetAtom } from 'jotai';
import { isEqual } from '@react-hookz/deep-equal';
import { selectAtom } from 'jotai/utils';
import { useLocaleConfig } from '@/i18n/config';
import classNames from 'classnames';
import { Typography } from '@/components/commons/Typography';
import { CheckboxInternal } from '@/components/commons/Checkbox';
import {
FullResetIcon,
MountingResetIcon,
YawResetIcon,
} from '@/components/commons/icon/ResetIcon';
import {
SettingRow,
SettingsGroup,
SettingsGroupLabel,
} from '@/components/settings/SettingRow';
type TapDetectionForm = {
yawResetEnabled: boolean;
@@ -80,7 +91,7 @@ export function TapDetectionSettings() {
label: l10n.getString(`body_part-${BodyPart[value]}`),
}));
const { control, watch, handleSubmit, getValues, reset } =
const { control, watch, handleSubmit, getValues, reset, setValue } =
useForm<TapDetectionForm>({
defaultValues,
mode: 'onChange',
@@ -160,189 +171,160 @@ export function TapDetectionSettings() {
}
);
const resetKinds = [
{
id: 'yawReset',
enabled: watch('yawResetEnabled'),
icon: <YawResetIcon width={20} />,
},
{
id: 'fullReset',
enabled: watch('fullResetEnabled'),
icon: <FullResetIcon width={20} />,
},
{
id: 'mountingReset',
enabled: watch('mountingResetEnabled'),
icon: <MountingResetIcon width={20} />,
},
] as const;
const column = (id: string) => (
<Typography
variant="section-title"
id={`settings-general-gesture_control-column-${id}`}
/>
);
return (
<>
<div className="flex flex-col pt-5 pb-2 gap-1">
<Typography variant="section-title">
{l10n.getString('settings-general-gesture_control-subtitle')}
</Typography>
<Typography>
{l10n.getString('settings-general-gesture_control-description')}
</Typography>
<div className="flex flex-col gap-2 min-w-0 mt-8">
<div className="px-3 xs:px-4">
<SettingsGroupLabel id="settings-general-gesture_control-subtitle" />
</div>
<div>
<div className="grid sm:grid-cols-3 gap-5 pb-2">
<CheckBox
variant="toggle"
outlined
control={control}
name="yawResetEnabled"
label={l10n.getString(
'settings-general-gesture_control-yawResetEnabled'
)}
/>
<CheckBox
variant="toggle"
outlined
control={control}
name="fullResetEnabled"
label={l10n.getString(
'settings-general-gesture_control-fullResetEnabled'
)}
/>
<CheckBox
variant="toggle"
outlined
control={control}
name="mountingResetEnabled"
label={l10n.getString(
'settings-general-gesture_control-mountingResetEnabled'
)}
/>
</div>
<div className="grid sm:grid-cols-3 gap-5 pb-2">
<Dropdown
display="block"
control={control}
placeholder={''}
label={l10n.getString(
'settings-general-gesture_control-yawResetTracker'
)}
name="yawResetTracker"
items={bodyParts}
/>
<Dropdown
display="block"
control={control}
placeholder={''}
label={l10n.getString(
'settings-general-gesture_control-fullResetTracker'
)}
name="fullResetTracker"
items={bodyParts}
/>
<Dropdown
display="block"
control={control}
placeholder={''}
label={l10n.getString(
'settings-general-gesture_control-mountingResetTracker'
)}
name="mountingResetTracker"
items={bodyParts}
/>
</div>
<div className="px-3 xs:px-4 max-w-[75ch]">
<Typography id="settings-general-gesture_control-description" />
</div>
<div className="grid sm:grid-cols-3 gap-5 pb-2">
<NumberSelector
control={control}
name="yawResetDelay"
label={l10n.getString(
'settings-general-gesture_control-yawResetDelay'
)}
valueLabelFormat={(value) => secondsFormat.format(value)}
min={0.2}
max={3.0}
step={0.2}
/>
<NumberSelector
control={control}
name="fullResetDelay"
label={l10n.getString(
'settings-general-gesture_control-fullResetDelay'
)}
valueLabelFormat={(value) => secondsFormat.format(value)}
min={0.2}
max={3.0}
step={0.2}
/>
<NumberSelector
control={control}
name="mountingResetDelay"
label={l10n.getString(
'settings-general-gesture_control-mountingResetDelay'
)}
valueLabelFormat={(value) => secondsFormat.format(value)}
min={0.2}
max={3.0}
step={0.2}
/>
</div>
<div className="grid sm:grid-cols-3 gap-5">
<NumberSelector
control={control}
name="yawResetTaps"
label={l10n.getString(
'settings-general-gesture_control-yawResetTaps'
)}
valueLabelFormat={(value) =>
l10n.getString('settings-general-gesture_control-taps', {
amount: Math.round(value),
})
}
min={2}
max={10}
step={1}
/>
<NumberSelector
control={control}
name="fullResetTaps"
label={l10n.getString(
'settings-general-gesture_control-fullResetTaps'
)}
valueLabelFormat={(value) =>
l10n.getString('settings-general-gesture_control-taps', {
amount: Math.round(value),
})
}
min={2}
max={10}
step={1}
/>
<NumberSelector
control={control}
name="mountingResetTaps"
label={l10n.getString(
'settings-general-gesture_control-mountingResetTaps'
)}
valueLabelFormat={(value) =>
l10n.getString('settings-general-gesture_control-taps', {
amount: Math.round(value),
})
}
min={2}
max={10}
step={1}
/>
<div className="rounded-2xl bg-background-80 overflow-hidden">
<table className="w-full text-left border-collapse block md:table">
<thead className="hidden md:table-header-group">
<tr className="border-b border-background-60 uppercase">
<th className="py-3 pl-4 pr-2 w-0" />
<th className="py-3 pr-4 w-64 whitespace-nowrap">
{column('reset')}
</th>
<th className="py-3 px-4">{column('tracker')}</th>
<th className="py-3 px-4 w-56">{column('taps')}</th>
<th className="py-3 pl-4 pr-4 w-56">{column('delay')}</th>
</tr>
</thead>
<tbody className="divide-y divide-background-60 block md:table-row-group">
{resetKinds.map(({ id, enabled, icon }) => (
<tr
key={id}
className="grid grid-cols-[auto,1fr] md:table-row p-4 md:p-0 gap-x-3 gap-y-3 md:gap-0 items-center border-b border-background-60 md:border-b-0"
>
<td className="py-2 md:py-3 pl-0 md:pl-4 pr-0 md:pr-2 block md:table-cell align-middle">
<CheckboxInternal
variant="toggle"
name={`${id}Enabled`}
id={`tap-${id}`}
checked={enabled}
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
setValue(
`${id}Enabled` as keyof TapDetectionForm,
event.currentTarget.checked,
{ shouldDirty: true }
)
}
/>
</td>
<td className="py-2 md:py-3 pl-0 md:pr-4 block md:table-cell align-middle">
<label
htmlFor={`tap-${id}`}
className="flex items-center gap-2.5 cursor-pointer whitespace-nowrap"
>
<div className="w-6 h-6 flex items-center justify-center fill-background-10 flex-shrink-0">
{icon}
</div>
<Typography
bold
whitespace="whitespace-nowrap"
id={`settings-general-gesture_control-${id}-name`}
/>
</label>
</td>
<fieldset
disabled={!enabled}
className={classNames(
'contents',
!enabled && '[&_td]:opacity-50'
)}
>
<td className="col-span-2 py-2 md:py-3 px-0 md:px-4 block md:table-cell align-middle">
<span className="md:hidden">{column('tracker')}</span>
<Dropdown
display="block"
control={control}
placeholder={''}
name={`${id}Tracker` as keyof TapDetectionForm}
items={bodyParts}
/>
</td>
<td className="col-span-2 py-2 md:py-3 px-0 md:px-4 block md:table-cell align-middle">
<span className="md:hidden">{column('taps')}</span>
<NumberSelector
control={control}
name={`${id}Taps` as keyof TapDetectionForm}
valueLabelFormat={(value) =>
l10n.getString(
'settings-general-gesture_control-taps',
{ amount: Math.round(value) }
)
}
min={2}
max={10}
step={1}
/>
</td>
<td className="col-span-2 py-2 md:py-3 px-0 md:px-4 block md:table-cell align-middle">
<span className="md:hidden">{column('delay')}</span>
<NumberSelector
control={control}
name={`${id}Delay` as keyof TapDetectionForm}
valueLabelFormat={(value) => secondsFormat.format(value)}
min={0.2}
max={3.0}
step={0.2}
/>
</td>
</fieldset>
</tr>
))}
</tbody>
</table>
</div>
<div className="grid sm:grid-cols-1 gap-1 pt-3">
<Typography variant="section-title">
{l10n.getString(
'settings-general-gesture_control-numberTrackersOverThreshold'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-gesture_control-numberTrackersOverThreshold-description'
)}
</Typography>
<div>
<NumberSelector
control={control}
name="numberTrackersOverThreshold"
valueLabelFormat={(value) =>
l10n.getString('settings-general-gesture_control-trackers', {
amount: Math.round(value),
})
}
min={1}
max={20}
step={1}
/>
</div>
</div>
</>
<SettingsGroup>
<SettingRow
title="settings-general-gesture_control-numberTrackersOverThreshold"
description="settings-general-gesture_control-numberTrackersOverThreshold-description"
controlWidth="wide"
control={
<NumberSelector
control={control}
name="numberTrackersOverThreshold"
valueLabelFormat={(value) =>
l10n.getString('settings-general-gesture_control-trackers', {
amount: Math.round(value),
})
}
min={1}
max={20}
step={1}
/>
}
/>
</SettingsGroup>
</div>
);
}
@@ -1,4 +1,4 @@
import { useLocalization, Localized } from '@fluent/react';
import { Localized } from '@fluent/react';
import { useEffect, useState } from 'react';
import { DefaultValues, useForm } from 'react-hook-form';
import {
@@ -11,6 +11,7 @@ import { useWebsocketAPI } from '@/hooks/websocket-api';
import { Typography } from '@/components/commons/Typography';
import { NumberSelector } from '@/components/commons/NumberSelector';
import { useLocaleConfig } from '@/i18n/config';
import { SettingRow } from '@/components/settings/SettingRow';
type TimeoutForm = {
delay: number;
@@ -22,7 +23,6 @@ const defaultValues: TimeoutForm = {
export function TimeoutSettings() {
const [settings, setSettings] = useState(new TimeoutSettingsResponseT());
const { l10n } = useLocalization();
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
const { currentLocales } = useLocaleConfig();
@@ -75,26 +75,27 @@ export function TimeoutSettings() {
);
return (
<>
<div className="flex flex-col pb-2 pt-5">
<Typography variant="section-title">
{l10n.getString('settings-general-tracker_mechanics-timeout_delay')}
</Typography>
<SettingRow
title="settings-general-tracker_mechanics-timeout_delay"
details={
<Localized
id="settings-general-tracker_mechanics-timeout_delay-description"
elems={{ b: <b /> }}
>
<Typography />
</Localized>
</div>
<NumberSelector
control={control}
name="delay"
valueLabelFormat={(value) => secondsFormat.format(value)}
min={0.0}
max={3600}
step={1.0}
/>
</>
}
controlWidth="wide"
control={
<NumberSelector
control={control}
name="delay"
valueLabelFormat={(value) => secondsFormat.format(value)}
min={0.0}
max={3600}
step={1.0}
/>
}
/>
);
}
@@ -1,5 +1,4 @@
import { CheckBox } from '@/components/commons/Checkbox';
import { Typography } from '@/components/commons/Typography';
import {
trackingchecklistIdtoLabel,
useTrackingChecklist,
@@ -8,6 +7,7 @@ import { useLocalization } from '@fluent/react';
import { useEffect } from 'react';
import { FieldPath, useForm } from 'react-hook-form';
import { TrackingChecklistStepId } from 'solarxr-protocol';
import { SettingsGroup } from '@/components/settings/SettingRow';
type StepsForm = { steps: Record<TrackingChecklistStepId, boolean> };
export function TrackingChecklistSettings({
@@ -55,16 +55,12 @@ export function TrackingChecklistSettings({
};
return (
<div className="flex flex-col">
<div className="flex flex-col pt-4 pb-2">
<Typography bold id="settings-tracking_checklist-active_steps" />
<Typography
color="secondary"
id="settings-tracking_checklist-active_steps-desc"
/>
</div>
<SettingsGroup
title="settings-tracking_checklist-active_steps"
description="settings-tracking_checklist-active_steps-desc"
>
<form
className="grid md:grid-cols-2 gap-2 grid-rows-3 mobile:flex flex-col"
className="grid md:grid-cols-2 gap-2 p-3 xs:p-4 mobile:flex flex-col"
onChange={handleSubmit(onSubmit)}
>
{steps
@@ -82,6 +78,6 @@ export function TrackingChecklistSettings({
</div>
))}
</form>
</div>
</SettingsGroup>
);
}
@@ -130,7 +130,6 @@ export function VRCWarningsPage() {
return (
<SettingsPagePaneLayout icon={<WarningIcon />} className="w-full min-w-fit">
<div className="flex flex-col gap-3">
<Typography variant="main-title" id={'vrc_config-page-title'} />
<Typography variant="standard" id={'vrc_config-page-desc'} />
</div>
<div className="w-full mt-4 gap-2 flex flex-col">