Skip to content

Commit 5c106d7

Browse files
committed
section page alert front
1 parent 0b02d52 commit 5c106d7

File tree

5 files changed

+25
-10
lines changed

5 files changed

+25
-10
lines changed

resources/js/Pages/Dashboard/Dashboard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</template>
6363

6464
<div class="container @container mx-auto">
65-
<div :class="dashboard.pageAlert ? 'pt-4' : 'pt-10'">
65+
<div :class="dashboard.pageAlert && !dashboard.pageAlert.sectionKey ? 'pt-4' : 'pt-10'">
6666
<DashboardComponent
6767
:dashboard-key="dashboardKey"
6868
:dashboard="dashboard"

resources/js/Pages/Show/Show.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@
134134

135135
<WithCommands :commands="commands">
136136
<div class="@container">
137-
<div :class="show.pageAlert ? 'pt-4' : 'pt-6 @3xl:pt-10'">
138-
<template v-if="show.pageAlert">
137+
<div :class="show.pageAlert && !show.pageAlert.sectionKey ? 'pt-4' : 'pt-6 @3xl:pt-10'">
138+
<template v-if="show.pageAlert && !show.pageAlert.sectionKey">
139139
<div class="container">
140140
<PageAlert
141141
class="mb-4"
@@ -153,6 +153,14 @@
153153
v-show="show.sectionShouldBeVisible(section, locale) || i == 0"
154154
v-slot="{ collapsed, onCollapseToggle }"
155155
>
156+
<template v-if="show.pageAlert?.sectionKey && show.pageAlert.sectionKey === section.key">
157+
<div class="container">
158+
<PageAlert
159+
class="mb-4"
160+
:page-alert="show.pageAlert"
161+
/>
162+
</div>
163+
</template>
156164
<template v-if="show.sectionHasField(section, 'entityList')">
157165
<template v-for="column in section.columns">
158166
<template v-for="row in column.fields">

resources/js/dashboard/Dashboard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class Dashboard {
99
layout: DashboardData['layout'];
1010
data: DashboardData['data'];
1111
filterValues: DashboardData['filterValues'];
12-
pageAlert:DashboardData['pageAlert'];
12+
pageAlert: DashboardData['pageAlert'];
1313
query: DashboardData['query'];
1414

1515
dashboardKey: string;

resources/js/dashboard/components/Dashboard.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
<template>
6868
<WithCommands :commands="commands">
69-
<template v-if="dashboard?.pageAlert">
69+
<template v-if="dashboard && dashboard.pageAlert && !dashboard.pageAlert.sectionKey">
7070
<PageAlert
7171
class="mb-8"
7272
:page-alert="dashboard.pageAlert"
@@ -186,6 +186,12 @@
186186
</h2>
187187
</template>
188188
</template>
189+
<template v-if="dashboard.pageAlert?.sectionKey && dashboard.pageAlert.sectionKey === section.key">
190+
<PageAlert
191+
class="mb-4"
192+
:page-alert="dashboard.pageAlert"
193+
/>
194+
</template>
189195
<template v-if="dashboard.sectionVisibleFilters(section)?.length || dashboard.visibleCommands?.[section.key]?.flat().length">
190196
<div class="flex gap-2 mb-4">
191197
<template v-if="dashboard.sectionVisibleFilters(section)?.length">

resources/js/types/generated.d.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ export type EmbedFormData = {
140140
fields: { [key: string]: FormFieldData };
141141
layout: FormLayoutData | null;
142142
};
143-
export type EmbeddedFieldAuthorizationsData = {
144-
view: boolean;
145-
};
146143
export type EntityListAuthorizationsData = {
147144
create: boolean;
148145
reorder: boolean;
@@ -726,6 +723,7 @@ export type OrderedListWidgetData = {
726723
export type PageAlertData = {
727724
level: PageAlertLevel;
728725
text: string;
726+
sectionKey: string | null;
729727
buttonLabel: string | null;
730728
buttonUrl: string | null;
731729
};
@@ -811,7 +809,7 @@ export type ShowDashboardFieldData = {
811809
dashboardKey: string;
812810
hiddenCommands: Array<string>;
813811
endpointUrl: string;
814-
authorizations: EmbeddedFieldAuthorizationsData;
812+
authorizations: ShowFieldAuthorizationsData;
815813
label: string | null;
816814
hiddenFilters: { [key: string]: any } | null;
817815
};
@@ -838,10 +836,13 @@ export type ShowEntityListFieldData = {
838836
showSearchField: boolean;
839837
showCount: boolean;
840838
endpointUrl: string;
841-
authorizations: EmbeddedFieldAuthorizationsData;
839+
authorizations: ShowFieldAuthorizationsData;
842840
label: string | null;
843841
hiddenFilters: { [key: string]: any } | null;
844842
};
843+
export type ShowFieldAuthorizationsData = {
844+
view: boolean;
845+
};
845846
export type ShowFieldData =
846847
| ShowDashboardFieldData
847848
| ShowEntityListFieldData

0 commit comments

Comments
 (0)