-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core-data-access): Refactoring updates to data access library
Updates to folder structure of state management files Moved form hooks
- Loading branch information
1 parent
b04d437
commit faacb9c
Showing
69 changed files
with
996 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from "./hooks"; | ||
export * from "./models"; | ||
export * from "./types"; | ||
export * from "./state"; | ||
export * from "./types"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
export * from "./useIsDarkMode"; | ||
export * from "./useToastMessages"; | ||
export * from "./useTheme"; | ||
export * from "./useAtomList"; | ||
export * from "./useNotifications"; | ||
export * from "./useCurrentUserId"; | ||
export * from "./useFileUploadList"; | ||
export * from "./useFormId"; | ||
export * from "./useFormId"; | ||
export * from "./useIsDarkMode"; | ||
export * from "./useNotifications"; | ||
export * from "./useTheme"; | ||
export * from "./useToastMessages"; | ||
export * from "./useFieldValue"; | ||
export * from "./useFormValues"; | ||
export * from "./useIsSubmitting"; | ||
export * from "./useIsValid"; | ||
export * from "./useFieldErrors"; | ||
export * from "./useFieldRegistration"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
libs/core/typescript/data-access/src/hooks/useCurrentUserId.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { useAtomValue } from "jotai"; | ||
import { currentUserIdAtom } from "../state/current-user-id"; | ||
|
||
export const useCurrentUserId = (): string => { | ||
return useAtomValue(currentUserIdAtom); | ||
}; |
File renamed without changes.
25 changes: 25 additions & 0 deletions
25
libs/core/typescript/data-access/src/hooks/useFieldRegistration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useSetAtom } from "jotai"; | ||
import { useCallback } from "react"; | ||
import { useFormContext } from "react-hook-form"; | ||
import { useFormId } from "../hooks/useFormId"; | ||
import { formFieldConfigFamily } from "../state/form"; | ||
import { FormFieldConfig } from "../types"; | ||
|
||
export const useFieldRegistration = (field: string) => { | ||
const { register } = useFormContext(); | ||
|
||
const formId = useFormId(); | ||
const setFormFieldConfig = useSetAtom( | ||
formFieldConfigFamily({ field, formId }) | ||
); | ||
|
||
return useCallback( | ||
(config: Partial<FormFieldConfig>) => { | ||
const props = register(field, config as any); | ||
setFormFieldConfig(config); | ||
|
||
return { ...props, name: field, config }; | ||
}, | ||
[field, register, setFormFieldConfig] | ||
); | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export * from "./formatting"; | ||
export * from "./hooks"; | ||
export * from "./models"; | ||
export * from "./state"; | ||
export * from "./types"; | ||
export * from "./utilities"; | ||
export * from "./formatting"; |
Oops, something went wrong.