-
-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: @fz6m teaching and review suggestions
- Loading branch information
Showing
16 changed files
with
175 additions
and
170 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
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
110 changes: 0 additions & 110 deletions
110
src/components/widgets/comment/CommentBox/CommentBoxProvider.tsx
This file was deleted.
Oops, something went wrong.
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
11 changes: 10 additions & 1 deletion
11
...CommentBox/CommentBoxSignedOutContent.tsx → ...s/comment/CommentBox/SignedOutContent.tsx
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
'use client' | ||
|
||
import { useCallback, useContext } from 'react' | ||
import { useAtomValue } from 'jotai' | ||
import { selectAtom } from 'jotai/utils' | ||
import type { ExtractAtomValue } from 'jotai' | ||
import type { createInitialValue } from './providers' | ||
|
||
import { jotaiStore } from '~/lib/store' | ||
|
||
import { MAX_COMMENT_TEXT_LENGTH } from './constants' | ||
import { | ||
CommentBoxContext, | ||
CommentCompletedCallbackContext, | ||
CommentIsReplyContext, | ||
CommentOriginalRefIdContext, | ||
} from './providers' | ||
|
||
export const useUseCommentReply = () => useContext(CommentIsReplyContext) | ||
export const useCommentOriginalRefId = () => | ||
useContext(CommentOriginalRefIdContext) | ||
export const useCommentCompletedCallback = () => | ||
useContext(CommentCompletedCallbackContext) | ||
|
||
export const useCommentBoxTextValue = () => | ||
useAtomValue(useContext(CommentBoxContext).text) | ||
|
||
export const useCommentBoxRefIdValue = () => | ||
useAtomValue(useContext(CommentBoxContext).refId) | ||
|
||
export const useGetCommentBoxAtomValues = () => { | ||
return useContext(CommentBoxContext) | ||
} | ||
|
||
export const useCommentBoxHasText = () => | ||
useAtomValue( | ||
selectAtom( | ||
useContext(CommentBoxContext).text, | ||
useCallback((v) => v.length > 0, []), | ||
), | ||
) | ||
|
||
export const useCommentBoxTextIsOversize = () => | ||
useAtomValue( | ||
selectAtom( | ||
useContext(CommentBoxContext).text, | ||
useCallback((v) => v.length > MAX_COMMENT_TEXT_LENGTH, []), | ||
), | ||
) | ||
type CommentContextValue = ReturnType<typeof createInitialValue> | ||
|
||
export const useSetCommentBoxValues = < | ||
T extends keyof CommentContextValue, | ||
>() => { | ||
const ctx = useContext(CommentBoxContext) | ||
return (key: T, value: ExtractAtomValue<CommentContextValue[T]>) => { | ||
const atom = ctx[key] | ||
if (!atom) throw new Error(`atom ${key} not found`) | ||
jotaiStore.set(atom, value) | ||
} | ||
} |
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 +1 @@ | ||
export { CommentBoxRoot } from './CommentBoxRoot' | ||
export { CommentBoxRoot } from './Root' |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
1c74c89
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
springtide – ./
springtide.vercel.app
springtide-git-main-innei.vercel.app
springtide-innei.vercel.app
innei.in