| null>(null);
const isPlaying = useSoundStore(state => state.isPlaying);
const play = useSoundStore(state => state.play);
diff --git a/src/components/modals/sleep-timer/timer/reverse/reverse.tsx b/src/components/modals/sleep-timer/timer/reverse/reverse.tsx
index d0f34fb6..c5aa2c01 100644
--- a/src/components/modals/sleep-timer/timer/reverse/reverse.tsx
+++ b/src/components/modals/sleep-timer/timer/reverse/reverse.tsx
@@ -11,9 +11,9 @@ export function Reverse({ time }: ReverseProps) {
let minutes = Math.floor((time % 3600) / 60);
let seconds = time % 60;
- hours = isNaN(hours) ? 0 : hours;
- minutes = isNaN(minutes) ? 0 : minutes;
- seconds = isNaN(seconds) ? 0 : seconds;
+ hours = Number.isNaN(hours) ? 0 : hours;
+ minutes = Number.isNaN(minutes) ? 0 : minutes;
+ seconds = Number.isNaN(seconds) ? 0 : seconds;
const formattedHours = padNumber(hours);
const formattedMinutes = padNumber(minutes);
diff --git a/src/components/modals/sleep-timer/timer/timer.tsx b/src/components/modals/sleep-timer/timer/timer.tsx
index b5e79128..f4244a2b 100644
--- a/src/components/modals/sleep-timer/timer/timer.tsx
+++ b/src/components/modals/sleep-timer/timer/timer.tsx
@@ -14,9 +14,9 @@ export function Timer({ reverse, timer }: TimerProps) {
let minutes = Math.floor((timer % 3600) / 60);
let seconds = timer % 60;
- hours = isNaN(hours) ? 0 : hours;
- minutes = isNaN(minutes) ? 0 : minutes;
- seconds = isNaN(seconds) ? 0 : seconds;
+ hours = Number.isNaN(hours) ? 0 : hours;
+ minutes = Number.isNaN(minutes) ? 0 : minutes;
+ seconds = Number.isNaN(seconds) ? 0 : seconds;
const formattedHours = padNumber(hours);
const formattedMinutes = padNumber(minutes);
diff --git a/src/components/slider/slider.tsx b/src/components/slider/slider.tsx
index 2e6858a4..b5cd7b55 100644
--- a/src/components/slider/slider.tsx
+++ b/src/components/slider/slider.tsx
@@ -1,4 +1,4 @@
-import * as RadixSlider from '@radix-ui/react-slider';
+import { Slider as RadixSlider } from 'radix-ui';
import styles from './slider.module.css';
type SliderProps = {
diff --git a/src/components/toolbar/menu/item/item.tsx b/src/components/toolbar/menu/item/item.tsx
index 0b3b1f0e..4542e6dc 100644
--- a/src/components/toolbar/menu/item/item.tsx
+++ b/src/components/toolbar/menu/item/item.tsx
@@ -1,5 +1,5 @@
import { FiExternalLink } from 'react-icons/fi/index';
-import { Item as DropdownItem } from '@radix-ui/react-dropdown-menu';
+import { DropdownMenu } from 'radix-ui';
import styles from './item.module.css';
@@ -25,7 +25,7 @@ export function Item({
const Comp = href ? 'a' : 'button';
return (
-
+
)}
-
+
);
}
diff --git a/src/components/toolbar/menu/menu.tsx b/src/components/toolbar/menu/menu.tsx
index c576d062..d4120620 100644
--- a/src/components/toolbar/menu/menu.tsx
+++ b/src/components/toolbar/menu/menu.tsx
@@ -1,6 +1,6 @@
import { useState, useMemo, useCallback } from 'react';
import { IoMenu, IoClose } from 'react-icons/io5/index';
-import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
+import { DropdownMenu } from 'radix-ui';
import { useHotkeys } from 'react-hotkeys-hook';
import { AnimatePresence, motion } from 'motion/react';
diff --git a/src/components/toolbox/countdown/countdown.tsx b/src/components/toolbox/countdown/countdown.tsx
index e17f2398..2d279136 100644
--- a/src/components/toolbox/countdown/countdown.tsx
+++ b/src/components/toolbox/countdown/countdown.tsx
@@ -87,7 +87,9 @@ export function Countdown({ onClose, show }: CountdownProps) {
placeholder="HH"
type="number"
value={hours}
- onChange={e => setHours(Math.max(0, parseInt(e.target.value)))}
+ onChange={e =>
+ setHours(Math.max(0, Number.parseInt(e.target.value, 10) || 0))
+ }
/>
:
@@ -98,7 +100,12 @@ export function Countdown({ onClose, show }: CountdownProps) {
type="number"
value={minutes}
onChange={e =>
- setMinutes(Math.max(0, Math.min(59, parseInt(e.target.value))))
+ setMinutes(
+ Math.max(
+ 0,
+ Math.min(59, Number.parseInt(e.target.value, 10)),
+ ),
+ )
}
/>
@@ -110,7 +117,12 @@ export function Countdown({ onClose, show }: CountdownProps) {
type="number"
value={seconds}
onChange={e =>
- setSeconds(Math.max(0, Math.min(59, parseInt(e.target.value))))
+ setSeconds(
+ Math.max(
+ 0,
+ Math.min(59, Number.parseInt(e.target.value, 10)),
+ ),
+ )
}
/>
diff --git a/src/components/toolbox/pomodoro/timer/timer.tsx b/src/components/toolbox/pomodoro/timer/timer.tsx
index e99157f1..a39c60f7 100644
--- a/src/components/toolbox/pomodoro/timer/timer.tsx
+++ b/src/components/toolbox/pomodoro/timer/timer.tsx
@@ -11,9 +11,9 @@ export function Timer({ timer }: TimerProps) {
let minutes = Math.floor((timer % 3600) / 60);
let seconds = timer % 60;
- hours = isNaN(hours) ? 0 : hours;
- minutes = isNaN(minutes) ? 0 : minutes;
- seconds = isNaN(seconds) ? 0 : seconds;
+ hours = Number.isNaN(hours) ? 0 : hours;
+ minutes = Number.isNaN(minutes) ? 0 : minutes;
+ seconds = Number.isNaN(seconds) ? 0 : seconds;
const formattedHours = padNumber(hours);
const formattedMinutes = padNumber(minutes);
diff --git a/src/components/toolbox/todo/todos/todos.tsx b/src/components/toolbox/todo/todos/todos.tsx
index cef242ac..00e26807 100644
--- a/src/components/toolbox/todo/todos/todos.tsx
+++ b/src/components/toolbox/todo/todos/todos.tsx
@@ -19,16 +19,9 @@ export function Todos() {
{todos.length > 0 ? (
- <>
- {todos.map(todo => (
-
- ))}
- >
+ todos.map(todo => (
+
+ ))
) : (
You don't have any todos.
)}
diff --git a/src/components/tooltip/tooltip.tsx b/src/components/tooltip/tooltip.tsx
index 3d2ae7eb..a677c4f2 100644
--- a/src/components/tooltip/tooltip.tsx
+++ b/src/components/tooltip/tooltip.tsx
@@ -1,6 +1,6 @@
import { useState } from 'react';
import { motion, AnimatePresence } from 'motion/react';
-import * as TooltipPrimitive from '@radix-ui/react-tooltip';
+import { Tooltip as TooltipPrimitive } from 'radix-ui';
import { slideX, slideY, mix, fade } from '@/lib/motion';
@@ -21,11 +21,15 @@ type Placement =
| 'left-end';
interface TooltipProps {
- children: JSX.Element;
+ children: React.ReactNode;
content: string;
placement?: Placement;
}
+type PlacementSide = 'top' | 'right' | 'bottom' | 'left';
+type PlacementAlign = 'start' | 'end' | 'center';
+type Motion = ReturnType;
+
export function Tooltip({
children,
content,
@@ -33,21 +37,17 @@ export function Tooltip({
}: TooltipProps) {
const [isOpen, setIsOpen] = useState(false);
- const side = placement.split('-')[0] as 'top' | 'right' | 'bottom' | 'left';
- const align = placement.split('-')[1] as
- | 'start'
- | 'end'
- | 'center'
- | undefined;
+ const side = placement.split('-')[0] as PlacementSide;
+ const align = placement.split('-')[1] as PlacementAlign | undefined;
- const slide = {
+ const slides: Record = {
bottom: slideY(-5),
left: slideX(5),
right: slideX(-5),
top: slideY(5),
- }[side];
+ };
- const variants = mix(fade(), slide!);
+ const variants = mix(fade(), slides[side]);
return (
setIsOpen(o)}>
diff --git a/src/helpers/download.ts b/src/helpers/download.ts
index d8ff2119..d26b0042 100644
--- a/src/helpers/download.ts
+++ b/src/helpers/download.ts
@@ -8,7 +8,7 @@ export function download(filename: string, content: string) {
const element = document.createElement('a');
element.setAttribute(
'href',
- 'data:text/plain;charset=utf-8,' + encodeURIComponent(content),
+ `data:text/plain;charset=utf-8,${encodeURIComponent(content)}`,
);
element.setAttribute('download', filename);
element.click();
diff --git a/src/hooks/use-local-storage.ts b/src/hooks/use-local-storage.ts
index ed42416a..ad498c7a 100644
--- a/src/hooks/use-local-storage.ts
+++ b/src/hooks/use-local-storage.ts
@@ -22,7 +22,7 @@ export function useLocalStorage(key: string, fallback: T): [T, SetValue] {
try {
parsed = JSON.parse(value);
- } catch (error) {
+ } catch {
parsed = fallback;
}
diff --git a/src/stores/note.ts b/src/stores/note.ts
index ccb35a6c..903dbc31 100644
--- a/src/stores/note.ts
+++ b/src/stores/note.ts
@@ -33,6 +33,7 @@ export const useNoteStore = create()(
restore() {
if (!get().history) return;
+ // biome-ignore lint/style/noNonNullAssertion: it's guaranteed to be not null
set({ history: null, note: get().history! });
},
diff --git a/tsconfig.json b/tsconfig.json
index 66d31aa7..66f8915f 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -6,7 +6,6 @@
"baseUrl": "./src",
"paths": {
"@/*": ["./*"]
- },
- "types": ["vite-plugin-pwa/react", "vite-plugin-pwa/info"]
+ }
}
}