From 8af77a3f7812aade73c59162df1802483e94c4ab Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 13 Oct 2024 23:19:58 -0600 Subject: [PATCH] Add Profile Carousels --- app/Http/Controllers/ProfileController.php | 10 +- package-lock.json | 6 + package.json | 1 + .../assets/components/FullscreenCarousel.vue | 336 ++++++++++++++++++ .../assets/components/ProfileCarousel.vue | 197 ++++++++++ resources/assets/components/SplashScreen.vue | 46 +++ resources/assets/js/profile.js | 5 + resources/assets/sass/profile.scss | 2 + .../views/profile/show_carousel.blade.php | 42 +++ webpack.mix.js | 1 + 10 files changed, 644 insertions(+), 2 deletions(-) create mode 100644 resources/assets/components/FullscreenCarousel.vue create mode 100644 resources/assets/components/ProfileCarousel.vue create mode 100644 resources/assets/components/SplashScreen.vue create mode 100644 resources/assets/sass/profile.scss create mode 100644 resources/views/profile/show_carousel.blade.php diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index fba1e40b3..5c6e4b082 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -33,7 +33,7 @@ class ProfileController extends Controller } // redirect authed users to Metro 2.0 - if ($request->user()) { + if ($request->user() && !$request->filled('carousel')) { // unless they force static view if (! $request->has('fs') || $request->input('fs') != '1') { $pid = AccountService::usernameToId($username); @@ -64,6 +64,7 @@ class ProfileController extends Controller protected function buildProfile(Request $request, $user) { + $carousel = (bool) $request->filled('carousel'); $username = $user->username; $loggedIn = Auth::check(); $isPrivate = false; @@ -97,6 +98,9 @@ class ProfileController extends Controller ], ]; + if($carousel) { + return view('profile.show_carousel', compact('profile', 'settings')); + } return view('profile.show', compact('profile', 'settings')); } else { $key = 'profile:settings:'.$user->id; @@ -135,7 +139,9 @@ class ProfileController extends Controller 'list' => $settings->show_profile_followers, ], ]; - + if($carousel) { + return view('profile.show_carousel', compact('profile', 'settings')); + } return view('profile.show', compact('profile', 'settings')); } } diff --git a/package-lock.json b/package-lock.json index 0856697af..971e78307 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "name": "pixelfed", "dependencies": { "@fancyapps/fancybox": "^3.5.7", + "@glidejs/glide": "^3.6.2", "@hcaptcha/vue-hcaptcha": "^1.3.0", "@peertube/p2p-media-loader-core": "^1.0.14", "@peertube/p2p-media-loader-hlsjs": "^1.0.14", @@ -2140,6 +2141,11 @@ "jquery": ">=1.9.0" } }, + "node_modules/@glidejs/glide": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/@glidejs/glide/-/glide-3.6.2.tgz", + "integrity": "sha512-oXw7In0IZV69PC0PChQakY+yh+UnqIb5+zfVuEIzub6Kkfl1foo7TAhr2PZXPzihOG9YS57t8wvdzBFEZ0aPVA==" + }, "node_modules/@hcaptcha/vue-hcaptcha": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@hcaptcha/vue-hcaptcha/-/vue-hcaptcha-1.3.0.tgz", diff --git a/package.json b/package.json index 0fced8c08..7724f040c 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ }, "dependencies": { "@fancyapps/fancybox": "^3.5.7", + "@glidejs/glide": "^3.6.2", "@hcaptcha/vue-hcaptcha": "^1.3.0", "@peertube/p2p-media-loader-core": "^1.0.14", "@peertube/p2p-media-loader-hlsjs": "^1.0.14", diff --git a/resources/assets/components/FullscreenCarousel.vue b/resources/assets/components/FullscreenCarousel.vue new file mode 100644 index 000000000..1aac449f9 --- /dev/null +++ b/resources/assets/components/FullscreenCarousel.vue @@ -0,0 +1,336 @@ + + + + + diff --git a/resources/assets/components/ProfileCarousel.vue b/resources/assets/components/ProfileCarousel.vue new file mode 100644 index 000000000..fa27f174e --- /dev/null +++ b/resources/assets/components/ProfileCarousel.vue @@ -0,0 +1,197 @@ + + + + + diff --git a/resources/assets/components/SplashScreen.vue b/resources/assets/components/SplashScreen.vue new file mode 100644 index 000000000..3088949b2 --- /dev/null +++ b/resources/assets/components/SplashScreen.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/resources/assets/js/profile.js b/resources/assets/js/profile.js index ab72c974e..783626116 100644 --- a/resources/assets/js/profile.js +++ b/resources/assets/js/profile.js @@ -28,6 +28,11 @@ Vue.component( require('./components/PostMenu.vue').default ); +Vue.component( + 'profile-carousel', + require('./../components/ProfileCarousel.vue').default +); + Vue.component( 'profile', require('./components/Profile.vue').default diff --git a/resources/assets/sass/profile.scss b/resources/assets/sass/profile.scss new file mode 100644 index 000000000..0d1f2533f --- /dev/null +++ b/resources/assets/sass/profile.scss @@ -0,0 +1,2 @@ +@import "node_modules/@glidejs/glide/src/assets/sass/glide.core.scss"; +@import "node_modules/@glidejs/glide/src/assets/sass/glide.theme.scss"; diff --git a/resources/views/profile/show_carousel.blade.php b/resources/views/profile/show_carousel.blade.php new file mode 100644 index 000000000..a5be918d0 --- /dev/null +++ b/resources/views/profile/show_carousel.blade.php @@ -0,0 +1,42 @@ +@extends('layouts.blank', [ + 'title' => $profile->name . ' (@' . $acct . ') - Pixelfed', + 'ogTitle' => $profile->name . ' (@' . $acct . ')', + 'ogType' => 'profile' +]) + +@php +$acct = $profile->username . '@' . config('pixelfed.domain.app'); +$metaDescription = \App\Services\AccountService::getMetaDescription($profile->id); +@endphp + +@section('content') +@if (session('error')) +
+ {{ session('error') }} +
+@endif + + + +@endsection + +@push('meta') + + + + + + + + + + + + @if($profile->website) +@endif + @if(false == $settings['crawlable'] || $profile->remote_url)@endif +@endpush + +@push('scripts') + +@endpush diff --git a/webpack.mix.js b/webpack.mix.js index 1c52b178b..af23a60c0 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -13,6 +13,7 @@ mix.sass('resources/assets/sass/app.scss', 'public/css') .sass('resources/assets/sass/admin.scss', 'public/css') .sass('resources/assets/sass/portfolio.scss', 'public/css') .sass('resources/assets/sass/spa.scss', 'public/css') +.sass('resources/assets/sass/profile.scss', 'public/css') .sass('resources/assets/sass/landing.scss', 'public/css').version(); mix.js('resources/assets/js/app.js', 'public/js')