-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix Main Stage in React Hello World
- Loading branch information
Showing
5 changed files
with
49 additions
and
18 deletions.
There are no files selected for viewing
10 changes: 0 additions & 10 deletions
10
addons-web-sdk/samples/hello-world-react-ts-vite/src/components/Game.tsx
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
addons-web-sdk/samples/hello-world-react-ts-vite/src/components/MainStage.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { useEffect } from 'react'; | ||
import { meet } from '@googleworkspace/meet-addons/meet.addons'; | ||
import { CLOUD_PROJECT_NUMBER } from '../constants'; | ||
|
||
/** | ||
* See: https://developers.google.com/meet/add-ons/guides/overview#main-stage | ||
*/ | ||
function MainStage() { | ||
useEffect(() => { | ||
/** | ||
* Prepares the Add-on Main Stage Client, which signals that the add-on has | ||
* successfully launched in the main stage. | ||
*/ | ||
async function initializeMainStage() { | ||
const session = await meet.addon.createAddonSession({ | ||
cloudProjectNumber: CLOUD_PROJECT_NUMBER, | ||
}); | ||
await session.createSidePanelClient(); | ||
} | ||
initializeMainStage(); | ||
}, []); | ||
|
||
|
||
return ( | ||
<> | ||
<div>This is the Add-on Main Stage. Everyone in the call can see this.</div> | ||
<div>Hello, world!</div> | ||
</> | ||
) | ||
} | ||
|
||
export default MainStage; |
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
7 changes: 4 additions & 3 deletions
7
addons-web-sdk/samples/hello-world-react-ts-vite/src/mainStage.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { StrictMode } from 'react' | ||
import { createRoot } from 'react-dom/client' | ||
import Game from './components/Game.tsx' | ||
import MainStage from './components/MainStage.tsx' | ||
|
||
// Renders the MainStage as a React component. | ||
createRoot(document.getElementById('root')!).render( | ||
<StrictMode> | ||
<Game /> | ||
<MainStage /> | ||
</StrictMode>, | ||
) | ||
) |
7 changes: 4 additions & 3 deletions
7
addons-web-sdk/samples/hello-world-react-ts-vite/src/sidePanel.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { StrictMode } from 'react' | ||
import { createRoot } from 'react-dom/client' | ||
import Setup from './components/Setup.tsx' | ||
import SidePanel from './components/SidePanel.tsx' | ||
|
||
// Renders the SidePanel as a React component. | ||
createRoot(document.getElementById('root')!).render( | ||
<StrictMode> | ||
<Setup /> | ||
<SidePanel /> | ||
</StrictMode>, | ||
) | ||
) |