Skip to content
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
1 change: 1 addition & 0 deletions backend/src/Data/Transformers/CommentTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function __invoke( \WP_Comment $comment ) {
'author' => $comment->comment_author,
'authorEmail' => $comment->comment_author_email,
'authorIP' => $comment->comment_author_IP,
'authorUrl' => get_author_posts_url( $comment->user_id ),
'content' => $comment->comment_content,
'date' => $date,
'editUrl' => admin_url( 'comment.php?action=editcomment&c=' ) . $comment->comment_ID,
Expand Down
10 changes: 10 additions & 0 deletions backend/src/Hooks/Actions/OnEnqueueScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ public function generate_frontend_config() {

$current_user = $this->users->current( $this->user_transform );

$wp_comments = get_option( 'default_comment_status' );
if ( isset( $wp_comments ) ) {
if ( $wp_comments === 'closed' ) {
$wp_comment_status = 0;
} else {
$wp_comment_status = 1;
}
}

return [
'adminURLs' => $this->site->get_admin_urls(),
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
Expand All @@ -124,6 +133,7 @@ public function generate_frontend_config() {
'pluginURL' => FL_ASSISTANT_URL,
'taxonomies' => $this->posts->get_taxononies(),
'userRoles' => $this->users->get_roles(),
'wpCommentStatus' => $wp_comment_status,

/*
'integrations' => [
Expand Down
6 changes: 5 additions & 1 deletion src/apps/fl-comments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ import { registerApp } from 'assistant'
import { __ } from '@wordpress/i18n'
import { addQueryArgs } from 'assistant/utils/url'
import { currentUserCan } from 'assistant/utils/wordpress'
import { getSystemConfig } from 'data'
import { Page } from 'assistant/ui'
import { CommentsApp } from './app'
import Icon from './icon'


const { wpCommentStatus } = getSystemConfig()

registerApp( 'fl-comments', {
label: __( 'Comments' ),
root: CommentsApp,
icon: Icon,
enabled: currentUserCan( 'moderate_comments' ),
enabled: currentUserCan( 'moderate_comments' ) && 1 == wpCommentStatus,
accent: {
color: '#FFCC00'
},
Expand Down
67 changes: 34 additions & 33 deletions src/render/app/side-bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ import { useMedia } from 'assistant/utils/react'
import './style.scss'

const Sidebar = ( { edge = 'right' } ) => {
const { window, isAppHidden } = useSystemState()
const { window, isAppHidden } = useSystemState()
const { isMobile, isCompactHeight, application } = Env.useEnvironment()
const {
toggleIsShowingUI,
setWindow,
setIsAppHidden
} = getSystemActions()
const { toggleIsShowingUI, setWindow, setIsAppHidden } = getSystemActions()
const isVeryCompactHeight = useMedia( { maxHeight: 400 } )


const getMaxCount = () => {
if ( isVeryCompactHeight ) {
return 3
Expand Down Expand Up @@ -67,74 +62,80 @@ const Sidebar = ( { edge = 'right' } ) => {
} )

return (
<div className={ classes }
<div
className={ classes }
style={ {
[`${edgeProp}`]: isAppHidden ? '' : '2px solid var(--fluid-line-color)' }
}
[`${edgeProp}`]: isAppHidden ? '' : '2px solid var(--fluid-line-color)'
} }
>
{ ! isBeaverBuilder && (
<div className="fl-asst-sidebar-cell fl-asst-sidebar-cell-top">
{! isBeaverBuilder && (
<div className='fl-asst-sidebar-cell fl-asst-sidebar-cell-top'>
<Button
appearance="transparent"
appearance='transparent'
onClick={ () => toggleIsShowingUI( false ) }
className="fl-asst-sidebar-close-button"
className='fl-asst-sidebar-close-button'
title={ __( 'Hide Panel' ) }
>
<Icon.Close />
</Button>
</div>
)}


<div
className="fl-asst-sidebar-cell fl-asst-sidebar-cell-middle"
>
<div className='fl-asst-sidebar-cell fl-asst-sidebar-cell-middle'>
<Button
appearance={ ( isRoot && ! isAppHidden ) ? 'normal' : 'transparent' }
status={ ( isRoot && ! isAppHidden ) ? 'primary' : '' }
appearance={ isRoot && ! isAppHidden ? 'normal' : 'transparent' }
status={ isRoot && ! isAppHidden ? 'primary' : '' }
title={ __( 'Home' ) }
onClick={ () => navOrHideApp( isRoot, goToRoot ) }
>
<Icon.Home />
</Button>

{ apps.map( ( app, i ) => {
{apps.map( ( app, i ) => {
const { label, handle, icon } = app

const location = {
pathname: `/${handle}`,
state: app,
state: app
}
const isSelected = pathname.startsWith( `/${handle}` )
return (
<Button
key={ i }
appearance={ ( isSelected && ! isAppHidden ) ? 'normal' : 'transparent' }
appearance={ isSelected && ! isAppHidden ? 'normal' : 'transparent' }
isSelected={ isSelected }
onClick={ () => navOrHideApp( isSelected, () => history.push( location ) ) }
onClick={ () =>
navOrHideApp( isSelected, () => history.push( location ) )
}
title={ label }
>{ icon( { context: 'sidebar', isSelected } ) }</Button>
>
{icon( { context: 'sidebar', isSelected } )}
</Button>
)
} )}

<Button
appearance={ ( isManage && ! isAppHidden ) ? 'normal' : 'transparent' }
status={ ( isManage && ! isAppHidden ) ? 'primary' : '' }
onClick={ () => navOrHideApp( isManage, () => history.push( '/fl-manage' ) ) }
appearance={ isManage && ! isAppHidden ? 'normal' : 'transparent' }
status={ isManage && ! isAppHidden ? 'primary' : '' }
onClick={ () =>
navOrHideApp( isManage, () => history.push( '/fl-manage' ) )
}
title={ __( 'Manage Apps' ) }
>
<Icon.Apps />
</Button>
</div>

{ ! isBeaverBuilder && ! isMobile && (
<div className="fl-asst-sidebar-cell">
{! isBeaverBuilder && ! isMobile && (
<div className='fl-asst-sidebar-cell'>
<Button
appearance="transparent"
appearance='transparent'
onClick={ toggleWindowSize }
title={ 'mini' === window.size ? __( 'Expand Panel' ) : __( 'Collapse Panel' ) }
title={
'mini' === window.size ? __( 'Expand Panel' ) : __( 'Collapse Panel' )
}
>
{ 'mini' === window.size ? <Icon.Expand /> : <Icon.Collapse /> }
{'mini' === window.size ? <Icon.Expand /> : <Icon.Collapse />}
</Button>
</div>
)}
Expand Down
5 changes: 5 additions & 0 deletions src/system/ui/pages/comment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const Comment = ( { location } ) => {
postId,
url,
editUrl,
authorUrl
} = item
const { pluginURL } = getSystemConfig()
const hero = `${pluginURL}img/comment-hero-a.jpg`
Expand Down Expand Up @@ -248,6 +249,10 @@ export const Comment = ( { location } ) => {
type: 'text',
component: 'plain-text'
},
authorUrl: {
label: __( 'Author Url' ),
component: 'url'
},
date: {
label: __( 'Submitted On' ),
labelPlacement: 'beside',
Expand Down
1 change: 1 addition & 0 deletions src/system/utils/wordpress/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export const currentUserCan = ( cap ) => {
const { currentUser } = getSystemConfig()
return currentUser.capabilities[ cap ] ? true : false
}