Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React App dependencies update #108

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,706 changes: 613 additions & 8,093 deletions app.js

Large diffs are not rendered by default.

8,237 changes: 1 addition & 8,236 deletions app.min.js

Large diffs are not rendered by default.

26 changes: 18 additions & 8 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
{
"presets": [
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
"@babel/plugin-transform-runtime",
[
"@babel/preset-env",
"module-resolver",
{
"useBuiltIns": "usage",
"corejs": "3.6.5"
"root": ["./src"],
"alias": {
"@assets": "./src/js/app/assets",
"@components": "./src/js/app/components",
"@config": "./src/js/app/config",
"@constants": "./src/js/app/constants",
"@context": "./src/js/app/context",
"@routes": "./src/js/app/routes",
"@utils": "./src/js/app/utils",
"@views": "./src/js/app/views",
"@styles": "./src/scss"
}
}
],
["@babel/preset-react"]
],
"plugins": ["@babel/plugin-transform-runtime"]
]
]
}
5 changes: 2 additions & 3 deletions data/museum-of-scientists.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@
{
"id": "patrick-cozzi",
"type": "wrapper",
"position": "3.85 1.573 -2.472",
"show-details-on-click": ""
"position": "3.85 1.573 -2.472"
},
{
"id": "brandonjones",
Expand All @@ -196,4 +195,4 @@
"position": "4.21625 2.40029 2.72588",
"scale": "0.4 0.4 0.4"
}
]
]
117 changes: 110 additions & 7 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,117 @@ function makers_setup() {
function my_custom_mime_types($mimes) {
// Creating an array of allowed MIME types
$mimes = array(
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
// Image formats.
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
'bmp' => 'image/bmp',
'tiff|tif' => 'image/tiff',
'webp' => 'image/webp',
'ico' => 'image/x-icon',
'heic' => 'image/heic',
// Video formats.
'asf|asx' => 'video/x-ms-asf',
'wmv' => 'video/x-ms-wmv',
'wmx' => 'video/x-ms-wmx',
'wm' => 'video/x-ms-wm',
'avi' => 'video/avi',
'divx' => 'video/divx',
'flv' => 'video/x-flv',
'mov|qt' => 'video/quicktime',
'mpeg|mpg|mpe' => 'video/mpeg',
'mp4|m4v' => 'video/mp4',
'ogv' => 'video/ogg',
'webm' => 'video/webm',
'mkv' => 'video/x-matroska',
'3gp|3gpp' => 'video/3gpp', // Can also be audio.
'3g2|3gp2' => 'video/3gpp2', // Can also be audio.
// Text formats.
'txt|asc|c|cc|h|srt' => 'text/plain',
'csv' => 'text/csv',
'tsv' => 'text/tab-separated-values',
'ics' => 'text/calendar',
'rtx' => 'text/richtext',
'css' => 'text/css',
'htm|html' => 'text/html',
'vtt' => 'text/vtt',
'dfxp' => 'application/ttaf+xml',
// Audio formats.
'mp3|m4a|m4b' => 'audio/mpeg',
'aac' => 'audio/aac',
'ra|ram' => 'audio/x-realaudio',
'wav' => 'audio/wav',
'ogg|oga' => 'audio/ogg',
'flac' => 'audio/flac',
'mid|midi' => 'audio/midi',
'wma' => 'audio/x-ms-wma',
'wax' => 'audio/x-ms-wax',
'mka' => 'audio/x-matroska',
// Misc application formats.
'rtf' => 'application/rtf',
'js' => 'application/javascript',
'pdf' => 'application/pdf',
'swf' => 'application/x-shockwave-flash',
'class' => 'application/java',
'tar' => 'application/x-tar',
'zip' => 'application/zip',
'gz|gzip' => 'application/x-gzip',
'rar' => 'application/rar',
'7z' => 'application/x-7z-compressed',
'exe' => 'application/x-msdownload',
'psd' => 'application/octet-stream',
'xcf' => 'application/octet-stream',
// MS Office formats.
'doc' => 'application/msword',
'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
'wri' => 'application/vnd.ms-write',
'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
'mdb' => 'application/vnd.ms-access',
'mpp' => 'application/vnd.ms-project',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'docm' => 'application/vnd.ms-word.document.macroEnabled.12',
'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'dotm' => 'application/vnd.ms-word.template.macroEnabled.12',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12',
'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12',
'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12',
'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
'sldm' => 'application/vnd.ms-powerpoint.slide.macroEnabled.12',
'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote',
'oxps' => 'application/oxps',
'xps' => 'application/vnd.ms-xpsdocument',
// OpenOffice formats.
'odt' => 'application/vnd.oasis.opendocument.text',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'odc' => 'application/vnd.oasis.opendocument.chart',
'odb' => 'application/vnd.oasis.opendocument.database',
'odf' => 'application/vnd.oasis.opendocument.formula',
// WordPerfect formats.
'wp|wpd' => 'application/wordperfect',
// iWork formats.
'key' => 'application/vnd.apple.keynote',
'numbers' => 'application/vnd.apple.numbers',
'pages' => 'application/vnd.apple.pages',
// 3d models formates
'bin' => 'application/octet-stream',
'glb' => 'model/gltf-binary',
'ttf' => 'font/ttf',
'otf' => 'font/otf'

);
'gltf' => 'model/gltf+json',
'usdz' => 'model/vnd.usdz+zip',

);


return $mimes;
}
Expand Down
142 changes: 94 additions & 48 deletions functions/functions-enqueue.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
<?php

// enqueue_styles in wordpress theme
function enqueue_style() {
function enqueue_style()
{
if (defined('WP_ENVIRONMENT_TYPE') && WP_ENVIRONMENT_TYPE === 'production') {
wp_enqueue_style('makers', get_stylesheet_directory_uri() . '/style.min.css');

wp_register_style(
'bootstrap', // handle name
'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css', // the URL of the stylesheet
array(), // an array of dependent styles
'5.3.0', // version number
'all' // CSS media type
);
wp_enqueue_style('bootstrap');

wp_register_style(
'font-awesome',
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css',
array(),
'6.4.0',
'all'
);
wp_enqueue_style('font-awesome');
} else {

wp_enqueue_style('makers', get_stylesheet_directory_uri() . '/style.css');

Expand All @@ -24,65 +46,89 @@ function enqueue_style() {
wp_enqueue_style('font-awesome');

}
add_action( 'wp_enqueue_scripts', 'enqueue_style' );
}
add_action('wp_enqueue_scripts', 'enqueue_style');

// enqueue_scripts in wordpress theme
function theme_scripts() {


$config_wp = array(
"SITE_URL" => get_site_url(),
"HOME_URL" => get_home_url(),
"SITE_TITLE" => get_bloginfo( 'name' ),
"SITE_TAGLINE" => get_bloginfo( 'description' ),
"SITE_CUSTOM_LOGO" => wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' ),
// "THEME_LOGO" => get_custom_logo()
// "SITE_PLUGINS" => get_plugins(),
// "SITE_ALL_OPTIONS" => wp_load_alloptions(),
"SITE_ACTIVE_PLUGINS" => get_option( 'active_plugins' ),
"SITE_FRONT_PAGE" => get_option('page_on_front'),
"SITE_POST_PAGE" => get_option('page_for_posts'),
);


wp_register_script('config-script', get_template_directory_uri() . '/src/js/app/config/appConfig.js', array( 'jquery' ), '1.0.0', true);
wp_enqueue_script('config-script');
wp_localize_script('config-script', 'configData', $config_wp);

wp_register_script('app',get_stylesheet_directory_uri() . '/app.js', array('jquery'),rand(100000,999999), true);
function theme_scripts()
{


$config_wp = array(
"SITE_URL" => get_site_url(),
"HOME_URL" => get_home_url(),
"THEME_DIR_URL" => get_stylesheet_directory_uri(),
"UPLOAD_DIR_URL" => wp_upload_dir(),
"SITE_TITLE" => get_bloginfo('name'),
"SITE_TAGLINE" => get_bloginfo('description'),
"SITE_CUSTOM_LOGO" => wp_get_attachment_image_src(get_theme_mod('custom_logo'), 'full'),
// "THEME_LOGO" => get_custom_logo()
// "SITE_PLUGINS" => get_plugins(),
// "SITE_ALL_OPTIONS" => wp_load_alloptions(),
"SITE_ACTIVE_PLUGINS" => get_option('active_plugins'),
"SITE_FRONT_PAGE" => get_option('page_on_front'),
"SITE_POST_PAGE" => get_option('page_for_posts'),
);


wp_register_script('config-script', get_template_directory_uri() . '/src/js/app/config/AppConfig.js', array('jquery'), '1.0.0', true);
wp_enqueue_script('config-script');
wp_localize_script('config-script', 'configData', $config_wp);

if (defined('WP_ENVIRONMENT_TYPE') && WP_ENVIRONMENT_TYPE === 'production') {
wp_register_script('app', get_stylesheet_directory_uri() . '/app.min.js', array('jquery'), '1.0.0', true);
wp_enqueue_script('app');

wp_register_script('vendor', get_stylesheet_directory_uri() . '/vendor.min.js', array('jquery'), '1.0.0', true);
wp_enqueue_script('vendor');

} else {
wp_register_script('app', get_stylesheet_directory_uri() . '/app.js', array('jquery'), rand(100000, 999999), true);
wp_enqueue_script('app');

wp_register_script('vendor',get_stylesheet_directory_uri() . '/vendor.min.js', array('jquery'),rand(100000,999999), false);
wp_register_script('vendor', get_stylesheet_directory_uri() . '/vendor.js', array('jquery'), rand(100000, 999999), true);
wp_enqueue_script('vendor');

wp_register_script('bootstrap','https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js', array('jquery'),'5.3.0', true);
wp_enqueue_script('bootstrap');

// A-Frame CDN's
wp_register_script( 'aframe', 'https://aframe.io/releases/1.4.0/aframe.min.js', array('jquery'), '1.4.0' , false );
wp_enqueue_script( 'aframe' );

wp_register_script('aframe-troika-text', 'https://unpkg.com/aframe-troika-text/dist/aframe-troika-text.min.js', array('jquery'),rand(100000,999999), true);
wp_enqueue_script('aframe-troika-text');
}


wp_register_script('bootstrap', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js', array('jquery'), '5.3.0', true);
wp_enqueue_script('bootstrap');

// A-Frame CDN's
wp_register_script('aframe', 'https://aframe.io/releases/1.4.2/aframe.min.js', array('jquery'), '1.4.2', false);
wp_enqueue_script('aframe');

wp_register_script('aframe-environment', 'https://unpkg.com/[email protected]/dist/aframe-environment-component.min.js', array('aframe'), '1.3.3', true);
wp_enqueue_script('aframe-environment');

//uncomment to add aframe-extras full support
wp_register_script('aframe-extras', 'https://cdn.jsdelivr.net/gh/c-frame/[email protected]/dist/aframe-extras.min.js', array('aframe'), '7.1.0', true);
wp_enqueue_script('aframe-extras');
// uncomment to add aframe-extras-control partial support
// wp_register_script('aframe-extras-controls', 'https://cdn.jsdelivr.net/gh/c-frame/[email protected]/dist/aframe-extras.controls.min.js', array('aframe'),'7.1.0', true);
// wp_enqueue_script('aframe-extras-controls');

wp_register_script('aframe-superhands', 'https://unpkg.com/super-hands@^3.0.3/dist/super-hands.min.js', array('aframe'), '3.0.3', true);
wp_enqueue_script('aframe-superhands');

// wp_register_script('aframe-teleport','https://unpkg.com/[email protected]/dist/aframe-teleport-controls.min.js', array('aframe'),'0.3.x', true);
// wp_enqueue_script('aframe-teleport');

wp_register_script('aframe-environment', 'https://unpkg.com/aframe-[email protected]/dist/aframe-environment-component.min.js', array('jquery'),'1.3.0', true);
wp_enqueue_script('aframe-environment');
wp_register_script('aframe-teleport', 'https://rawgit.com/fernandojsg/aframe-teleport-controls/master/dist/aframe-teleport-controls.min.js', array('aframe'), '', true);
wp_enqueue_script('aframe-teleport');

// TODO: uncomment to fix nav-mesh movement issues
wp_register_script('aframe-physics', 'https://cdn.jsdelivr.net/gh/c-frame/[email protected]/dist/aframe-extras.min.js', array('jquery'),'7.0.0', true);
wp_enqueue_script('aframe-physics');
wp_register_script('aframe-troika-text', 'https://unpkg.com/aframe-troika-text/dist/aframe-troika-text.min.js', array('aframe'), '0.11.0', true);
wp_enqueue_script('aframe-troika-text');

wp_register_script('aframe-superHands','https://unpkg.com/super-hands@^3.0.3/dist/super-hands.min.js', array('jquery'),'3.0.3', true);
wp_enqueue_script('aframe-superHands');
// wp_register_script('aframe-input-mapping-component', 'https://unpkg.com/aframe-input-mapping-component/dist/aframe-input-mapping-component.min.js', array('aframe'),'', true);
// wp_enqueue_script('aframe-input-mapping-component');

wp_register_script('aframe-teleport','https://rawgit.com/fernandojsg/aframe-teleport-controls/master/dist/aframe-teleport-controls.min.js', array('jquery'),'', true);
wp_enqueue_script('aframe-teleport');

wp_register_script('aframe-physics-system', 'https://cdn.jsdelivr.net/gh/c-frame/[email protected]/dist/aframe-physics-system.min.js', array('aframe'), '4.2.2', true);
wp_enqueue_script('aframe-physics-system');



}
add_action( 'wp_enqueue_scripts', 'theme_scripts' );
add_action('wp_enqueue_scripts', 'theme_scripts');



Expand Down
4 changes: 2 additions & 2 deletions functions/functions-rest-register.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function get_media_data_by_id($id){//this function builds the data for a lean js

The meta data properties are only accessible inside a loop for some dumb reason.
*/
if(strpos($mime,'mage/') && !strpos($mime,'svg')){ // the i is left of so the strpos returns a postive value
if(strpos($mime,'image/') && !strpos($mime,'svg')){ // the i is left of so the strpos returns a postive value
$meta_data = array();
foreach($meta as $key => $value){
if($key == 'width'){
Expand Down Expand Up @@ -369,7 +369,7 @@ function register_properties_3D() {
function get_attachment_path($id){

$url = wp_upload_dir();
$path = $url['baseurl']."/";
$path = $url['path']."/";
$uploads_path = $url['baseurl']."/";
$attachment_path = str_replace($path,"",wp_get_attachment_url($id));
$attachment_path= str_replace("-scaled","",$attachment_path);
Expand Down
1 change: 1 addition & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "esnext",
"target": "es2017",
"allowJs": true,
"jsx": "react",
"lib": ["es6", "dom", "es2015.iterable", "es2017"],
"moduleResolution": "node",
"removeComments": false
Expand Down
Loading