From 1ad8fbdd571687d63230d8c59f705dcae8628d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Carodej?= Date: Fri, 18 Mar 2022 07:21:33 +0100 Subject: [PATCH] alert icon in mobile menu --- public/mix-manifest.json | 10 +- .../js/components/FilesView/MobileToolbar.vue | 2 +- .../components/Notifications/Notification.vue | 1 + .../Notifications/NotificationCenter.vue | 13 +-- .../components/Others/NotificationsPopup.vue | 94 +++++++++++++++++++ .../components/Others/Popup/PopupHeader.vue | 3 + .../js/components/Sidebar/UserHeadline.vue | 43 ++++----- resources/js/store/modules/userAuth.js | 15 ++- resources/js/views/Platform.vue | 3 + .../Console/Commands/SetupDevEnvironment.php | 23 +++++ src/App/Providers/AppServiceProvider.php | 5 +- 11 files changed, 171 insertions(+), 41 deletions(-) create mode 100644 resources/js/components/Others/NotificationsPopup.vue diff --git a/public/mix-manifest.json b/public/mix-manifest.json index cf83877a..c8788e22 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,6 +1,6 @@ { "/js/main.js": "/js/main.js", - "/chunks/request.js": "/chunks/request.js?id=1a9ada603e8d364a", + "/chunks/request.js": "/chunks/request.js?id=f5a2c854bb7d7457", "/chunks/request-upload.js": "/chunks/request-upload.js?id=35b65503f01ef52c", "/chunks/setup-wizard.js": "/chunks/setup-wizard.js?id=19a0784e59d768ec", "/chunks/status-check.js": "/chunks/status-check.js?id=c7d5cfeb0120db76", @@ -9,13 +9,13 @@ "/chunks/environment-setup.js": "/chunks/environment-setup.js?id=fc3886e258b9a9b9", "/chunks/app-setup.js": "/chunks/app-setup.js?id=7bae302e249c73a1", "/chunks/admin-account.js": "/chunks/admin-account.js?id=309dc20e668952e6", - "/chunks/shared.js": "/chunks/shared.js?id=c1bd69381de51386", + "/chunks/shared.js": "/chunks/shared.js?id=d92943b9a1c8cdd2", "/chunks/shared/browser.js": "/chunks/shared/browser.js?id=7d78c21314593e88", "/chunks/shared/single-file.js": "/chunks/shared/single-file.js?id=af632a9bdc82be95", "/chunks/shared/authenticate.js": "/chunks/shared/authenticate.js?id=c303bb3ce8a22918", "/chunks/not-found.js": "/chunks/not-found.js?id=5fbc874846003a91", "/chunks/temporary-unavailable.js": "/chunks/temporary-unavailable.js?id=9c283755ffea5e90", - "/chunks/admin.js": "/chunks/admin.js?id=2872d2125afadd0f", + "/chunks/admin.js": "/chunks/admin.js?id=35b06ddc77e91737", "/chunks/dashboard.js": "/chunks/dashboard.js?id=3cb0b23a8ab78cbb", "/chunks/invoices.js": "/chunks/invoices.js?id=f89964a5a55ace45", "/chunks/subscriptions.js": "/chunks/subscriptions.js?id=62582c26b6288d7d", @@ -57,12 +57,12 @@ "/chunks/sign-up.js": "/chunks/sign-up.js?id=d87ef46a15b3a4c3", "/chunks/forgotten-password.js": "/chunks/forgotten-password.js?id=63bc2a81117cee2f", "/chunks/create-new-password.js": "/chunks/create-new-password.js?id=b7d1b17596c771c3", - "/chunks/settings.js": "/chunks/settings.js?id=2c8f1d93e56030e0", + "/chunks/settings.js": "/chunks/settings.js?id=0be4a28092747772", "/chunks/profile.js": "/chunks/profile.js?id=baa99177b1a788a2", "/chunks/settings-password.js": "/chunks/settings-password.js?id=29034c929a287e2a", "/chunks/settings-storage.js": "/chunks/settings-storage.js?id=80bca2eb75da275d", "/chunks/billing.js": "/chunks/billing.js?id=9008d99558ed20a5", - "/chunks/platform.js": "/chunks/platform.js?id=9b210e9d35286856", + "/chunks/platform.js": "/chunks/platform.js?id=595ebf8df2edae41", "/chunks/files.js": "/chunks/files.js?id=535a172eef59e2f4", "/chunks/recent-uploads.js": "/chunks/recent-uploads.js?id=a6d8378911b23390", "/chunks/my-shared-items.js": "/chunks/my-shared-items.js?id=ebfebefef781b070", diff --git a/resources/js/components/FilesView/MobileToolbar.vue b/resources/js/components/FilesView/MobileToolbar.vue index 5e57db40..383a44aa 100644 --- a/resources/js/components/FilesView/MobileToolbar.vue +++ b/resources/js/components/FilesView/MobileToolbar.vue @@ -15,7 +15,7 @@
-
+
diff --git a/resources/js/components/Notifications/Notification.vue b/resources/js/components/Notifications/Notification.vue index 7f7a2eb9..169e2389 100644 --- a/resources/js/components/Notifications/Notification.vue +++ b/resources/js/components/Notifications/Notification.vue @@ -138,6 +138,7 @@ export default { }, closeCenter() { this.$store.commit('CLOSE_NOTIFICATION_CENTER') + this.$closePopup() }, }, created() { diff --git a/resources/js/components/Notifications/NotificationCenter.vue b/resources/js/components/Notifications/NotificationCenter.vue index 9c9de486..87650871 100644 --- a/resources/js/components/Notifications/NotificationCenter.vue +++ b/resources/js/components/Notifications/NotificationCenter.vue @@ -15,7 +15,7 @@
- + {{ $t('Clear all') }} @@ -71,18 +71,9 @@ export default { if (this.isVisibleNotificationCenter) this.$store.commit('CLOSE_NOTIFICATION_CENTER') }, - deleteAllNotifications() { - axios.delete('/api/user/notifications') - .then(() => { - this.$store.commit('FLUSH_NOTIFICATIONS') - }) - } }, created() { - axios.post('/api/user/notifications/read') - .then(() => { - this.$store.commit('UPDATE_NOTIFICATION_COUNT', 0) - }) + this.$store.dispatch('readAllNotifications') } } diff --git a/resources/js/components/Others/NotificationsPopup.vue b/resources/js/components/Others/NotificationsPopup.vue new file mode 100644 index 00000000..6ad9bcd4 --- /dev/null +++ b/resources/js/components/Others/NotificationsPopup.vue @@ -0,0 +1,94 @@ + + + diff --git a/resources/js/components/Others/Popup/PopupHeader.vue b/resources/js/components/Others/Popup/PopupHeader.vue index f6cd383e..58dc4a10 100644 --- a/resources/js/components/Others/Popup/PopupHeader.vue +++ b/resources/js/components/Others/Popup/PopupHeader.vue @@ -10,6 +10,7 @@ +
@@ -24,6 +25,7 @@ diff --git a/resources/js/store/modules/userAuth.js b/resources/js/store/modules/userAuth.js index 9a26f0c3..60d5ec06 100644 --- a/resources/js/store/modules/userAuth.js +++ b/resources/js/store/modules/userAuth.js @@ -116,10 +116,21 @@ const actions = { .post(getters.api + '/folders/favourites/' + folder.data.id, { _method: 'delete', }) - .catch(() => { - Vue.prototype.$isSomethingWrong() + .catch(() => Vue.prototype.$isSomethingWrong()) + }, + readAllNotifications: ({ commit }) => { + axios.post('/api/user/notifications/read') + .then(() => { + commit('UPDATE_NOTIFICATION_COUNT', 0) }) }, + deleteAllNotifications: ({ commit }) => { + axios.delete('/api/user/notifications') + .then(() => { + commit('FLUSH_NOTIFICATIONS') + }) + .catch(() => Vue.prototype.$isSomethingWrong()) + }, } const mutations = { diff --git a/resources/js/views/Platform.vue b/resources/js/views/Platform.vue index 44c49241..518e34bf 100644 --- a/resources/js/views/Platform.vue +++ b/resources/js/views/Platform.vue @@ -15,6 +15,7 @@ + @@ -77,10 +78,12 @@ import InfoSidebar from '../components/FilesView/InfoSidebar' import { events } from '../bus' import { mapGetters } from 'vuex' import CreateUploadRequestPopup from "../components/Others/CreateUploadRequestPopup"; +import NotificationsPopup from "../components/Others/NotificationsPopup"; export default { name: 'Platform', components: { + NotificationsPopup, CreateUploadRequestPopup, CreateTeamFolderPopup, PanelNavigationFiles, diff --git a/src/App/Console/Commands/SetupDevEnvironment.php b/src/App/Console/Commands/SetupDevEnvironment.php index 90406226..b94cd0c5 100644 --- a/src/App/Console/Commands/SetupDevEnvironment.php +++ b/src/App/Console/Commands/SetupDevEnvironment.php @@ -74,6 +74,7 @@ class SetupDevEnvironment extends Command $this->create_share_records(); $this->generate_traffic(); + $this->generateCommonNotification(); $this->generateTeamInvitationNotification(); $this->generateFileRequestFilledNotification(); @@ -90,6 +91,28 @@ class SetupDevEnvironment extends Command $this->info('Everything is done, congratulations! 🥳🥳🥳'); } + private function generateCommonNotification() + { + $howdy = User::whereEmail('howdy@hi5ve.digital') + ->first(); + + DB::table('notifications') + ->insert([ + 'id' => Str::uuid(), + 'type' => 'App\Users\Notifications\RegistrationBonusAddedNotification', + 'notifiable_type' => 'App\Users\Models\User', + 'notifiable_id' => $howdy->id, + 'data' => json_encode([ + 'category' => 'gift', + 'title' => 'You Received $10.00', + 'description' => 'You received credit bonus $10.00 for your registration. Happy spending!', + ]), + 'read_at' => now()->subMinutes(5), + 'created_at' => now()->subMinutes(5), + 'updated_at' => now()->subMinutes(5), + ]); + } + private function generateTeamInvitationNotification() { $alice = User::whereEmail('alice@hi5ve.digital') diff --git a/src/App/Providers/AppServiceProvider.php b/src/App/Providers/AppServiceProvider.php index 4754044a..18a24794 100644 --- a/src/App/Providers/AppServiceProvider.php +++ b/src/App/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; +use Schema; class AppServiceProvider extends ServiceProvider { @@ -21,9 +22,11 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { + Schema::defaultStringLength(191); + try { $app_locale = get_settings('language') ?? 'en'; - } catch (\PDOException $exception) { + } catch (\PDOException $e) { $app_locale = 'en'; }