Browse Source

Merge pull request #445 from danditomaso/fix/switch-style-issue

fix: improve switch dark mode style, fixed merge conflict bug in HTTP component.
pull/448/head
Dan Ditomaso 1 year ago
committed by GitHub
parent
commit
ac550d3b44
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      src/components/PageComponents/Connect/HTTP.tsx
  2. 2
      src/components/UI/Switch.tsx
  3. 2
      src/core/stores/appStore.ts

8
src/components/PageComponents/Connect/HTTP.tsx

@ -8,7 +8,7 @@ import { useDeviceStore } from "@core/stores/deviceStore.ts";
import { subscribeAll } from "@core/subscriptions.ts"; import { subscribeAll } from "@core/subscriptions.ts";
import { randId } from "@core/utils/randId.ts"; import { randId } from "@core/utils/randId.ts";
import { HttpConnection } from "@meshtastic/js"; import { HttpConnection } from "@meshtastic/js";
import { useState } from "react"; import { type JSX, useState } from "react";
import { Controller, useForm } from "react-hook-form"; import { Controller, useForm } from "react-hook-form";
export const HTTP = ({ closeDialog }: TabElementProps): JSX.Element => { export const HTTP = ({ closeDialog }: TabElementProps): JSX.Element => {
@ -68,15 +68,13 @@ export const HTTP = ({ closeDialog }: TabElementProps): JSX.Element => {
<> <>
<Label>Use HTTPS</Label> <Label>Use HTTPS</Label>
<Switch <Switch
onCheckedChange={(checked) => { onCheckedChange={(checked) => {
checked ? setHTTPS(true) : setHTTPS(false); checked ? setHTTPS(true) : setHTTPS(false);
}} }}
disabled={
disabled={
location.protocol === "https:" || connectionInProgress location.protocol === "https:" || connectionInProgress
} }
checked={value} checked={https}
{...rest} {...rest}
/> />
</> </>

2
src/components/UI/Switch.tsx

@ -9,7 +9,7 @@ const Switch = React.forwardRef<
>(({ className, ...props }, ref) => ( >(({ className, ...props }, ref) => (
<SwitchPrimitives.Root <SwitchPrimitives.Root
className={cn( className={cn(
"peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus:outline-hidden focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=checked]:bg-slate-600 dark:data-[state=unchecked]:bg-slate-100", "peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus:outline-hidden focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=checked]:bg-slate-600 dark:data-[state=unchecked]:bg-slate-300",
className, className,
)} )}
{...props} {...props}

2
src/core/stores/appStore.ts

@ -14,13 +14,11 @@ interface ErrorState {
message: string; message: string;
} }
interface ErrorState { interface ErrorState {
field: string; field: string;
message: string; message: string;
} }
interface AppState { interface AppState {
selectedDevice: number; selectedDevice: number;
devices: { devices: {

Loading…
Cancel
Save