@if($community->gift_app_community==0)
    {!! Theme::extend('community-timeline-before-editor') !!}
    
    <div class="community-post-editor">
        @if($community->present()->canPost())
            {!! Theme::section('post.editor.main', [
                'offPrivacy' => true,
                'type' => 'community',
                'community_id' => $community->id,
                'privacy' => (($community->privacy == 1) ? 1 : 6)
            ]) !!}
        @endif
    </div>
            
    <div data-type="community-{{$community->id}}" data-lastcheck="" data-offset="{{\Config::get('post-per-page')}}" id="post-list" data-url="{{$community->present()->url()}}/getcommunityposts">    
        <?php \App\Performance\N1QueryOptimizer::primePostMediaForFeed($posts, ['communityId' => (int) $community->id]); ?>
        @foreach($posts as $post)    
            <?php                
                $communityOwnerActions='';
                if(Auth::check()){                    
                    if($community->user_id==Auth::user()->id){
                        $communityOwnerActions='yes';
                    }
                }
            ?>
           
            {{-- Use placeholder with self-contained lazy loading --}}
            {!! Theme::section('post.media', ['post' => $post,'communityOwnerActions' => $communityOwnerActions]) !!}
        @endforeach
    </div>
    
    @if(count($posts))
        <div class="community-post-load">
            <a class="post-load-more" href="">{{trans('post.load-more')}}</a>
        </div>
        <br />
        
        <style>
            .community-history{
                display:none;
            }	
        </style>
    @else    
         <style>
            .community-history{
                min-height:860px;
            }	
        </style>
    @endif
@else
	Gift app community
@endif

@if(!Auth::check())
	{!! Theme::section('home.ask-login') !!}
@endif 
