forked from syncfusion/blazor-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.razor
More file actions
271 lines (266 loc) · 15.1 KB
/
App.razor
File metadata and controls
271 lines (266 loc) · 15.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
@using BlazorDemos.Components;
@inject NavigationManager Urihelper
@inject SampleService SampleService
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
@if (isNET10_0){
<ResourcePreloader />
}
<link rel="alternate" hreflang="en" href="@Urihelper.BaseUri" />
<link rel="preconnect" href="https://cdn.syncfusion.com" crossorigin />
@if (!SampleUtils.IsLocalSample(Urihelper.BaseUri))
{
@* Google Tag Manager *@
@* Load GTM-P3WXFWCW immediately on page load *@
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || []; w[l].push({
'gtm.start':
new Date().getTime(), event: 'gtm.js'
}); var f = d.getElementsByTagName(s)[0],
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-P3WXFWCW');
</script>
@* Load GTM-W8WD8WN on user interaction *@
<script>
document.addEventListener("DOMContentLoaded", function () {
const events = ["mousemove", "scroll", "keydown", "touchstart"];
function loadGTM() {
events.forEach(event => document.removeEventListener(event, loadGTM));
(function (w, d, s, l, i) {
w[l] = w[l] || []; w[l].push({
'gtm.start':
new Date().getTime(), event: 'gtm.js'
}); var f = d.getElementsByTagName(s)[0],
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-W8WD8WN');
}
events.forEach(event => document.addEventListener(event, loadGTM, { once: true }));
});
</script>
@* End Google Tag Manager *@
}
<script>
function onCommonLayoutStylesLoaded(selectedTheme){
const theme = document.getElementById('common-layout-style');
if (theme) {
const href = theme.getAttribute('href') || '';
const marker = 'demo-page-comps/';
const i = href.indexOf(marker);
if (i !== -1) {
const base = href.slice(0, i + marker.length);
theme.setAttribute('href', base + selectedTheme + '.min.css');
}
}
}
</script>
@* SB's Home pages LCP image preloading and stylesheets *@
@if (SampleUtils.IsHomePage(Urihelper))
{
@if (!isSTAGING && isRELEASE)
{
// Preloading LCP image of Home page with high priority based on screen size using media queries.
<link rel="preload" as="image" href="https://cdn.syncfusion.com/blazor/images/demos/home-banner-mobile.webp" fetchpriority="high" media="(max-width: 450px)" />
<link rel="preload" as="image" href="https://cdn.syncfusion.com/blazor/images/demos/home-banner-tab.webp" fetchpriority="high" media="(min-width: 456px) and (max-width: 1024px)" />
<link rel="preload" as="image" href="https://cdn.syncfusion.com/blazor/images/demos/home-banner.webp" fetchpriority="high" media="(min-width: 1025px)" />
<link rel="stylesheet" type="text/css" href="https://cdn.syncfusion.com/blazor/sb/styles/32.1.19/home-page/fluent2.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.syncfusion.com/blazor/sb/styles/32.1.19/common/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.syncfusion.com/blazor/sb/styles/32.1.19/common/site.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.syncfusion.com/blazor/sb/styles/32.1.19/common/home.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.syncfusion.com/blazor/sb/styles/32.1.19/common/devices.min.css" media="(max-width: 1024px)" />
}
else if(!isDEBUG && isSTAGING)
{
// Preloading LCP image of Home page with high priority based on screen size using media queries.
<link rel="preload" as="image" href="@(SampleService.AssetsPath + "images/common/home-banner-mobile.webp")" fetchpriority="high" media="(max-width: 450px)" />
<link rel="preload" as="image" href="@(SampleService.AssetsPath + "images/common/home-banner-tab.webp")" fetchpriority="high" media="(min-width: 456px) and (max-width: 1024px)" />
<link rel="preload" as="image" href="@(SampleService.AssetsPath + "images/common/home-banner.webp")" fetchpriority="high" media="(min-width: 1025px)" />
@if (isNET10_0 || isNET9_0)
{
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/component-samples/home-page/fluent2.min.css")]" />
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/bootstrap.min.css")]" />
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/site.min.css")]" />
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/common/home.min.css")]" />
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/common/devices.min.css")]" media="(max-width: 1024px)" />
}
else
{
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/component-samples/home-page/fluent2.min.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/bootstrap.min.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/site.min.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/common/home.min.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/common/devices.min.css")" media="(max-width: 1024px)" />
}
}
else
{
// Preloading LCP image of Home page with high priority based on screen size using media queries.
<link rel="preload" as="image" href="@(SampleService.AssetsPath + "images/common/home-banner-mobile.webp")" fetchpriority="high" media="(max-width: 450px)" />
<link rel="preload" as="image" href="@(SampleService.AssetsPath + "images/common/home-banner-tab.webp" )" fetchpriority="high" media="(min-width: 456px) and (max-width: 1024px)" />
<link rel="preload" as="image" href="@(SampleService.AssetsPath + "images/common/home-banner.webp")" fetchpriority="high" media="(min-width: 1025px)" />
@if (isNET10_0 || isNET9_0)
{
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/component-samples/home-page/fluent2.min.css")]" />
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/bootstrap.min.css")]" />
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/site.css")]" />
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/common/home.css")]" />
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/common/devices.css")]" media="(max-width: 1024px)" />
}
else
{
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/component-samples/home-page/fluent2.min.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/bootstrap.min.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/site.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/common/home.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/common/devices.css")" media="(max-width: 1024px)" />
}
}
}
@* SB's Demo pages LCP image preloading and stylesheets *@
@if (!SampleUtils.IsHomePage(Urihelper))
{
@if(!isSTAGING && isRELEASE){
<link rel="preload" as="image" href="https://cdn.syncfusion.com/blazor/images/demos/ad-bg.webp" fetchpriority="high" />
}
else{
<link rel="preload" as="image" href="@(SampleService.AssetsPath + "images/common/ad-bg.webp")" fetchpriority="high" />
}
@if (isNET8_0)
{
<link href="Blazor_Server_Demos_NET8.styles.css" rel="stylesheet" />
}
@if (isNET9_0)
{
<link href="@Assets["Blazor_Server_Demos_NET9.styles.css"]" rel="stylesheet" />
}
@if (isNET10_0)
{
<link href="@Assets["Blazor_Server_Demos_NET10.styles.css"]" rel="stylesheet" />
}
// Preloading LCP image of Demo page with high priority.
@if(!isSTAGING && isRELEASE)
{
<link rel="stylesheet" type="text/css" href="https://cdn.syncfusion.com/blazor/sb/styles/32.1.19/common/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.syncfusion.com/blazor/sb/styles/32.1.19/common/highlight.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.syncfusion.com/blazor/sb/styles/32.1.19/common/demos.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.syncfusion.com/blazor/sb/styles/32.1.19/common/devices.min.css" media="(max-width: 1024px)" />
<link id="common-layout-style" rel="stylesheet" type="text/css" href="https://cdn.syncfusion.com/blazor/sb/styles/32.1.19/demo-page-comps/fluent2.min.css" />
}
else if(!isDEBUG && isSTAGING)
{
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/bootstrap.min.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/common/highlight.min.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/common/demos.min.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/common/devices.min.css")" media="(max-width: 1024px)" />
<link id="common-layout-style" rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/component-samples/demo-page-comps/fluent2.min.css")" />
}
else {
@if (isNET10_0 || isNET9_0)
{
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/bootstrap.min.css")]" />
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/common/highlight.css")]" />
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/common/demos.css")]" />
<link rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/common/devices.css")]" media="(max-width: 1024px)" />
<link id="common-layout-style" rel="stylesheet" type="text/css" href="@Assets[(SampleService.AssetsPath + "styles/component-samples/demo-page-comps/fluent2.min.css")]" />
}
else
{
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/bootstrap.min.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/common/highlight.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/common/demos.css")" />
<link rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/common/devices.css")" media="(max-width: 1024px)" />
<link id="common-layout-style" rel="stylesheet" type="text/css" href="@(SampleService.AssetsPath + "styles/component-samples/demo-page-comps/fluent2.min.css")" />
}
}
}
<SampleMetaData @rendermode="@RenderMode.InteractiveServer" />
@if (!SampleUtils.IsHomePage(Urihelper) && SampleService.IsOldTheme(SampleUtils.GetThemeName(Urihelper.Uri)))
{
<script>
const theme = document.getElementById('common-layout-style');
if (theme) {
theme.disabled = true;
}
</script>
@if (isNET10_0 || isNET9_0)
{
<link id="theme" href=@Assets[($"_content/Syncfusion.Blazor.Themes/{SampleUtils.GetThemeName(Urihelper.Uri)}.css")] rel="stylesheet" />
}
else
{
<link id="theme" href=@($"_content/Syncfusion.Blazor.Themes/{SampleUtils.GetThemeName(Urihelper.Uri)}.css") rel="stylesheet" />
}
}
<DynamicResourceLoader @rendermode="@RenderMode.InteractiveServer" />
@if( isNET9_0 || isNET10_0 )
{
<ImportMap />
}
</head>
<body class="@SampleUtils.GetThemeName(Urihelper.Uri)">
<AddHeaderTag @rendermode="@RenderMode.InteractiveServer" />
<div hidden id="sync-analytics" data-queue="EJ2 - Blazor - Demos"></div>
<!-- Google Tag Manager (noscript) -->
@if (!SampleUtils.IsLocalSample(Urihelper.BaseUri))
{
<!--Page Load-->
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P3WXFWCW" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!--Interaction-->
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W8WD8WN" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
}
<!-- End Google Tag Manager (noscript) -->
<Routes @rendermode="@(new InteractiveServerRenderMode(true))" />
@if (isNET10_0)
{
<Layout.ReconnectModal />
}
<script src="_framework/blazor.web.js" autostart="false"></script>
<script>
Blazor.start({
circuit: {
configureSignalR: function (builder) {
builder.withServerTimeout(300000);
}
}
});
</script>
@if(isDEBUG || isSTAGING)
{
@if (isNET10_0 || isNET9_0)
{
<script src="@Assets[(SampleService.AssetsPath + "scripts/common/index.js")]" defer></script>
}
else
{
<script src="@(SampleService.AssetsPath + "scripts/common/index.js")" defer></script>
}
}
else
{
<script src="https://cdn.syncfusion.com/blazor/sb/scripts/32.1.19/index.min.js" defer></script>
}
<script>
function onCompStylesLoaded(hasScript){
if(hasScript){
setTimeout(() =>window.sfBlazorSB.dotnetRef.invokeMethodAsync('OnCompStylesLoaded'), 50);
}
else{
setTimeout(() =>window.sfBlazorSB.dotnetRef.invokeMethodAsync('RefreshRightPane'), 50);
}
}
function onCompScriptsLoaded(){
setTimeout(() =>window.sfBlazorSB.dotnetRef.invokeMethodAsync('OnCompScriptsLoaded'), 1000);
}
</script>
</body>
</html>