Skip to content

Commit

Permalink
adding wordpress support
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardTMiles committed Dec 22, 2023
1 parent 82d0bd3 commit a495cee
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 8 deletions.
15 changes: 12 additions & 3 deletions src/CarbonORM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,17 @@ import UpgradeToPro, {UPGRADE_TO_PRO} from "pages/UI/MaterialDashboard/UpgradeTo
import UserProfile, {USER_PROFILE} from "pages/UI/MaterialDashboard/UserProfile/UserProfile";
import CarbonORMDocumentation, {CARBON_ORM_INTRODUCTION} from "pages/Documentation/CarbonORM/CarbonORM"
import isTest from "variables/isTest";
import {initialWordPressState, iWordPress} from "state/wordpress";


export const initialCarbonORMState: typeof initialRestfulObjectsState
& typeof initialRequiredCarbonORMState
& iAuthenticate
& iVersions
& iUi
& iWordPress
& {} = {
...initialWordPressState,
...initialVersionsState,
...initialRestfulObjectsState,
...initialRequiredCarbonORMState,
Expand Down Expand Up @@ -83,12 +86,12 @@ export default class CarbonORM extends CarbonReact<{ browserRouter?: boolean },
render() {
console.log("CarbonORM TSX RENDER");

const {isLoaded, backendThrowable} = this.state;
const {isLoaded, backendThrowable, pureWordpressPluginConfigured} = this.state;


if (backendThrowable.length > 0) {

return <BackendThrowable />
return <BackendThrowable/>

}

Expand Down Expand Up @@ -161,7 +164,13 @@ export default class CarbonORM extends CarbonReact<{ browserRouter?: boolean },
<Route path={IMPLEMENTATIONS + "*"} element={ppr(Implementations, {})}/>
<Route path={SUPPORT + '*'} element={ppr(Support, {})}/>
<Route path={LICENSE + "*"} element={ppr(License, {})}/>
<Route path={'*'} element={<Navigate to={'/' + DOCUMENTATION + CARBON_ORM_INTRODUCTION}/>}/>
<Route path={'*'} element={
<Navigate to={'/' + DOCUMENTATION
+ (pureWordpressPluginConfigured
? CARBON_WORDPRESS
: CARBON_ORM_INTRODUCTION)}
/>
}/>
</Route>
<Route path="/landing-page" element={ppr(LandingPage, {})}/>
<Route path={'*'} element={<Navigate to={'/' + DOCUMENTATION}/>}/>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Documentation/Documentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class Documentation extends React.Component<{
</h1>
<h3 className={classes.subtitle}
style={{color: (darkMode ? "white" : "black")}}>
Generate a powerful MySQL Restful ORM. Write secure json based sql queries in front end.
Auto-magically manage your database across multiple servers and teams!
Generate a powerful MySQL Restful ORM. Write secure json based sql queries in front
end and middleware. Auto-magically manage your database across multiple servers and teams!
</h3>
</div>
</GridItem>
Expand Down
4 changes: 1 addition & 3 deletions src/state/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import CarbonORM from "CarbonORM";


export interface iUi {
pureWordpressPluginConfigured?: boolean,
documentationVersionURI: string,
isLoaded: boolean,
darkMode: boolean,
}

export const initialUiState: iUi = {
pureWordpressPluginConfigured: false,
export const initialUiState: iUi = {
documentationVersionURI: '0.0.0',
isLoaded: false,
darkMode: true,
Expand Down
24 changes: 24 additions & 0 deletions src/state/wordpress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

export interface iWordPress {
pureWordpressPluginConfigured?: boolean,
C6WordPressGuidedSetup?: boolean,
C6WordPressVersion?: string,
C6PHPVersion?: string,
}


declare global {
interface Window {
C6WordPress: any;
C6WordPressGuidedSetup: any;
C6WordPressVersion: any;
C6PHPVersion: any;
}
}

export const initialWordPressState: iWordPress = {
pureWordpressPluginConfigured: window?.C6WordPress ?? false,
C6WordPressGuidedSetup: window?.C6WordPressGuidedSetup ?? false,
C6WordPressVersion: window?.C6WordPressVersion ?? false,
C6PHPVersion: window?.C6PHPVersion ?? false,
}

0 comments on commit a495cee

Please sign in to comment.