Skip to content

Commit fec95c6

Browse files
committed
fixes & improvements: toast global pt styles, better comments, cleanup
1 parent 84deedc commit fec95c6

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

bootstrap/app.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@
6262
->toResponse($request)
6363
->setStatusCode($statusCode);
6464
} else {
65-
// Return standard modal for easier debugging locally
65+
// Show standard modal for easier debugging locally
6666
if (app()->isLocal() && $statusCode === 500) {
6767
return $response;
6868
}
69-
// Return JSON response for PrimeVue toast to display
69+
// Return JSON response for PrimeVue toast to display, handled by Inertia router event listener
7070
$errorSummary = "$statusCode - $errorTitles[$statusCode]";
7171
$errorDetail = $errorDetails[$statusCode];
7272
if (get_class($exception) === ErrorToastException::class) {

resources/css/tailwind.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@source '../../storage/framework/views/*.php';
77
@source '../../resources/views/**/*.blade.php';
88
@source '../../resources/js/**/*.vue';
9+
@source '../../resources/js/theme/*.js';
910

1011
@custom-variant dark (&:where(.dark, .dark *));
1112

resources/js/app.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import PageTitleSection from '@/components/PageTitleSection.vue';
1616

1717
import { useSiteColorMode } from '@/composables/useSiteColorMode';
1818
import themePreset from '@/theme/noir-preset';
19+
import globalPt from '@/theme/global-pt';
1920

2021
/* global Ziggy */
2122
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
@@ -44,7 +45,6 @@ createInertiaApp({
4445
summary: responseBody.error_summary,
4546
detail: responseBody.error_detail,
4647
life: 5000,
47-
//styleClass: 'shadow-lg mb-0 mt-4 left-4 md:left-auto',
4848
});
4949
}
5050
});
@@ -69,16 +69,7 @@ createInertiaApp({
6969
},
7070
},
7171
},
72-
pt: {
73-
toast: {
74-
root: {
75-
class: 'fixed left-4! right-4! bottom-4 md:left-auto! md:top-auto'
76-
},
77-
message: {
78-
class: 'shadow-lg mb-0 mt-4 w-full'
79-
},
80-
},
81-
}
72+
pt: globalPt,
8273
})
8374
.use(ToastService)
8475
.component('InertiaHead', Head)

resources/js/pages/settings/Profile.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const showSuccessToast = () => {
3939
severity: 'success',
4040
summary: 'Saved',
4141
detail: 'Profile information has been updated',
42-
life: 120000,
42+
life: 5000,
4343
});
4444
};
4545
const updateProfileInformation = () => {

resources/js/theme/global-pt.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Global pass through styling for components
3+
* https://primevue.org/passthrough/#global
4+
*/
5+
export default {
6+
toast: {
7+
root: {
8+
// Full width/centered on mobile, bottom right desktop
9+
class: 'fixed! left-4! right-4! bottom-4! w-auto! md:right-8! md:bottom-8! sm:w-[25rem]! sm:not-fixed! sm:left-auto! sm:ml-auto!'
10+
},
11+
message: {
12+
class: 'shadow-lg mb-0 mt-4'
13+
},
14+
},
15+
}

0 commit comments

Comments
 (0)