From 04d76c2a702e22d03ed648c9fcaa55d429bf28e0 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 8 Aug 2023 17:52:21 +0200 Subject: [PATCH] Move `useCycleState` to `(utils)` --- todoblue/src/app/{[lang] => (utils)}/useCycleState.ts | 5 +++++ todoblue/src/app/[lang]/board/[board]/useBoard.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) rename todoblue/src/app/{[lang] => (utils)}/useCycleState.ts (75%) diff --git a/todoblue/src/app/[lang]/useCycleState.ts b/todoblue/src/app/(utils)/useCycleState.ts similarity index 75% rename from todoblue/src/app/[lang]/useCycleState.ts rename to todoblue/src/app/(utils)/useCycleState.ts index bbb6eae..6dbdc1e 100644 --- a/todoblue/src/app/[lang]/useCycleState.ts +++ b/todoblue/src/app/(utils)/useCycleState.ts @@ -1,6 +1,11 @@ import {useCallback, useMemo, useState} from "react" +/** + * **Hook** similar to {@link useState}, but which allows a value to be chosen from a cycle of items. + * + * @param items The items in the cycle. + */ export function useCycleState(items: any[]) { const [index, setIndex] = useState(0); diff --git a/todoblue/src/app/[lang]/board/[board]/useBoard.tsx b/todoblue/src/app/[lang]/board/[board]/useBoard.tsx index 12c4751..19fe675 100644 --- a/todoblue/src/app/[lang]/board/[board]/useBoard.tsx +++ b/todoblue/src/app/[lang]/board/[board]/useBoard.tsx @@ -7,7 +7,7 @@ import {useBoardTaskEditor} from "@/app/[lang]/board/[board]/useBoardTaskEditor" import {useBoardWs} from "@/app/[lang]/board/[board]/useBoardWs" import {TaskGroup, useBoardTaskArranger} from "@/app/[lang]/board/[board]/useBoardTaskArranger" import {useBoardTitleEditor} from "@/app/[lang]/board/[board]/useBoardTitleEditor" -import {useCycleState} from "@/app/[lang]/useCycleState" +import {useCycleState} from "@/app/(utils)/useCycleState" import {Dispatch, SetStateAction, useState} from "react" export interface UseBoardReturns {