Skip to content

Commit

Permalink
fix: clean up code a bit to match proposed changes to devsite (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyward authored Sep 16, 2024
1 parent b5bec10 commit 42490f7
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ import { CLOUD_PROJECT_NUMBER } from '../../constants';
* See: https://developers.google.com/meet/add-ons/guides/overview#main-stage
*/
export default function Page() {
/**
* Prepares the Add-on Main Stage Client, which signals that the add-on has
* successfully launched in the main stage.
*/
useEffect(() => {
/**
* Prepares the Add-on Main Stage Client, which signals that the add-on has
* successfully launched in the main stage.
*/
async function initializeMainStage() {
(async () => {
const session = await meet.addon.createAddonSession({
cloudProjectNumber: CLOUD_PROJECT_NUMBER,
});
await session.createMainStageClient();
}
initializeMainStage();
})();
}, []);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ export default function Page() {
await sidePanelClient.startActivity({ mainStageUrl: MAIN_STAGE_URL });
}

/**
* Prepares the Add-on Side Panel Client.
*/
useEffect(() => {
/**
* Prepares the Add-on Side Panel Client.
*/
async function setUpAddon() {
(async () => {
const session = await meet.addon.createAddonSession({
cloudProjectNumber: CLOUD_PROJECT_NUMBER,
});
setSidePanelClient(await session.createSidePanelClient());
}
setUpAddon();
})();
}, []);

return (
Expand Down
36 changes: 17 additions & 19 deletions addons-web-sdk/samples/hello-world/src/MainStage.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
<!DOCTYPE html>
<html>
<!-- See: https://developers.google.com/meet/add-ons/guides/overview#main-stage -->
<head>
<title>Meet Add-on Main Stage</title>
<script src="./main.js"></script>
</head>

<!-- See: https://developers.google.com/meet/add-ons/guides/overview#main-stage -->
<head>
<title>Meet Add-on Main Stage</title>
<script src="./main.js"></script>
</head>
<body style="width: 100%; height: 100%; margin: 0">
<div>This is the Add-on Main Stage. Everyone in the call can see this.</div>
<div>Hello, world!</div>

<body style="width: 100%; height: 100%; margin: 0">
<div>This is the Add-on Main Stage. Everyone in the call can see this.</div>
<div>Hello, world!</div>

<script>
document.body.onload = () => {
// Library name (`helloWorld`) is defined in the webpack config.
// The function (`initializeMainStage`) is defined in index.js.
helloWorld.initializeMainStage();
};
</script>
</body>

</html>
<script>
document.body.onload = () => {
// Library name (`helloWorld`) is defined in the webpack config.
// The function (`initializeMainStage`) is defined in main.js.
helloWorld.initializeMainStage();
};
</script>
</body>
</html>
36 changes: 17 additions & 19 deletions addons-web-sdk/samples/hello-world/src/SidePanel.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
<!DOCTYPE html>
<html>
<!-- See: https://developers.google.com/meet/add-ons/guides/overview#side-panel -->
<head>
<title>Meet Add-on Side Panel</title>
<script src="./main.js"></script>
</head>

<!-- See: https://developers.google.com/meet/add-ons/guides/overview#side-panel -->
<head>
<title>Meet Add-on Side Panel</title>
<script src="./main.js"></script>
</head>
<body style="width: 100%; height: 100%; margin: 0">
<div>This is the Add-on Side Panel. Only you can see this.</div>
<button id="start-activity">Launch Activity in Main Stage.</button>

<body style="width: 100%; height: 100%; margin: 0">
<div>This is the Add-on Side Panel. Only you can see this.</div>
<button id="start-activity">Launch Activity in Main Stage.</button>

<script>
document.body.onload = () => {
// Library name (`helloWorld`) is defined in the webpack config.
// The function (`setUpAddon`) is defined in index.js.
helloWorld.setUpAddon();
};
</script>
</body>

</html>
<script>
document.body.onload = () => {
// Library name (`helloWorld`) is defined in the webpack config.
// The function (`setUpAddon`) is defined in main.js.
helloWorld.setUpAddon();
};
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import { meet } from '@googleworkspace/meet-addons/meet.addons';

// TODO: Make sure that you modify these constants, if you fork this!
const CLOUD_PROJECT_NUMBER = '989911054302';
const MAIN_STAGE_URL =
'https://googleworkspace.github.io/meet/hello-world/MainStage.html';
Expand Down
5 changes: 2 additions & 3 deletions addons-web-sdk/samples/hello-world/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
const path = require('path');

module.exports = {
entry: './src/index.js',
entry: './src/main.js',
output: {
filename: 'main.js',
library: "helloWorld",
library: 'helloWorld',
path: path.resolve(__dirname, '../dist/hello-world'),
},
};

0 comments on commit 42490f7

Please sign in to comment.