@extends(Theme::viewName('layout'))
@section('title', trans('gallery.user_activity_feed.title'))

@section('breadcrumb')
    <li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
    <li class="breadcrumb-item active">@lang('navigation.breadcrumb.activity_feed')</li>
@endsection

@section('content')
    <div class="container" id="user-app">
        <div class="row">
            <div class="col">
                <div v-if="is_loading">
                    <p class="text-center mb-1">
                        <img src="{{ asset('ripple.svg') }}" alt="@lang('global.please_wait')" title="@lang('global.please_wait')"/>
                    </p>
                    <p class="text-center">
                        @lang('global.please_wait')
                    </p>
                </div>
                <div v-if="feed_items.length > 0">
                    <div class="card mb-2" v-for="feed_item in feed_items">
                        <div class="card-body row">
                            <div class="col-2 col-md-1 pr-0" style="max-width: 47px;">
                                <img class="rounded-circle" v-bind:src="feed_item.avatar"/>
                            </div>
                            <div class="col-10 col-md-11">
                                <span v-html="feed_item.description"></span><br/>
                                <span class="text-muted" style="font-size: smaller;" v-html="feed_item.activity_at"></span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="text-center" v-if="!is_loading && feed_items.length == 0">
                    <h4 class="text-danger"><b>@lang('gallery.user_activity_feed.no_activity_p1')</b></h4>
                    <p>@lang('gallery.user_activity_feed.no_activity_p2')</p>
                    <p>@lang('gallery.user_activity_feed.no_activity_p3', [
                        'l_explore_start' => sprintf('<a href="%s">', route('exploreUsers')),
                        'l_explore_end' => '</a>'
                    ])</p>
                    <p class="mt-4"><a href="{{ route('exploreUsers') }}" class="btn btn-primary btn-lg"><i class="fa fa-fw fa-search"></i> @lang('gallery.user_activity_feed.explore_photographers_link')</a></p>
                </div>
            </div>
        </div>
    </div>
@endsection

@push('scripts')
    <script type="text/javascript">
        var viewModel = new UserViewModel({
            feed_url: '{{ route('userActivityFeedJson') }}?t={{ time() }}'
        });

        var app = new Vue(viewModel);
        app.loadFeedItems();
    </script>
@endpush