* refactor: translate on server * refactor: remove summary and translation action * enable summary and translation from settings * remove translate and summary from action * follow setting * ignore whitespace change * correct content translation for social item * update * update * fix content * global setting for summary on mobile * translation store * show and cache translation * update migrate sql * token header for social sign in * remove readabilityContent in web view * ci debug * check repository * ci check condition * fix readability * show entry content translation * update * update * translation for social item * Revert "remove translate and summary from action" This reverts commit c8a195a9b224b308cbcd86a6293ffae03e946a72. * update text * support global,once,action summary and translation * fix condition * refactor * refactor: extract use entry translation hook * update * rename * Revert "rename" This reverts commit 672092f88c04670c7e1017aaf8b9caa6499f1877. * update * update * fix * translation header action * unsave prompt * chore: auto-fix linting and formatting issues * connect and row * prompt on mobile before leave * update * follow action setting * hide button when follow action * update changelog
17 lines
576 B
TypeScript
17 lines
576 B
TypeScript
import type { PrimitiveAtom } from "jotai"
|
|
import { createContext, useContext } from "react"
|
|
|
|
interface EntryContentContextType {
|
|
showAISummaryAtom: PrimitiveAtom<boolean>
|
|
showAITranslationAtom: PrimitiveAtom<boolean>
|
|
showReadabilityAtom: PrimitiveAtom<boolean>
|
|
}
|
|
export const EntryContentContext = createContext<EntryContentContextType>(null!)
|
|
export const useEntryContentContext = () => {
|
|
const context = useContext(EntryContentContext)
|
|
if (!context) {
|
|
throw new Error("useEntryContentContext must be used within a EntryContentContext")
|
|
}
|
|
return context
|
|
}
|