mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: migrate orgconfig model across the app
This commit is contained in:
parent
6485b6e1bb
commit
28a2456d69
12 changed files with 467 additions and 363 deletions
|
|
@ -33,7 +33,7 @@ function SignUpClient(props: SignUpClientProps) {
|
|||
useEffect(() => {
|
||||
if (props.org.config) {
|
||||
setJoinMethod(
|
||||
props.org?.config?.config?.GeneralConfig.users.signup_mechanism
|
||||
props.org?.config?.config?.features.members.signup_mode
|
||||
)
|
||||
}
|
||||
if (inviteCodeParam) {
|
||||
|
|
|
|||
|
|
@ -10,21 +10,9 @@ function useGetAIFeatures(props: UseGetAIFeatures) {
|
|||
const [isEnabled, setisEnabled] = React.useState(false)
|
||||
|
||||
function checkAvailableAIFeaturesOnOrg(feature: string) {
|
||||
const config = org?.config?.config?.AIConfig
|
||||
const config = org?.config?.config?.features.ai.enabled
|
||||
|
||||
if (!config) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!config.enabled) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!config.features[feature]) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
return config
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export function OrgProvider({ children, orgslug }: { children: React.ReactNode,
|
|||
)
|
||||
|
||||
|
||||
const isOrgActive = useMemo(() => org?.config?.config?.GeneralConfig?.active !== false, [org])
|
||||
const isOrgActive = useMemo(() => org?.config?.config?.general?.enabled !== false, [org])
|
||||
const isUserPartOfTheOrg = useMemo(() => orgs?.some((userOrg: any) => userOrg.id === org?.id), [orgs, org?.id])
|
||||
|
||||
if (orgError || orgsError) return <ErrorUI message='An error occurred while fetching data' />
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ function OrgAccess() {
|
|||
|
||||
async function getOrgJoinMethod() {
|
||||
if (org) {
|
||||
if (org.config.config.GeneralConfig.users.signup_mechanism == 'open') {
|
||||
if (org.config.config.features.members.signup_mode == 'open') {
|
||||
setJoinMethod('open')
|
||||
} else {
|
||||
setJoinMethod('inviteOnly')
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ function ActiveAvatars(props: ActiveAvatarsProps) {
|
|||
|
||||
/* Collaboration Features */
|
||||
const collab = getCollaborationServerUrl()
|
||||
const isCollabEnabledOnThisOrg = org?.config.config.GeneralConfig.collaboration && collab
|
||||
const isCollabEnabledOnThisOrg = org?.config.config.features.collaboration.enabled && collab
|
||||
|
||||
// Get users from the mouseMovements object
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ function EditorWrapper(props: EditorWrapperProps): JSX.Element {
|
|||
|
||||
/* Collaboration Features */
|
||||
const collab = getCollaborationServerUrl()
|
||||
const isCollabEnabledOnThisOrg = props.org.config.config.GeneralConfig.collaboration && collab
|
||||
const isCollabEnabledOnThisOrg = props.org.config.config.features.collaboration.enabled && collab
|
||||
const doc = new Y.Doc()
|
||||
// mouse movement
|
||||
const [mouseMovements, setMouseMovements] = useState({} as any);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ function MouseMovements({ movements, onlinePageInstanceID, org }: MouseMovements
|
|||
|
||||
/* Collaboration config */
|
||||
const collab = getCollaborationServerUrl()
|
||||
const isCollabEnabledOnThisOrg = org?.config.config.GeneralConfig.collaboration && collab
|
||||
const isCollabEnabledOnThisOrg = org?.config.config.features.collaboration.enabled && collab
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue