Browse Source

biome

pull/311/head
medentem 2 years ago
parent
commit
8549d56c21
  1. 12
      src/components/Form/FormInput.tsx
  2. 15
      src/components/Form/FormPasswordGenerator.tsx
  3. 2
      src/components/PageComponents/Channel.tsx
  4. 2
      src/pages/Messages.tsx

12
src/components/Form/FormInput.tsx

@ -41,10 +41,14 @@ export function GenericInput<T extends FieldValues>({
render={({ field: { value, onChange, ...rest } }) => ( render={({ field: { value, onChange, ...rest } }) => (
<Input <Input
type={field.type == "password" && passwordShown ? "text" : field.type} type={field.type == "password" && passwordShown ? "text" : field.type}
action={field.type == "password" ? { action={
icon: passwordShown ? EyeOff : Eye, field.type == "password"
onClick: togglePasswordVisiblity ? {
} : undefined} icon: passwordShown ? EyeOff : Eye,
onClick: togglePasswordVisiblity,
}
: undefined
}
step={field.properties?.step} step={field.properties?.step}
value={field.type === "number" ? Number.parseFloat(value) : value} value={field.type === "number" ? Number.parseFloat(value) : value}
onChange={(e) => { onChange={(e) => {

15
src/components/Form/FormPasswordGenerator.tsx

@ -3,9 +3,9 @@ import type {
GenericFormElementProps, GenericFormElementProps,
} from "@components/Form/DynamicForm.js"; } from "@components/Form/DynamicForm.js";
import { Generator } from "@components/UI/Generator.js"; import { Generator } from "@components/UI/Generator.js";
import { Eye, EyeOff } from "lucide-react";
import type { ChangeEventHandler, MouseEventHandler } from "react"; import type { ChangeEventHandler, MouseEventHandler } from "react";
import { useState } from "react"; import { useState } from "react";
import { Eye, EyeOff } from "lucide-react";
import { Controller, type FieldValues } from "react-hook-form"; import { Controller, type FieldValues } from "react-hook-form";
export interface PasswordGeneratorProps<T> extends BaseFormBuilderProps<T> { export interface PasswordGeneratorProps<T> extends BaseFormBuilderProps<T> {
@ -23,7 +23,6 @@ export function PasswordGenerator<T extends FieldValues>({
field, field,
disabled, disabled,
}: GenericFormElementProps<T, PasswordGeneratorProps<T>>) { }: GenericFormElementProps<T, PasswordGeneratorProps<T>>) {
const [passwordShown, setPasswordShown] = useState(false); const [passwordShown, setPasswordShown] = useState(false);
const togglePasswordVisiblity = () => { const togglePasswordVisiblity = () => {
setPasswordShown(passwordShown ? false : true); setPasswordShown(passwordShown ? false : true);
@ -36,10 +35,14 @@ export function PasswordGenerator<T extends FieldValues>({
render={({ field: { value, ...rest } }) => ( render={({ field: { value, ...rest } }) => (
<Generator <Generator
type={field.hide && !passwordShown ? "password" : "text"} type={field.hide && !passwordShown ? "password" : "text"}
action={field.hide ? { action={
icon: passwordShown ? EyeOff : Eye, field.hide
onClick: togglePasswordVisiblity ? {
} : undefined} icon: passwordShown ? EyeOff : Eye,
onClick: togglePasswordVisiblity,
}
: undefined
}
devicePSKBitCount={field.devicePSKBitCount} devicePSKBitCount={field.devicePSKBitCount}
bits={field.bits} bits={field.bits}
inputChange={field.inputChange} inputChange={field.inputChange}

2
src/components/PageComponents/Channel.tsx

@ -133,7 +133,7 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
buttonClick: clickEvent, buttonClick: clickEvent,
hide: true, hide: true,
properties: { properties: {
value: pass value: pass,
}, },
}, },
{ {

2
src/pages/Messages.tsx

@ -76,7 +76,7 @@ export const MessagesPage = (): JSX.Element => {
chatType === "broadcast" && currentChannel chatType === "broadcast" && currentChannel
? getChannelName(currentChannel) ? getChannelName(currentChannel)
: chatType === "direct" && nodes.get(activeChat) : chatType === "direct" && nodes.get(activeChat)
? nodes.get(activeChat)?.user?.longName ?? nodeHex ? (nodes.get(activeChat)?.user?.longName ?? nodeHex)
: "Loading..." : "Loading..."
}`} }`}
actions={ actions={

Loading…
Cancel
Save