Skip to content

Commit

Permalink
Merge pull request #3 from maikthomas/make-pages
Browse files Browse the repository at this point in the history
Make pages
  • Loading branch information
maikthomas authored Sep 25, 2024
2 parents 21aef95 + 05c8a1c commit f5afdc5
Show file tree
Hide file tree
Showing 19 changed files with 2,314 additions and 139 deletions.
11 changes: 11 additions & 0 deletions ML-Transformers/BackgroundEnchantments/copyToDocs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const ejs = require('ejs');
const fs = require('fs');
const packageInfo = require('./package.json');

const currentVersion = packageInfo.dependencies['@vonage/ml-transformers']

const folderName = '../../docs/versions/' + currentVersion;
fs.mkdirSync(folderName, { recursive: true });
fs.cpSync('./dist', folderName, {recursive: true});
fs.cpSync('./media', folderName + '/media', {recursive: true});
fs.cpSync('./public', folderName + '/public', {recursive: true});
3 changes: 2 additions & 1 deletion ML-Transformers/BackgroundEnchantments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
"preview": "vite preview",
"buildToDocs": "npm run build && node copyToDocs.js"
},
"dependencies": {
"@vonage/ml-transformers": "5.1.3",
Expand Down
19 changes: 19 additions & 0 deletions docs/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const ejs = require('ejs');
const fs = require('fs');
const packageInfo = require('../ML-Transformers/BackgroundEnchantments/package.json');


const getDirectories = source =>
fs.readdirSync(source, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name)

const versions = getDirectories('./versions');
var versionListTemplate = fs.readFileSync('./version_list_template.ejs', 'utf-8');
var versionListHtml = ejs.render( versionListTemplate , {versions});
fs.writeFileSync("./versions/index.html", versionListHtml, 'utf8');

const currentVersion = packageInfo.dependencies['@vonage/ml-transformers']
var redirectTemplate = fs.readFileSync('./redirect_template.ejs', 'utf-8');
var redirectHtml = ejs.render( redirectTemplate , {version: currentVersion});
fs.writeFileSync("./index.html", redirectHtml, 'utf8');
139 changes: 1 addition & 138 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,142 +1,5 @@
<html>

<head>
<style>
body {
margin: 0px;
}

.headline {
text-align: center;
}

#version_tag {
text-align: end;
}

vwc-top-app-bar img {
margin-left: 16px
}

.maincard {
margin: 10 auto;
width: 58%;
max-width: 1120px;
height: fit-content;
display: block;
}

.maincardlayout {
display: grid;
grid-template-columns: 4fr 6fr;
}

.video-wrapper {
aspect-ratio: 1.1;
background-image: url(assets/vonage.deae136d.png);
background-repeat: no-repeat;
background-position: center;
background-color: var(--vvd-color-canvas);
background-size: 100% auto;
border-radius: 4px;
overflow: hidden;
border: 1px solid var(--vvd-color-neutral-30);
}

.video {
width: 100%;
height: 100%;
object-fit: cover;
}
</style>



<title>Background Effects sample</title>
<link rel="icon" href="https://vonage-background-enchantments-sample.s3.amazonaws.com/vonage.png">
<script type="module" crossorigin src="assets/index.d385c202.js"></script>
<meta http-equiv="refresh" content="0; url=version/5.1.3</index.html" />
</head>

<body>
<vwc-top-app-bar alternate>
<img slot="navigationIcon" height="24"
src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQQI9k8NKq3KoOs1VkwSYwPwwQbisiS_K-0jtBUyml13k7EBy8Aekz7G7I1vqceWf5kEQ&usqp=CAU" />
<div>
<vwc-banner open connotation="info" message="Vonage Background Effects (out of the box solution) sample"></vwc-banner>
<vwc-layout gutters="xs" column-basis="block">
<vwc-text font-face="subtitle-1" class="headline" tight>This sample application shows how to use Vonage Background Effects solution.</vwc-text>
</vwc-layout>

<vwc-card class="maincard" elevation="0">
<div slot="main" gutters="xs" class="maincardlayout">
<vwc-layout column-basis="block" gutters="xs">
<vwc-text font-face="subtitle-2" class="headline" tight>Source</vwc-text>
<div class="video-wrapper">
<video id="source_video" class="video"></video>
</div>
<vwc-layout column-spacing="md" style="--layout-grid-template-columns: 1fr 1fr;">
<vwc-text font-face="subtitle-2" tight>Show Preview</vwc-text>
<vwc-switch id="cameraswitch" style="justify-self: end;"></vwc-switch>
<vwc-text font-face="subtitle-2" tight>Type</vwc-text>
<vwc-select dense="" id="typeSelector">
<vwc-list-item disabled selected value="Choose_an_item">
Type
</vwc-list-item>
<vwc-list-item value="blurLow">
Blur Low
</vwc-list-item>
<vwc-list-item value="blurHigh">
Blur High
</vwc-list-item>
<vwc-list-item value="virtual">
Virtual
</vwc-list-item>
<vwc-list-item value="video">
Video
</vwc-list-item>
<vwc-list-item value="silhouetteLow">
Silhouette Low
</vwc-list-item>
<vwc-list-item value="silhouetteHigh">
Silhouette High
</vwc-list-item>
</vwc-select>
<vwc-text font-face="subtitle-2" tight>Segmentation</vwc-text>
<vwc-select dense="" id="segmentationSelector">
<vwc-list-item selected value="auto">
Auto
</vwc-list-item>
<vwc-list-item value="fast">
Fast
</vwc-list-item>
<vwc-list-item value="precise">
Precise
</vwc-list-item>
</vwc-select>
</vwc-layout>
</vwc-layout>
<vwc-layout column-basis="block" gutters="xs">
<vwc-text font-face="subtitle-2" class="headline" tight>Preview</vwc-text>
<div class="video-wrapper">
<video id="priview_video" class="video"></video>
</div>
<vwc-layout>
<vwc-button connotation="cta" label="View code in GitHub" layout="filled" icon="open-line" trailingIcon
id="githubButton"></vwc-button>
<vwc-button connotation="cta" label="Use Vivid" layout="filled" icon="open-line" trailingIcon
id="vividButton"></vwc-button>
</vwc-layout>
<vwc-layout>
<vwc-text id="version_tag" font-face="body-1"></vwc-text>
</vwc-layout>
</vwc-layout>
</div>
</vwc-card>
<vwc-snackbar timeoutms="5000" icon="megaphone-solid" message="Please select a processing type"
dismissible="true" position="BOTTOM-CENTER" connotation="info" id="disabledHover"></vwc-snackbar>
</div>
</vwc-top-app-bar>

</body>

</html>
205 changes: 205 additions & 0 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f5afdc5

Please sign in to comment.