|
@@ -17,7 +17,6 @@ import { useDetachContext } from './detach-context'
|
|
|
import getMeta from '../../utils/meta'
|
|
import getMeta from '../../utils/meta'
|
|
|
import { useUserContext } from './user-context'
|
|
import { useUserContext } from './user-context'
|
|
|
import { saveProjectSettings } from '@/features/editor-left-menu/utils/api'
|
|
import { saveProjectSettings } from '@/features/editor-left-menu/utils/api'
|
|
|
-import { PermissionsLevel } from '@/features/ide-react/types/permissions'
|
|
|
|
|
import { useModalsContext } from '@/features/ide-react/context/modals-context'
|
|
import { useModalsContext } from '@/features/ide-react/context/modals-context'
|
|
|
import { WritefullAPI } from './types/writefull-instance'
|
|
import { WritefullAPI } from './types/writefull-instance'
|
|
|
import { Cobranding } from '../../../../types/cobranding'
|
|
import { Cobranding } from '../../../../types/cobranding'
|
|
@@ -28,19 +27,16 @@ export const EditorContext = createContext<
|
|
|
cobranding?: Cobranding
|
|
cobranding?: Cobranding
|
|
|
hasPremiumCompile?: boolean
|
|
hasPremiumCompile?: boolean
|
|
|
renameProject: (newName: string) => void
|
|
renameProject: (newName: string) => void
|
|
|
- setPermissionsLevel: (permissionsLevel: PermissionsLevel) => void
|
|
|
|
|
showSymbolPalette?: boolean
|
|
showSymbolPalette?: boolean
|
|
|
toggleSymbolPalette?: () => void
|
|
toggleSymbolPalette?: () => void
|
|
|
insertSymbol?: (symbol: SymbolWithCharacter) => void
|
|
insertSymbol?: (symbol: SymbolWithCharacter) => void
|
|
|
isProjectOwner: boolean
|
|
isProjectOwner: boolean
|
|
|
isRestrictedTokenMember?: boolean
|
|
isRestrictedTokenMember?: boolean
|
|
|
isPendingEditor: boolean
|
|
isPendingEditor: boolean
|
|
|
- permissionsLevel: PermissionsLevel
|
|
|
|
|
deactivateTutorial: (tutorial: string) => void
|
|
deactivateTutorial: (tutorial: string) => void
|
|
|
inactiveTutorials: string[]
|
|
inactiveTutorials: string[]
|
|
|
currentPopup: string | null
|
|
currentPopup: string | null
|
|
|
setCurrentPopup: Dispatch<SetStateAction<string | null>>
|
|
setCurrentPopup: Dispatch<SetStateAction<string | null>>
|
|
|
- setOutOfSync: (value: boolean) => void
|
|
|
|
|
hasPremiumSuggestion: boolean
|
|
hasPremiumSuggestion: boolean
|
|
|
setHasPremiumSuggestion: (value: boolean) => void
|
|
setHasPremiumSuggestion: (value: boolean) => void
|
|
|
setPremiumSuggestionResetDate: (date: Date) => void
|
|
setPremiumSuggestionResetDate: (date: Date) => void
|
|
@@ -78,9 +74,6 @@ export const EditorProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
const [projectName, setProjectName] = useScopeValue('project.name')
|
|
const [projectName, setProjectName] = useScopeValue('project.name')
|
|
|
- const [permissionsLevel, setPermissionsLevel] =
|
|
|
|
|
- useScopeValue('permissionsLevel')
|
|
|
|
|
- const [outOfSync, setOutOfSync] = useState(false)
|
|
|
|
|
const [showSymbolPalette] = useScopeValue('editor.showSymbolPalette')
|
|
const [showSymbolPalette] = useScopeValue('editor.showSymbolPalette')
|
|
|
const [toggleSymbolPalette] = useScopeValue('editor.toggleSymbolPalette')
|
|
const [toggleSymbolPalette] = useScopeValue('editor.toggleSymbolPalette')
|
|
|
|
|
|
|
@@ -187,8 +180,6 @@ export const EditorProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
|
|
cobranding,
|
|
cobranding,
|
|
|
hasPremiumCompile: features?.compileGroup === 'priority',
|
|
hasPremiumCompile: features?.compileGroup === 'priority',
|
|
|
renameProject,
|
|
renameProject,
|
|
|
- permissionsLevel: outOfSync ? 'readOnly' : permissionsLevel,
|
|
|
|
|
- setPermissionsLevel,
|
|
|
|
|
isProjectOwner: owner?._id === userId,
|
|
isProjectOwner: owner?._id === userId,
|
|
|
isRestrictedTokenMember: getMeta('ol-isRestrictedTokenMember'),
|
|
isRestrictedTokenMember: getMeta('ol-isRestrictedTokenMember'),
|
|
|
isPendingEditor,
|
|
isPendingEditor,
|
|
@@ -199,7 +190,6 @@ export const EditorProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
|
|
deactivateTutorial,
|
|
deactivateTutorial,
|
|
|
currentPopup,
|
|
currentPopup,
|
|
|
setCurrentPopup,
|
|
setCurrentPopup,
|
|
|
- setOutOfSync,
|
|
|
|
|
hasPremiumSuggestion,
|
|
hasPremiumSuggestion,
|
|
|
setHasPremiumSuggestion,
|
|
setHasPremiumSuggestion,
|
|
|
premiumSuggestionResetDate,
|
|
premiumSuggestionResetDate,
|
|
@@ -213,8 +203,6 @@ export const EditorProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
|
|
owner,
|
|
owner,
|
|
|
userId,
|
|
userId,
|
|
|
renameProject,
|
|
renameProject,
|
|
|
- permissionsLevel,
|
|
|
|
|
- setPermissionsLevel,
|
|
|
|
|
isPendingEditor,
|
|
isPendingEditor,
|
|
|
showSymbolPalette,
|
|
showSymbolPalette,
|
|
|
toggleSymbolPalette,
|
|
toggleSymbolPalette,
|
|
@@ -223,8 +211,6 @@ export const EditorProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
|
|
deactivateTutorial,
|
|
deactivateTutorial,
|
|
|
currentPopup,
|
|
currentPopup,
|
|
|
setCurrentPopup,
|
|
setCurrentPopup,
|
|
|
- outOfSync,
|
|
|
|
|
- setOutOfSync,
|
|
|
|
|
hasPremiumSuggestion,
|
|
hasPremiumSuggestion,
|
|
|
setHasPremiumSuggestion,
|
|
setHasPremiumSuggestion,
|
|
|
premiumSuggestionResetDate,
|
|
premiumSuggestionResetDate,
|
|
@@ -238,6 +224,7 @@ export const EditorProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
|
|
<EditorContext.Provider value={value}>{children}</EditorContext.Provider>
|
|
<EditorContext.Provider value={value}>{children}</EditorContext.Provider>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
export function useEditorContext() {
|
|
export function useEditorContext() {
|
|
|
const context = useContext(EditorContext)
|
|
const context = useContext(EditorContext)
|
|
|
|
|
|