@panomc/theme-core 1.0.0-dev.62 → 1.0.0-dev.63

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.
@@ -1,8 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 186.05 279.07">
2
- <defs>
3
- <style>.a,.b{fill:#fff;}.a{opacity:0.7;}</style>
4
- </defs>
5
- <path class="a" d="M0,232.56v16.51a30,30,0,0,0,30,30H63a30,30,0,0,0,30-30V186H46.51S0,186,0,232.56Z"/>
6
- <path class="b"
7
- d="M156,0H30A30,30,0,0,0,0,30V232.56C0,186,46.51,186,46.51,186H156a30,30,0,0,0,30-30V30A30,30,0,0,0,156,0Z"/>
8
- </svg>
1
+ <svg width="128" xmlns="http://www.w3.org/2000/svg" height="128" id="screenshot-ee3e5d8f-3c83-8056-8008-1a9e394be899" viewBox="558 -739 128 128" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1"><g id="shape-ee3e5d8f-3c83-8056-8008-1a9e394be899"><g class="fills" id="fills-ee3e5d8f-3c83-8056-8008-1a9e394be899"><path d="M558,-698.0399780273438C558,-720.6464233398438,576.3535766601562,-739,598.9600219726562,-739L645.0399780273438,-739C667.6464233398438,-739,686,-720.6464233398438,686,-698.0399780273438L686,-692.9199829101562C686,-647.7070922851562,649.2929077148438,-611,604.0800170898438,-611L598.9600219726562,-611C576.3535766601562,-611,558,-629.3535766601562,558,-651.9600219726562L558,-698.0399780273438" style="fill: rgb(255, 255, 255); fill-opacity: 1;"/></g></g></svg>
package/bin/sync.js CHANGED
@@ -222,7 +222,7 @@ export { load } from "$pano/routes/root-layout-load.js";
222
222
  ...pagePair("(theme)/post/[url]", "PostDetailPage", "PostDetailPage.svelte"),
223
223
  // The posts feed is always reachable here, whatever the admin picked as the home page (doc 01 section 9).
224
224
  ...pagePair("(theme)/posts", "Home", "HomePage.svelte"),
225
- ...pagePair("(theme)/preview/post/[id]", "PreviewPostPage", "PreviewPostPage.svelte", 'post="{data.post}"'),
225
+ ...pagePair("(theme)/preview/post/[id]", "PreviewPostPage", "PreviewPostPage.svelte", '{data} post="{data.post}"'),
226
226
  ...layoutPair("(theme)/profile", "ProfileLayout", "ProfileLayout.svelte"),
227
227
  ...pagePair("(theme)/profile", "ProfilePage", "profile/ProfilePage.svelte"),
228
228
  ...pagePair("(theme)/profile/settings", "SettingsPage", "profile/SettingsPage.svelte"),
package/lang/en-US.json CHANGED
@@ -64,7 +64,8 @@
64
64
  }
65
65
  },
66
66
  "toasts": {
67
- "session-logged-out-successful": "Session logged out successfully!"
67
+ "session-logged-out-successful": "Session logged out successfully!",
68
+ "ticket-created": "Support ticket created."
68
69
  },
69
70
  "components": {
70
71
  "toasts": {
@@ -467,6 +468,7 @@
467
468
  "CANT_CHANGE_EMAIL_WAIT_15_MINUTES": "Can't change email, wait 15 minutes.",
468
469
  "CANT_RESET_PASSWORD_WAIT5MINUTES": "Can't reset password, wait 5 minutes.",
469
470
  "CATEGORY_NOT_EXISTS": "This category is not found!",
471
+ "TICKET_CATEGORY_REQUIRED": "Pick a category to open a ticket.",
470
472
  "CURRENT_PASSWORD_NOT_CORRECT": "Current password is not correct!",
471
473
  "INVALID_DATA": "Invalid data!",
472
474
  "INVALID_EMAIL": "Invalid e-mail!",
package/lang/ru.json CHANGED
@@ -64,7 +64,8 @@
64
64
  }
65
65
  },
66
66
  "toasts": {
67
- "session-logged-out-successful": "Сеанс успешно завершен!"
67
+ "session-logged-out-successful": "Сеанс успешно завершен!",
68
+ "ticket-created": "Тикет поддержки создан."
68
69
  },
69
70
  "components": {
70
71
  "toasts": {
@@ -467,6 +468,7 @@
467
468
  "CANT_CHANGE_EMAIL_WAIT_15_MINUTES": "Нельзя сменить почту, подождите 15 минут.",
468
469
  "CANT_RESET_PASSWORD_WAIT5MINUTES": "Нельзя сбросить пароль, подождите 5 минут.",
469
470
  "CATEGORY_NOT_EXISTS": "Эта категория не найдена!",
471
+ "TICKET_CATEGORY_REQUIRED": "Выберите категорию, чтобы создать тикет.",
470
472
  "CURRENT_PASSWORD_NOT_CORRECT": "Текущий пароль неверен!",
471
473
  "INVALID_DATA": "Неверные данные!",
472
474
  "INVALID_EMAIL": "Неверный e-mail!",
package/lang/tr.json CHANGED
@@ -64,7 +64,8 @@
64
64
  }
65
65
  },
66
66
  "toasts": {
67
- "session-logged-out-successful": "Oturum başarıyla kapatıldı!"
67
+ "session-logged-out-successful": "Oturum başarıyla kapatıldı!",
68
+ "ticket-created": "Destek talebi oluşturuldu."
68
69
  },
69
70
  "components": {
70
71
  "toasts": {
@@ -467,6 +468,7 @@
467
468
  "CANT_CHANGE_EMAIL_WAIT_15_MINUTES": "E-posta değiştirilemez, 15 dakika bekleyin.",
468
469
  "CANT_RESET_PASSWORD_WAIT5MINUTES": "Şifre sıfırlanamaz, 5 dakika bekleyin.",
469
470
  "CATEGORY_NOT_EXISTS": "Bu kategori bulunamadı!",
471
+ "TICKET_CATEGORY_REQUIRED": "Destek talebi açmak için bir kategori seçin.",
470
472
  "CURRENT_PASSWORD_NOT_CORRECT": "Mevcut şifre doğru değil!",
471
473
  "INVALID_DATA": "Geçersiz veri!",
472
474
  "INVALID_EMAIL": "Geçersiz e-posta!",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panomc/theme-core",
3
- "version": "1.0.0-dev.62",
3
+ "version": "1.0.0-dev.63",
4
4
  "description": "The Pano theme engine: hooks factories, plugin engine, headless page controllers, default views and the theme CLI. Themes depend on this package instead of forking vanilla-theme.",
5
5
  "author": "PanoMC",
6
6
  "pano": {
@@ -61,7 +61,7 @@
61
61
  "@fortawesome/fontawesome-free": "^6.7.2"
62
62
  },
63
63
  "peerDependencies": {
64
- "@panomc/sdk": "^2.0.0-dev.62",
64
+ "@panomc/sdk": "^2.0.0-dev.63",
65
65
  "@sveltejs/adapter-node": "^5.5.4",
66
66
  "@sveltejs/kit": "^2.57.1",
67
67
  "@sveltejs/vite-plugin-svelte": "^7.0.0",
@@ -71,7 +71,7 @@
71
71
  "vite": "^8.0.9"
72
72
  },
73
73
  "devDependencies": {
74
- "@panomc/sdk": "2.0.0-dev.62",
74
+ "@panomc/sdk": "2.0.0-dev.63",
75
75
  "@sveltejs/adapter-node": "^5.5.4",
76
76
  "@sveltejs/kit": "^2.57.1",
77
77
  "@sveltejs/vite-plugin-svelte": "^7.0.0",
@@ -398,7 +398,7 @@
398
398
  "TicketDetailView": {
399
399
  "contract": 1,
400
400
  "source": "src/lib/views/TicketDetailView.svelte",
401
- "uses": ["Date", "PageTitle", "TicketStatus"],
401
+ "uses": ["Date", "TicketStatus"],
402
402
  "hooks": [],
403
403
  "slotProps": {},
404
404
  "props": {
@@ -1060,7 +1060,7 @@
1060
1060
  },
1061
1061
  "ProfileSidebar": {
1062
1062
  "kind": "component",
1063
- "contract": 1,
1063
+ "contract": 2,
1064
1064
  "source": "src/lib/views/parts/ProfileSidebar.svelte",
1065
1065
  "uses": ["PageTitle", "PlayerHead", "Sidebar"],
1066
1066
  "hooks": [],
@@ -1069,6 +1069,7 @@
1069
1069
  "side": "\"left\" | \"right\" - which side of the content the column sits on",
1070
1070
  "showDeleteAll": "boolean - show the \"delete all notifications\" button (default false)",
1071
1071
  "onDeleteAllClick": "function() - opens the confirmation for deleting all notifications",
1072
+ "showCreateTicket": "boolean - show the \"create support ticket\" button of the tickets page (default false)",
1072
1073
  "items": "store of { id, component, props } - the sidebar items, plugin items included (an id the markup does not know is rendered with <ViewComponent>, the place plugins inject)",
1073
1074
  "data": "store - { lastActivityTime, inGame, permissionGroupName, isBanned } of the signed-in user",
1074
1075
  "user": "object - the signed-in user ({} for a visitor)",
@@ -1076,8 +1077,8 @@
1076
1077
  "navEntries": "array - { id, href, text, icon, badge, active } of the profile navigation (hrefs already go through route())"
1077
1078
  },
1078
1079
  "locked": {
1079
- "contract": 1,
1080
- "props": ["checkTime", "data", "items", "navEntries", "onDeleteAllClick", "showDeleteAll", "side", "user"]
1080
+ "contract": 2,
1081
+ "props": ["checkTime", "data", "items", "navEntries", "onDeleteAllClick", "showCreateTicket", "showDeleteAll", "side", "user"]
1081
1082
  }
1082
1083
  },
1083
1084
  "SupportSidebar": {
@@ -48,13 +48,17 @@ describe("engine sidebars: files and contract (FX-05)", () => {
48
48
  expect(read(lib, "components", "sidebars", "TicketCreateAndDetailSidebar.svelte")).toMatch(/export const update = /);
49
49
  });
50
50
 
51
- test("skin-contract lists the five cards as component views of contract 1 with their props", () => {
51
+ // ProfileSidebar is at contract 2 since it got `showCreateTicket` (the tickets page's button).
52
+ const CONTRACTS = { ProfileSidebar: 2 };
53
+ const contractOf = (name) => CONTRACTS[name] ?? 1;
54
+
55
+ test("skin-contract lists the five cards as component views with their contract and props", () => {
52
56
  const contract = JSON.parse(read(pkg, "skin-contract.json"));
53
57
  for (const name of SIDEBARS) {
54
58
  const entry = contract.views[name];
55
59
  expect(entry).toBeDefined();
56
60
  expect(entry.kind).toBe("component");
57
- expect(entry.contract).toBe(1);
61
+ expect(entry.contract).toBe(contractOf(name));
58
62
  expect(entry.source).toBe(`src/lib/views/parts/${name}.svelte`);
59
63
 
60
64
  // every `export let` of the part is listed, and nothing else
@@ -69,7 +73,7 @@ describe("engine sidebars: files and contract (FX-05)", () => {
69
73
 
70
74
  test("the generated engine table registers the five parts as defaults", () => {
71
75
  const table = read(lib, "views", "parts", "engine-views.generated.js");
72
- for (const name of SIDEBARS) expect(table).toContain(`"${name}": { contract: 1, component: () => import("./${name}.svelte")`);
76
+ for (const name of SIDEBARS) expect(table).toContain(`"${name}": { contract: ${contractOf(name)}, component: () => import("./${name}.svelte")`);
73
77
  });
74
78
 
75
79
  test("no literal href=\"/...\" is left in the engine components or the parts", () => {
@@ -85,7 +85,8 @@
85
85
  import { sanitize } from "@jill64/universal-sanitizer";
86
86
 
87
87
  import { browser } from "$app/environment";
88
- import { goto } from "$app/navigation";
88
+ import { goto, invalidateAll } from "$app/navigation";
89
+ import { page } from "$app/stores";
89
90
  import { base } from "$app/paths";
90
91
 
91
92
  import { notificationsCount, quickNotifications, avatarVersion } from "$pano/lib/Store";
@@ -207,7 +208,10 @@
207
208
  }
208
209
 
209
210
  // Notifications without a click listener navigate to their safe `details.href`.
210
- const navigate = (path) => goto(base + path);
211
+ // One that leads to the page already open reloads it instead: going to the address one is on does
212
+ // nothing, and the news the notification is about (a new ticket reply) would stay unseen.
213
+ const navigate = (path) =>
214
+ $page.url.pathname === base + path ? invalidateAll() : goto(base + path);
211
215
 
212
216
  function markRead(id) {
213
217
  ApiUtil.post({
@@ -8,6 +8,7 @@
8
8
  {side}
9
9
  {showDeleteAll}
10
10
  {onDeleteAllClick}
11
+ {showCreateTicket}
11
12
  {items}
12
13
  {data}
13
14
  {user}
@@ -78,6 +79,7 @@
78
79
 
79
80
  export let side;
80
81
  export let showDeleteAll = false;
82
+ export let showCreateTicket = false;
81
83
 
82
84
  const session = getContext("session");
83
85
 
@@ -1,7 +1,7 @@
1
1
  <svelte:component
2
- this={data.View}
3
- {data}
4
- {post}
2
+ this={pageData.View}
3
+ data={pageData}
4
+ post={post ?? pageData.post}
5
5
  {themeSettings}
6
6
  {avatarVersion} />
7
7
 
@@ -26,8 +26,15 @@
26
26
  import { getContext } from "svelte";
27
27
  import { avatarVersion } from "$pano/lib/Store";
28
28
 
29
- export let data;
30
- export let post;
29
+ import { page } from "$app/stores";
30
+
31
+ // The route generated for this page hands over `post` only (older syncs) or `data` (newer ones).
32
+ // Without `data` the view could not be found (`data.View` of undefined) and the preview answered
33
+ // 500 for everyone who was allowed to see it, so the page's own load data is the fallback.
34
+ export let data = undefined;
35
+ export let post = undefined;
36
+
37
+ $: pageData = data ?? $page.data;
31
38
 
32
39
  const themeSettings = getContext("themeSettings");
33
40
  </script>
@@ -38,6 +38,9 @@
38
38
  let error = writable();
39
39
  let title = writable("");
40
40
  let message = writable("");
41
- let categoryId = writable(-1);
41
+ // Where a ticket must have a category the form starts on the first one, not on "no category".
42
+ let categoryId = writable(
43
+ data.allowNoCategory === false && data.categories?.length ? data.categories[0].id : -1,
44
+ );
42
45
  let loading = writable(false);
43
46
  </script>
@@ -34,6 +34,7 @@
34
34
  import { avatarVersion } from "$pano/lib/Store";
35
35
 
36
36
  import {
37
+ applyTicket,
37
38
  init,
38
39
  loadMore,
39
40
  sendMessage,
@@ -51,4 +52,14 @@
51
52
  messages,
52
53
  ticket,
53
54
  } = init(data);
55
+
56
+ // The stores are filled once, on mount. When the same page loads again (a notification about this
57
+ // ticket clicked while it is open) the new ticket goes into them, so the new messages show.
58
+ let shownTicket = data.ticket;
59
+
60
+ $: if (data.ticket !== shownTicket) {
61
+ shownTicket = data.ticket;
62
+
63
+ applyTicket({ ticket, messages, sentMessageCount, shouldScroll }, data.ticket);
64
+ }
54
65
  </script>
@@ -43,13 +43,22 @@ export const getPostDetail = async ({ url, request, csrfToken }) => {
43
43
  });
44
44
  };
45
45
 
46
+ /**
47
+ * A post as its author previews it. A numeric `id` is a saved post (draft or not); anything else is
48
+ * the token of the panel editor's unsaved content (`POST /api/v1/panel/posts/previews`), which is
49
+ * how a change is looked at before it is saved.
50
+ */
46
51
  export const getPostPreview = async ({ id, request, csrfToken }) => {
52
+ const saved = /^\d+$/.test(String(id));
53
+
47
54
  return ApiUtil.get({
48
- path: `/posts/previews/${id}`,
55
+ path: saved
56
+ ? `/posts/previews/${id}`
57
+ : `/posts/previews/drafts/${encodeURIComponent(id)}`,
49
58
  request,
50
59
  csrfToken
51
60
  }).then((body) => {
52
- body.id = parseInt(id);
61
+ if (saved) body.id = parseInt(id);
53
62
 
54
63
  return body;
55
64
  });
@@ -6,6 +6,7 @@ import { goto } from "$app/navigation";
6
6
  import { createTicket, getTicketCategories } from "$pano/lib/services/tickets";
7
7
 
8
8
  import { NETWORK_ERROR } from "$pano/lib/api.util";
9
+ import { showSuccess as showSuccessToast } from "$pano/lib/components/ToastContainer.svelte";
9
10
 
10
11
  import TicketCreateAndDetailSidebar, {
11
12
  load as loadSidebar
@@ -74,6 +75,8 @@ export async function submit(error, loading, title, message, categoryId) {
74
75
  }
75
76
 
76
77
  goto("/ticket/" + body.id);
78
+
79
+ void showSuccessToast("toasts.ticket-created");
77
80
  })
78
81
  .catch(() => {
79
82
  loading.set(false);
@@ -1,6 +1,11 @@
1
+ import { error, redirect } from "@sveltejs/kit";
2
+
1
3
  import { getPostPreview } from "$pano/lib/services/posts";
2
4
 
3
5
  /**
6
+ * The preview of a post for its author: `/preview/post/<id>` for a saved post (draft or not) and
7
+ * `/preview/post/<token>` for the panel editor's unsaved content.
8
+ *
4
9
  * @type {import("@sveltejs/kit").Load}
5
10
  */
6
11
  export async function processLoad(event) {
@@ -8,46 +13,34 @@ export async function processLoad(event) {
8
13
 
9
14
  const parentData = await parent();
10
15
 
11
- const { session } = parentData;
12
- const { user } = session;
16
+ const user = parentData.session?.user;
13
17
 
14
- if (!user && !user.panelAccess) {
15
- return {
16
- status: 302,
17
- redirect: "/"
18
- };
18
+ // A preview is for people who may use the panel. (This used to read `!user && !user.panelAccess`,
19
+ // which threw for a visitor who was not signed in and let a signed-in one without access through.)
20
+ if (!user || !user.panelAccess) {
21
+ throw redirect(302, "/");
19
22
  }
20
23
 
21
- let data = {
22
- post: {
23
-
24
- id: -1,
25
- title: "",
26
- category: "-",
27
- writer: {
28
- username: ""
29
- },
30
- text: "",
31
- date: 0,
32
- status: 1,
33
- image: "",
34
- views: 0
35
- },
36
- previousPost: "-",
37
- nextPost: "-"
38
- };
24
+ const body = await getPostPreview({ id: event.params.id, request: event });
39
25
 
40
- await getPostPreview({ id: event.params.id, request: event }).then(
41
- (body) => {
42
- if (body.error) {
43
- data = {};
26
+ if (!body || body.error) {
27
+ const code = body?.error?.code;
44
28
 
45
- return;
46
- }
29
+ // A draft token that expired or belongs to someone else reads as "not found" too.
30
+ if (code === "POST_NOT_FOUND" || code === "NOT_FOUND") {
31
+ throw error(404, code);
32
+ }
47
33
 
48
- data.post = body.post;
34
+ if (code === "NOT_LOGGED_IN" || code === "NO_PERMISSION") {
35
+ throw redirect(302, "/");
49
36
  }
50
- );
51
37
 
52
- return data;
53
- }
38
+ throw error(500, code);
39
+ }
40
+
41
+ return {
42
+ post: body.post,
43
+ previousPost: body.previousPost ?? "-",
44
+ nextPost: body.nextPost ?? "-"
45
+ };
46
+ }
@@ -1,6 +1,9 @@
1
1
  import { afterUpdate, onMount } from "svelte";
2
2
  import { get, writable } from "svelte/store";
3
3
  import { error } from "@sveltejs/kit";
4
+ import { _ } from "svelte-i18n";
5
+
6
+ import { route } from "$pano/registry/routes.js";
4
7
 
5
8
  import { getTicketDetail, loadMoreTicketMessages, sendTicketMessage } from "$pano/lib/services/tickets";
6
9
 
@@ -50,17 +53,47 @@ export async function processLoad(event) {
50
53
 
51
54
  await loadSidebar(event, data.ticket);
52
55
 
53
- data.pageTitle = {
54
- title: "pages.ticket-detail.tab-title",
55
- titleValues: {
56
- ticketId: `#${data.ticket.id}`,
57
- title: data.ticket.title,
58
- },
59
- };
56
+ data.pageTitle = ticketPageTitle(data.ticket);
60
57
 
61
58
  return { ...data, sidebar: TicketCreateAndDetailSidebar };
62
59
  }
63
60
 
61
+ const escapeHtml = (text) =>
62
+ String(text ?? "").replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
63
+
64
+ /**
65
+ * The page title of a ticket: its number and title, and under it the category it was opened in (a
66
+ * link to that category's tickets). It is the only title on the page; the view draws none of its own.
67
+ * Translated here because the title is taken verbatim (`raw`): the ticket's own title is not a key.
68
+ */
69
+ export function ticketPageTitle(ticket) {
70
+ const translate = get(_);
71
+ const hasCategory = ticket.category && ticket.category !== "-";
72
+ const name = hasCategory ? ticket.category.title : translate("pages.ticket-detail.no-category");
73
+ const link = `<a href="${route("/tickets")}?category=${encodeURIComponent(
74
+ hasCategory ? ticket.category.url : "-",
75
+ )}" title="${escapeHtml(translate("pages.ticket-detail.filter"))}">${escapeHtml(name)}</a>`;
76
+
77
+ return {
78
+ raw: true,
79
+ title: `#${ticket.id} ${ticket.title}`,
80
+ subtitle: translate("pages.ticket-detail.detail.opened-in-category", { values: { category: link } }),
81
+ subtitleHtml: true,
82
+ };
83
+ }
84
+
85
+ /**
86
+ * Puts a freshly loaded ticket into the page's stores: the same page was loaded again (a notification
87
+ * about this ticket was clicked while it is open), and the stores were filled only once, on mount.
88
+ */
89
+ export function applyTicket(stores, ticket) {
90
+ stores.ticket.set(ticket);
91
+ stores.messages.set(ticket.messages);
92
+ stores.sentMessageCount.set(0);
93
+ stores.shouldScroll.set(true);
94
+ updateSidebar(ticket);
95
+ }
96
+
64
97
  export async function loadMore(loadMoreLoading, messages, data) {
65
98
  loadMoreLoading.set(true);
66
99
 
@@ -72,7 +72,7 @@ export async function processLoad(event) {
72
72
  } : null
73
73
  };
74
74
 
75
- return { ...data, sidebar: ProfileSidebar };
75
+ return { ...data, sidebar: ProfileSidebar, sidebarProps: { showCreateTicket: true } };
76
76
  }
77
77
 
78
78
  async function refreshData(data) {
@@ -53,7 +53,10 @@
53
53
  class="pano-create-ticket-view__select form-select form-select-lg rounded-top-0"
54
54
  id="datalistOptions"
55
55
  bind:value={$categoryId}>
56
- <option value={-1}>{$_("pages.create-ticket.inputs.no-category")}</option>
56
+ <!-- Offered unless the website asks for a category (the categories answer says so). -->
57
+ {#if data.allowNoCategory !== false}
58
+ <option value={-1}>{$_("pages.create-ticket.inputs.no-category")}</option>
59
+ {/if}
57
60
  {#each data.categories as category, index (category)}
58
61
  <option value={category.id}>{category.title}</option>
59
62
  {/each}
@@ -85,7 +85,7 @@
85
85
  <div
86
86
  class="col-lg-3 d-flex align-items-end justify-content-end opacity-75">
87
87
  <a
88
- href={route(`/player/${data.post.writer.username}`)}
88
+ href={data.post.writer.username !== "-" ? route(`/player/${data.post.writer.username}`) : undefined}
89
89
  class="d-inline-block focus-ring rounded-circle ms-2"
90
90
  hidden={typeof themeSettings.postAuthorImageEnabled ===
91
91
  "undefined"
@@ -97,7 +97,7 @@
97
97
  alt={data.post.writer.username}
98
98
  width="24"
99
99
  height="24"
100
- use:tooltip={[
100
+ use:tooltip={data.post.writer.username !== "-" && [
101
101
  data.post.writer.username,
102
102
  { placement: "bottom" },
103
103
  ]}
@@ -128,7 +128,7 @@
128
128
  <div class="d-flex align-items-center">
129
129
  <Date time={data.post.date} />
130
130
  <a
131
- href={route(`/player/${data.post.writer.username}`)}
131
+ href={data.post.writer.username !== "-" ? route(`/player/${data.post.writer.username}`) : undefined}
132
132
  class="d-inline-block rounded focus-ring rounded-circle ms-2"
133
133
  hidden={typeof themeSettings.postAuthorImageEnabled ===
134
134
  "undefined"
@@ -140,7 +140,7 @@
140
140
  alt={data.post.writer.username}
141
141
  width="28"
142
142
  height="28"
143
- use:tooltip={[
143
+ use:tooltip={data.post.writer.username !== "-" && [
144
144
  data.post.writer.username,
145
145
  { placement: "bottom" },
146
146
  ]}
@@ -88,7 +88,7 @@
88
88
  alt={post.writer.username}
89
89
  width="24"
90
90
  height="24"
91
- use:tooltip={[
91
+ use:tooltip={post.writer.username !== "-" && [
92
92
  post.writer.username,
93
93
  { placement: "bottom" },
94
94
  ]}
@@ -125,7 +125,7 @@
125
125
  alt={post.writer.username}
126
126
  width="28"
127
127
  height="28"
128
- use:tooltip={[
128
+ use:tooltip={post.writer.username !== "-" && [
129
129
  post.writer.username,
130
130
  { placement: "bottom" },
131
131
  ]}
@@ -5,6 +5,7 @@ const store = (value) => ({ subscribe: (run) => (run(value), () => {}) });
5
5
  const base = (extra = {}) => ({
6
6
  side: "left",
7
7
  showDeleteAll: false,
8
+ showCreateTicket: false,
8
9
  onDeleteAllClick: noop,
9
10
  items: items([
10
11
  { id: "profile-info", component: null, props: {} },
@@ -28,23 +28,6 @@
28
28
  </style>
29
29
 
30
30
  <div class="pano-ticket-detail-view vstack gap-3">
31
- <PageTitle
32
- title={`#${$ticket.id} ${$ticket.title}`}
33
- subtitle={$_("pages.ticket-detail.detail.opened-in-category", {
34
- values: {
35
- category: `<a
36
- href="${route("/tickets")}?category=${$ticket.category.url}"
37
- title="${$_("pages.ticket-detail.filter")}"
38
- >${
39
- $ticket.category === "-"
40
- ? $_("pages.ticket-detail.no-category")
41
- : $ticket.category.title
42
- }
43
- </a>`,
44
- },
45
- })}
46
- subtitleHtml={true} />
47
-
48
31
  <div class="card mt-lg-0">
49
32
  <CardHeader>
50
33
  <small slot="left" class="text-body-secondary">
@@ -167,7 +150,6 @@
167
150
  import TicketStatus, {
168
151
  TicketStatuses,
169
152
  } from "$pano/lib/components/TicketStatus.svelte";
170
- import PageTitle from "$pano/lib/components/PageTitle.svelte";
171
153
  import CardHeader from "$pano/lib/components/CardHeader.svelte";
172
154
 
173
155
  export let data;
@@ -184,7 +184,7 @@
184
184
  <div class="d-flex align-items-center gap-2">
185
185
  <Date time={post.date} class="text-muted small" />
186
186
  <a
187
- href={route(`/player/${post.writer.username}`)}
187
+ href={post.writer.username !== "-" ? route(`/player/${post.writer.username}`) : undefined}
188
188
  class="d-inline-block rounded focus-ring rounded-circle"
189
189
  hidden={typeof themeSettings.postAuthorImageEnabled === "undefined"
190
190
  ? false
@@ -194,7 +194,7 @@
194
194
  alt={post.writer.username}
195
195
  width="32"
196
196
  height="32"
197
- use:tooltip={[post.writer.username, { placement: "bottom" }]}
197
+ use:tooltip={post.writer.username !== "-" && [post.writer.username, { placement: "bottom" }]}
198
198
  class="pano-post__image-3 rounded-circle border" />
199
199
  </a>
200
200
  </div>
@@ -214,7 +214,7 @@
214
214
  <Date time={post.date} class="small" />
215
215
  <a
216
216
  class="d-inline-block rounded focus-ring rounded-circle"
217
- href={route(`/player/${post.writer.username}`)}
217
+ href={post.writer.username !== "-" ? route(`/player/${post.writer.username}`) : undefined}
218
218
  hidden={typeof themeSettings.postAuthorImageEnabled === "undefined"
219
219
  ? false
220
220
  : !themeSettings.postAuthorImageEnabled}>
@@ -223,7 +223,7 @@
223
223
  alt={post.writer.username}
224
224
  width="28"
225
225
  height="28"
226
- use:tooltip={[post.writer.username, { placement: "bottom" }]}
226
+ use:tooltip={post.writer.username !== "-" && [post.writer.username, { placement: "bottom" }]}
227
227
  class="pano-post__image-4 rounded-circle border border-2 border-white" />
228
228
  </a>
229
229
  </div>
@@ -1,5 +1,5 @@
1
1
  <!--
2
- Default markup of the engine's <ProfileSidebar> (registry name "ProfileSidebar", contract 1): the
2
+ Default markup of the engine's <ProfileSidebar> (registry name "ProfileSidebar", contract 2): the
3
3
  cards beside the profile pages. The controller (components/sidebars/ProfileSidebar.svelte) owns the
4
4
  data, the item list, the navigation entries and the clock.
5
5
 
@@ -7,6 +7,7 @@
7
7
  side "left" | "right" - which side of the content the column sits on
8
8
  showDeleteAll boolean - show the "delete all notifications" button
9
9
  onDeleteAllClick function() - opens the confirmation for deleting all notifications
10
+ showCreateTicket boolean - show the "create support ticket" button (the tickets page)
10
11
  items store of { id, component, props } - the sidebar items, plugin items included;
11
12
  unknown ids are rendered with <ViewComponent> (the place plugins inject)
12
13
  data store of { lastActivityTime, inGame, permissionGroupName, isBanned }
@@ -26,11 +27,21 @@
26
27
  {$_("buttons.delete-all")}
27
28
  </button>
28
29
  </div>
30
+ {:else if showCreateTicket}
31
+ <div class="order-last order-lg-first w-100">
32
+ <a
33
+ class="pano-profile-sidebar__create-ticket btn btn-primary w-100"
34
+ role="button"
35
+ href={route("/ticket/create")}>
36
+ <i class="fas fa-plus me-2"></i>
37
+ {$_("pages.create-ticket.title")}
38
+ </a>
39
+ </div>
29
40
  {/if}
30
41
  <div
31
42
  class="vstack gap-3"
32
- class:order-first={showDeleteAll}
33
- class:order-lg-last={showDeleteAll}>
43
+ class:order-first={showDeleteAll || showCreateTicket}
44
+ class:order-lg-last={showDeleteAll || showCreateTicket}>
34
45
  {#each $items as item (item.id)}
35
46
  {#if item.id === "profile-info"}
36
47
  <!-- Profile Info Snippet -->
@@ -79,6 +90,8 @@
79
90
  <script>
80
91
  import { _ } from "svelte-i18n";
81
92
 
93
+ import { route } from "$pano/registry/routes.js";
94
+
82
95
  import PlayerPermissionBadge from "$pano/lib/components/PlayerPermissionBadge.svelte";
83
96
  import PlayerStatusBadge from "$pano/lib/components/PlayerStatusBadge.svelte";
84
97
  import Sidebar from "$pano/lib/components/Sidebar.svelte";
@@ -90,6 +103,7 @@
90
103
  export let side;
91
104
  export let showDeleteAll = false;
92
105
  export let onDeleteAllClick = () => {};
106
+ export let showCreateTicket = false;
93
107
  export let items;
94
108
  export let data;
95
109
  export let user;
@@ -20,7 +20,7 @@ export const engineViews = {
20
20
  "ProfileView": { contract: 1, component: () => import("../ProfileView.svelte"), uses: ["Date"] },
21
21
  "SettingsView": { contract: 1, component: () => import("../SettingsView.svelte"), uses: ["Date","LogoutSessionConfirmModal","NoContent"] },
22
22
  "TicketsView": { contract: 1, component: () => import("../TicketsView.svelte"), uses: ["Pagination","Tickets"] },
23
- "TicketDetailView": { contract: 1, component: () => import("../TicketDetailView.svelte"), uses: ["Date","PageTitle","TicketStatus"] },
23
+ "TicketDetailView": { contract: 1, component: () => import("../TicketDetailView.svelte"), uses: ["Date","TicketStatus"] },
24
24
  "CreateTicketView": { contract: 1, component: () => import("../CreateTicketView.svelte") },
25
25
  "AppLayoutView": { contract: 1, component: () => import("../AppLayoutView.svelte"), uses: ["ToastContainer"] },
26
26
  "MainLayoutView": { contract: 1, component: () => import("../MainLayoutView.svelte"), uses: ["Breadcrumb","Main","NotificationContainer"], hooks: ["theme:top","page:top"] },
@@ -56,7 +56,7 @@ export const engineViews = {
56
56
  "Header": { contract: 1, component: () => import("../../components/Header.svelte") },
57
57
  "Footer": { contract: 1, component: () => import("../../components/Footer.svelte") },
58
58
  "HomeSidebar": { contract: 1, component: () => import("./HomeSidebar.svelte"), uses: ["Sidebar"] },
59
- "ProfileSidebar": { contract: 1, component: () => import("./ProfileSidebar.svelte"), uses: ["PageTitle","PlayerHead","Sidebar"] },
59
+ "ProfileSidebar": { contract: 2, component: () => import("./ProfileSidebar.svelte"), uses: ["PageTitle","PlayerHead","Sidebar"] },
60
60
  "SupportSidebar": { contract: 1, component: () => import("./SupportSidebar.svelte"), uses: ["Sidebar"] },
61
61
  "PlayerDetailSidebar": { contract: 1, component: () => import("./PlayerDetailSidebar.svelte"), uses: ["PageTitle","PlayerHead","Sidebar"] },
62
62
  "TicketCreateAndDetailSidebar": { contract: 1, component: () => import("./TicketCreateAndDetailSidebar.svelte"), uses: ["Sidebar"] },