time tracking

This commit is contained in:
2024-08-03 05:37:59 +03:00
parent deb7574380
commit 2ae47287a2
19 changed files with 483 additions and 16 deletions

View File

@@ -0,0 +1,34 @@
import {NumberInput, NumberInputProps} from "@mantine/core";
import {useEffect, useState} from "react";
import {useDebouncedValue} from "@mantine/hooks";
import {isNumber, omit} from "lodash";
type Props = NumberInputProps;
const DebouncedNumberInput = (props: Props) => {
const [value, setValue] = useState<number | string>(props.defaultValue || props.value || '');
const [debounced] = useDebouncedValue(value, 200);
useEffect(() => {
if (!props.onChange) return;
props.onChange(debounced);
}, [debounced])
useEffect(() => {
if (!isNumber(props.value)) return;
setValue(props.value);
}, [props.value])
const restProps = omit(props, ["onChange", "value"])
return (
<NumberInput
value={value}
onChange={setValue}
{...restProps}
/>
)
}
export default DebouncedNumberInput;

View File

@@ -4,8 +4,8 @@ import styles from './CreateDealButton.module.css';
import {Text, Transition} from '@mantine/core';
import CreateDealFrom from "../CreateDealForm/CreateDealFrom.tsx";
import {DealService} from "../../../client";
import {dateWithoutTimezone} from "../../../shared/lib/utils.ts";
import {useQueryClient} from "@tanstack/react-query";
import {dateWithoutTimezone} from "../../../shared/lib/date.ts";
type Props = {
onClick: () => void;