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

Frontend ui refactor
This commit is contained in:
daniel 2019-03-09 22:34:50 -07:00 committed by GitHub
commit 00b0dece87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 9804 additions and 3401 deletions

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 586 KiB

After

Width:  |  Height:  |  Size: 644 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 477 KiB

After

Width:  |  Height:  |  Size: 797 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

2
public/js/status.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,12 @@
{ {
"/js/activity.js": "/js/activity.js?id=7915246c3bc2b7e9770e", "/js/activity.js": "/js/activity.js?id=7915246c3bc2b7e9770e",
"/js/app.js": "/js/app.js?id=a51da95c2b9df7cf8de2", "/js/app.js": "/js/app.js?id=a51da95c2b9df7cf8de2",
"/css/app.css": "/css/app.css?id=da1490bc71c86824a5d8", "/css/app.css": "/css/app.css?id=a3d1a9d5833199d019d4",
"/css/appdark.css": "/css/appdark.css?id=75eb957c4cbdd84b6016", "/css/appdark.css": "/css/appdark.css?id=241076c8fb3c47e088d2",
"/js/components.js": "/js/components.js?id=fe7e6d95339a03a9b03f", "/js/components.js": "/js/components.js?id=2cc86bfe798c5a7af92b",
"/js/discover.js": "/js/discover.js?id=75fb12b06ee23fa05186", "/js/discover.js": "/js/discover.js?id=75fb12b06ee23fa05186",
"/js/micro.js": "/js/micro.js?id=178479fb6990f8806257", "/js/micro.js": "/js/micro.js?id=178479fb6990f8806257",
"/js/profile.js": "/js/profile.js?id=9b4b7d662fb70fb48856", "/js/profile.js": "/js/profile.js?id=9b4b7d662fb70fb48856",
"/js/status.js": "/js/status.js?id=d3866ac390bc28d9bcc1", "/js/status.js": "/js/status.js?id=fd76f38cedc711b9c634",
"/js/timeline.js": "/js/timeline.js?id=8a3d417eb838a7219cc9" "/js/timeline.js": "/js/timeline.js?id=3d3a0103fc53c6b03769"
} }

View File

@ -55,7 +55,7 @@
</div> </div>
<div class="postPresenterContainer d-none d-flex justify-content-center align-items-center"> <div class="postPresenterContainer d-none d-flex justify-content-center align-items-center">
<div v-if="status.pf_type === 'photo'" class="w-100"> <div v-if="status.pf_type === 'photo'" class="w-100">
<photo-presenter :status="status"></photo-presenter> <photo-presenter :status="status" v-on:lightbox="lightbox"></photo-presenter>
</div> </div>
<div v-else-if="status.pf_type === 'video'" class="w-100"> <div v-else-if="status.pf_type === 'video'" class="w-100">
@ -227,6 +227,19 @@
</infinite-loading> </infinite-loading>
</div> </div>
</b-modal> </b-modal>
<b-modal
id="lightbox"
ref="lightboxModal"
:hide-header="true"
:hide-footer="true"
centered
size="lg"
body-class="p-0"
>
<div v-if="lightboxMedia" :class="lightboxMedia.filter_class">
<img :src="lightboxMedia.url" class="img-fluid">
</div>
</b-modal>
</div> </div>
</template> </template>
@ -249,6 +262,7 @@ export default {
likesPage: 1, likesPage: 1,
shares: [], shares: [],
sharesPage: 1, sharesPage: 1,
lightboxMedia: false
} }
}, },
@ -534,6 +548,11 @@ export default {
ownerOrAdmin() { ownerOrAdmin() {
return this.owner() || this.admin(); return this.owner() || this.admin();
},
lightbox(src) {
this.lightboxMedia = src;
this.$refs.lightboxModal.show();
} }
}, },

View File

@ -58,7 +58,7 @@
<div class="postPresenterContainer"> <div class="postPresenterContainer">
<div v-if="status.pf_type === 'photo'" class="w-100"> <div v-if="status.pf_type === 'photo'" class="w-100">
<photo-presenter :status="status"></photo-presenter> <photo-presenter :status="status" v-on:lightbox="lightbox"></photo-presenter>
</div> </div>
<div v-else-if="status.pf_type === 'video'" class="w-100"> <div v-else-if="status.pf_type === 'video'" class="w-100">
@ -355,6 +355,19 @@
</div> </div>
</div> </div>
</b-modal> </b-modal>
<b-modal
id="lightbox"
ref="lightboxModal"
hide-header="true"
hide-footer="true"
centered
size="lg"
body-class="p-0"
>
<div v-if="lightboxMedia" :class="lightboxMedia.filter_class">
<img :src="lightboxMedia.url" class="img-fluid">
</div>
</b-modal>
</div> </div>
</template> </template>
@ -374,12 +387,12 @@
<script type="text/javascript"> <script type="text/javascript">
export default { export default {
props: ['scope'],
data() { data() {
return { return {
page: 2, page: 2,
feed: [], feed: [],
profile: {}, profile: {},
scope: window.location.pathname == '/' ? 'home' : 'local',
min_id: 0, min_id: 0,
max_id: 0, max_id: 0,
notifications: {}, notifications: {},
@ -401,7 +414,8 @@
followerMore: true, followerMore: true,
following: [], following: [],
followingCursor: 1, followingCursor: 1,
followingMore: true followingMore: true,
lightboxMedia: false
} }
}, },
@ -437,12 +451,23 @@
}, },
fetchTimelineApi() { fetchTimelineApi() {
let homeTimeline = '/api/v1/timelines/home'; let apiUrl = false;
let localTimeline = '/api/v1/timelines/public'; switch(this.scope) {
let apiUrl = this.scope == 'home' ? homeTimeline : localTimeline; case 'home':
apiUrl = '/api/v1/timelines/home';
break;
case 'local':
apiUrl = '/api/v1/timelines/public';
break;
case 'network':
apiUrl = '/api/v1/timelines/network';
break;
}
axios.get(apiUrl, { axios.get(apiUrl, {
params: { params: {
max_id: 0, max_id: this.max_id,
limit: 4 limit: 4
} }
}).then(res => { }).then(res => {
@ -459,9 +484,20 @@
}, },
infiniteTimeline($state) { infiniteTimeline($state) {
let homeTimeline = '/api/v1/timelines/home'; let apiUrl = false;
let localTimeline = '/api/v1/timelines/public'; switch(this.scope) {
let apiUrl = this.scope == 'home' ? homeTimeline : localTimeline; case 'home':
apiUrl = '/api/v1/timelines/home';
break;
case 'local':
apiUrl = '/api/v1/timelines/public';
break;
case 'network':
apiUrl = '/api/v1/timelines/network';
break;
}
axios.get(apiUrl, { axios.get(apiUrl, {
params: { params: {
max_id: this.max_id, max_id: this.max_id,
@ -894,7 +930,7 @@
this.following = res.data; this.following = res.data;
this.followingCursor++; this.followingCursor++;
}); });
if(res.data.length < 10) { if(res.data.length < 10) {
this.followingMore = false; this.followingMore = false;
} }
this.$refs.followingModal.show(); this.$refs.followingModal.show();
@ -914,7 +950,7 @@
this.followers = res.data; this.followers = res.data;
this.followerCursor++; this.followerCursor++;
}) })
if(res.data.length < 10) { if(res.data.length < 10) {
this.followerMore = false; this.followerMore = false;
} }
this.$refs.followerModal.show(); this.$refs.followerModal.show();
@ -931,13 +967,12 @@
this.following.push(...res.data); this.following.push(...res.data);
this.followingCursor++; this.followingCursor++;
} }
if(res.data.length < 10) { if(res.data.length < 10) {
this.followingMore = false; this.followingMore = false;
} }
}); });
}, },
followersLoadMore() { followersLoadMore() {
axios.get('/api/v1/accounts/'+this.profile.id+'/followers', { axios.get('/api/v1/accounts/'+this.profile.id+'/followers', {
params: { params: {
@ -949,10 +984,15 @@
this.followers.push(...res.data); this.followers.push(...res.data);
this.followerCursor++; this.followerCursor++;
} }
if(res.data.length < 10) { if(res.data.length < 10) {
this.followerMore = false; this.followerMore = false;
} }
}); });
},
lightbox(src) {
this.lightboxMedia = src;
this.$refs.lightboxModal.show();
} }
} }
} }

View File

@ -11,7 +11,7 @@
</details> </details>
</div> </div>
<div v-else> <div v-else>
<div :class="status.media_attachments[0].filter_class"> <div :class="status.media_attachments[0].filter_class" v-on:click="showLightbox(status.media_attachments[0])">
<img class="card-img-top" :src="status.media_attachments[0].url" :alt="status.media_attachments[0].description" :title="status.media_attachments[0].description"> <img class="card-img-top" :src="status.media_attachments[0].url" :alt="status.media_attachments[0].description" :title="status.media_attachments[0].description">
</div> </div>
</div> </div>
@ -19,6 +19,12 @@
<script type="text/javascript"> <script type="text/javascript">
export default { export default {
props: ['status'] props: ['status'],
methods: {
showLightbox(src) {
this.$emit('lightbox', src);
}
}
} }
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
@section('content') @section('content')
<timeline></timeline> <timeline scope="home"></timeline>
@endsection @endsection

View File

@ -2,7 +2,7 @@
@section('content') @section('content')
<timeline></timeline> <timeline scope="local"></timeline>
@endsection @endsection

View File

@ -0,0 +1,16 @@
@extends('layouts.app')
@section('content')
<timeline scope="network"></timeline>
@endsection
@push('scripts')
<script type="text/javascript" src="{{ mix('js/timeline.js') }}"></script>
<script type="text/javascript">
new Vue({
el: '#content'
});
</script>
@endpush