(feat): add custom lint rules
(qol): update todo (chore): update licenses
This commit is contained in:
parent
bf8f449f03
commit
17db895203
28 changed files with 585 additions and 513 deletions
|
|
@ -4,7 +4,14 @@ import { Label } from "@tensamin/ui";
|
|||
import { useStorage } from "@tensamin/storage/context";
|
||||
import { log, toast } from "@tensamin/shared/log";
|
||||
import { File } from "lucide-react";
|
||||
import * as React from "react";
|
||||
import {
|
||||
type ChangeEvent,
|
||||
type FormEvent,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { z } from "zod";
|
||||
import { isTauri } from "@tauri-apps/api/core";
|
||||
import QrCodeScanner from "@tensamin/tauri/qrCodeScanner";
|
||||
|
|
@ -78,13 +85,13 @@ function parseTuFileContent(rawFileContent: string): {
|
|||
|
||||
export default function Form() {
|
||||
const isMobile = useIsMobile();
|
||||
const uploadRef = React.useRef<HTMLInputElement | null>(null);
|
||||
const [isDragging, setIsDragging] = React.useState(false);
|
||||
const uploadRef = useRef<HTMLInputElement | null>(null);
|
||||
const [isDragging, setIsDragging] = useState(false);
|
||||
const { save } = useStorage();
|
||||
const navigate = useNavigate();
|
||||
const loginPendingRef = React.useRef(false);
|
||||
const loginPendingRef = useRef(false);
|
||||
|
||||
const persistLogin = React.useCallback(
|
||||
const persistLogin = useCallback(
|
||||
async (userId: number, privateKey: string, domain?: string | null) => {
|
||||
if (loginPendingRef.current) return false;
|
||||
loginPendingRef.current = true;
|
||||
|
|
@ -103,7 +110,7 @@ export default function Form() {
|
|||
);
|
||||
|
||||
// Process dropped files
|
||||
const processDroppedFile = React.useCallback(
|
||||
const processDroppedFile = useCallback(
|
||||
async (file: globalThis.File): Promise<void> => {
|
||||
try {
|
||||
if (!file.name.endsWith(".tu")) {
|
||||
|
|
@ -124,8 +131,8 @@ export default function Form() {
|
|||
);
|
||||
|
||||
// Handle .tu files
|
||||
const handleFileInputChange = React.useCallback(
|
||||
async (event: React.ChangeEvent<HTMLInputElement>): Promise<void> => {
|
||||
const handleFileInputChange = useCallback(
|
||||
async (event: ChangeEvent<HTMLInputElement>): Promise<void> => {
|
||||
const file = event.currentTarget.files?.[0];
|
||||
|
||||
if (!file) {
|
||||
|
|
@ -139,7 +146,7 @@ export default function Form() {
|
|||
);
|
||||
|
||||
// Drag and drop listener
|
||||
React.useEffect(() => {
|
||||
useEffect(() => {
|
||||
let dragCounter = 0;
|
||||
|
||||
const handleDragEnter = (event: DragEvent) => {
|
||||
|
|
@ -209,8 +216,8 @@ export default function Form() {
|
|||
* @param event Form submit event.
|
||||
* @returns Promise that resolves after login processing.
|
||||
*/
|
||||
const handleCredentialsSubmit = React.useCallback(
|
||||
async (event: React.FormEvent<HTMLFormElement>): Promise<void> => {
|
||||
const handleCredentialsSubmit = useCallback(
|
||||
async (event: FormEvent<HTMLFormElement>): Promise<void> => {
|
||||
event.preventDefault();
|
||||
|
||||
const formData = new FormData(event.currentTarget);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import * as React from "react";
|
||||
import { useRef, useState } from "react";
|
||||
import { useVirtualizer } from "@tanstack/react-virtual";
|
||||
|
||||
import Switch from "./switch";
|
||||
|
|
@ -8,14 +8,14 @@ import { Loader2 } from "lucide-react";
|
|||
import { useSession } from "@tensamin/storage/session";
|
||||
|
||||
export default function List() {
|
||||
const [category, setCategory] = React.useState<
|
||||
"conversations" | "communities"
|
||||
>("conversations");
|
||||
const [category, setCategory] = useState<"conversations" | "communities">(
|
||||
"conversations",
|
||||
);
|
||||
|
||||
const { contacts, communities } = useSession();
|
||||
const items = category === "conversations" ? contacts : communities;
|
||||
|
||||
const scrollRef = React.useRef<HTMLDivElement | null>(null);
|
||||
const scrollRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
// TanStack Virtual is intentionally used here; React Compiler memoization is skipped.
|
||||
// eslint-disable-next-line react-hooks/incompatible-library
|
||||
|
|
|
|||
Loading…
Reference in a new issue