Skip to content

Commit

Permalink
Merge pull request #354 from beaverbuilder/cloud-fixes
Browse files Browse the repository at this point in the history
Fixes for libraries and misc react errors
  • Loading branch information
fastlinemedia committed Sep 15, 2021
2 parents 588472c + 13996f1 commit 76e9c5b
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,11 @@ public function import_post_media_from_library( $post_id, $media, $import = true
$service = new MediaLibraryService();

// Import post thumbnail
if ( $import && isset( $media->thumb ) && 'screenshot.png' !== $media->thumb->file_name ) {
$response = $service->import_cloud_media( $media->thumb, $post_id );
set_post_thumbnail( $post_id, $response['id'] );
if ( $import && isset( $media->thumb ) ) {
if ( ! preg_match( '/screenshot\.(png|jpg|gif)/', $media->thumb->file_name ) ) {
$response = $service->import_cloud_media( $media->thumb, $post_id );
set_post_thumbnail( $post_id, $response['id'] );
}
}

// Import post attachments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
use FL\Assistant\Services\CustomizerService;

/**
* Class OnPluginsLoaded
* Class OnWPLoaded
* @package FL\Assistant\Hooks\Actions
*/
class OnPluginsLoaded {
class OnWPLoaded {

public function __invoke() {
$this->init_customizer_requests();
Expand Down
6 changes: 3 additions & 3 deletions backend/src/Providers/HooksServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use FL\Assistant\System\Contracts\ServiceProviderAbstract;

use FL\Assistant\Hooks\Actions\OnPluginsLoaded;
use FL\Assistant\Hooks\Actions\OnWPLoaded;
use FL\Assistant\Hooks\Actions\OnEditUserProfile;
use FL\Assistant\Hooks\Actions\OnEnqueueScripts;
use FL\Assistant\Hooks\Actions\OnPersonalOptionsUpdate;
Expand Down Expand Up @@ -45,8 +45,8 @@ public function bootstrap() {

public function actions() {

// Plugins loaded
add_action( 'plugins_loaded', $this->injector->make( OnPluginsLoaded::class ) );
// WP loaded
add_action( 'wp_loaded', $this->injector->make( OnWPLoaded::class ) );

// Enqueue Assistant frontend
$enqueue_scripts = $this->injector->make( OnEnqueueScripts::class );
Expand Down
64 changes: 32 additions & 32 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"@beaverbuilder/box": "0.0.3",
"@beaverbuilder/cloud": "^0.5.5",
"@beaverbuilder/cloud-ui": "^0.8.4",
"@beaverbuilder/fluid": "^0.7.8",
"@beaverbuilder/fluid-docs": "0.0.6",
"@beaverbuilder/forms": "^0.3.8",
"@beaverbuilder/icons": "0.0.5",
"@beaverbuilder/fluid": "^0.7.9",
"@beaverbuilder/fluid-docs": "0.0.7",
"@beaverbuilder/forms": "^0.3.11",
"@beaverbuilder/icons": "^0.0.6",
"@popmotion/popcorn": "^0.4.4",
"array-move": "^3.0.1",
"axios": "0.21.1",
Expand Down
1 change: 1 addition & 0 deletions src/apps/fl-home/ui/header-bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const HeaderBar = ( {
setIsFocused( true )
onFocus()
} }
onChange={ () => {} } // Prevent react error
/>
<Button
appearance="transparent"
Expand Down
3 changes: 2 additions & 1 deletion src/apps/fl-home/ui/sections/media/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,15 @@ const MediaGrid = ( {
// Loading placeholder
if ( null === item ) {
return (
<div />
<div key={ i } />
)
}

// Handle files currently uploading
if ( item instanceof File ) {
return (
<div
key={ i }
src={ URL.createObjectURL( item ) }
alt={ sprintf( 'Uploading %s', item.name ) }
style={ {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/fl-home/ui/sections/recent-posts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const RecentPostsSection = ( { isCollapsed, ...rest } ) => {

const Actions = () => (
<select
value={ query.post_type }
onChange={ e => {
setQuery( { ...query, post_type: e.target.value } )
} }
Expand All @@ -27,7 +28,6 @@ const RecentPostsSection = ( { isCollapsed, ...rest } ) => {
<option
key={ value }
value={ value }
selected={ value === query.post_type }
>
{ def.labels.plural }
</option>
Expand Down
4 changes: 2 additions & 2 deletions src/apps/fl-updates/icon.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import { useSystemState } from 'assistant/data'
import { getSystemState } from 'assistant/data'

const AppIcon = ( { context, isSelected = false } ) => {
const { counts } = useSystemState()
const { counts } = getSystemState()
const total = counts['update/total'] ? counts['update/total'] : 0
const shouldHighlight = 'sidebar' === context && 0 < total
const color = ( shouldHighlight && ! isSelected ) ? 'var(--fluid-blue)' : 'currentColor'
Expand Down

0 comments on commit 76e9c5b

Please sign in to comment.