Merge pull request #1164 from pixelfed/frontend-ui-refactor

Frontend ui refactor
This commit is contained in:
daniel 2019-04-20 20:20:31 -06:00 committed by GitHub
commit 923b6dea3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 6 deletions

View file

@ -32,10 +32,15 @@ class ApiController extends BaseApiController
'media_types' => config('pixelfed.media_types'), 'media_types' => config('pixelfed.media_types'),
'enforce_account_limit' => config('pixelfed.enforce_account_limit') 'enforce_account_limit' => config('pixelfed.enforce_account_limit')
], ],
'activitypub' => [ 'activitypub' => [
'enabled' => config('pixelfed.activitypub_enabled'), 'enabled' => config('pixelfed.activitypub_enabled'),
'remote_follow' => config('pixelfed.remote_follow_enabled') 'remote_follow' => config('pixelfed.remote_follow_enabled')
] ],
'ab' => [
'lc' => config('exp.lc')
],
]; ];
}); });
return response()->json($res); return response()->json($res);

7
config/exp.php Normal file
View file

@ -0,0 +1,7 @@
<?php
return [
'lc' => env('EXP_LC', false)
];

BIN
public/js/timeline.js vendored

Binary file not shown.

Binary file not shown.

View file

@ -7,7 +7,7 @@
<span class="sr-only">Loading...</span> <span class="sr-only">Loading...</span>
</div> </div>
</div> </div>
<div class="card mb-sm-4 status-card card-md-rounded-0" :data-status-id="status.id" v-for="(status, index) in feed" :key="status.id"> <div class="card mb-sm-4 status-card card-md-rounded-0" :data-status-id="status.id" v-for="(status, index) in feed" :key="`${index}-${status.id}`">
<div class="card-header d-inline-flex align-items-center bg-white"> <div class="card-header d-inline-flex align-items-center bg-white">
<img v-bind:src="status.account.avatar" width="32px" height="32px" style="border-radius: 32px;"> <img v-bind:src="status.account.avatar" width="32px" height="32px" style="border-radius: 32px;">
@ -89,7 +89,7 @@
<h3 v-bind:class="[status.reblogged ? 'far fa-share-square pr-3 m-0 text-primary cursor-pointer' : 'far fa-share-square pr-3 m-0 share-btn cursor-pointer']" title="Share" v-on:click="shareStatus(status, $event)"></h3> <h3 v-bind:class="[status.reblogged ? 'far fa-share-square pr-3 m-0 text-primary cursor-pointer' : 'far fa-share-square pr-3 m-0 share-btn cursor-pointer']" title="Share" v-on:click="shareStatus(status, $event)"></h3>
</div> </div>
<div class="likes font-weight-bold"> <div class="likes font-weight-bold" v-if="expLc(status) == true">
<span class="like-count">{{status.favourites_count}}</span> {{status.favourites_count == 1 ? 'like' : 'likes'}} <span class="like-count">{{status.favourites_count}}</span> {{status.favourites_count == 1 ? 'like' : 'likes'}}
</div> </div>
<div class="caption"> <div class="caption">
@ -390,6 +390,7 @@
props: ['scope'], props: ['scope'],
data() { data() {
return { return {
config: {},
page: 2, page: 2,
feed: [], feed: [],
profile: {}, profile: {},
@ -420,8 +421,12 @@
}, },
beforeMount() { beforeMount() {
this.fetchTimelineApi(); axios.get('/api/v2/config')
this.fetchProfile(); .then(res => {
this.config = res.data;
this.fetchTimelineApi();
this.fetchProfile();
});
}, },
mounted() { mounted() {
@ -531,12 +536,12 @@
}).then(res => { }).then(res => {
if (res.data.length && this.loading == false) { if (res.data.length && this.loading == false) {
let data = res.data; let data = res.data;
this.feed.push(...data);
let ids = data.map(status => status.id); let ids = data.map(status => status.id);
this.min_id = Math.min(...ids); this.min_id = Math.min(...ids);
if(this.page == 1) { if(this.page == 1) {
this.max_id = Math.max(...ids); this.max_id = Math.max(...ids);
} }
this.feed.push(...data);
this.page += 1; this.page += 1;
this.loading = false; this.loading = false;
event.target.innerText = 'Load more posts'; event.target.innerText = 'Load more posts';
@ -997,6 +1002,16 @@
lightbox(src) { lightbox(src) {
this.lightboxMedia = src; this.lightboxMedia = src;
this.$refs.lightboxModal.show(); this.$refs.lightboxModal.show();
},
expLc(status) {
if(this.config.ab.lc == false) {
return true;
}
if(this.statusOwner(status) == true) {
return true;
}
return false;
} }
} }
} }