@panomc/theme-core 1.0.0-dev.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/bundle-internal-libs.js +104 -0
- package/bin/check.js +253 -0
- package/bin/generate-licenses.js +125 -0
- package/bin/generate-runtime-shims.js +180 -0
- package/bin/license/file-fingerprint.js +74 -0
- package/bin/license/finalize-fingerprint.js +72 -0
- package/bin/license/generate-license-constants.js +335 -0
- package/bin/new.js +281 -0
- package/bin/package-zip.js +57 -0
- package/bin/sync.js +326 -0
- package/bin/templates/app.html +59 -0
- package/bin/theme-core.js +103 -0
- package/package.json +77 -0
- package/src/index.js +15 -0
- package/src/kit/hooks-client.js +128 -0
- package/src/kit/hooks-server.js +319 -0
- package/src/kit/license-runtime.js +373 -0
- package/src/kit/resolve.js +71 -0
- package/src/kit/specifiers.js +62 -0
- package/src/kit/svelte-config.js +74 -0
- package/src/kit/vite-config.js +249 -0
- package/src/lib/NotificationManager.js +1 -0
- package/src/lib/PluginAPI.js +368 -0
- package/src/lib/PluginManager.js +1 -0
- package/src/lib/Store.js +43 -0
- package/src/lib/api.util.js +5 -0
- package/src/lib/auth.util.js +77 -0
- package/src/lib/components/App.svelte +10 -0
- package/src/lib/components/Breadcrumb.svelte +88 -0
- package/src/lib/components/CardHeader.svelte +42 -0
- package/src/lib/components/Date.svelte +34 -0
- package/src/lib/components/DefaultToast.svelte +11 -0
- package/src/lib/components/ErrorAlert.svelte +16 -0
- package/src/lib/components/Footer.svelte +223 -0
- package/src/lib/components/Header.svelte +122 -0
- package/src/lib/components/Hook.svelte +71 -0
- package/src/lib/components/LinkCodeInput.svelte +129 -0
- package/src/lib/components/LoginFormBody.svelte +90 -0
- package/src/lib/components/Main.svelte +76 -0
- package/src/lib/components/Navbar.svelte +462 -0
- package/src/lib/components/NoContent.svelte +14 -0
- package/src/lib/components/NotificationContainer.svelte +304 -0
- package/src/lib/components/OnlineAdmins.svelte +64 -0
- package/src/lib/components/PageActions.svelte +39 -0
- package/src/lib/components/PageTitle.svelte +36 -0
- package/src/lib/components/Pagination.svelte +65 -0
- package/src/lib/components/PlayerHead.svelte +58 -0
- package/src/lib/components/PlayerPermissionBadge.svelte +19 -0
- package/src/lib/components/PlayerStatusBadge.svelte +63 -0
- package/src/lib/components/Post.svelte +240 -0
- package/src/lib/components/Posts.svelte +19 -0
- package/src/lib/components/RegisterForm.svelte +125 -0
- package/src/lib/components/Sidebar.svelte +12 -0
- package/src/lib/components/SuccessAlert.svelte +14 -0
- package/src/lib/components/TicketRow.svelte +61 -0
- package/src/lib/components/TicketStatus.svelte +24 -0
- package/src/lib/components/Tickets.svelte +43 -0
- package/src/lib/components/Toast.svelte +13 -0
- package/src/lib/components/ToastContainer.svelte +83 -0
- package/src/lib/components/ViewComponent.svelte +8 -0
- package/src/lib/components/modals/CloseTicketConfirmModal.svelte +121 -0
- package/src/lib/components/modals/ConfirmRemoveAllNotificationsModal.svelte +93 -0
- package/src/lib/components/modals/LogoutSessionConfirmModal.svelte +61 -0
- package/src/lib/components/sidebars/HomeSidebar.svelte +333 -0
- package/src/lib/components/sidebars/PlayerDetailSidebar.svelte +124 -0
- package/src/lib/components/sidebars/ProfileSidebar.svelte +149 -0
- package/src/lib/components/sidebars/SupportSidebar.svelte +54 -0
- package/src/lib/components/sidebars/TicketCreateAndDetailSidebar.svelte +84 -0
- package/src/lib/csrf.js +5 -0
- package/src/lib/init.libs.js +2 -0
- package/src/lib/language.util.js +154 -0
- package/src/lib/layouts/AppLayout.svelte +59 -0
- package/src/lib/layouts/AuthLayout.svelte +29 -0
- package/src/lib/layouts/MainLayout.svelte +60 -0
- package/src/lib/layouts/ProfileLayout.svelte +29 -0
- package/src/lib/layouts/ThemeSettingsLayout.svelte +37 -0
- package/src/lib/layouts/TicketsLayout.svelte +31 -0
- package/src/lib/loginInput.util.js +4 -0
- package/src/lib/orderNavLinks.util.js +58 -0
- package/src/lib/pages/ActivateEmailPage.svelte +48 -0
- package/src/lib/pages/ConfirmNewEmailPage.svelte +48 -0
- package/src/lib/pages/ErrorPage.svelte +41 -0
- package/src/lib/pages/HomePage.svelte +35 -0
- package/src/lib/pages/LoginPage.svelte +448 -0
- package/src/lib/pages/NotificationsPage.svelte +70 -0
- package/src/lib/pages/PlayerDetailPage.svelte +29 -0
- package/src/lib/pages/PostDetailPage.svelte +36 -0
- package/src/lib/pages/PreviewPostPage.svelte +38 -0
- package/src/lib/pages/RegisterPage.svelte +144 -0
- package/src/lib/pages/RenewPasswordPage.svelte +49 -0
- package/src/lib/pages/ResetPasswordPage.svelte +55 -0
- package/src/lib/pages/RulesPage.svelte +52 -0
- package/src/lib/pages/SupportPage.svelte +36 -0
- package/src/lib/pages/ThemeSettingsPage.svelte +551 -0
- package/src/lib/pages/profile/ProfilePage.svelte +32 -0
- package/src/lib/pages/profile/SettingsPage.svelte +163 -0
- package/src/lib/pages/profile/TicketsPage.svelte +54 -0
- package/src/lib/pages/ticket/CreateTicketPage.svelte +48 -0
- package/src/lib/pages/ticket/TicketDetailPage.svelte +59 -0
- package/src/lib/services/auth.js +85 -0
- package/src/lib/services/posts.js +152 -0
- package/src/lib/services/profile.js +37 -0
- package/src/lib/services/theme-setting.js +22 -0
- package/src/lib/services/tickets.js +95 -0
- package/src/lib/siteRealtime.js +244 -0
- package/src/lib/string.util.js +27 -0
- package/src/lib/tooltip.util.js +5 -0
- package/src/lib/ui-logics/layout-logics/AppLayoutLogics.js +321 -0
- package/src/lib/ui-logics/layout-logics/AuthLayoutLogics.js +10 -0
- package/src/lib/ui-logics/layout-logics/MainLayoutLogics.js +19 -0
- package/src/lib/ui-logics/layout-logics/ProfileLayoutLogics.js +10 -0
- package/src/lib/ui-logics/layout-logics/ThemeSettingsLayoutLogics.js +215 -0
- package/src/lib/ui-logics/layout-logics/TicketsLayoutLogics.js +10 -0
- package/src/lib/ui-logics/page-logics/ActiveEmailPageLogics.js +45 -0
- package/src/lib/ui-logics/page-logics/ConfirmNewEmailPageLogics.js +42 -0
- package/src/lib/ui-logics/page-logics/CreateTicketPageLogics.js +83 -0
- package/src/lib/ui-logics/page-logics/HomePageLogics.js +65 -0
- package/src/lib/ui-logics/page-logics/NotificationsPageLogics.js +264 -0
- package/src/lib/ui-logics/page-logics/PlayerDetailPageLogics.js +40 -0
- package/src/lib/ui-logics/page-logics/PostDetailPageLogics.js +58 -0
- package/src/lib/ui-logics/page-logics/PreviewPostPageLogics.js +53 -0
- package/src/lib/ui-logics/page-logics/ProfilePageLogics.js +44 -0
- package/src/lib/ui-logics/page-logics/RenewPasswordPageLogics.js +44 -0
- package/src/lib/ui-logics/page-logics/ResetPasswordPageLogics.js +53 -0
- package/src/lib/ui-logics/page-logics/SettingsPageLogics.js +230 -0
- package/src/lib/ui-logics/page-logics/SupportPageLogics.js +60 -0
- package/src/lib/ui-logics/page-logics/TicketDetailPageLogics.js +160 -0
- package/src/lib/ui-logics/page-logics/TicketsPageLogics.js +132 -0
- package/src/lib/variables.js +1 -0
- package/src/lib/views/ActivateEmailView.svelte +71 -0
- package/src/lib/views/AppLayoutView.svelte +31 -0
- package/src/lib/views/AuthLayoutView.svelte +23 -0
- package/src/lib/views/ConfirmNewEmailView.svelte +71 -0
- package/src/lib/views/CreateTicketView.svelte +73 -0
- package/src/lib/views/ErrorView.svelte +38 -0
- package/src/lib/views/HomeView.svelte +72 -0
- package/src/lib/views/LoginView.svelte +372 -0
- package/src/lib/views/MainLayoutView.svelte +86 -0
- package/src/lib/views/NotificationsView.svelte +129 -0
- package/src/lib/views/PlayerDetailView.svelte +31 -0
- package/src/lib/views/PostDetailView.svelte +199 -0
- package/src/lib/views/PreviewPostView.svelte +151 -0
- package/src/lib/views/ProfileLayoutView.svelte +16 -0
- package/src/lib/views/ProfileView.svelte +68 -0
- package/src/lib/views/RegisterView.svelte +113 -0
- package/src/lib/views/RenewPasswordView.svelte +98 -0
- package/src/lib/views/ResetPasswordView.svelte +88 -0
- package/src/lib/views/RulesView.svelte +26 -0
- package/src/lib/views/SettingsView.svelte +471 -0
- package/src/lib/views/SupportView.svelte +79 -0
- package/src/lib/views/ThemeSettingsLayoutView.svelte +19 -0
- package/src/lib/views/ThemeSettingsView.svelte +1508 -0
- package/src/lib/views/TicketDetailView.svelte +185 -0
- package/src/lib/views/TicketsLayoutView.svelte +21 -0
- package/src/lib/views/TicketsView.svelte +87 -0
- package/src/plugin-engine/engine.js +484 -0
- package/src/registry/index.js +86 -0
- package/src/routes/RootLayout.svelte +21 -0
- package/src/routes/plugin-ui/Layout.svelte +291 -0
- package/src/routes/plugin-ui/Page.svelte +117 -0
- package/src/routes/plugin-ui/layout.js +8 -0
- package/src/routes/plugin-ui/page.js +8 -0
- package/src/routes/plugins-client-file.js +76 -0
- package/src/routes/root-layout-load.js +15 -0
- package/src/routes/theme-api-languages.js +52 -0
- package/src/routes/theme-api-licenses.js +28 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
<div class="toast-container position-fixed bottom-0 end-0 p-3 d-xl-block d-none">
|
|
2
|
+
{#each $notifications as notification, index (notification)}
|
|
3
|
+
<article
|
|
4
|
+
id="notificationToast{notification.id}"
|
|
5
|
+
class="toast position-relative"
|
|
6
|
+
aria-live="assertive"
|
|
7
|
+
aria-atomic="true">
|
|
8
|
+
|
|
9
|
+
<div class="toast-header text-bg-primary">
|
|
10
|
+
<strong class="me-auto">
|
|
11
|
+
{$_("components.notification-container.notification")}
|
|
12
|
+
</strong>
|
|
13
|
+
<small>
|
|
14
|
+
{getTime(
|
|
15
|
+
checkTime,
|
|
16
|
+
parseInt(notification.createdAt),
|
|
17
|
+
locales[$currentLanguage.dateFnsCode],
|
|
18
|
+
)}
|
|
19
|
+
</small>
|
|
20
|
+
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
class="btn-close btn-close-white position-relative z-3"
|
|
24
|
+
aria-label="{$_('buttons.close')}"
|
|
25
|
+
data-bs-dismiss="toast"
|
|
26
|
+
on:click|stopPropagation>
|
|
27
|
+
</button>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div class="toast-body">
|
|
31
|
+
<div
|
|
32
|
+
class="fw-normal list-group-item list-group-item-action d-flex align-items-center gap-3 text-wrap">
|
|
33
|
+
<button
|
|
34
|
+
type="button"
|
|
35
|
+
title={$_("buttons.view")}
|
|
36
|
+
on:click={() => onNotificationClick(notification)}
|
|
37
|
+
class="text-start border-0 bg-transparent p-0 d-flex align-items-center gap-3">
|
|
38
|
+
|
|
39
|
+
<span class="d-flex align-items-center">
|
|
40
|
+
{#if notification.details.faIcon}
|
|
41
|
+
<i class="{notification.details.faIcon} fa-fw"></i>
|
|
42
|
+
{:else if notification.details.image || notification.details.username}
|
|
43
|
+
<img
|
|
44
|
+
src="{notification.details.image || `/api/profile/picture/${notification.details.username}?${$avatarVersion}`}"
|
|
45
|
+
alt="{$_('buttons.view')}"
|
|
46
|
+
width="48"
|
|
47
|
+
height="48"
|
|
48
|
+
class="rounded" />
|
|
49
|
+
{:else}
|
|
50
|
+
<i class="fa fa-fw fa-bolt"></i>
|
|
51
|
+
{/if}
|
|
52
|
+
</span>
|
|
53
|
+
|
|
54
|
+
<span class="text-start">
|
|
55
|
+
<span class="text-wrap markdown-renderer text-break">
|
|
56
|
+
{@html $_('notifications.' + notification.type, {
|
|
57
|
+
values: { ...sanitizeObject(notification.details || {}) }
|
|
58
|
+
})}
|
|
59
|
+
</span>
|
|
60
|
+
</span>
|
|
61
|
+
</button>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<!-- Invisible button covering whole area without creating spacing -->
|
|
66
|
+
<button
|
|
67
|
+
type="button"
|
|
68
|
+
class="stretched-link p-0 border-0 bg-transparent position-absolute top-0 start-0 w-100 h-100"
|
|
69
|
+
aria-label={$_("buttons.view")}
|
|
70
|
+
on:click={() => onClick(notification)}>
|
|
71
|
+
</button>
|
|
72
|
+
</article>
|
|
73
|
+
|
|
74
|
+
{/each}
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<script context="module">
|
|
78
|
+
import { tick } from "svelte";
|
|
79
|
+
import { get, writable } from "svelte/store";
|
|
80
|
+
|
|
81
|
+
const notifications = writable([]);
|
|
82
|
+
const notificationToasts = writable({});
|
|
83
|
+
|
|
84
|
+
Array.prototype.insert = function (index, item) {
|
|
85
|
+
this.splice(index, 0, item);
|
|
86
|
+
|
|
87
|
+
return this;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
Array.prototype.remove = function (index) {
|
|
91
|
+
this.splice(index, 1);
|
|
92
|
+
|
|
93
|
+
return this;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
function delay(time) {
|
|
97
|
+
return new Promise((resolve) => setTimeout(resolve, time));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function deleteFromNotifications(id) {
|
|
101
|
+
notifications.update((notifications) => {
|
|
102
|
+
const foundNotification = notifications.find(
|
|
103
|
+
(notification) => notification.id === id
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
notifications.remove(notifications.indexOf(foundNotification));
|
|
107
|
+
delete notificationToasts[id];
|
|
108
|
+
|
|
109
|
+
return notifications;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export async function show(id) {
|
|
114
|
+
await tick();
|
|
115
|
+
|
|
116
|
+
const notificationElement = document.getElementById(
|
|
117
|
+
"notificationToast" + id
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
if (notificationElement) {
|
|
121
|
+
const toast = new window.bootstrap.Toast(notificationElement);
|
|
122
|
+
|
|
123
|
+
notificationToasts[id] = toast;
|
|
124
|
+
|
|
125
|
+
toast.show();
|
|
126
|
+
|
|
127
|
+
notificationElement.addEventListener("hidden.bs.toast", () => {
|
|
128
|
+
deleteFromNotifications(id);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export async function hide(id) {
|
|
134
|
+
notificationToasts[id].hide();
|
|
135
|
+
deleteFromNotifications(id);
|
|
136
|
+
}
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
<script>
|
|
140
|
+
import { getContext, onDestroy, onMount } from "svelte";
|
|
141
|
+
import { formatDistanceToNow } from "date-fns";
|
|
142
|
+
import { sanitize } from "@jill64/universal-sanitizer";
|
|
143
|
+
import { _ } from "svelte-i18n";
|
|
144
|
+
|
|
145
|
+
import { browser } from "$app/environment";
|
|
146
|
+
|
|
147
|
+
import { notificationsCount, quickNotifications, avatarVersion } from "$pano/lib/Store";
|
|
148
|
+
import { onNotificationRefresh, setSiteNotificationsSubscription } from "$pano/lib/siteRealtime.js";
|
|
149
|
+
import ApiUtil from "$pano/lib/api.util";
|
|
150
|
+
import { onNotificationClick } from "$pano/lib/NotificationManager.js";
|
|
151
|
+
import * as locales from "date-fns/locale";
|
|
152
|
+
import { currentLanguage } from "$pano/lib/language.util.js";
|
|
153
|
+
|
|
154
|
+
let quickNotificationProcessID = 0;
|
|
155
|
+
|
|
156
|
+
let checkTime = 0;
|
|
157
|
+
let interval;
|
|
158
|
+
let mounted = false;
|
|
159
|
+
let unsubRefresh = () => {};
|
|
160
|
+
|
|
161
|
+
const session = getContext("session");
|
|
162
|
+
|
|
163
|
+
function getTime(check, time, locale) {
|
|
164
|
+
return formatDistanceToNow(time, { addSuffix: true, locale });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function addNotification(notification) {
|
|
168
|
+
notifications.update((notifications) => {
|
|
169
|
+
notifications.push(notification);
|
|
170
|
+
|
|
171
|
+
return notifications;
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
show(notification.id);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function setNotifications(newNotifications) {
|
|
178
|
+
if (get(quickNotifications).length === 0 || newNotifications.length === 0) {
|
|
179
|
+
quickNotifications.set(newNotifications);
|
|
180
|
+
|
|
181
|
+
newNotifications.forEach((notification) => {
|
|
182
|
+
if (notification.status === "NOT_READ") {
|
|
183
|
+
addNotification(notification);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const listOfFilterIsNotificationExists = [];
|
|
191
|
+
|
|
192
|
+
newNotifications.forEach((item, index) => {
|
|
193
|
+
listOfFilterIsNotificationExists[index] = get(quickNotifications).filter(
|
|
194
|
+
(filterItem) => filterItem.id === item.id
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
newNotifications.forEach((item, index) => {
|
|
199
|
+
if (listOfFilterIsNotificationExists[index].length === 0) {
|
|
200
|
+
quickNotifications.update((quickNotifications) => {
|
|
201
|
+
return quickNotifications.insert(index, item);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
addNotification(item);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
get(quickNotifications).forEach((item, index) => {
|
|
209
|
+
const newArrayOfFilter = newNotifications.filter(
|
|
210
|
+
(filterItem) => filterItem.id === item.id
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
if (newArrayOfFilter.length === 0) {
|
|
214
|
+
quickNotifications.update((quickNotifications) => {
|
|
215
|
+
return quickNotifications.remove(index);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function delay(time) {
|
|
222
|
+
return new Promise((resolve) => setTimeout(resolve, time));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async function getQuickNotifications(id) {
|
|
226
|
+
await delay();
|
|
227
|
+
|
|
228
|
+
ApiUtil.get({
|
|
229
|
+
path: "/api/notifications/quick",
|
|
230
|
+
}).then((body) => {
|
|
231
|
+
if (quickNotificationProcessID === id) {
|
|
232
|
+
if (body.result === "ok") {
|
|
233
|
+
setNotifications(body.notifications);
|
|
234
|
+
|
|
235
|
+
notificationsCount.set(body.notificationCount);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function startQuickNotificationsCountDown() {
|
|
242
|
+
quickNotificationProcessID++;
|
|
243
|
+
|
|
244
|
+
const id = quickNotificationProcessID;
|
|
245
|
+
|
|
246
|
+
getQuickNotifications(id);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (browser) {
|
|
250
|
+
const sessionSubscription = session.subscribe((session) => {
|
|
251
|
+
quickNotificationProcessID++;
|
|
252
|
+
if (mounted && session.user) {
|
|
253
|
+
setSiteNotificationsSubscription(true);
|
|
254
|
+
startQuickNotificationsCountDown();
|
|
255
|
+
} else {
|
|
256
|
+
setSiteNotificationsSubscription(false);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
onDestroy(sessionSubscription);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function markRead(id) {
|
|
264
|
+
ApiUtil.post({
|
|
265
|
+
path: `/api/notifications/${id}/read`,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function onClick(notification) {
|
|
270
|
+
markRead(notification.id);
|
|
271
|
+
onNotificationClick(notification);
|
|
272
|
+
hide(notification.id);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
onMount(() => {
|
|
276
|
+
mounted = true;
|
|
277
|
+
unsubRefresh = onNotificationRefresh(() => {
|
|
278
|
+
if (get(session).user) {
|
|
279
|
+
startQuickNotificationsCountDown();
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
if ($session.user) {
|
|
283
|
+
setSiteNotificationsSubscription(true);
|
|
284
|
+
startQuickNotificationsCountDown();
|
|
285
|
+
}
|
|
286
|
+
interval = setInterval(() => {
|
|
287
|
+
checkTime += 1;
|
|
288
|
+
}, 1000);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
onDestroy(() => {
|
|
292
|
+
quickNotificationProcessID++;
|
|
293
|
+
setSiteNotificationsSubscription(false);
|
|
294
|
+
unsubRefresh();
|
|
295
|
+
clearInterval(interval);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
function sanitizeObject(obj) {
|
|
299
|
+
return Object.keys(obj).reduce((sanitizedObj, key) => {
|
|
300
|
+
sanitizedObj[key] = sanitize(obj[key]);
|
|
301
|
+
return sanitizedObj;
|
|
302
|
+
}, {});
|
|
303
|
+
}
|
|
304
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!-- Online Admins Card -->
|
|
2
|
+
<div
|
|
3
|
+
class="card h-100 mb-3 mb-lg-0"
|
|
4
|
+
hidden={typeof themeSettings.sidebarCarts?.onlineAdmins === "undefined"
|
|
5
|
+
? false
|
|
6
|
+
: !themeSettings.sidebarCarts.onlineAdmins}>
|
|
7
|
+
<CardHeader headerClasses="bg-transparent">
|
|
8
|
+
<div slot="left">{$_("components.online-admins.online-admins")}</div>
|
|
9
|
+
</CardHeader>
|
|
10
|
+
<div class="card-body pt-3 d-flex flex-column justify-content-start">
|
|
11
|
+
{#if onlineAdmins && onlineAdmins.length > 0}
|
|
12
|
+
<div class="row g-3 justify-content-evenly align-items-start align-content-start">
|
|
13
|
+
{#each onlineAdmins as onlineAdmin, index (onlineAdmin)}
|
|
14
|
+
<div class="col-auto">
|
|
15
|
+
<a
|
|
16
|
+
href="/player/{onlineAdmin}"
|
|
17
|
+
class="online-admin-link focus-ring rounded position-relative d-inline-block">
|
|
18
|
+
<img
|
|
19
|
+
src="/api/profile/picture/{onlineAdmin}?{$avatarVersion}"
|
|
20
|
+
class="online-admin-avatar rounded border border-3 border-success"
|
|
21
|
+
alt={onlineAdmin}
|
|
22
|
+
use:tooltip={[
|
|
23
|
+
$_("components.player-head.in-website"),
|
|
24
|
+
{ placement: "bottom" },
|
|
25
|
+
]} />
|
|
26
|
+
</a>
|
|
27
|
+
</div>
|
|
28
|
+
{/each}
|
|
29
|
+
</div>
|
|
30
|
+
{:else}
|
|
31
|
+
<NoContent />
|
|
32
|
+
{/if}
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<!-- Online Admins Card End -->
|
|
37
|
+
<script>
|
|
38
|
+
import { _ } from "svelte-i18n";
|
|
39
|
+
import { avatarVersion } from "$pano/lib/Store";
|
|
40
|
+
import tooltip from "$pano/lib/tooltip.util";
|
|
41
|
+
import { getContext } from "svelte";
|
|
42
|
+
import NoContent from "./NoContent.svelte";
|
|
43
|
+
import CardHeader from "./CardHeader.svelte";
|
|
44
|
+
|
|
45
|
+
export let onlineAdmins;
|
|
46
|
+
|
|
47
|
+
const themeSettings = getContext("themeSettings");
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<style>
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
.online-admin-link {
|
|
54
|
+
display: block;
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.online-admin-avatar {
|
|
59
|
+
display: block;
|
|
60
|
+
width: 48px;
|
|
61
|
+
height: 48px;
|
|
62
|
+
object-fit: cover;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
/* Robust centering for scrollable flex containers */
|
|
3
|
+
.scroll-center::before,
|
|
4
|
+
.scroll-center::after {
|
|
5
|
+
content: "";
|
|
6
|
+
margin: auto;
|
|
7
|
+
}
|
|
8
|
+
</style>
|
|
9
|
+
|
|
10
|
+
<div
|
|
11
|
+
class="row d-flex align-items-center gy-3 justify-content-lg-between justify-content-center">
|
|
12
|
+
{#if (leftClasses !== null && $$slots.left) || (leftClasses !== null && leftClasses !== undefined)}
|
|
13
|
+
<div
|
|
14
|
+
class="col-lg-auto col-12 d-flex justify-content-lg-start overflow-x-auto scroll-center {leftClasses ||
|
|
15
|
+
''}">
|
|
16
|
+
<slot name="left" />
|
|
17
|
+
</div>
|
|
18
|
+
{/if}
|
|
19
|
+
{#if (middleClasses !== null && $$slots.middle) || (middleClasses !== null && middleClasses !== undefined)}
|
|
20
|
+
<div
|
|
21
|
+
class="col-lg-auto col-12 order-lg-2 order-last d-flex justify-content-center overflow-x-auto scroll-center {middleClasses ||
|
|
22
|
+
''}">
|
|
23
|
+
<slot name="middle" />
|
|
24
|
+
</div>
|
|
25
|
+
{/if}
|
|
26
|
+
{#if (rightClasses !== null && $$slots.right) || (rightClasses !== null && rightClasses !== undefined)}
|
|
27
|
+
<div
|
|
28
|
+
class="col-lg-auto col-12 order-3 d-flex justify-content-lg-end overflow-x-auto scroll-center {rightClasses ||
|
|
29
|
+
''}">
|
|
30
|
+
<slot name="right" />
|
|
31
|
+
</div>
|
|
32
|
+
{/if}
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
export let leftClasses = undefined;
|
|
37
|
+
export let middleClasses = undefined;
|
|
38
|
+
export let rightClasses = undefined;
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { getContext } from "svelte";
|
|
3
|
+
|
|
4
|
+
export let title = "";
|
|
5
|
+
export let subtitle = "";
|
|
6
|
+
export let html;
|
|
7
|
+
export let subtitleHtml = false;
|
|
8
|
+
|
|
9
|
+
const themeSettings = getContext("themeSettings");
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
{#if title || subtitle}
|
|
13
|
+
<div class="text-center animate__animated animate__fadeIn">
|
|
14
|
+
<h1 class="fs-3 mb-0 text-break word-break">
|
|
15
|
+
<slot name="title">
|
|
16
|
+
{#if title}
|
|
17
|
+
{#if html}
|
|
18
|
+
{@html title}
|
|
19
|
+
{:else}
|
|
20
|
+
{title}
|
|
21
|
+
{/if}
|
|
22
|
+
{/if}
|
|
23
|
+
</slot>
|
|
24
|
+
</h1>
|
|
25
|
+
{#if subtitle}
|
|
26
|
+
<p class="mb-0 mt-2 opacity-75">
|
|
27
|
+
{#if subtitleHtml}
|
|
28
|
+
{@html subtitle}
|
|
29
|
+
{:else}
|
|
30
|
+
{subtitle}
|
|
31
|
+
{/if}
|
|
32
|
+
</p>
|
|
33
|
+
{/if}
|
|
34
|
+
<slot />
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<nav>
|
|
2
|
+
<ul class="pagination pagination-sm mb-0 justify-content-start flex-wrap">
|
|
3
|
+
<li class="page-item" class:disabled={parseInt(page) === 1}>
|
|
4
|
+
<button
|
|
5
|
+
type="button"
|
|
6
|
+
class="page-link"
|
|
7
|
+
title={$_("components.pagination.previous-page")}
|
|
8
|
+
onclick={onFirstPageClick}
|
|
9
|
+
aria-hidden={parseInt(page) === 1}>
|
|
10
|
+
<i class="fa-solid fa-caret-left"></i>
|
|
11
|
+
</button>
|
|
12
|
+
</li>
|
|
13
|
+
|
|
14
|
+
{#each pages as index}
|
|
15
|
+
<li
|
|
16
|
+
class="page-item"
|
|
17
|
+
class:active={parseInt(page) === index}
|
|
18
|
+
aria-current={parseInt(page) === index ? "page" : ""}>
|
|
19
|
+
<button
|
|
20
|
+
type="button"
|
|
21
|
+
class="page-link"
|
|
22
|
+
onclick={() => onPageLinkClick(index)}
|
|
23
|
+
aria-hidden={parseInt(page) === index}>
|
|
24
|
+
{index}
|
|
25
|
+
</button>
|
|
26
|
+
</li>
|
|
27
|
+
{/each}
|
|
28
|
+
|
|
29
|
+
<li class="page-item" class:disabled={parseInt(page) === totalPage}>
|
|
30
|
+
<button
|
|
31
|
+
type="button"
|
|
32
|
+
class="page-link"
|
|
33
|
+
title={$_("components.pagination.next-page")}
|
|
34
|
+
onclick={onLastPageClick}
|
|
35
|
+
aria-hidden={parseInt(page) === totalPage}>
|
|
36
|
+
<i class="fa-solid fa-caret-right"></i>
|
|
37
|
+
</button>
|
|
38
|
+
</li>
|
|
39
|
+
</ul>
|
|
40
|
+
</nav>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import { createEventDispatcher } from "svelte";
|
|
44
|
+
import { _ } from "svelte-i18n";
|
|
45
|
+
|
|
46
|
+
const dispatch = createEventDispatcher();
|
|
47
|
+
|
|
48
|
+
let { page = 1, totalPage = 1 } = $props();
|
|
49
|
+
|
|
50
|
+
const pages = $derived(Array.from({ length: totalPage }, (_, i) => i + 1));
|
|
51
|
+
|
|
52
|
+
function onFirstPageClick() {
|
|
53
|
+
dispatch("firstPageClick", {});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function onLastPageClick() {
|
|
57
|
+
dispatch("lastPageClick", {});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function onPageLinkClick(index) {
|
|
61
|
+
dispatch("pageLinkClick", {
|
|
62
|
+
page: index,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{#if lastActivityTime}
|
|
2
|
+
<img
|
|
3
|
+
src="/api/profile/picture/{username}?{$avatarVersion}"
|
|
4
|
+
class="img-thumbnail rounded d-block m-auto"
|
|
5
|
+
width="{width}"
|
|
6
|
+
height="{height}"
|
|
7
|
+
alt="{username}"
|
|
8
|
+
class:border="{banned ||isOnline}"
|
|
9
|
+
class:border-3="{banned || isOnline}"
|
|
10
|
+
class:border-success="{!banned && isOnline}"
|
|
11
|
+
class:border-danger="{banned}"
|
|
12
|
+
use:tooltip="{!banned && [
|
|
13
|
+
isOnline
|
|
14
|
+
? $_('components.player-head.' + (inGame ? 'in-game' : 'in-website'))
|
|
15
|
+
: getOfflineRelativeDateText(checkTime),
|
|
16
|
+
{ placement: 'right' },
|
|
17
|
+
]}" />
|
|
18
|
+
{:else}
|
|
19
|
+
<img
|
|
20
|
+
src="/api/profile/picture/{username}?{$avatarVersion}"
|
|
21
|
+
class="rounded d-block m-auto"
|
|
22
|
+
width="{width}"
|
|
23
|
+
height="{height}"
|
|
24
|
+
alt="{username}"
|
|
25
|
+
class:border="{banned}"
|
|
26
|
+
class:border-3="{banned}"
|
|
27
|
+
class:border-danger="{banned}" />
|
|
28
|
+
{/if}
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
import tooltip from "$pano/lib/tooltip.util";
|
|
32
|
+
import { formatRelative } from "date-fns";
|
|
33
|
+
import * as locales from "date-fns/locale";
|
|
34
|
+
import { currentLanguage } from "$pano/lib/language.util.js";
|
|
35
|
+
|
|
36
|
+
import { _ } from "svelte-i18n";
|
|
37
|
+
import { avatarVersion } from "$pano/lib/Store";
|
|
38
|
+
|
|
39
|
+
export let username;
|
|
40
|
+
export let width = 64;
|
|
41
|
+
export let height = 64;
|
|
42
|
+
export let checkTime;
|
|
43
|
+
export let inGame = false;
|
|
44
|
+
export let lastActivityTime;
|
|
45
|
+
export let banned;
|
|
46
|
+
|
|
47
|
+
$: isOnline = lastActivityTime > Date.now() - 5 * 60 * 1000 || inGame;
|
|
48
|
+
|
|
49
|
+
function getOfflineRelativeDateText(checkTime) {
|
|
50
|
+
return formatRelative(new Date(parseInt(lastActivityTime)), new Date(), {
|
|
51
|
+
locale: locales[$currentLanguage.dateFnsCode]
|
|
52
|
+
}).capitalize();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
String.prototype.capitalize = function () {
|
|
56
|
+
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
57
|
+
};
|
|
58
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<span class="badge rounded-pill text-bg-secondary">
|
|
2
|
+
{#if permissionGroupName}
|
|
3
|
+
{permissionGroupName.capitalize()}
|
|
4
|
+
{:else}
|
|
5
|
+
{$_("components.player-permission-badge.player")}
|
|
6
|
+
{/if}
|
|
7
|
+
</span>
|
|
8
|
+
|
|
9
|
+
<script context="module">
|
|
10
|
+
String.prototype.capitalize = function () {
|
|
11
|
+
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
12
|
+
};
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import { _ } from "svelte-i18n";
|
|
17
|
+
|
|
18
|
+
export let permissionGroupName;
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{#if banned}
|
|
2
|
+
<div class="badge rounded-pill text-bg-danger">
|
|
3
|
+
<i class="fa-solid fa-hammer me-1"></i>
|
|
4
|
+
{$_("components.player-status-badge.banned")}
|
|
5
|
+
</div>
|
|
6
|
+
{:else if isOnline}
|
|
7
|
+
<div
|
|
8
|
+
class="badge rounded-pill text-bg-success"
|
|
9
|
+
use:tooltip={[
|
|
10
|
+
(inGame
|
|
11
|
+
? $_("components.player-status-badge.in-game")
|
|
12
|
+
: $_("components.player-status-badge.in-website")) +
|
|
13
|
+
" " +
|
|
14
|
+
$_("components.player-status-badge.online"),
|
|
15
|
+
{ placement: "bottom" },
|
|
16
|
+
]}>
|
|
17
|
+
<span>
|
|
18
|
+
{#if inGame}
|
|
19
|
+
<i class="fa-solid fa-gamepad me-1"></i>
|
|
20
|
+
{:else}
|
|
21
|
+
<i class="fa-solid fa-globe me-1"></i>
|
|
22
|
+
{/if}
|
|
23
|
+
{$_("components.player-status-badge.online")}
|
|
24
|
+
</span>
|
|
25
|
+
</div>
|
|
26
|
+
{:else}
|
|
27
|
+
<div
|
|
28
|
+
class="badge rounded-pill text-bg-primary"
|
|
29
|
+
use:tooltip={[
|
|
30
|
+
getOfflineRelativeDateText(checkTime),
|
|
31
|
+
{ placement: "bottom" },
|
|
32
|
+
]}>
|
|
33
|
+
<span>{$_("components.player-status-badge.offline")}</span>
|
|
34
|
+
</div>
|
|
35
|
+
{/if}
|
|
36
|
+
|
|
37
|
+
<script context="module">
|
|
38
|
+
String.prototype.capitalize = function () {
|
|
39
|
+
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
import { formatRelative } from "date-fns";
|
|
45
|
+
|
|
46
|
+
import tooltip from "$pano/lib/tooltip.util.js";
|
|
47
|
+
import { _ } from "svelte-i18n";
|
|
48
|
+
|
|
49
|
+
export let banned = false;
|
|
50
|
+
export let lastActivityTime = 0;
|
|
51
|
+
export let inGame = false;
|
|
52
|
+
export let checkTime = 0;
|
|
53
|
+
|
|
54
|
+
$: isOnline = lastActivityTime > Date.now() - 5 * 60 * 1000 || inGame;
|
|
55
|
+
|
|
56
|
+
function getOfflineRelativeDateText(checkTime) {
|
|
57
|
+
if (!lastActivityTime) return $_("components.player-status-badge.offline");
|
|
58
|
+
return formatRelative(
|
|
59
|
+
new Date(parseInt(lastActivityTime)),
|
|
60
|
+
new Date(),
|
|
61
|
+
).capitalize();
|
|
62
|
+
}
|
|
63
|
+
</script>
|